@univerjs/sheets-table-ui 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +74 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.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/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.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 +74 -2587
- package/lib/es/locale/ca-ES.js +1 -125
- package/lib/es/locale/en-US.js +1 -125
- package/lib/es/locale/es-ES.js +1 -125
- package/lib/es/locale/fa-IR.js +1 -125
- package/lib/es/locale/fr-FR.js +1 -125
- package/lib/es/locale/ja-JP.js +1 -125
- package/lib/es/locale/ko-KR.js +1 -125
- package/lib/es/locale/ru-RU.js +1 -125
- package/lib/es/locale/sk-SK.js +1 -125
- package/lib/es/locale/vi-VN.js +1 -125
- package/lib/es/locale/zh-CN.js +1 -125
- package/lib/es/locale/zh-TW.js +1 -125
- package/lib/index.css +466 -1
- package/lib/index.js +74 -2587
- package/lib/locale/ca-ES.js +1 -125
- package/lib/locale/en-US.js +1 -125
- package/lib/locale/es-ES.js +1 -125
- package/lib/locale/fa-IR.js +1 -125
- package/lib/locale/fr-FR.js +1 -125
- package/lib/locale/ja-JP.js +1 -125
- package/lib/locale/ko-KR.js +1 -125
- package/lib/locale/ru-RU.js +1 -125
- package/lib/locale/sk-SK.js +1 -125
- package/lib/locale/vi-VN.js +1 -125
- package/lib/locale/zh-CN.js +1 -125
- package/lib/locale/zh-TW.js +1 -125
- package/lib/types/commands/operations/open-table-filter-dialog.opration.d.ts +16 -1
- package/lib/types/commands/operations/open-table-selector.operation.d.ts +17 -1
- package/lib/types/config/config.d.ts +16 -1
- package/lib/types/controllers/sheet-table-anchor.controller.d.ts +20 -3
- package/lib/types/controllers/sheet-table-component.controller.d.ts +17 -1
- package/lib/types/controllers/sheet-table-filter-button-render.controller.d.ts +18 -2
- package/lib/types/controllers/sheet-table-render.controller.d.ts +18 -2
- package/lib/types/controllers/sheet-table-selection.controller.d.ts +15 -0
- package/lib/types/controllers/sheet-table-theme-ui.controller.d.ts +16 -1
- package/lib/types/locale/ca-ES.d.ts +16 -1
- package/lib/types/locale/es-ES.d.ts +16 -1
- package/lib/types/locale/fa-IR.d.ts +16 -1
- package/lib/types/locale/fr-FR.d.ts +16 -1
- package/lib/types/locale/ja-JP.d.ts +16 -1
- package/lib/types/locale/ko-KR.d.ts +16 -1
- package/lib/types/locale/ru-RU.d.ts +16 -1
- package/lib/types/locale/sk-SK.d.ts +16 -1
- package/lib/types/locale/vi-VN.d.ts +16 -1
- package/lib/types/locale/zh-CN.d.ts +16 -1
- package/lib/types/locale/zh-TW.d.ts +16 -1
- package/lib/types/menu/menu.d.ts +19 -3
- package/lib/types/menu/schema.d.ts +16 -1
- package/lib/types/menu/sheet-table-menu.controller.d.ts +15 -0
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/services/sheets-table-ui-service.d.ts +19 -2
- package/lib/types/views/components/SheetTableConditionPanel.d.ts +17 -2
- package/lib/types/views/components/SheetTableItemsFilterPanel.d.ts +17 -2
- package/lib/types/views/components/SheetTableSelector.d.ts +16 -1
- package/lib/types/views/components/SheetTableThemePanel.d.ts +16 -1
- package/lib/types/views/components/type.d.ts +16 -1
- package/lib/types/views/components/util.d.ts +20 -3
- package/lib/types/views/widgets/drawings.d.ts +16 -1
- package/lib/types/views/widgets/table-filter-button.shape.d.ts +17 -1
- package/lib/umd/index.js +74 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.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/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.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 +16 -15
package/lib/index.js
CHANGED
|
@@ -1,2587 +1,74 @@
|
|
|
1
|
-
var $n = Object.defineProperty;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, (zr(r, t).children || []).map((a, s) => mn(a, `${e}-${r.tag}-${s}`, t, void 0, i)));
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
children: [
|
|
77
|
-
{
|
|
78
|
-
tag: "path",
|
|
79
|
-
attrs: {
|
|
80
|
-
fill: "currentColor",
|
|
81
|
-
d: "M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
tag: "path",
|
|
86
|
-
attrs: {
|
|
87
|
-
fill: "currentColor",
|
|
88
|
-
d: "M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983C1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022C7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916C7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212C1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967Z",
|
|
89
|
-
fillRule: "evenodd",
|
|
90
|
-
clipRule: "evenodd"
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
tag: "path",
|
|
95
|
-
attrs: {
|
|
96
|
-
fill: "currentColor",
|
|
97
|
-
d: "M5.1846 1.86439C4.8641 0.989866 3.62725 0.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655C2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055L3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655C7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439ZM4.98996 4.82056L4.24567 2.78971L3.50138 4.82056H4.98996Z",
|
|
98
|
-
fillRule: "evenodd",
|
|
99
|
-
clipRule: "evenodd"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
}, pn = le(function(e, t) {
|
|
104
|
-
return ie(ae, Object.assign({}, e, {
|
|
105
|
-
id: "ascending-icon",
|
|
106
|
-
ref: t,
|
|
107
|
-
icon: Xr
|
|
108
|
-
}));
|
|
109
|
-
});
|
|
110
|
-
pn.displayName = "AscendingIcon";
|
|
111
|
-
const Kr = {
|
|
112
|
-
tag: "svg",
|
|
113
|
-
attrs: {
|
|
114
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
115
|
-
fill: "none",
|
|
116
|
-
viewBox: "0 0 16 16",
|
|
117
|
-
width: "1em",
|
|
118
|
-
height: "1em"
|
|
119
|
-
},
|
|
120
|
-
children: [
|
|
121
|
-
{
|
|
122
|
-
tag: "path",
|
|
123
|
-
attrs: {
|
|
124
|
-
fill: "currentColor",
|
|
125
|
-
d: "M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
tag: "path",
|
|
130
|
-
attrs: {
|
|
131
|
-
fill: "currentColor",
|
|
132
|
-
d: "M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
tag: "path",
|
|
137
|
-
attrs: {
|
|
138
|
-
fill: "currentColor",
|
|
139
|
-
d: "M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z"
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
tag: "path",
|
|
144
|
-
attrs: {
|
|
145
|
-
fill: "currentColor",
|
|
146
|
-
d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",
|
|
147
|
-
fillRule: "evenodd",
|
|
148
|
-
clipRule: "evenodd"
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
]
|
|
152
|
-
}, fn = le(function(e, t) {
|
|
153
|
-
return ie(ae, Object.assign({}, e, {
|
|
154
|
-
id: "delete-icon",
|
|
155
|
-
ref: t,
|
|
156
|
-
icon: Kr
|
|
157
|
-
}));
|
|
158
|
-
});
|
|
159
|
-
fn.displayName = "DeleteIcon";
|
|
160
|
-
const Jr = {
|
|
161
|
-
tag: "svg",
|
|
162
|
-
attrs: {
|
|
163
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
164
|
-
fill: "none",
|
|
165
|
-
viewBox: "0 0 16 16",
|
|
166
|
-
width: "1em",
|
|
167
|
-
height: "1em"
|
|
168
|
-
},
|
|
169
|
-
children: [
|
|
170
|
-
{
|
|
171
|
-
tag: "path",
|
|
172
|
-
attrs: {
|
|
173
|
-
fill: "currentColor",
|
|
174
|
-
d: "M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
tag: "path",
|
|
179
|
-
attrs: {
|
|
180
|
-
fill: "currentColor",
|
|
181
|
-
d: "M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983C1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022C7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916C7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212C1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967Z",
|
|
182
|
-
fillRule: "evenodd",
|
|
183
|
-
clipRule: "evenodd"
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
tag: "path",
|
|
188
|
-
attrs: {
|
|
189
|
-
fill: "currentColor",
|
|
190
|
-
d: "M5.1846 1.86439C4.8641 0.989866 3.62725 0.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655C2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055L3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655C7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439ZM4.98996 4.82056L4.24567 2.78971L3.50138 4.82056H4.98996Z",
|
|
191
|
-
fillRule: "evenodd",
|
|
192
|
-
clipRule: "evenodd"
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
]
|
|
196
|
-
}, Cn = le(function(e, t) {
|
|
197
|
-
return ie(ae, Object.assign({}, e, {
|
|
198
|
-
id: "descending-icon",
|
|
199
|
-
ref: t,
|
|
200
|
-
icon: Jr
|
|
201
|
-
}));
|
|
202
|
-
});
|
|
203
|
-
Cn.displayName = "DescendingIcon";
|
|
204
|
-
const ei = {
|
|
205
|
-
tag: "svg",
|
|
206
|
-
attrs: {
|
|
207
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
208
|
-
fill: "none",
|
|
209
|
-
viewBox: "0 0 16 16",
|
|
210
|
-
width: "1em",
|
|
211
|
-
height: "1em"
|
|
212
|
-
},
|
|
213
|
-
children: [{
|
|
214
|
-
tag: "path",
|
|
215
|
-
attrs: {
|
|
216
|
-
fill: "currentColor",
|
|
217
|
-
d: "M8.85869 12.9216C8.38445 13.4708 7.61555 13.4708 7.14131 12.9216L0.358114 5.06726C-0.406895 4.18144 0.134916 2.66683 1.2168 2.66683L14.7832 2.66683C15.8651 2.66683 16.4069 4.18144 15.6419 5.06726L8.85869 12.9216Z"
|
|
218
|
-
}
|
|
219
|
-
}]
|
|
220
|
-
}, qe = le(function(e, t) {
|
|
221
|
-
return ie(ae, Object.assign({}, e, {
|
|
222
|
-
id: "dropdown-icon",
|
|
223
|
-
ref: t,
|
|
224
|
-
icon: ei
|
|
225
|
-
}));
|
|
226
|
-
});
|
|
227
|
-
qe.displayName = "DropdownIcon";
|
|
228
|
-
const ti = {
|
|
229
|
-
tag: "svg",
|
|
230
|
-
attrs: {
|
|
231
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
232
|
-
fill: "none",
|
|
233
|
-
viewBox: "0 0 16 16",
|
|
234
|
-
width: "1em",
|
|
235
|
-
height: "1em"
|
|
236
|
-
},
|
|
237
|
-
children: [{
|
|
238
|
-
tag: "path",
|
|
239
|
-
attrs: {
|
|
240
|
-
fill: "currentColor",
|
|
241
|
-
d: "M3.33333 3.33333V6H6V3.33333H3.33333ZM2 3.238C2 2.55427 2.55427 2 3.238 2H6.09533C6.77906 2 7.33333 2.55427 7.33333 3.238V6.09533C7.33333 6.77906 6.77906 7.33333 6.09533 7.33333H3.238C2.55427 7.33333 2 6.77906 2 6.09533V3.238ZM10 3.33333V6H12.6667V3.33333H10ZM8.66667 3.238C8.66667 2.55427 9.22094 2 9.90467 2H12.762C13.4457 2 14 2.55427 14 3.238V6.09533C14 6.77906 13.4457 7.33333 12.762 7.33333H9.90467C9.22094 7.33333 8.66667 6.77906 8.66667 6.09533V3.238ZM3.33333 10V12.6667H6V10H3.33333ZM2 9.90467C2 9.22094 2.55427 8.66667 3.238 8.66667H6.09533C6.77906 8.66667 7.33333 9.22094 7.33333 9.90467V12.762C7.33333 13.4457 6.77906 14 6.09533 14H3.238C2.55427 14 2 13.4457 2 12.762V9.90467ZM10 10V12.6667H12.6667V10H10ZM8.66667 9.90467C8.66667 9.22094 9.22094 8.66667 9.90467 8.66667H12.762C13.4457 8.66667 14 9.22094 14 9.90467V12.762C14 13.4457 13.4457 14 12.762 14H9.90467C9.22094 14 8.66667 13.4457 8.66667 12.762V9.90467Z",
|
|
242
|
-
fillRule: "evenodd",
|
|
243
|
-
clipRule: "evenodd"
|
|
244
|
-
}
|
|
245
|
-
}]
|
|
246
|
-
}, Sn = le(function(e, t) {
|
|
247
|
-
return ie(ae, Object.assign({}, e, {
|
|
248
|
-
id: "grid-outline-icon",
|
|
249
|
-
ref: t,
|
|
250
|
-
icon: ti
|
|
251
|
-
}));
|
|
252
|
-
});
|
|
253
|
-
Sn.displayName = "GridOutlineIcon";
|
|
254
|
-
const ni = {
|
|
255
|
-
tag: "svg",
|
|
256
|
-
attrs: {
|
|
257
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
258
|
-
fill: "none",
|
|
259
|
-
viewBox: "0 0 16 16",
|
|
260
|
-
width: "1em",
|
|
261
|
-
height: "1em"
|
|
262
|
-
},
|
|
263
|
-
children: [{
|
|
264
|
-
tag: "path",
|
|
265
|
-
attrs: {
|
|
266
|
-
fill: "currentColor",
|
|
267
|
-
d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",
|
|
268
|
-
fillRule: "evenodd",
|
|
269
|
-
clipRule: "evenodd"
|
|
270
|
-
}
|
|
271
|
-
}]
|
|
272
|
-
}, xt = le(function(e, t) {
|
|
273
|
-
return ie(ae, Object.assign({}, e, {
|
|
274
|
-
id: "more-down-icon",
|
|
275
|
-
ref: t,
|
|
276
|
-
icon: ni
|
|
277
|
-
}));
|
|
278
|
-
});
|
|
279
|
-
xt.displayName = "MoreDownIcon";
|
|
280
|
-
const ri = {
|
|
281
|
-
tag: "svg",
|
|
282
|
-
attrs: {
|
|
283
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
284
|
-
fill: "none",
|
|
285
|
-
viewBox: "0 0 16 16",
|
|
286
|
-
width: "1em",
|
|
287
|
-
height: "1em"
|
|
288
|
-
},
|
|
289
|
-
children: [{
|
|
290
|
-
tag: "path",
|
|
291
|
-
attrs: {
|
|
292
|
-
fill: "currentColor",
|
|
293
|
-
d: "M3.80068 2.57257L7.27955 2.57256C7.61092 2.57256 7.87954 2.30393 7.87954 1.97256C7.87954 1.64119 7.61091 1.37256 7.27954 1.37256L3.80068 1.37257C2.36473 1.37257 1.20067 2.53665 1.20068 3.97259L1.20074 12.3001C1.20075 13.736 2.36481 14.9 3.80074 14.9H12.1282C13.5641 14.9 14.7282 13.736 14.7282 12.3V8.82116C14.7282 8.48979 14.4595 8.22116 14.1282 8.22116C13.7968 8.22116 13.5282 8.48979 13.5282 8.82116V12.3C13.5282 13.0732 12.9014 13.7 12.1282 13.7H3.80074C3.02754 13.7 2.40074 13.0732 2.40074 12.3001L2.40068 3.97258C2.40068 3.19938 3.02748 2.57257 3.80068 2.57257Z"
|
|
294
|
-
}
|
|
295
|
-
}, {
|
|
296
|
-
tag: "path",
|
|
297
|
-
attrs: {
|
|
298
|
-
fill: "currentColor",
|
|
299
|
-
d: "M14.0072 2.0955C13.0997 1.18757 11.6278 1.18794 10.7207 2.09632L6.17749 6.646C6.10294 6.72065 6.04543 6.81056 6.00889 6.90954L4.59817 10.7315C4.51713 10.951 4.57116 11.1977 4.73657 11.3633C4.90198 11.5288 5.14858 11.5831 5.36823 11.5023L9.20237 10.0916C9.30186 10.055 9.3922 9.99722 9.46714 9.92224L14.0073 5.37972C14.9139 4.47266 14.9138 3.00252 14.0072 2.0955ZM11.5698 2.94424C12.0083 2.50513 12.7198 2.50496 13.1585 2.94384C13.5968 3.38229 13.5968 4.09294 13.1585 4.53141L8.69127 9.00102L6.1742 9.92713L7.09912 7.42132L11.5698 2.94424Z",
|
|
300
|
-
fillRule: "evenodd",
|
|
301
|
-
clipRule: "evenodd"
|
|
302
|
-
}
|
|
303
|
-
}]
|
|
304
|
-
}, _n = le(function(e, t) {
|
|
305
|
-
return ie(ae, Object.assign({}, e, {
|
|
306
|
-
id: "rename-icon",
|
|
307
|
-
ref: t,
|
|
308
|
-
icon: ri
|
|
309
|
-
}));
|
|
310
|
-
});
|
|
311
|
-
_n.displayName = "RenameIcon";
|
|
312
|
-
const ii = {
|
|
313
|
-
tag: "svg",
|
|
314
|
-
attrs: {
|
|
315
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
316
|
-
fill: "none",
|
|
317
|
-
viewBox: "0 0 16 16",
|
|
318
|
-
width: "1em",
|
|
319
|
-
height: "1em"
|
|
320
|
-
},
|
|
321
|
-
children: [{
|
|
322
|
-
tag: "path",
|
|
323
|
-
attrs: {
|
|
324
|
-
fill: "currentColor",
|
|
325
|
-
d: "M1.7643 4.13354C1.7643 2.82523 2.82488 1.76465 4.13319 1.76465H11.8665C13.1748 1.76465 14.2354 2.82524 14.2354 4.13354V11.8669C14.2354 13.1752 13.1748 14.2358 11.8665 14.2358H4.13318C2.82488 14.2358 1.7643 13.1752 1.7643 11.8669V6.1462C1.76388 6.13711 1.76367 6.12797 1.76367 6.11878C1.76367 6.10959 1.76388 6.10045 1.7643 6.09136V4.13354ZM2.94652 6.70989V11.8669C2.94652 12.5222 3.47781 13.0535 4.13318 13.0535H5.52732V6.70989H2.94652ZM5.52732 5.52767H2.94652V4.13354C2.94652 3.47816 3.47781 2.94687 4.13319 2.94687H5.52732V5.52767ZM6.70954 6.70989V13.0535H11.8665C12.5219 13.0535 13.0532 12.5222 13.0532 11.8669V6.70989L6.70954 6.70989ZM13.0532 5.52767L6.70954 5.52767V2.94687H11.8665C12.5219 2.94687 13.0532 3.47816 13.0532 4.13354V5.52767Z",
|
|
326
|
-
fillRule: "evenodd",
|
|
327
|
-
clipRule: "evenodd"
|
|
328
|
-
}
|
|
329
|
-
}]
|
|
330
|
-
}, Tn = le(function(e, t) {
|
|
331
|
-
return ie(ae, Object.assign({}, e, {
|
|
332
|
-
id: "table-icon",
|
|
333
|
-
ref: t,
|
|
334
|
-
icon: ii
|
|
335
|
-
}));
|
|
336
|
-
});
|
|
337
|
-
Tn.displayName = "TableIcon";
|
|
338
|
-
const ai = {
|
|
339
|
-
tag: "svg",
|
|
340
|
-
attrs: {
|
|
341
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
342
|
-
fill: "none",
|
|
343
|
-
viewBox: "0 0 17 16",
|
|
344
|
-
width: "1em",
|
|
345
|
-
height: "1em"
|
|
346
|
-
},
|
|
347
|
-
children: [
|
|
348
|
-
{
|
|
349
|
-
tag: "path",
|
|
350
|
-
attrs: {
|
|
351
|
-
fill: "currentColor",
|
|
352
|
-
d: "M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",
|
|
353
|
-
fillRule: "evenodd",
|
|
354
|
-
clipRule: "evenodd"
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
tag: "path",
|
|
359
|
-
attrs: {
|
|
360
|
-
fill: "currentColor",
|
|
361
|
-
d: "M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
tag: "path",
|
|
366
|
-
attrs: {
|
|
367
|
-
fill: "colorChannel1",
|
|
368
|
-
d: "M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
]
|
|
372
|
-
}, wn = le(function(e, t) {
|
|
373
|
-
return ie(ae, Object.assign({}, e, {
|
|
374
|
-
id: "paint-bucket-double-icon",
|
|
375
|
-
ref: t,
|
|
376
|
-
icon: ai
|
|
377
|
-
}));
|
|
378
|
-
});
|
|
379
|
-
wn.displayName = "PaintBucketDoubleIcon";
|
|
380
|
-
var me = /* @__PURE__ */ ((r) => (r.Items = "items", r.Condition = "condition", r))(me || {}), si = Object.getOwnPropertyDescriptor, oi = (r, e, t, n) => {
|
|
381
|
-
for (var i = n > 1 ? void 0 : n ? si(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
382
|
-
(s = r[a]) && (i = s(i) || i);
|
|
383
|
-
return i;
|
|
384
|
-
}, Ze = (r, e) => (t, n) => e(t, n, r);
|
|
385
|
-
let Ee = class extends ke {
|
|
386
|
-
constructor(e, t, n, i, a) {
|
|
387
|
-
super();
|
|
388
|
-
U(this, "_itemsCache", /* @__PURE__ */ new Map());
|
|
389
|
-
this._tableManager = e, this._sheetTableService = t, this._univerInstanceService = n, this._commandService = i, this._localeService = a, this._registerTableFilterChangeEvent();
|
|
390
|
-
}
|
|
391
|
-
_registerTableFilterChangeEvent() {
|
|
392
|
-
this._commandService.onCommandExecuted((e) => {
|
|
393
|
-
if (e.id === kr.id) {
|
|
394
|
-
const { unitId: t, subUnitId: n, cellValue: i } = e.params, a = this._tableManager.getTablesBySubunitId(t, n);
|
|
395
|
-
if (!a.length)
|
|
396
|
-
return;
|
|
397
|
-
new kn(i).forValue((c, u, h) => {
|
|
398
|
-
const d = jt(c, u), v = a.find((f) => {
|
|
399
|
-
const w = f.getTableFilterRange();
|
|
400
|
-
return be.intersects(w, d);
|
|
401
|
-
});
|
|
402
|
-
if (v) {
|
|
403
|
-
const f = u - v.getRange().startColumn;
|
|
404
|
-
this._itemsCache.delete(v.getId() + f);
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
} else if (e.id === Lt.id) {
|
|
408
|
-
const { unitId: t, tableId: n } = e.params, i = this._tableManager.getTable(t, n);
|
|
409
|
-
if (!i)
|
|
410
|
-
return;
|
|
411
|
-
const a = i.getSubunitId();
|
|
412
|
-
this._tableManager.getTablesBySubunitId(t, a).forEach((c) => {
|
|
413
|
-
const u = c.getRange();
|
|
414
|
-
for (let h = u.startColumn; h <= u.endColumn; h++)
|
|
415
|
-
this._itemsCache.delete(c.getId() + h);
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
getTableFilterPanelInitProps(e, t, n, i) {
|
|
421
|
-
const a = this._tableManager.getTable(e, n), s = a.getRange(), c = a.getTableFilterColumn(i - s.startColumn);
|
|
422
|
-
return {
|
|
423
|
-
unitId: e,
|
|
424
|
-
subUnitId: t,
|
|
425
|
-
tableFilter: c,
|
|
426
|
-
currentFilterBy: Yn(c) ? me.Condition : me.Items,
|
|
427
|
-
tableId: n,
|
|
428
|
-
columnIndex: i - s.startColumn
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
getTableFilterCheckedItems(e, t, n) {
|
|
432
|
-
const i = this._tableManager.getTable(e, t), a = [];
|
|
433
|
-
if (i) {
|
|
434
|
-
const s = i.getTableFilterColumn(n);
|
|
435
|
-
s && Qn(s) && a.push(...s.values);
|
|
436
|
-
}
|
|
437
|
-
return a;
|
|
438
|
-
}
|
|
439
|
-
setTableFilter(e, t, n, i) {
|
|
440
|
-
if (!this._tableManager.getTable(e, t))
|
|
441
|
-
return;
|
|
442
|
-
const s = {
|
|
443
|
-
unitId: e,
|
|
444
|
-
tableId: t,
|
|
445
|
-
column: n,
|
|
446
|
-
tableFilter: i
|
|
447
|
-
};
|
|
448
|
-
this._commandService.executeCommand(Lt.id, s);
|
|
449
|
-
}
|
|
450
|
-
getTableFilterItems(e, t, n, i) {
|
|
451
|
-
var E;
|
|
452
|
-
if (this._itemsCache.has(n + i))
|
|
453
|
-
return this._itemsCache.get(n + i) || { data: [], itemsCountMap: /* @__PURE__ */ new Map(), allItemsCount: 0 };
|
|
454
|
-
const a = this._tableManager.getTable(e, n);
|
|
455
|
-
if (!a)
|
|
456
|
-
return { data: [], itemsCountMap: /* @__PURE__ */ new Map(), allItemsCount: 0 };
|
|
457
|
-
const s = a.getTableFilterRange(), { startRow: c, endRow: u, startColumn: h } = s, d = h + i, v = (E = this._univerInstanceService.getUnit(e)) == null ? void 0 : E.getSheetBySheetId(t);
|
|
458
|
-
if (!v)
|
|
459
|
-
return { data: [], itemsCountMap: /* @__PURE__ */ new Map(), allItemsCount: 0 };
|
|
460
|
-
const f = [], w = /* @__PURE__ */ new Map();
|
|
461
|
-
let S = 0;
|
|
462
|
-
for (let C = c; C <= u; C++) {
|
|
463
|
-
if (v.isRowFiltered(C))
|
|
464
|
-
continue;
|
|
465
|
-
let I = this._sheetTableService.getCellValueWithConditionType(v, C, d);
|
|
466
|
-
I === void 0 && (I = this._localeService.t("sheets-table.condition.empty")), w.has(I) || f.push({
|
|
467
|
-
title: I,
|
|
468
|
-
key: `${d}_${C}`,
|
|
469
|
-
leaf: !0
|
|
470
|
-
}), S++, w.set(I, (w.get(I) || 0) + 1);
|
|
471
|
-
}
|
|
472
|
-
return this._itemsCache.set(n + i, { data: f, itemsCountMap: w, allItemsCount: S }), { data: f, itemsCountMap: w, allItemsCount: S };
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
Ee = oi([
|
|
476
|
-
Ze(0, N(re)),
|
|
477
|
-
Ze(1, N(qn)),
|
|
478
|
-
Ze(2, N(pe)),
|
|
479
|
-
Ze(3, te),
|
|
480
|
-
Ze(4, N(ne))
|
|
481
|
-
], Ee);
|
|
482
|
-
var j = /* @__PURE__ */ ((r) => (r.DatePicker = "DatePicker", r.DateRange = "DateRange", r.Input = "Input", r.Inputs = "Inputs", r.Select = "Select", r.None = "None", r))(j || {});
|
|
483
|
-
function li(r) {
|
|
484
|
-
const t = r.get(ne).t;
|
|
485
|
-
return [
|
|
486
|
-
{
|
|
487
|
-
value: F.String,
|
|
488
|
-
label: t(`sheets-table.condition.${F.String}`),
|
|
489
|
-
children: [
|
|
490
|
-
{
|
|
491
|
-
value: Z.Equal,
|
|
492
|
-
label: t(`sheets-table.string.compare.${Z.Equal}`)
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
value: Z.NotEqual,
|
|
496
|
-
label: t(`sheets-table.string.compare.${Z.NotEqual}`)
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
value: Z.Contains,
|
|
500
|
-
label: t(`sheets-table.string.compare.${Z.Contains}`)
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
value: Z.NotContains,
|
|
504
|
-
label: t(`sheets-table.string.compare.${Z.NotContains}`)
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
value: Z.StartsWith,
|
|
508
|
-
label: t(`sheets-table.string.compare.${Z.StartsWith}`)
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
value: Z.EndsWith,
|
|
512
|
-
label: t(`sheets-table.string.compare.${Z.EndsWith}`)
|
|
513
|
-
}
|
|
514
|
-
]
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
value: F.Number,
|
|
518
|
-
label: t(`sheets-table.condition.${F.Number}`),
|
|
519
|
-
children: [
|
|
520
|
-
{
|
|
521
|
-
value: k.Equal,
|
|
522
|
-
label: t(`sheets-table.number.compare.${k.Equal}`)
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
value: k.NotEqual,
|
|
526
|
-
label: t(`sheets-table.number.compare.${k.NotEqual}`)
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
value: k.GreaterThan,
|
|
530
|
-
label: t(`sheets-table.number.compare.${k.GreaterThan}`)
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
value: k.GreaterThanOrEqual,
|
|
534
|
-
label: t(`sheets-table.number.compare.${k.GreaterThanOrEqual}`)
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
value: k.LessThan,
|
|
538
|
-
label: t(`sheets-table.number.compare.${k.LessThan}`)
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
value: k.LessThanOrEqual,
|
|
542
|
-
label: t(`sheets-table.number.compare.${k.LessThanOrEqual}`)
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
value: k.Between,
|
|
546
|
-
label: t(`sheets-table.number.compare.${k.Between}`)
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
value: k.NotBetween,
|
|
550
|
-
label: t(`sheets-table.number.compare.${k.NotBetween}`)
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
value: k.Above,
|
|
554
|
-
label: t(`sheets-table.number.compare.${k.Above}`)
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
value: k.Below,
|
|
558
|
-
label: t(`sheets-table.number.compare.${k.Below}`)
|
|
559
|
-
}
|
|
560
|
-
// {
|
|
561
|
-
// value: TableNumberCompareTypeEnum.TopN,
|
|
562
|
-
// label: t(`sheets-table.number.compare.${TableNumberCompareTypeEnum.TopN}`),
|
|
563
|
-
// },
|
|
564
|
-
]
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
value: F.Date,
|
|
568
|
-
label: t(`sheets-table.condition.${F.Date}`),
|
|
569
|
-
children: [
|
|
570
|
-
{
|
|
571
|
-
value: o.Equal,
|
|
572
|
-
label: t(`sheets-table.date.compare.${o.Equal}`)
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
value: o.NotEqual,
|
|
576
|
-
label: t(`sheets-table.date.compare.${o.NotEqual}`)
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
value: o.After,
|
|
580
|
-
label: t(`sheets-table.date.compare.${o.After}`)
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
value: o.AfterOrEqual,
|
|
584
|
-
label: t(`sheets-table.date.compare.${o.AfterOrEqual}`)
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
value: o.Before,
|
|
588
|
-
label: t(`sheets-table.date.compare.${o.Before}`)
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
value: o.BeforeOrEqual,
|
|
592
|
-
label: t(`sheets-table.date.compare.${o.BeforeOrEqual}`)
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
value: o.Between,
|
|
596
|
-
label: t(`sheets-table.date.compare.${o.Between}`)
|
|
597
|
-
},
|
|
598
|
-
{
|
|
599
|
-
value: o.NotBetween,
|
|
600
|
-
label: t(`sheets-table.date.compare.${o.NotBetween}`)
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
value: o.Today,
|
|
604
|
-
label: t(`sheets-table.date.compare.${o.Today}`)
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
value: o.Yesterday,
|
|
608
|
-
label: t(`sheets-table.date.compare.${o.Yesterday}`)
|
|
609
|
-
},
|
|
610
|
-
{
|
|
611
|
-
value: o.Tomorrow,
|
|
612
|
-
label: t(`sheets-table.date.compare.${o.Tomorrow}`)
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
value: o.ThisWeek,
|
|
616
|
-
label: t(`sheets-table.date.compare.${o.ThisWeek}`)
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
value: o.LastWeek,
|
|
620
|
-
label: t(`sheets-table.date.compare.${o.LastWeek}`)
|
|
621
|
-
},
|
|
622
|
-
{
|
|
623
|
-
value: o.NextWeek,
|
|
624
|
-
label: t(`sheets-table.date.compare.${o.NextWeek}`)
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
value: o.ThisMonth,
|
|
628
|
-
label: t(`sheets-table.date.compare.${o.ThisMonth}`)
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
value: o.LastMonth,
|
|
632
|
-
label: t(`sheets-table.date.compare.${o.LastMonth}`)
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
value: o.NextMonth,
|
|
636
|
-
label: t(`sheets-table.date.compare.${o.NextMonth}`)
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
value: o.ThisYear,
|
|
640
|
-
label: t(`sheets-table.date.compare.${o.ThisYear}`)
|
|
641
|
-
},
|
|
642
|
-
{
|
|
643
|
-
value: o.LastYear,
|
|
644
|
-
label: t(`sheets-table.date.compare.${o.LastYear}`)
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
value: o.NextYear,
|
|
648
|
-
label: t(`sheets-table.date.compare.${o.NextYear}`)
|
|
649
|
-
},
|
|
650
|
-
{
|
|
651
|
-
value: o.Quarter,
|
|
652
|
-
label: t(`sheets-table.date.compare.${o.Quarter}`)
|
|
653
|
-
},
|
|
654
|
-
{
|
|
655
|
-
value: o.Month,
|
|
656
|
-
label: t(`sheets-table.date.compare.${o.Month}`)
|
|
657
|
-
}
|
|
658
|
-
]
|
|
659
|
-
}
|
|
660
|
-
];
|
|
661
|
-
}
|
|
662
|
-
function ci(r, e) {
|
|
663
|
-
if (!e)
|
|
664
|
-
return [];
|
|
665
|
-
const n = r.get(ne).t;
|
|
666
|
-
switch (e) {
|
|
667
|
-
case o.Quarter:
|
|
668
|
-
return [
|
|
669
|
-
{
|
|
670
|
-
value: o.Q1,
|
|
671
|
-
label: n(`sheets-table.date.compare.${o.Q1}`)
|
|
672
|
-
},
|
|
673
|
-
{
|
|
674
|
-
value: o.Q2,
|
|
675
|
-
label: n(`sheets-table.date.compare.${o.Q2}`)
|
|
676
|
-
},
|
|
677
|
-
{
|
|
678
|
-
value: o.Q3,
|
|
679
|
-
label: n(`sheets-table.date.compare.${o.Q3}`)
|
|
680
|
-
},
|
|
681
|
-
{
|
|
682
|
-
value: o.Q4,
|
|
683
|
-
label: n(`sheets-table.date.compare.${o.Q4}`)
|
|
684
|
-
}
|
|
685
|
-
];
|
|
686
|
-
case o.Month:
|
|
687
|
-
return [
|
|
688
|
-
{
|
|
689
|
-
value: o.M1,
|
|
690
|
-
label: n(`sheets-table.date.compare.${o.M1}`)
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
value: o.M2,
|
|
694
|
-
label: n(`sheets-table.date.compare.${o.M2}`)
|
|
695
|
-
},
|
|
696
|
-
{
|
|
697
|
-
value: o.M3,
|
|
698
|
-
label: n(`sheets-table.date.compare.${o.M3}`)
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
value: o.M4,
|
|
702
|
-
label: n(`sheets-table.date.compare.${o.M4}`)
|
|
703
|
-
},
|
|
704
|
-
{
|
|
705
|
-
value: o.M5,
|
|
706
|
-
label: n(`sheets-table.date.compare.${o.M5}`)
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
value: o.M6,
|
|
710
|
-
label: n(`sheets-table.date.compare.${o.M6}`)
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
value: o.M7,
|
|
714
|
-
label: n(`sheets-table.date.compare.${o.M7}`)
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
value: o.M8,
|
|
718
|
-
label: n(`sheets-table.date.compare.${o.M8}`)
|
|
719
|
-
},
|
|
720
|
-
{
|
|
721
|
-
value: o.M9,
|
|
722
|
-
label: n(`sheets-table.date.compare.${o.M9}`)
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
value: o.M10,
|
|
726
|
-
label: n(`sheets-table.date.compare.${o.M10}`)
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
value: o.M11,
|
|
730
|
-
label: n(`sheets-table.date.compare.${o.M11}`)
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
value: o.M12,
|
|
734
|
-
label: n(`sheets-table.date.compare.${o.M12}`)
|
|
735
|
-
}
|
|
736
|
-
];
|
|
737
|
-
default:
|
|
738
|
-
return [];
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
const Nt = /* @__PURE__ */ new Set([
|
|
742
|
-
o.Equal,
|
|
743
|
-
o.NotEqual,
|
|
744
|
-
o.After,
|
|
745
|
-
o.AfterOrEqual,
|
|
746
|
-
o.Before,
|
|
747
|
-
o.BeforeOrEqual
|
|
748
|
-
]);
|
|
749
|
-
function ui(r, e) {
|
|
750
|
-
return e ? r === F.String ? j.Input : r === F.Number ? e === k.Between || e === k.NotBetween ? j.Inputs : j.Input : r === F.Date ? e === o.Between || e === o.NotBetween ? j.DateRange : e === o.Quarter || e === o.Month ? j.Select : Nt.has(e) ? j.DatePicker : j.None : j.None : j.None;
|
|
751
|
-
}
|
|
752
|
-
function di(r) {
|
|
753
|
-
if (!r || r.filterType !== "condition")
|
|
754
|
-
return {
|
|
755
|
-
type: F.String,
|
|
756
|
-
compareType: Z.Equal,
|
|
757
|
-
info: {}
|
|
758
|
-
};
|
|
759
|
-
const e = r.filterInfo, { conditionType: t, compareType: n } = e;
|
|
760
|
-
if (t === F.Date)
|
|
761
|
-
if (n === o.Between || n === o.NotBetween) {
|
|
762
|
-
let i;
|
|
763
|
-
return Array.isArray(e.expectedValue) && (i = e.expectedValue.map((a) => typeof a == "string" ? new Date(a) : a)), {
|
|
764
|
-
type: t,
|
|
765
|
-
compare: n,
|
|
766
|
-
info: {
|
|
767
|
-
dateRange: i
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
} else {
|
|
771
|
-
if (n === o.Today || n === o.Yesterday || n === o.Tomorrow || n === o.ThisWeek || n === o.LastWeek || n === o.NextWeek || n === o.ThisMonth || n === o.LastMonth || n === o.NextMonth || n === o.ThisYear || n === o.LastYear || n === o.NextYear)
|
|
772
|
-
return {
|
|
773
|
-
type: t,
|
|
774
|
-
compare: n,
|
|
775
|
-
info: {}
|
|
776
|
-
};
|
|
777
|
-
if (Nt.has(n)) {
|
|
778
|
-
let i;
|
|
779
|
-
if (typeof e.expectedValue == "string")
|
|
780
|
-
i = new Date(e.expectedValue);
|
|
781
|
-
else if (Array.isArray(e.expectedValue))
|
|
782
|
-
for (let a = 0; a < e.expectedValue.length; a++)
|
|
783
|
-
typeof e.expectedValue[a] == "string" && (e.expectedValue[a] = new Date(e.expectedValue[a]));
|
|
784
|
-
return {
|
|
785
|
-
type: t,
|
|
786
|
-
compare: n,
|
|
787
|
-
info: {
|
|
788
|
-
date: i
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
} else
|
|
792
|
-
return (/* @__PURE__ */ new Set([o.Q1, o.Q2, o.Q3, o.Q4])).has(n) ? {
|
|
793
|
-
type: t,
|
|
794
|
-
compare: o.Quarter,
|
|
795
|
-
info: {
|
|
796
|
-
dateSelect: e.compareType
|
|
797
|
-
}
|
|
798
|
-
} : {
|
|
799
|
-
type: t,
|
|
800
|
-
compare: o.Month,
|
|
801
|
-
info: {
|
|
802
|
-
dateSelect: e.compareType
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
else {
|
|
807
|
-
if (t === F.Number)
|
|
808
|
-
return n === k.Between || n === k.NotBetween ? {
|
|
809
|
-
type: t,
|
|
810
|
-
compare: n,
|
|
811
|
-
info: {
|
|
812
|
-
numberRange: e.expectedValue
|
|
813
|
-
}
|
|
814
|
-
} : {
|
|
815
|
-
type: t,
|
|
816
|
-
compare: n,
|
|
817
|
-
info: {
|
|
818
|
-
number: e.expectedValue
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
if (t === F.String)
|
|
822
|
-
return {
|
|
823
|
-
type: t,
|
|
824
|
-
compare: n,
|
|
825
|
-
info: {
|
|
826
|
-
string: e.expectedValue
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
return {
|
|
831
|
-
type: F.String,
|
|
832
|
-
compare: Z.Equal,
|
|
833
|
-
info: {}
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
const hi = (r) => {
|
|
837
|
-
var w, S, E, C, $, I, B, R;
|
|
838
|
-
const { conditionInfo: e, onChange: t } = r, n = M(ne), [i, a] = q(!1), s = M(Pe), c = li(s), u = (g, x, y) => {
|
|
839
|
-
t({
|
|
840
|
-
type: x != null ? x : e.type,
|
|
841
|
-
compare: y != null ? y : e.compare,
|
|
842
|
-
info: g
|
|
843
|
-
});
|
|
844
|
-
}, h = (g) => {
|
|
845
|
-
var O;
|
|
846
|
-
const x = g[0], y = g[1];
|
|
847
|
-
y && a(!1);
|
|
848
|
-
const m = {};
|
|
849
|
-
x === F.Date ? y === o.Quarter ? m.dateSelect = o.Q1 : y === o.Month ? m.dateSelect = o.M1 : Nt.has(y) ? m.date = /* @__PURE__ */ new Date() : m.dateRange = [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()] : x === F.Number ? m.number = 0 : x === F.String && (m.string = ""), u(m, g[0], (O = g[1]) != null ? O : Z.Equal);
|
|
850
|
-
}, d = ui(e.type, e.compare);
|
|
851
|
-
let v = "";
|
|
852
|
-
e.compare ? v = `${n.t(`sheets-table.condition.${e.type}`)} - ${n.t(`sheets-table.${e.type}.compare.${e.compare}`)}` : v = n.t(`sheets-table.condition.${e.type}`);
|
|
853
|
-
const f = ci(s, e.compare);
|
|
854
|
-
return /* @__PURE__ */ T("div", { children: [
|
|
855
|
-
/* @__PURE__ */ l(
|
|
856
|
-
Ne,
|
|
857
|
-
{
|
|
858
|
-
align: "start",
|
|
859
|
-
open: i,
|
|
860
|
-
onOpenChange: a,
|
|
861
|
-
overlay: /* @__PURE__ */ l(
|
|
862
|
-
yr,
|
|
863
|
-
{
|
|
864
|
-
value: [e.type, e.compare],
|
|
865
|
-
options: c,
|
|
866
|
-
onChange: h,
|
|
867
|
-
contentClassName: "univer-flex-1",
|
|
868
|
-
wrapperClassName: "!univer-h-[150px]"
|
|
869
|
-
}
|
|
870
|
-
),
|
|
871
|
-
children: /* @__PURE__ */ T(
|
|
872
|
-
"div",
|
|
873
|
-
{
|
|
874
|
-
className: D("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-2 univer-text-sm univer-transition-colors univer-duration-200 hover:univer-border-primary-600 focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2 dark:!univer-bg-gray-700 dark:!univer-text-white", H),
|
|
875
|
-
children: [
|
|
876
|
-
/* @__PURE__ */ l("span", { children: v }),
|
|
877
|
-
/* @__PURE__ */ l(xt, {})
|
|
878
|
-
]
|
|
879
|
-
}
|
|
880
|
-
)
|
|
881
|
-
}
|
|
882
|
-
),
|
|
883
|
-
/* @__PURE__ */ T("div", { className: "univer-mt-3 univer-w-full", children: [
|
|
884
|
-
d === j.Input && /* @__PURE__ */ l(Rt, { children: e.type === F.String ? /* @__PURE__ */ l(
|
|
885
|
-
Mt,
|
|
886
|
-
{
|
|
887
|
-
className: "univer-w-full",
|
|
888
|
-
placeholder: "请输入",
|
|
889
|
-
value: e.info.string,
|
|
890
|
-
onChange: (g) => u({ string: g })
|
|
891
|
-
}
|
|
892
|
-
) : /* @__PURE__ */ l(
|
|
893
|
-
bt,
|
|
894
|
-
{
|
|
895
|
-
className: "univer-h-7 univer-w-full",
|
|
896
|
-
value: e.info.number,
|
|
897
|
-
controls: !1,
|
|
898
|
-
onChange: (g) => {
|
|
899
|
-
g !== null && u({ number: g });
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
) }),
|
|
903
|
-
d === j.DatePicker && /* @__PURE__ */ l("div", { id: "univer-table-date-picker-wrapper", children: /* @__PURE__ */ l(
|
|
904
|
-
Rr,
|
|
905
|
-
{
|
|
906
|
-
className: "univer-w-full",
|
|
907
|
-
value: (w = e.info.date) != null ? w : /* @__PURE__ */ new Date(),
|
|
908
|
-
onValueChange: (g) => u({ date: g })
|
|
909
|
-
}
|
|
910
|
-
) }),
|
|
911
|
-
d === j.DateRange && /* @__PURE__ */ l("div", { id: "univer-table-date-range-wrapper", children: /* @__PURE__ */ l(
|
|
912
|
-
Mr,
|
|
913
|
-
{
|
|
914
|
-
className: "univer-w-full",
|
|
915
|
-
value: [(E = (S = e.info.dateRange) == null ? void 0 : S[0]) != null ? E : /* @__PURE__ */ new Date(), ($ = (C = e.info.dateRange) == null ? void 0 : C[1]) != null ? $ : /* @__PURE__ */ new Date()],
|
|
916
|
-
onValueChange: (g) => {
|
|
917
|
-
u(g ? { dateRange: g } : {});
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
) }),
|
|
921
|
-
d === j.Inputs && /* @__PURE__ */ T("div", { className: "univer-flex univer-items-center univer-gap-2", children: [
|
|
922
|
-
/* @__PURE__ */ l(
|
|
923
|
-
bt,
|
|
924
|
-
{
|
|
925
|
-
className: "univer-w-full",
|
|
926
|
-
value: (I = e.info.numberRange) == null ? void 0 : I[0],
|
|
927
|
-
onChange: (g) => {
|
|
928
|
-
var x;
|
|
929
|
-
g !== null && u({ numberRange: [g, (x = e.info.numberRange) == null ? void 0 : x[1]] });
|
|
930
|
-
},
|
|
931
|
-
controls: !1
|
|
932
|
-
}
|
|
933
|
-
),
|
|
934
|
-
/* @__PURE__ */ l("span", { children: " - " }),
|
|
935
|
-
/* @__PURE__ */ l(
|
|
936
|
-
bt,
|
|
937
|
-
{
|
|
938
|
-
className: "univer-w-full",
|
|
939
|
-
value: (B = e.info.numberRange) == null ? void 0 : B[1],
|
|
940
|
-
controls: !1,
|
|
941
|
-
onChange: (g) => {
|
|
942
|
-
var x;
|
|
943
|
-
g !== null && u({ numberRange: [(x = e.info.numberRange) == null ? void 0 : x[0], g] });
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
)
|
|
947
|
-
] }),
|
|
948
|
-
d === j.Select && /* @__PURE__ */ l(
|
|
949
|
-
xr,
|
|
950
|
-
{
|
|
951
|
-
className: "univer-w-full",
|
|
952
|
-
value: (R = e.info.dateSelect) != null ? R : f[0].value,
|
|
953
|
-
options: f,
|
|
954
|
-
onChange: (g) => u({ dateSelect: g })
|
|
955
|
-
}
|
|
956
|
-
)
|
|
957
|
-
] })
|
|
958
|
-
] });
|
|
959
|
-
}, vi = (r) => {
|
|
960
|
-
let e = 0;
|
|
961
|
-
return r.forEach((t) => {
|
|
962
|
-
e += t;
|
|
963
|
-
}), e;
|
|
964
|
-
};
|
|
965
|
-
function gi(r) {
|
|
966
|
-
const { unitId: e, tableId: t, subUnitId: n, columnIndex: i, checkedItemSet: a, setCheckedItemSet: s, tableFilter: c } = r, u = M(ne), h = M(Ee), { data: d, itemsCountMap: v, allItemsCount: f } = h.getTableFilterItems(e, n, t, i), [w, S] = q(c === void 0 ? !0 : a.size === v.size), [E, C] = q(w ? f : vi(v)), $ = !w && a.size > 0, [I, B] = q(""), R = sn(() => I ? d.filter((m) => String(m.title).toLowerCase().includes(I.toLowerCase())) : d, [I, d]), g = Bt(() => {
|
|
967
|
-
w ? (a.clear(), s(new Set(a)), S(!1)) : (R.forEach((m) => {
|
|
968
|
-
a.add(m.title);
|
|
969
|
-
}), s(new Set(a)), S(!0));
|
|
970
|
-
}, [w]), x = Bt((m) => {
|
|
971
|
-
m === "" ? (S(!0), d.forEach((O) => {
|
|
972
|
-
a.add(O.title);
|
|
973
|
-
}), C(f)) : (a.clear(), S(!1), C(0)), B(m);
|
|
974
|
-
}, []), y = (m) => {
|
|
975
|
-
if (w) {
|
|
976
|
-
S(!1);
|
|
977
|
-
const O = /* @__PURE__ */ new Set();
|
|
978
|
-
for (const { title: L } of d)
|
|
979
|
-
m !== L && O.add(L);
|
|
980
|
-
C(f - v.get(m)), s(O);
|
|
981
|
-
} else
|
|
982
|
-
a.has(m) ? (a.delete(m), C(E - v.get(m))) : (a.add(m), C(E + v.get(m))), s(new Set(a));
|
|
983
|
-
};
|
|
984
|
-
return /* @__PURE__ */ T("div", { className: "univer-flex univer-h-full univer-flex-col", children: [
|
|
985
|
-
/* @__PURE__ */ l(Mt, { autoFocus: !0, value: I, placeholder: u.t("sheets-table.filter.search-placeholder"), onChange: x }),
|
|
986
|
-
/* @__PURE__ */ l(
|
|
987
|
-
"div",
|
|
988
|
-
{
|
|
989
|
-
className: D("univer-mt-2 univer-box-border univer-flex univer-h-[180px] univer-max-h-[180px] univer-flex-grow univer-flex-col univer-overflow-hidden univer-rounded-md univer-py-1.5 univer-pl-2", H),
|
|
990
|
-
children: /* @__PURE__ */ l(
|
|
991
|
-
"div",
|
|
992
|
-
{
|
|
993
|
-
className: D("univer-h-40 univer-overflow-y-auto univer-py-1 univer-pl-2", Nr),
|
|
994
|
-
children: /* @__PURE__ */ T("div", { className: "univer-h-full", children: [
|
|
995
|
-
/* @__PURE__ */ l("div", { className: "univer-flex univer-items-center univer-px-2 univer-py-1", children: /* @__PURE__ */ l(
|
|
996
|
-
Dt,
|
|
997
|
-
{
|
|
998
|
-
indeterminate: $,
|
|
999
|
-
disabled: d.length === 0,
|
|
1000
|
-
checked: w,
|
|
1001
|
-
onChange: g,
|
|
1002
|
-
children: /* @__PURE__ */ T("div", { className: "univer-flex univer-h-5 univer-flex-1 univer-items-center univer-text-sm", children: [
|
|
1003
|
-
/* @__PURE__ */ l("span", { className: "univer-inline-block univer-truncate", children: `${u.t("sheets-table.filter.select-all")}` }),
|
|
1004
|
-
/* @__PURE__ */ l("span", { className: "univer-ml univer-text-gray-400", children: `(${E}/${I ? R.length : f})` })
|
|
1005
|
-
] })
|
|
1006
|
-
}
|
|
1007
|
-
) }),
|
|
1008
|
-
R.map((m) => /* @__PURE__ */ l(
|
|
1009
|
-
"div",
|
|
1010
|
-
{
|
|
1011
|
-
className: "univer-flex univer-items-center univer-px-2 univer-py-1",
|
|
1012
|
-
children: /* @__PURE__ */ l(
|
|
1013
|
-
Dt,
|
|
1014
|
-
{
|
|
1015
|
-
checked: w || a.has(m.title),
|
|
1016
|
-
onChange: () => {
|
|
1017
|
-
y(m.title);
|
|
1018
|
-
},
|
|
1019
|
-
children: /* @__PURE__ */ T("div", { className: "univer-flex univer-h-5 univer-flex-1 univer-text-sm", children: [
|
|
1020
|
-
/* @__PURE__ */ l("span", { className: "univer-inline-block univer-truncate", children: m.title }),
|
|
1021
|
-
/* @__PURE__ */ l("span", { className: "univer-ml-1 univer-text-gray-400", children: `(${v.get(m.title) || 0})` })
|
|
1022
|
-
] })
|
|
1023
|
-
}
|
|
1024
|
-
)
|
|
1025
|
-
},
|
|
1026
|
-
m.key
|
|
1027
|
-
))
|
|
1028
|
-
] })
|
|
1029
|
-
}
|
|
1030
|
-
)
|
|
1031
|
-
}
|
|
1032
|
-
)
|
|
1033
|
-
] });
|
|
1034
|
-
}
|
|
1035
|
-
function bi() {
|
|
1036
|
-
var de;
|
|
1037
|
-
const r = M(ne), e = mi(r), t = M(Ee), n = M(re), i = M(te), a = M(qt), s = M($e), c = s.getCurrentTableFilterInfo(), u = t.getTableFilterPanelInitProps(c.unitId, c.subUnitId, c.tableId, c.column), { unitId: h, subUnitId: d, tableId: v, tableFilter: f, currentFilterBy: w, columnIndex: S } = u, { data: E } = t.getTableFilterItems(h, d, v, S), C = t.getTableFilterCheckedItems(h, v, S), [$, I] = q(new Set(C)), [B, R] = q(w || me.Items), [g, x] = q(() => {
|
|
1038
|
-
const b = u.tableFilter;
|
|
1039
|
-
return di(b);
|
|
1040
|
-
}), y = n.getTable(h, v);
|
|
1041
|
-
if (!y) return null;
|
|
1042
|
-
const m = y.getTableFilters(), O = m.getSortState();
|
|
1043
|
-
O.columnIndex === S && (O.sortState, Ke.Asc), O.columnIndex === S && (O.sortState, Ke.Desc);
|
|
1044
|
-
const L = () => {
|
|
1045
|
-
s.closeFilterPanel();
|
|
1046
|
-
}, Y = () => {
|
|
1047
|
-
L();
|
|
1048
|
-
}, V = (b) => {
|
|
1049
|
-
const P = y.getTableFilterRange();
|
|
1050
|
-
i.executeCommand(Vr.id, {
|
|
1051
|
-
unitId: h,
|
|
1052
|
-
subUnitId: d,
|
|
1053
|
-
range: P,
|
|
1054
|
-
orderRules: [{ colIndex: S + P.startColumn, type: b ? Ht.ASC : Ht.DESC }],
|
|
1055
|
-
hasTitle: !1
|
|
1056
|
-
}), m.setSortState(S, b ? Ke.Asc : Ke.Desc), L();
|
|
1057
|
-
}, z = () => {
|
|
1058
|
-
if (B === me.Items) {
|
|
1059
|
-
const b = [];
|
|
1060
|
-
for (const Q of E)
|
|
1061
|
-
$.has(Q.title) && b.push(Q.title);
|
|
1062
|
-
const P = y.getTableFilterColumn(S);
|
|
1063
|
-
if (P) {
|
|
1064
|
-
if (P.values.join(",") === b.join(",")) {
|
|
1065
|
-
L();
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
} else if (b.length === 0) {
|
|
1069
|
-
L();
|
|
1070
|
-
return;
|
|
1071
|
-
}
|
|
1072
|
-
const A = {
|
|
1073
|
-
filterType: kt.manual,
|
|
1074
|
-
values: b
|
|
1075
|
-
};
|
|
1076
|
-
t.setTableFilter(h, v, S, A);
|
|
1077
|
-
} else {
|
|
1078
|
-
let b;
|
|
1079
|
-
g.compare === o.Quarter || g.compare === o.Month ? b = {
|
|
1080
|
-
conditionType: g.type,
|
|
1081
|
-
compareType: Object.values(g.info)[0]
|
|
1082
|
-
} : b = {
|
|
1083
|
-
conditionType: g.type,
|
|
1084
|
-
compareType: g.compare,
|
|
1085
|
-
expectedValue: Object.values(g.info)[0]
|
|
1086
|
-
};
|
|
1087
|
-
const P = {
|
|
1088
|
-
filterType: kt.condition,
|
|
1089
|
-
// @ts-ignore
|
|
1090
|
-
filterInfo: b
|
|
1091
|
-
};
|
|
1092
|
-
t.setTableFilter(h, v, S, P);
|
|
1093
|
-
}
|
|
1094
|
-
L();
|
|
1095
|
-
}, ce = () => {
|
|
1096
|
-
t.setTableFilter(h, v, S, void 0), L();
|
|
1097
|
-
}, ue = new ln(h).id, fe = (de = a.getPermissionPoint(ue)) == null ? void 0 : de.value;
|
|
1098
|
-
return /* @__PURE__ */ T(
|
|
1099
|
-
"div",
|
|
1100
|
-
{
|
|
1101
|
-
className: "univer-box-border univer-flex univer-min-w-[312px] univer-flex-col univer-rounded-[10px] univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
|
|
1102
|
-
children: [
|
|
1103
|
-
fe && /* @__PURE__ */ l("div", { className: "univer-mb-3 univer-flex", children: /* @__PURE__ */ T(Er, { className: "univer-mb-3 !univer-flex univer-w-full", children: [
|
|
1104
|
-
/* @__PURE__ */ T(_e, { className: "univer-w-1/2", onClick: () => V(!0), children: [
|
|
1105
|
-
/* @__PURE__ */ l(pn, { className: "univer-mr-1" }),
|
|
1106
|
-
r.t("sheets-sort.general.sort-asc")
|
|
1107
|
-
] }),
|
|
1108
|
-
/* @__PURE__ */ T(_e, { className: "univer-w-1/2", onClick: () => V(!1), children: [
|
|
1109
|
-
/* @__PURE__ */ l(Cn, { className: "univer-mr-1" }),
|
|
1110
|
-
r.t("sheets-sort.general.sort-desc")
|
|
1111
|
-
] })
|
|
1112
|
-
] }) }),
|
|
1113
|
-
/* @__PURE__ */ l("div", { className: "univer-w-full", children: /* @__PURE__ */ l(
|
|
1114
|
-
$r,
|
|
1115
|
-
{
|
|
1116
|
-
value: B,
|
|
1117
|
-
items: e,
|
|
1118
|
-
onChange: (b) => R(b)
|
|
1119
|
-
}
|
|
1120
|
-
) }),
|
|
1121
|
-
/* @__PURE__ */ l("div", { className: "univer-z-10 univer-h-60", children: /* @__PURE__ */ l("div", { className: "univer-mt-3 univer-size-full", children: B === me.Items ? /* @__PURE__ */ l(
|
|
1122
|
-
gi,
|
|
1123
|
-
{
|
|
1124
|
-
tableFilter: f,
|
|
1125
|
-
unitId: h,
|
|
1126
|
-
subUnitId: d,
|
|
1127
|
-
tableId: v,
|
|
1128
|
-
columnIndex: S,
|
|
1129
|
-
checkedItemSet: $,
|
|
1130
|
-
setCheckedItemSet: I
|
|
1131
|
-
}
|
|
1132
|
-
) : /* @__PURE__ */ l(
|
|
1133
|
-
hi,
|
|
1134
|
-
{
|
|
1135
|
-
tableFilter: f,
|
|
1136
|
-
unitId: h,
|
|
1137
|
-
subUnitId: d,
|
|
1138
|
-
tableId: v,
|
|
1139
|
-
columnIndex: S,
|
|
1140
|
-
conditionInfo: g,
|
|
1141
|
-
onChange: x
|
|
1142
|
-
}
|
|
1143
|
-
) }) }),
|
|
1144
|
-
/* @__PURE__ */ T(
|
|
1145
|
-
"div",
|
|
1146
|
-
{
|
|
1147
|
-
className: "univer-flex-wrap-nowrap univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-justify-between univer-gap-6 univer-overflow-hidden",
|
|
1148
|
-
children: [
|
|
1149
|
-
/* @__PURE__ */ l(
|
|
1150
|
-
_e,
|
|
1151
|
-
{
|
|
1152
|
-
disabled: f === void 0,
|
|
1153
|
-
onClick: ce,
|
|
1154
|
-
children: r.t("sheets-table.filter.clear-filter")
|
|
1155
|
-
}
|
|
1156
|
-
),
|
|
1157
|
-
/* @__PURE__ */ T("div", { children: [
|
|
1158
|
-
/* @__PURE__ */ l(_e, { className: "univer-mr-2", onClick: Y, children: r.t("sheets-table.filter.cancel") }),
|
|
1159
|
-
/* @__PURE__ */ l(_e, { variant: "primary", onClick: z, children: r.t("sheets-table.filter.confirm") })
|
|
1160
|
-
] })
|
|
1161
|
-
]
|
|
1162
|
-
}
|
|
1163
|
-
)
|
|
1164
|
-
]
|
|
1165
|
-
}
|
|
1166
|
-
);
|
|
1167
|
-
}
|
|
1168
|
-
function mi(r) {
|
|
1169
|
-
const e = r.getCurrentLocale();
|
|
1170
|
-
return sn(() => [
|
|
1171
|
-
{ label: r.t("sheets-table.filter.by-values"), value: me.Items },
|
|
1172
|
-
{ label: r.t("sheets-table.filter.by-conditions"), value: me.Condition }
|
|
1173
|
-
], [e, r]);
|
|
1174
|
-
}
|
|
1175
|
-
var pi = Object.getOwnPropertyDescriptor, fi = (r, e, t, n) => {
|
|
1176
|
-
for (var i = n > 1 ? void 0 : n ? pi(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
1177
|
-
(s = r[a]) && (i = s(i) || i);
|
|
1178
|
-
return i;
|
|
1179
|
-
}, tt = (r, e) => (t, n) => e(t, n, r);
|
|
1180
|
-
let $e = class extends ke {
|
|
1181
|
-
constructor(e, t, n, i) {
|
|
1182
|
-
super();
|
|
1183
|
-
U(this, "_popupDisposable");
|
|
1184
|
-
U(this, "_currentTableFilterInfo", null);
|
|
1185
|
-
this._componentManager = e, this._contextService = t, this._sheetCanvasPopupService = n, this._dialogService = i, this._initComponents(), this._initUIPopup();
|
|
1186
|
-
}
|
|
1187
|
-
setCurrentTableFilterInfo(e) {
|
|
1188
|
-
this._currentTableFilterInfo = e;
|
|
1189
|
-
}
|
|
1190
|
-
clearCurrentTableFilterInfo() {
|
|
1191
|
-
this._currentTableFilterInfo = null;
|
|
1192
|
-
}
|
|
1193
|
-
getCurrentTableFilterInfo() {
|
|
1194
|
-
return this._currentTableFilterInfo;
|
|
1195
|
-
}
|
|
1196
|
-
_initComponents() {
|
|
1197
|
-
[
|
|
1198
|
-
[ge, bi]
|
|
1199
|
-
].forEach(([e, t]) => {
|
|
1200
|
-
this.disposeWithMe(this._componentManager.register(e, t));
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
_initUIPopup() {
|
|
1204
|
-
this.disposeWithMe(this._contextService.subscribeContextValue$(ge).pipe(an(void 0), Cr()).subscribe((e) => {
|
|
1205
|
-
e ? this._openFilterPopup() : e === !1 && this._closeFilterPopup();
|
|
1206
|
-
}));
|
|
1207
|
-
}
|
|
1208
|
-
closeFilterPanel() {
|
|
1209
|
-
this._contextService.setContextValue(ge, !1);
|
|
1210
|
-
}
|
|
1211
|
-
_openFilterPopup() {
|
|
1212
|
-
const e = this._currentTableFilterInfo;
|
|
1213
|
-
if (!e)
|
|
1214
|
-
throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");
|
|
1215
|
-
const { row: t, column: n } = e;
|
|
1216
|
-
this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(t, n, {
|
|
1217
|
-
componentKey: ge,
|
|
1218
|
-
direction: "horizontal",
|
|
1219
|
-
onClickOutside: () => {
|
|
1220
|
-
this._dialogService.close(jr), this._contextService.setContextValue(ge, !1);
|
|
1221
|
-
},
|
|
1222
|
-
offset: [5, 0],
|
|
1223
|
-
portal: !0
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
_closeFilterPopup() {
|
|
1227
|
-
var e;
|
|
1228
|
-
(e = this._popupDisposable) == null || e.dispose(), this._popupDisposable = null, this.clearCurrentTableFilterInfo();
|
|
1229
|
-
}
|
|
1230
|
-
};
|
|
1231
|
-
$e = fi([
|
|
1232
|
-
tt(0, N(nn)),
|
|
1233
|
-
tt(1, It),
|
|
1234
|
-
tt(2, N(nr)),
|
|
1235
|
-
tt(3, N(rn))
|
|
1236
|
-
], $e);
|
|
1237
|
-
const St = {
|
|
1238
|
-
type: Yt.OPERATION,
|
|
1239
|
-
id: "sheet.operation.open-table-filter-panel",
|
|
1240
|
-
async handler(r, e) {
|
|
1241
|
-
if (!e)
|
|
1242
|
-
return !1;
|
|
1243
|
-
const { row: t, col: n, unitId: i, subUnitId: a, tableId: s } = e, c = r.get(re), u = r.get(It), h = r.get($e);
|
|
1244
|
-
return c.getTable(i, s) ? (u.getContextValue(ge) || (h.setCurrentTableFilterInfo({ unitId: i, subUnitId: a, row: t, tableId: s, column: n }), u.setContextValue(ge, !0)), !0) : !1;
|
|
1245
|
-
}
|
|
1246
|
-
}, Et = {
|
|
1247
|
-
type: Yt.OPERATION,
|
|
1248
|
-
id: "sheet.operation.open-table-selector",
|
|
1249
|
-
async handler(r) {
|
|
1250
|
-
var w;
|
|
1251
|
-
const e = r.get(pe), t = r.get(te), n = ct(e);
|
|
1252
|
-
if (!n)
|
|
1253
|
-
return !1;
|
|
1254
|
-
const { unitId: i, subUnitId: a, worksheet: s } = n, u = r.get(ut).getCurrentLastSelection(), h = (w = u == null ? void 0 : u.range) != null ? w : { startRow: 0, endRow: 0, startColumn: 0, endColumn: 0 }, v = Pr(u) ? Or(h, { up: !0, left: !0, right: !0, down: !0 }, s) : h, f = await In(r, i, a, v);
|
|
1255
|
-
return f ? (t.executeCommand(zn.id, { ...f }), !0) : !1;
|
|
1256
|
-
}
|
|
1257
|
-
};
|
|
1258
|
-
async function In(r, e, t, n, i) {
|
|
1259
|
-
const a = r.get(rn), s = r.get(ne);
|
|
1260
|
-
return new Promise((c) => {
|
|
1261
|
-
const u = {
|
|
1262
|
-
unitId: e,
|
|
1263
|
-
subUnitId: t,
|
|
1264
|
-
range: n,
|
|
1265
|
-
tableId: i,
|
|
1266
|
-
onConfirm: (h) => {
|
|
1267
|
-
c(h), a.close(xe);
|
|
1268
|
-
},
|
|
1269
|
-
onCancel: () => {
|
|
1270
|
-
c(null), a.close(xe);
|
|
1271
|
-
}
|
|
1272
|
-
};
|
|
1273
|
-
a.open({
|
|
1274
|
-
id: xe,
|
|
1275
|
-
title: { title: s.t("sheets-table.selectRange") },
|
|
1276
|
-
draggable: !0,
|
|
1277
|
-
destroyOnClose: !0,
|
|
1278
|
-
mask: !1,
|
|
1279
|
-
maskClosable: !1,
|
|
1280
|
-
children: {
|
|
1281
|
-
label: {
|
|
1282
|
-
name: xe,
|
|
1283
|
-
props: u
|
|
1284
|
-
}
|
|
1285
|
-
},
|
|
1286
|
-
width: 300,
|
|
1287
|
-
onClose: () => {
|
|
1288
|
-
c(null), a.close(xe);
|
|
1289
|
-
}
|
|
1290
|
-
});
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
const yn = "sheets-table-ui.config", Ut = {
|
|
1294
|
-
anchorHeight: 24,
|
|
1295
|
-
anchorBackgroundColor: "rgb(134,139,156)"
|
|
1296
|
-
};
|
|
1297
|
-
var Ci = Object.getOwnPropertyDescriptor, Si = (r, e, t, n) => {
|
|
1298
|
-
for (var i = n > 1 ? void 0 : n ? Ci(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
1299
|
-
(s = r[a]) && (i = s(i) || i);
|
|
1300
|
-
return i;
|
|
1301
|
-
}, _i = (r, e) => (t, n) => e(t, n, r);
|
|
1302
|
-
let Ie = class extends ke {
|
|
1303
|
-
constructor(e) {
|
|
1304
|
-
super();
|
|
1305
|
-
U(this, "_refreshTable", new Sr());
|
|
1306
|
-
U(this, "refreshTable$", this._refreshTable.asObservable());
|
|
1307
|
-
this._commandService = e, this._initListener();
|
|
1308
|
-
}
|
|
1309
|
-
_initListener() {
|
|
1310
|
-
this.disposeWithMe(
|
|
1311
|
-
this._commandService.onCommandExecuted((e) => {
|
|
1312
|
-
if (e.id === cn.id) {
|
|
1313
|
-
const t = e.params, { styleName: n } = t;
|
|
1314
|
-
n.startsWith(Gn) && this._refreshTable.next(Math.random());
|
|
1315
|
-
}
|
|
1316
|
-
})
|
|
1317
|
-
);
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
Ie = Si([
|
|
1321
|
-
_i(0, N(te))
|
|
1322
|
-
], Ie);
|
|
1323
|
-
const Ti = () => {
|
|
1324
|
-
var fe, de;
|
|
1325
|
-
const [r, e] = q(""), [t, n] = q(""), i = M(ur), [a, s] = q({}), c = M(Pe), u = M(at), h = Te(u.anchorPosition$), d = M(te), v = M(pe), f = M(un), w = Te(f.unitPermissionInitStateChange$, !1), S = M(re), E = M(dn), C = M(Ie), $ = Te(C.refreshTable$), I = M(ne), B = M(ut), R = Te(B.selectionChanged$, [{ range: jt(0, 0), primary: null }]), [, g] = q(Math.random()), y = M(Qt).getConfig(yn), m = (fe = y == null ? void 0 : y.anchorHeight) != null ? fe : 24, O = (de = y == null ? void 0 : y.anchorBackgroundColor) != null ? de : "rgb(53,91,183)", L = (b, P) => {
|
|
1326
|
-
s((A) => ({
|
|
1327
|
-
...A,
|
|
1328
|
-
[b]: P
|
|
1329
|
-
}));
|
|
1330
|
-
};
|
|
1331
|
-
if (on(() => {
|
|
1332
|
-
g(Math.random());
|
|
1333
|
-
}, [$]), !(h != null && h.length))
|
|
1334
|
-
return null;
|
|
1335
|
-
const Y = ct(v);
|
|
1336
|
-
if (!Y) return null;
|
|
1337
|
-
const { unitId: V, subUnitId: z } = Y, ce = (b, P) => {
|
|
1338
|
-
var Q;
|
|
1339
|
-
if (((Q = S.getTableById(V, b)) == null ? void 0 : Q.getDisplayName()) === P) {
|
|
1340
|
-
e(""), n("");
|
|
1341
|
-
return;
|
|
1342
|
-
}
|
|
1343
|
-
d.executeCommand(Ct.id, {
|
|
1344
|
-
tableId: b,
|
|
1345
|
-
unitId: V,
|
|
1346
|
-
name: P
|
|
1347
|
-
}), n(""), e("");
|
|
1348
|
-
}, ue = async (b) => {
|
|
1349
|
-
const P = S.getTableById(V, b);
|
|
1350
|
-
if (!P) return;
|
|
1351
|
-
const A = P.getRange(), Q = await In(c, V, z, A, b);
|
|
1352
|
-
Q && d.executeCommand(Ct.id, {
|
|
1353
|
-
tableId: b,
|
|
1354
|
-
unitId: V,
|
|
1355
|
-
updateRange: {
|
|
1356
|
-
newRange: Q.range
|
|
1357
|
-
}
|
|
1358
|
-
});
|
|
1359
|
-
};
|
|
1360
|
-
return w ? /* @__PURE__ */ l("div", { className: "univer-absolute univer-z-50 univer-size-0", children: h.map((b) => {
|
|
1361
|
-
var De, Be, p, _, X, K, se;
|
|
1362
|
-
const P = S.getTableById(V, b.tableId);
|
|
1363
|
-
if (!P) return null;
|
|
1364
|
-
const A = E.getRangeThemeStyle(V, P.getTableStyleId()), Q = (p = (Be = (De = A == null ? void 0 : A.getHeaderRowStyle()) == null ? void 0 : De.bg) == null ? void 0 : Be.rgb) != null ? p : O, ze = (K = (X = (_ = A == null ? void 0 : A.getHeaderRowStyle()) == null ? void 0 : _.cl) == null ? void 0 : X.rgb) != null ? K : "rgb(255, 255, 255)", Ge = P.getRange();
|
|
1365
|
-
if (!(R != null && R.length))
|
|
1366
|
-
return null;
|
|
1367
|
-
const Xe = R[R.length - 1].range, Oe = !be.intersects(Ge, Xe) && b.y <= 20;
|
|
1368
|
-
return /* @__PURE__ */ T(
|
|
1369
|
-
"div",
|
|
1370
|
-
{
|
|
1371
|
-
className: D("univer-shadow-xs univer-absolute univer-box-border univer-cursor-pointer univer-items-center univer-rounded-xl univer-px-2", H, {
|
|
1372
|
-
"univer-flex": !Oe,
|
|
1373
|
-
"univer-hidden": Oe
|
|
1374
|
-
}),
|
|
1375
|
-
style: {
|
|
1376
|
-
left: b.x,
|
|
1377
|
-
top: Math.max(b.y, 0),
|
|
1378
|
-
backgroundColor: Q,
|
|
1379
|
-
color: ze,
|
|
1380
|
-
borderWidth: "0.5px",
|
|
1381
|
-
height: m ? `${m}px` : "24px"
|
|
1382
|
-
},
|
|
1383
|
-
children: [
|
|
1384
|
-
/* @__PURE__ */ l("div", { className: "univer-text-nowrap", children: r === b.tableId ? /* @__PURE__ */ l(
|
|
1385
|
-
Mt,
|
|
1386
|
-
{
|
|
1387
|
-
className: "univer-h-[18px] univer-min-w-16 univer-rounded-none",
|
|
1388
|
-
inputClass: "univer-h-[18px] univer-w-[80px]",
|
|
1389
|
-
value: t,
|
|
1390
|
-
onChange: (W) => n(W),
|
|
1391
|
-
onBlur: () => ce(b.tableId, t),
|
|
1392
|
-
onKeyDown: (W) => {
|
|
1393
|
-
W.key === "Enter" && ce(b.tableId, t);
|
|
1394
|
-
},
|
|
1395
|
-
autoFocus: r === b.tableId
|
|
1396
|
-
}
|
|
1397
|
-
) : /* @__PURE__ */ l("div", { className: "univer-h-[18px] univer-max-w-24 univer-truncate univer-text-sm", children: b.tableName }) }),
|
|
1398
|
-
/* @__PURE__ */ l(
|
|
1399
|
-
Ne,
|
|
1400
|
-
{
|
|
1401
|
-
align: "start",
|
|
1402
|
-
overlay: /* @__PURE__ */ T("div", { className: "univer-py-2", children: [
|
|
1403
|
-
/* @__PURE__ */ T(
|
|
1404
|
-
"div",
|
|
1405
|
-
{
|
|
1406
|
-
className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-gap-2 univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
|
|
1407
|
-
onClick: () => {
|
|
1408
|
-
e(b.tableId), n(b.tableName);
|
|
1409
|
-
},
|
|
1410
|
-
children: [
|
|
1411
|
-
/* @__PURE__ */ l(_n, {}),
|
|
1412
|
-
I.t("sheets-table.rename")
|
|
1413
|
-
]
|
|
1414
|
-
}
|
|
1415
|
-
),
|
|
1416
|
-
/* @__PURE__ */ l(
|
|
1417
|
-
"div",
|
|
1418
|
-
{
|
|
1419
|
-
className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200"
|
|
1420
|
-
}
|
|
1421
|
-
),
|
|
1422
|
-
/* @__PURE__ */ T(
|
|
1423
|
-
"div",
|
|
1424
|
-
{
|
|
1425
|
-
onClick: () => ue(b.tableId),
|
|
1426
|
-
className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-gap-2 univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
|
|
1427
|
-
children: [
|
|
1428
|
-
/* @__PURE__ */ l(Sn, {}),
|
|
1429
|
-
I.t("sheets-table.updateRange")
|
|
1430
|
-
]
|
|
1431
|
-
}
|
|
1432
|
-
),
|
|
1433
|
-
/* @__PURE__ */ T(
|
|
1434
|
-
"div",
|
|
1435
|
-
{
|
|
1436
|
-
className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-gap-2 univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
|
|
1437
|
-
onClick: () => {
|
|
1438
|
-
L(b.tableId, !1);
|
|
1439
|
-
const W = S.getTableById(V, b.tableId);
|
|
1440
|
-
if (!W) return;
|
|
1441
|
-
const Ce = W.getTableConfig(), Se = {
|
|
1442
|
-
id: qr,
|
|
1443
|
-
header: { title: I.t("sheets-table.tableStyle") },
|
|
1444
|
-
children: {
|
|
1445
|
-
label: bn,
|
|
1446
|
-
oldConfig: Ce,
|
|
1447
|
-
unitId: V,
|
|
1448
|
-
subUnitId: z,
|
|
1449
|
-
tableId: b.tableId
|
|
1450
|
-
},
|
|
1451
|
-
width: 330
|
|
1452
|
-
};
|
|
1453
|
-
i.open(Se);
|
|
1454
|
-
},
|
|
1455
|
-
children: [
|
|
1456
|
-
/* @__PURE__ */ l(
|
|
1457
|
-
wn,
|
|
1458
|
-
{
|
|
1459
|
-
extend: { colorChannel1: "rgb(53,91,183)" }
|
|
1460
|
-
}
|
|
1461
|
-
),
|
|
1462
|
-
I.t("sheets-table.setTheme")
|
|
1463
|
-
]
|
|
1464
|
-
}
|
|
1465
|
-
),
|
|
1466
|
-
/* @__PURE__ */ l(
|
|
1467
|
-
"div",
|
|
1468
|
-
{
|
|
1469
|
-
className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200"
|
|
1470
|
-
}
|
|
1471
|
-
),
|
|
1472
|
-
/* @__PURE__ */ T(
|
|
1473
|
-
"div",
|
|
1474
|
-
{
|
|
1475
|
-
className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
|
|
1476
|
-
onClick: () => {
|
|
1477
|
-
L(b.tableId, !1), d.executeCommand(Xn.id, {
|
|
1478
|
-
tableId: b.tableId,
|
|
1479
|
-
subUnitId: z,
|
|
1480
|
-
unitId: V
|
|
1481
|
-
});
|
|
1482
|
-
},
|
|
1483
|
-
children: [
|
|
1484
|
-
/* @__PURE__ */ l(fn, { className: "univer-mr-2" }),
|
|
1485
|
-
I.t("sheets-table.removeTable")
|
|
1486
|
-
]
|
|
1487
|
-
}
|
|
1488
|
-
)
|
|
1489
|
-
] }),
|
|
1490
|
-
open: (se = a[b.tableId]) != null ? se : !1,
|
|
1491
|
-
onOpenChange: (W) => {
|
|
1492
|
-
L(b.tableId, W);
|
|
1493
|
-
},
|
|
1494
|
-
children: /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(xt, {}) })
|
|
1495
|
-
},
|
|
1496
|
-
b.tableId
|
|
1497
|
-
)
|
|
1498
|
-
]
|
|
1499
|
-
},
|
|
1500
|
-
b.tableId
|
|
1501
|
-
);
|
|
1502
|
-
}) }) : null;
|
|
1503
|
-
};
|
|
1504
|
-
var wi = Object.getOwnPropertyDescriptor, Ii = (r, e, t, n) => {
|
|
1505
|
-
for (var i = n > 1 ? void 0 : n ? wi(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
1506
|
-
(s = r[a]) && (i = s(i) || i);
|
|
1507
|
-
return i;
|
|
1508
|
-
}, ee = (r, e) => (t, n) => e(t, n, r);
|
|
1509
|
-
let at = class extends ke {
|
|
1510
|
-
constructor(e, t, n, i, a, s, c, u, h, d, v) {
|
|
1511
|
-
super();
|
|
1512
|
-
U(this, "_anchorVisible$", new Ot(!0));
|
|
1513
|
-
U(this, "_timer");
|
|
1514
|
-
U(this, "_anchorPosition$", new Ot([]));
|
|
1515
|
-
U(this, "anchorPosition$", this._anchorPosition$.asObservable());
|
|
1516
|
-
this._context = e, this._injector = t, this._sheetSkeletonManagerService = n, this._renderManagerService = i, this._commandService = a, this._univerInstanceService = s, this._uiPartsService = c, this._tableManager = u, this._scrollManagerService = h, this._workbookPermissionService = d, this._permissionService = v, this._initUI(), this._initListener(), this._initTableAnchor();
|
|
1517
|
-
}
|
|
1518
|
-
_initUI() {
|
|
1519
|
-
this.disposeWithMe(
|
|
1520
|
-
this._uiPartsService.registerComponent(hr.CONTENT, () => vr(Ti, this._injector))
|
|
1521
|
-
);
|
|
1522
|
-
}
|
|
1523
|
-
_initListener() {
|
|
1524
|
-
this.disposeWithMe(
|
|
1525
|
-
this._commandService.onCommandExecuted((e) => {
|
|
1526
|
-
(e.id === ir.id || e.id === ar.id) && (this._anchorVisible$.next(!1), this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
|
|
1527
|
-
this._anchorVisible$.next(!0);
|
|
1528
|
-
}, 300));
|
|
1529
|
-
})
|
|
1530
|
-
);
|
|
1531
|
-
}
|
|
1532
|
-
_initTableAnchor() {
|
|
1533
|
-
this.disposeWithMe(
|
|
1534
|
-
yt(
|
|
1535
|
-
this._context.unit.activeSheet$,
|
|
1536
|
-
this._sheetSkeletonManagerService.currentSkeleton$,
|
|
1537
|
-
this._scrollManagerService.validViewportScrollInfo$,
|
|
1538
|
-
this._tableManager.tableAdd$,
|
|
1539
|
-
this._tableManager.tableDelete$,
|
|
1540
|
-
this._tableManager.tableNameChanged$,
|
|
1541
|
-
this._tableManager.tableRangeChanged$,
|
|
1542
|
-
this._tableManager.tableThemeChanged$,
|
|
1543
|
-
this._workbookPermissionService.unitPermissionInitStateChange$.pipe(_r((e) => e)),
|
|
1544
|
-
this._permissionService.permissionPointUpdate$.pipe(Tr(300)),
|
|
1545
|
-
this._anchorVisible$
|
|
1546
|
-
).subscribe(() => {
|
|
1547
|
-
var h;
|
|
1548
|
-
if (!this._anchorVisible$.getValue()) {
|
|
1549
|
-
this._anchorPosition$.next([]);
|
|
1550
|
-
return;
|
|
1551
|
-
}
|
|
1552
|
-
const t = this._context.unit, n = t.getActiveSheet(), i = n == null ? void 0 : n.getSheetId(), a = this._tableManager.getTableList(this._context.unitId).filter((d) => d.subUnitId === i), s = this._renderManagerService.getRenderById(this._context.unitId);
|
|
1553
|
-
if (!s) {
|
|
1554
|
-
this._anchorPosition$.next([]);
|
|
1555
|
-
return;
|
|
1556
|
-
}
|
|
1557
|
-
if (!((h = this._permissionService.getPermissionPoint(new ln(t.getUnitId()).id)) == null ? void 0 : h.value)) {
|
|
1558
|
-
this._anchorPosition$.next([]);
|
|
1559
|
-
return;
|
|
1560
|
-
}
|
|
1561
|
-
const u = a.reduce((d, v) => {
|
|
1562
|
-
const { startRow: f, startColumn: w } = v.range, S = s.with(lt), E = sr(this._univerInstanceService, this._renderManagerService);
|
|
1563
|
-
if (!E) return d;
|
|
1564
|
-
const { scene: C } = E, $ = C.getViewport(Un.VIEW_MAIN);
|
|
1565
|
-
if (!$) return d;
|
|
1566
|
-
const I = C == null ? void 0 : C.scaleX, B = C == null ? void 0 : C.scaleY, R = C == null ? void 0 : C.getViewportScrollXY($);
|
|
1567
|
-
if (!I || !C || !B || !R) return d;
|
|
1568
|
-
const g = S.getCurrentSkeleton();
|
|
1569
|
-
if (!g) return d;
|
|
1570
|
-
const x = g.getNoMergeCellWithCoordByIndex(f, w), y = Wn(x.startX, I, R), m = Zn(x.startY, B, R) - 25 - 4;
|
|
1571
|
-
return m >= -10 && y >= 45 && d.push({
|
|
1572
|
-
x: y,
|
|
1573
|
-
y: m,
|
|
1574
|
-
tableId: v.id,
|
|
1575
|
-
tableName: v.name
|
|
1576
|
-
}), d;
|
|
1577
|
-
}, []);
|
|
1578
|
-
this._anchorPosition$.next(u);
|
|
1579
|
-
})
|
|
1580
|
-
);
|
|
1581
|
-
}
|
|
1582
|
-
};
|
|
1583
|
-
at = Ii([
|
|
1584
|
-
ee(1, N(Pe)),
|
|
1585
|
-
ee(2, N(lt)),
|
|
1586
|
-
ee(3, Gt),
|
|
1587
|
-
ee(4, te),
|
|
1588
|
-
ee(5, pe),
|
|
1589
|
-
ee(6, dr),
|
|
1590
|
-
ee(7, N(re)),
|
|
1591
|
-
ee(8, N(rr)),
|
|
1592
|
-
ee(9, N(un)),
|
|
1593
|
-
ee(10, N(qt))
|
|
1594
|
-
], at);
|
|
1595
|
-
const Me = 16;
|
|
1596
|
-
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");
|
|
1597
|
-
class Wt {
|
|
1598
|
-
static drawNoSetting(e, t, n, i) {
|
|
1599
|
-
e.save(), $t.drawWith(e, {
|
|
1600
|
-
radius: 2,
|
|
1601
|
-
width: Me,
|
|
1602
|
-
height: Me,
|
|
1603
|
-
fill: i
|
|
1604
|
-
}), e.lineCap = "square", e.strokeStyle = n, e.scale(t / Me, t / Me), 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();
|
|
1605
|
-
}
|
|
1606
|
-
static drawIconByPath(e, t, n, i) {
|
|
1607
|
-
e.save(), e.strokeStyle = n, e.fillStyle = i, $t.drawWith(e, {
|
|
1608
|
-
radius: 2,
|
|
1609
|
-
width: Me,
|
|
1610
|
-
height: Me,
|
|
1611
|
-
fill: i
|
|
1612
|
-
}), t.forEach((a) => {
|
|
1613
|
-
const s = new Path2D(a);
|
|
1614
|
-
e.fillStyle = n, e.fill(s, "evenodd");
|
|
1615
|
-
}), e.restore();
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
const yi = [
|
|
1619
|
-
"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"
|
|
1620
|
-
], Ri = [
|
|
1621
|
-
"M12.4008 13.1831C12.6907 13.1831 12.9258 12.9481 12.9258 12.6581V4.60873L14.013 5.69597C14.218 5.901 14.5505 5.901 14.7555 5.69597C14.9605 5.49094 14.9605 5.15853 14.7555 4.95351L12.7721 2.97017C12.5671 2.76515 12.2347 2.76515 12.0297 2.97017L10.0463 4.95351C9.84132 5.15853 9.84132 5.49094 10.0463 5.69597C10.2514 5.901 10.5838 5.901 10.7888 5.69597L11.8758 4.60901V12.6581C11.8758 12.9481 12.1108 13.1831 12.4008 13.1831Z",
|
|
1622
|
-
"M1.28069 4.85447C0.842195 4.33439 1.21191 3.5391 1.89218 3.5391H8.59333C9.2736 3.5391 9.64331 4.33439 9.20482 4.85447L6.51052 8.0501V11.6601C6.51052 12.2245 5.94174 12.6114 5.41683 12.404L4.48092 12.0343C4.1756 11.9136 3.97498 11.6187 3.97498 11.2904V8.0501L1.28069 4.85447Z"
|
|
1623
|
-
], Mi = [
|
|
1624
|
-
"M12.4008 2.81641C12.6907 2.81641 12.9258 3.05146 12.9258 3.34141V11.3908L14.013 10.3036C14.218 10.0986 14.5505 10.0986 14.7555 10.3036C14.9605 10.5086 14.9605 10.841 14.7555 11.046L12.7721 13.0294C12.5671 13.2344 12.2347 13.2344 12.0297 13.0294L10.0463 11.046C9.84132 10.841 9.84132 10.5086 10.0463 10.3036C10.2514 10.0986 10.5838 10.0986 10.7888 10.3036L11.8758 11.3905V3.34141C11.8758 3.05146 12.1108 2.81641 12.4008 2.81641Z",
|
|
1625
|
-
"M1.28069 4.85444C0.842195 4.33435 1.21191 3.53906 1.89218 3.53906H8.59333C9.2736 3.53906 9.64331 4.33435 9.20482 4.85443L6.51052 8.05006V11.6601C6.51052 12.2245 5.94174 12.6113 5.41683 12.404L4.48092 12.0342C4.1756 11.9136 3.97498 11.6186 3.97498 11.2903V8.05006L1.28069 4.85444Z"
|
|
1626
|
-
], xi = [
|
|
1627
|
-
"M11.9003 13.7046C11.9003 13.9969 11.6633 14.2339 11.371 14.2339C11.0787 14.2339 10.8417 13.9969 10.8417 13.7046V3.57272L9.74577 4.66862C9.53906 4.87534 9.20391 4.87534 8.9972 4.66862C8.79048 4.46191 8.79048 4.12676 8.9972 3.92005L10.9969 1.92039C11.2036 1.71368 11.5387 1.71368 11.7454 1.92039L13.7451 3.92005C13.9518 4.12676 13.9518 4.46191 13.7451 4.66862C13.5384 4.87534 13.2032 4.87534 12.9965 4.66862L11.9003 3.57243V13.7046Z",
|
|
1628
|
-
"M2.69779 10.0113C2.40546 10.0113 2.16847 9.77429 2.16847 9.48196C2.16847 9.18962 2.40546 8.95264 2.69779 8.95264H6.67804C6.89213 8.95264 7.08514 9.0816 7.16707 9.2794C7.249 9.47719 7.20371 9.70486 7.05233 9.85624L3.97569 12.9329H6.67804C6.97038 12.9329 7.20736 13.1699 7.20736 13.4622C7.20736 13.7545 6.97038 13.9915 6.67804 13.9915H2.69779C2.4837 13.9915 2.29069 13.8626 2.20876 13.6648C2.12684 13.467 2.17212 13.2393 2.32351 13.0879L5.40015 10.0113H2.69779Z",
|
|
1629
|
-
"M5.51638 2.58693C5.23363 1.81542 4.14248 1.81543 3.85973 2.58693L2.13245 7.29995C2.03185 7.57443 2.17281 7.87849 2.4473 7.97909C2.72178 8.07969 3.02584 7.93872 3.12644 7.66424L3.64346 6.25351L3.64504 6.25351H5.73266L6.24968 7.66424C6.35027 7.93872 6.65433 8.07969 6.92882 7.97909C7.2033 7.87849 7.34426 7.57443 7.24367 7.29995L5.51638 2.58693ZM5.34467 5.19487L4.68806 3.40325L4.03144 5.19487H5.34467Z"
|
|
1630
|
-
], Ni = [
|
|
1631
|
-
"M11.9003 2.29495C11.9003 2.00261 11.6633 1.76562 11.371 1.76562C11.0787 1.76562 10.8417 2.00261 10.8417 2.29495V12.4268L9.74577 11.3309C9.53906 11.1242 9.20391 11.1242 8.9972 11.3309C8.79048 11.5376 8.79048 11.8727 8.9972 12.0795L10.9969 14.0791C11.2036 14.2858 11.5387 14.2858 11.7454 14.0791L13.7451 12.0795C13.9518 11.8727 13.9518 11.5376 13.7451 11.3309C13.5384 11.1242 13.2032 11.1242 12.9965 11.3309L11.9003 12.4271V2.29495Z",
|
|
1632
|
-
"M2.69792 10.0113C2.40558 10.0113 2.16859 9.77429 2.16859 9.48196C2.16859 9.18962 2.40558 8.95264 2.69792 8.95264H6.67816C6.89225 8.95264 7.08526 9.0816 7.16719 9.2794C7.24912 9.47719 7.20384 9.70486 7.05245 9.85624L3.97581 12.9329H6.67816C6.9705 12.9329 7.20749 13.1699 7.20749 13.4622C7.20749 13.7545 6.9705 13.9915 6.67816 13.9915H2.69792C2.48383 13.9915 2.29082 13.8626 2.20889 13.6648C2.12696 13.467 2.17224 13.2393 2.32363 13.0879L5.40027 10.0113H2.69792Z",
|
|
1633
|
-
"M5.5165 2.58693C5.23375 1.81542 4.1426 1.81543 3.85985 2.58693L2.13257 7.29995C2.03197 7.57443 2.17294 7.8785 2.44742 7.97909C2.7219 8.07969 3.02596 7.93872 3.12656 7.66424L3.64358 6.25351L3.64516 6.25351H5.73278L6.2498 7.66424C6.35039 7.93872 6.65446 8.07969 6.92894 7.97909C7.20342 7.8785 7.34438 7.57443 7.24379 7.29995L5.5165 2.58693ZM5.34479 5.19487L4.68818 3.40325L4.03156 5.19487H5.34479Z"
|
|
1634
|
-
];
|
|
1635
|
-
var Ei = Object.getOwnPropertyDescriptor, $i = (r, e, t, n) => {
|
|
1636
|
-
for (var i = n > 1 ? void 0 : n ? Ei(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
1637
|
-
(s = r[a]) && (i = s(i) || i);
|
|
1638
|
-
return i;
|
|
1639
|
-
}, pt = (r, e) => (t, n) => e(t, n, r);
|
|
1640
|
-
const oe = 16, Ye = 1;
|
|
1641
|
-
let _t = class extends jn {
|
|
1642
|
-
constructor(e, t, n, i, a) {
|
|
1643
|
-
super(e, t);
|
|
1644
|
-
U(this, "_cellWidth", 0);
|
|
1645
|
-
U(this, "_cellHeight", 0);
|
|
1646
|
-
U(this, "_filterParams");
|
|
1647
|
-
U(this, "_hovered", !1);
|
|
1648
|
-
this._contextService = n, this._commandService = i, this._themeService = a, this.setShapeProps(t), this.onPointerDown$.subscribeEvent((s) => this.onPointerDown(s)), this.onPointerEnter$.subscribeEvent(() => this.onPointerEnter()), this.onPointerLeave$.subscribeEvent(() => this.onPointerLeave());
|
|
1649
|
-
}
|
|
1650
|
-
setShapeProps(e) {
|
|
1651
|
-
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({
|
|
1652
|
-
width: e.width,
|
|
1653
|
-
height: e.height
|
|
1654
|
-
});
|
|
1655
|
-
}
|
|
1656
|
-
_draw(e) {
|
|
1657
|
-
const t = this._cellHeight, n = this._cellWidth, i = oe - n, a = oe - t;
|
|
1658
|
-
e.save();
|
|
1659
|
-
const s = new Path2D();
|
|
1660
|
-
s.rect(i, a, n, t), e.clip(s);
|
|
1661
|
-
const { buttonState: c } = this._filterParams, u = this._themeService.getColorFromTheme("primary.600"), h = this._hovered ? this._themeService.getColorFromTheme("gray.50") : "rgba(255, 255, 255, 1.0)";
|
|
1662
|
-
let d;
|
|
1663
|
-
switch (c) {
|
|
1664
|
-
case Re.FilteredSortNone:
|
|
1665
|
-
d = yi;
|
|
1666
|
-
break;
|
|
1667
|
-
case Re.FilteredSortAsc:
|
|
1668
|
-
d = Ri;
|
|
1669
|
-
break;
|
|
1670
|
-
case Re.FilteredSortDesc:
|
|
1671
|
-
d = Mi;
|
|
1672
|
-
break;
|
|
1673
|
-
case Re.FilterNoneSortNone:
|
|
1674
|
-
break;
|
|
1675
|
-
case Re.FilterNoneSortAsc:
|
|
1676
|
-
d = xi;
|
|
1677
|
-
break;
|
|
1678
|
-
case Re.FilterNoneSortDesc:
|
|
1679
|
-
d = Ni;
|
|
1680
|
-
break;
|
|
1681
|
-
}
|
|
1682
|
-
d ? Wt.drawIconByPath(e, d, u, h) : c !== void 0 && Wt.drawNoSetting(e, oe, u, h), e.restore();
|
|
1683
|
-
}
|
|
1684
|
-
onPointerDown(e) {
|
|
1685
|
-
if (e.button === 2)
|
|
1686
|
-
return;
|
|
1687
|
-
const { row: t, col: n, unitId: i, subUnitId: a, tableId: s } = this._filterParams;
|
|
1688
|
-
this._contextService.getContextValue(ge) || !this._commandService.hasCommand(St.id) || setTimeout(() => {
|
|
1689
|
-
const u = {
|
|
1690
|
-
row: t,
|
|
1691
|
-
col: n,
|
|
1692
|
-
unitId: i,
|
|
1693
|
-
subUnitId: a,
|
|
1694
|
-
tableId: s
|
|
1695
|
-
};
|
|
1696
|
-
this._commandService.executeCommand(St.id, u);
|
|
1697
|
-
}, 200);
|
|
1698
|
-
}
|
|
1699
|
-
onPointerEnter() {
|
|
1700
|
-
this._hovered = !0, this.makeDirty(!0);
|
|
1701
|
-
}
|
|
1702
|
-
onPointerLeave() {
|
|
1703
|
-
this._hovered = !1, this.makeDirty(!0);
|
|
1704
|
-
}
|
|
1705
|
-
};
|
|
1706
|
-
_t = $i([
|
|
1707
|
-
pt(2, It),
|
|
1708
|
-
pt(3, te),
|
|
1709
|
-
pt(4, N(Pn))
|
|
1710
|
-
], _t);
|
|
1711
|
-
var Li = Object.getOwnPropertyDescriptor, ki = (r, e, t, n) => {
|
|
1712
|
-
for (var i = n > 1 ? void 0 : n ? Li(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
1713
|
-
(s = r[a]) && (i = s(i) || i);
|
|
1714
|
-
return i;
|
|
1715
|
-
}, je = (r, e) => (t, n) => e(t, n, r);
|
|
1716
|
-
const Pi = 5e3, Oi = (r, e, t, n) => {
|
|
1717
|
-
switch (n) {
|
|
1718
|
-
case it.TOP:
|
|
1719
|
-
return r + Ye;
|
|
1720
|
-
case it.MIDDLE:
|
|
1721
|
-
return r + Math.max(0, (t - oe) / 2);
|
|
1722
|
-
case it.BOTTOM:
|
|
1723
|
-
default:
|
|
1724
|
-
return e - oe - Ye;
|
|
1725
|
-
}
|
|
1726
|
-
};
|
|
1727
|
-
let Tt = class extends zt {
|
|
1728
|
-
constructor(e, t, n, i, a, s) {
|
|
1729
|
-
super();
|
|
1730
|
-
U(this, "_buttonRenderDisposable", null);
|
|
1731
|
-
U(this, "_tableFilterButtonShapes", []);
|
|
1732
|
-
this._context = e, this._injector = t, this._sheetSkeletonManagerService = n, this._sheetInterceptorService = i, this._tableManager = a, this._commandService = s, this._initRenderer(), this._initCommandExecuted();
|
|
1733
|
-
}
|
|
1734
|
-
dispose() {
|
|
1735
|
-
super.dispose(), this._disposeRendering();
|
|
1736
|
-
}
|
|
1737
|
-
_initRenderer() {
|
|
1738
|
-
const e = this._tableManager;
|
|
1739
|
-
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
1740
|
-
we((t) => {
|
|
1741
|
-
var c;
|
|
1742
|
-
if (!t) return J(null);
|
|
1743
|
-
const { unit: n, unitId: i } = this._context, a = ((c = n.getActiveSheet()) == null ? void 0 : c.getSheetId()) || "", s = () => ({
|
|
1744
|
-
unitId: i,
|
|
1745
|
-
worksheetId: a,
|
|
1746
|
-
tableFilterRanges: this._tableManager.getSheetFilterRangeWithState(n.getUnitId(), a),
|
|
1747
|
-
skeleton: t.skeleton
|
|
1748
|
-
});
|
|
1749
|
-
return yt(
|
|
1750
|
-
e.tableAdd$,
|
|
1751
|
-
e.tableNameChanged$,
|
|
1752
|
-
e.tableRangeChanged$,
|
|
1753
|
-
e.tableThemeChanged$,
|
|
1754
|
-
e.tableDelete$,
|
|
1755
|
-
e.tableFilterChanged$
|
|
1756
|
-
).pipe(
|
|
1757
|
-
wr(() => s()),
|
|
1758
|
-
an(s())
|
|
1759
|
-
);
|
|
1760
|
-
}),
|
|
1761
|
-
Ir(this.dispose$)
|
|
1762
|
-
).subscribe((t) => {
|
|
1763
|
-
this._disposeRendering(), !(!t || !t.tableFilterRanges) && this._renderButtons(t);
|
|
1764
|
-
});
|
|
1765
|
-
}
|
|
1766
|
-
_initCommandExecuted() {
|
|
1767
|
-
this.disposeWithMe(
|
|
1768
|
-
this._commandService.onCommandExecuted((e) => {
|
|
1769
|
-
var c;
|
|
1770
|
-
if (e.id !== Dr.id)
|
|
1771
|
-
return;
|
|
1772
|
-
const { unit: t, unitId: n } = this._context, i = ((c = t.getActiveSheet()) == null ? void 0 : c.getSheetId()) || "", a = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
1773
|
-
if (!a)
|
|
1774
|
-
return;
|
|
1775
|
-
const s = {
|
|
1776
|
-
unitId: n,
|
|
1777
|
-
worksheetId: i,
|
|
1778
|
-
tableFilterRanges: this._tableManager.getSheetFilterRangeWithState(t.getUnitId(), i),
|
|
1779
|
-
skeleton: a
|
|
1780
|
-
};
|
|
1781
|
-
this._disposeRendering(), !(!s || !s.tableFilterRanges) && this._renderButtons(s);
|
|
1782
|
-
})
|
|
1783
|
-
);
|
|
1784
|
-
}
|
|
1785
|
-
_renderButtons(e) {
|
|
1786
|
-
const { tableFilterRanges: t, unitId: n, skeleton: i, worksheetId: a } = e, { unit: s, scene: c } = this._context, u = s.getSheetBySheetId(a);
|
|
1787
|
-
if (u) {
|
|
1788
|
-
for (const { range: h, states: d, tableId: v } of t) {
|
|
1789
|
-
const { startRow: f, startColumn: w, endColumn: S } = h;
|
|
1790
|
-
this._interceptCellContent(n, a, h);
|
|
1791
|
-
for (let E = w; E <= S; E++) {
|
|
1792
|
-
const C = `sheets-table-filter-button-${f}-${E}`, $ = or(f, E, c, i), I = u.getCellStyle(f, E), B = (I == null ? void 0 : I.vt) || it.BOTTOM, { startX: R, startY: g, endX: x, endY: y } = $, m = x - R, O = y - g;
|
|
1793
|
-
if (O <= Ye || m <= Ye)
|
|
1794
|
-
continue;
|
|
1795
|
-
const L = d[E - w], Y = x - oe - Ye, V = Oi(g, y, O, B), z = {
|
|
1796
|
-
left: Y,
|
|
1797
|
-
top: V,
|
|
1798
|
-
height: oe,
|
|
1799
|
-
width: oe,
|
|
1800
|
-
zIndex: Pi,
|
|
1801
|
-
cellHeight: O,
|
|
1802
|
-
cellWidth: m,
|
|
1803
|
-
filterParams: { unitId: n, subUnitId: a, row: f, col: E, buttonState: L, tableId: v }
|
|
1804
|
-
}, ce = this._injector.createInstance(_t, C, z);
|
|
1805
|
-
this._tableFilterButtonShapes.push(ce);
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
c.addObjects(this._tableFilterButtonShapes), c.makeDirty();
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
_interceptCellContent(e, t, n) {
|
|
1812
|
-
const { startRow: i, startColumn: a, endColumn: s } = n;
|
|
1813
|
-
this._buttonRenderDisposable = this._sheetInterceptorService.intercept(Br.CELL_CONTENT, {
|
|
1814
|
-
effect: On.Style,
|
|
1815
|
-
handler: (c, u, h) => {
|
|
1816
|
-
const { row: d, col: v, unitId: f, subUnitId: w } = u;
|
|
1817
|
-
return f !== e || w !== t || d !== i || v < a || v > s || ((!c || c === u.rawData) && (c = { ...u.rawData }), c.fontRenderExtension = {
|
|
1818
|
-
...c == null ? void 0 : c.fontRenderExtension,
|
|
1819
|
-
rightOffset: oe
|
|
1820
|
-
}), h(c);
|
|
1821
|
-
},
|
|
1822
|
-
priority: 10
|
|
1823
|
-
});
|
|
1824
|
-
}
|
|
1825
|
-
_disposeRendering() {
|
|
1826
|
-
var e;
|
|
1827
|
-
this._tableFilterButtonShapes.forEach((t) => t.dispose()), (e = this._buttonRenderDisposable) == null || e.dispose(), this._buttonRenderDisposable = null, this._tableFilterButtonShapes = [];
|
|
1828
|
-
}
|
|
1829
|
-
};
|
|
1830
|
-
Tt = ki([
|
|
1831
|
-
je(1, N(Pe)),
|
|
1832
|
-
je(2, N(lt)),
|
|
1833
|
-
je(3, N(hn)),
|
|
1834
|
-
je(4, N(re)),
|
|
1835
|
-
je(5, te)
|
|
1836
|
-
], Tt);
|
|
1837
|
-
var Di = Object.getOwnPropertyDescriptor, Bi = (r, e, t, n) => {
|
|
1838
|
-
for (var i = n > 1 ? void 0 : n ? Di(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
1839
|
-
(s = r[a]) && (i = s(i) || i);
|
|
1840
|
-
return i;
|
|
1841
|
-
}, nt = (r, e) => (t, n) => e(t, n, r);
|
|
1842
|
-
let wt = class extends zt {
|
|
1843
|
-
constructor(r, e, t, n, i) {
|
|
1844
|
-
super(), this._context = r, this._injector = e, this._sheetSkeletonManagerService = t, this._tableManager = n, this._sheetTableThemeUIController = i, this._initListener();
|
|
1845
|
-
}
|
|
1846
|
-
_dirtySkeleton() {
|
|
1847
|
-
var e;
|
|
1848
|
-
(e = this._context.mainComponent) == null || e.makeDirty();
|
|
1849
|
-
const r = this._sheetSkeletonManagerService.getCurrentParam();
|
|
1850
|
-
if (r) {
|
|
1851
|
-
const t = { ...r, dirty: !0 };
|
|
1852
|
-
this._sheetSkeletonManagerService.reCalculate(t);
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
_initListener() {
|
|
1856
|
-
const r = this._tableManager, e = this._dirtySkeleton.bind(this);
|
|
1857
|
-
this.disposeWithMe(
|
|
1858
|
-
yt(
|
|
1859
|
-
r.tableAdd$,
|
|
1860
|
-
r.tableDelete$,
|
|
1861
|
-
r.tableNameChanged$,
|
|
1862
|
-
r.tableRangeChanged$,
|
|
1863
|
-
r.tableThemeChanged$,
|
|
1864
|
-
r.tableFilterChanged$,
|
|
1865
|
-
r.tableInitStatus$,
|
|
1866
|
-
this._sheetTableThemeUIController.refreshTable$
|
|
1867
|
-
).subscribe(
|
|
1868
|
-
e
|
|
1869
|
-
)
|
|
1870
|
-
);
|
|
1871
|
-
}
|
|
1872
|
-
};
|
|
1873
|
-
wt = Bi([
|
|
1874
|
-
nt(1, N(Pe)),
|
|
1875
|
-
nt(2, N(lt)),
|
|
1876
|
-
nt(3, N(re)),
|
|
1877
|
-
nt(4, N(Ie))
|
|
1878
|
-
], wt);
|
|
1879
|
-
var Fi = Object.getOwnPropertyDescriptor, Vi = (r, e, t, n) => {
|
|
1880
|
-
for (var i = n > 1 ? void 0 : n ? Fi(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
1881
|
-
(s = r[a]) && (i = s(i) || i);
|
|
1882
|
-
return i;
|
|
1883
|
-
}, ft = (r, e) => (t, n) => e(t, n, r);
|
|
1884
|
-
let st = class extends ke {
|
|
1885
|
-
constructor(r, e, t) {
|
|
1886
|
-
super(), this._sheetInterceptorService = r, this._univerInstanceService = e, this._tableManager = t, this._initSelectionChange();
|
|
1887
|
-
}
|
|
1888
|
-
_initSelectionChange() {
|
|
1889
|
-
this.disposeWithMe(
|
|
1890
|
-
this._sheetInterceptorService.interceptCommand({
|
|
1891
|
-
getMutations: (r) => {
|
|
1892
|
-
if (r.id === lr.id) {
|
|
1893
|
-
const e = ct(this._univerInstanceService);
|
|
1894
|
-
if (!e)
|
|
1895
|
-
return { redos: [], undos: [] };
|
|
1896
|
-
const t = r.params, { range: n } = t, { unitId: i, subUnitId: a, worksheet: s } = e, u = this._tableManager.getTablesBySubunitId(i, a).find((h) => {
|
|
1897
|
-
const d = h.getRange();
|
|
1898
|
-
return be.contains(d, n);
|
|
1899
|
-
});
|
|
1900
|
-
if (u) {
|
|
1901
|
-
const h = u.getRange(), d = {
|
|
1902
|
-
...h,
|
|
1903
|
-
startRow: h.startRow + 1
|
|
1904
|
-
};
|
|
1905
|
-
return be.equals(h, n) ? { undos: [], redos: [] } : be.equals(d, n) ? {
|
|
1906
|
-
undos: [],
|
|
1907
|
-
redos: [
|
|
1908
|
-
{
|
|
1909
|
-
id: Vt.id,
|
|
1910
|
-
params: {
|
|
1911
|
-
unitId: i,
|
|
1912
|
-
subUnitId: a,
|
|
1913
|
-
selections: [
|
|
1914
|
-
{
|
|
1915
|
-
range: h,
|
|
1916
|
-
primary: Ft(h, s)
|
|
1917
|
-
}
|
|
1918
|
-
]
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
]
|
|
1922
|
-
} : {
|
|
1923
|
-
undos: [],
|
|
1924
|
-
redos: [
|
|
1925
|
-
{
|
|
1926
|
-
id: Vt.id,
|
|
1927
|
-
params: {
|
|
1928
|
-
unitId: i,
|
|
1929
|
-
subUnitId: a,
|
|
1930
|
-
selections: [
|
|
1931
|
-
{
|
|
1932
|
-
range: d,
|
|
1933
|
-
primary: Ft(d, s)
|
|
1934
|
-
}
|
|
1935
|
-
]
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
]
|
|
1939
|
-
};
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
return { redos: [], undos: [] };
|
|
1943
|
-
}
|
|
1944
|
-
})
|
|
1945
|
-
);
|
|
1946
|
-
}
|
|
1947
|
-
};
|
|
1948
|
-
st = Vi([
|
|
1949
|
-
ft(0, N(hn)),
|
|
1950
|
-
ft(1, N(pe)),
|
|
1951
|
-
ft(2, N(re))
|
|
1952
|
-
], st);
|
|
1953
|
-
const Hi = (r) => {
|
|
1954
|
-
const { unitId: e, subUnitId: t, range: n, onCancel: i, onConfirm: a, tableId: s } = r, c = M(re), [u, h] = q(n), [d, v] = q(""), f = M(ne), w = M(pe);
|
|
1955
|
-
return /* @__PURE__ */ T(Rt, { children: [
|
|
1956
|
-
/* @__PURE__ */ l(
|
|
1957
|
-
Ar,
|
|
1958
|
-
{
|
|
1959
|
-
maxRangeCount: 1,
|
|
1960
|
-
unitId: e,
|
|
1961
|
-
subUnitId: t,
|
|
1962
|
-
initialValue: At(n),
|
|
1963
|
-
onChange: (S, E) => {
|
|
1964
|
-
const C = At(n), $ = Hr(E).range, I = ct(w, { unitId: e, subUnitId: t });
|
|
1965
|
-
if (!I)
|
|
1966
|
-
return;
|
|
1967
|
-
if (I.worksheet.getMergeData().some((L) => be.intersects($, L))) {
|
|
1968
|
-
v(f.t("sheets-table.tableRangeWithMergeError"));
|
|
1969
|
-
return;
|
|
1970
|
-
}
|
|
1971
|
-
if (c.getTablesBySubunitId(e, t).some((L) => {
|
|
1972
|
-
if (L.getId() === s)
|
|
1973
|
-
return !1;
|
|
1974
|
-
const Y = L.getRange();
|
|
1975
|
-
return be.intersects($, Y);
|
|
1976
|
-
})) {
|
|
1977
|
-
v(f.t("sheets-table.tableRangeWithOtherTableError"));
|
|
1978
|
-
return;
|
|
1979
|
-
}
|
|
1980
|
-
const { startRow: y, endRow: m } = $;
|
|
1981
|
-
if (y === m) {
|
|
1982
|
-
v(f.t("sheets-table.tableRangeSingleRowError"));
|
|
1983
|
-
return;
|
|
1984
|
-
}
|
|
1985
|
-
if (C !== E) {
|
|
1986
|
-
if (s) {
|
|
1987
|
-
const L = c.getTableById(e, s);
|
|
1988
|
-
if (L) {
|
|
1989
|
-
const Y = L.getRange();
|
|
1990
|
-
if (be.intersects($, Y) && Y.startRow === $.startRow) {
|
|
1991
|
-
h($), v(""), a({
|
|
1992
|
-
unitId: e,
|
|
1993
|
-
subUnitId: t,
|
|
1994
|
-
range: $
|
|
1995
|
-
});
|
|
1996
|
-
return;
|
|
1997
|
-
} else {
|
|
1998
|
-
v(f.t("sheets-table.updateError"));
|
|
1999
|
-
return;
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
h($), v("");
|
|
2004
|
-
}
|
|
2005
|
-
},
|
|
2006
|
-
supportAcrossSheet: !1
|
|
2007
|
-
}
|
|
2008
|
-
),
|
|
2009
|
-
d && /* @__PURE__ */ l("div", { className: "univer-mt-1 univer-text-xs univer-text-red-500", children: d }),
|
|
2010
|
-
/* @__PURE__ */ T("div", { className: "univer-mt-4 univer-flex univer-justify-end", children: [
|
|
2011
|
-
/* @__PURE__ */ l(_e, { onClick: i, children: f.t("sheets-table.cancel") }),
|
|
2012
|
-
/* @__PURE__ */ l(
|
|
2013
|
-
_e,
|
|
2014
|
-
{
|
|
2015
|
-
variant: "primary",
|
|
2016
|
-
onClick: () => {
|
|
2017
|
-
d || a({
|
|
2018
|
-
unitId: e,
|
|
2019
|
-
subUnitId: t,
|
|
2020
|
-
range: u
|
|
2021
|
-
});
|
|
2022
|
-
},
|
|
2023
|
-
className: "univer-ml-2",
|
|
2024
|
-
children: f.t("sheets-table.confirm")
|
|
2025
|
-
}
|
|
2026
|
-
)
|
|
2027
|
-
] })
|
|
2028
|
-
] });
|
|
2029
|
-
}, Ai = (r) => {
|
|
2030
|
-
var P, A, Q, ht, ze, Ge, vt, Xe, gt, Oe, De, Be;
|
|
2031
|
-
const { unitId: e, subUnitId: t, tableId: n } = r, i = M(te), a = M(ne), s = M(re), c = s.getTableById(e, n), u = M(dn), h = M(Ie), d = Te(u.rangeThemeMapChange$), v = Te(h.refreshTable$), f = M(Dn), [, w] = q(Math.random()), S = Te(s.tableThemeChanged$, {
|
|
2032
|
-
theme: c == null ? void 0 : c.getTableStyleId(),
|
|
2033
|
-
oldTheme: c == null ? void 0 : c.getTableStyleId(),
|
|
2034
|
-
unitId: e,
|
|
2035
|
-
subUnitId: t,
|
|
2036
|
-
tableId: n
|
|
2037
|
-
}), E = u.getRegisteredRangeThemes().filter((p) => p == null ? void 0 : p.startsWith(Yr)), C = u.getALLRegisteredTheme(e).filter((p) => p == null ? void 0 : p.startsWith(mt)), $ = c == null ? void 0 : c.getTableStyleId(), I = C.find((p) => p === $), B = I || C[0], R = u.getCustomRangeThemeStyle(e, B), g = (Q = (A = (P = R == null ? void 0 : R.getHeaderRowStyle()) == null ? void 0 : P.bg) == null ? void 0 : A.rgb) != null ? Q : ve, x = (Ge = (ze = (ht = R == null ? void 0 : R.getFirstRowStyle()) == null ? void 0 : ht.bg) == null ? void 0 : ze.rgb) != null ? Ge : ve, y = (gt = (Xe = (vt = R == null ? void 0 : R.getSecondRowStyle()) == null ? void 0 : vt.bg) == null ? void 0 : Xe.rgb) != null ? gt : ve, m = (Be = (De = (Oe = R == null ? void 0 : R.getLastRowStyle()) == null ? void 0 : Oe.bg) == null ? void 0 : De.rgb) != null ? Be : ve, [O, L] = q(null), Y = (p) => {
|
|
2038
|
-
i.executeCommand(Ct.id, {
|
|
2039
|
-
unitId: e,
|
|
2040
|
-
tableId: n,
|
|
2041
|
-
theme: p
|
|
2042
|
-
});
|
|
2043
|
-
}, V = () => {
|
|
2044
|
-
if (C.length >= 11) {
|
|
2045
|
-
f.emit(a.t("sheets-table.customTooMore"));
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
const p = C[C.length - 1];
|
|
2049
|
-
let _ = `${mt}1`;
|
|
2050
|
-
if (p) {
|
|
2051
|
-
const K = Number(p.split("-")[2]);
|
|
2052
|
-
_ = `${mt}${K + 1}`;
|
|
2053
|
-
}
|
|
2054
|
-
const X = new Fr(_, { ...Kn });
|
|
2055
|
-
i.executeCommand(Jn.id, {
|
|
2056
|
-
unitId: e,
|
|
2057
|
-
tableId: n,
|
|
2058
|
-
themeStyle: X
|
|
2059
|
-
});
|
|
2060
|
-
}, z = (p, _) => {
|
|
2061
|
-
i.executeCommand(cn.id, {
|
|
2062
|
-
unitId: e,
|
|
2063
|
-
subUnitId: t,
|
|
2064
|
-
styleName: p,
|
|
2065
|
-
style: _
|
|
2066
|
-
});
|
|
2067
|
-
}, ce = (p) => {
|
|
2068
|
-
i.executeCommand(er.id, {
|
|
2069
|
-
unitId: e,
|
|
2070
|
-
tableId: n,
|
|
2071
|
-
themeName: p
|
|
2072
|
-
});
|
|
2073
|
-
};
|
|
2074
|
-
if (on(() => {
|
|
2075
|
-
w(Math.random());
|
|
2076
|
-
}, [d, v]), !c) return null;
|
|
2077
|
-
const ue = new he(g).isDark(), fe = new he(x).isDark(), de = new he(y).isDark(), b = new he(m).isDark();
|
|
2078
|
-
return /* @__PURE__ */ T("div", { children: [
|
|
2079
|
-
/* @__PURE__ */ l("h5", { children: a.t("sheets-table.defaultStyle") }),
|
|
2080
|
-
/* @__PURE__ */ l("div", { className: "univer-flex univer-gap-2", children: E.map((p) => {
|
|
2081
|
-
var Ce, Se, Fe, Ve, He, Ae, Ue, We;
|
|
2082
|
-
const _ = u.getDefaultRangeThemeStyle(p), X = ((Se = (Ce = _ == null ? void 0 : _.getHeaderRowStyle()) == null ? void 0 : Ce.bg) == null ? void 0 : Se.rgb) || ve, K = ((Ve = (Fe = _ == null ? void 0 : _.getFirstRowStyle()) == null ? void 0 : Fe.bg) == null ? void 0 : Ve.rgb) || ve, se = ((Ae = (He = _ == null ? void 0 : _.getSecondRowStyle()) == null ? void 0 : He.bg) == null ? void 0 : Ae.rgb) || ve, W = ((We = (Ue = _ == null ? void 0 : _.getLastRowStyle()) == null ? void 0 : Ue.bg) == null ? void 0 : We.rgb) || ve;
|
|
2083
|
-
return /* @__PURE__ */ T(
|
|
2084
|
-
"div",
|
|
2085
|
-
{
|
|
2086
|
-
className: D("univer-h-10 univer-w-8 univer-cursor-pointer univer-border univer-border-solid univer-border-gray-200 univer-p-px [&>div]:univer-box-border [&>div]:univer-h-2.5", {
|
|
2087
|
-
"univer-border-blue-500": p === S.theme
|
|
2088
|
-
}),
|
|
2089
|
-
onClick: () => Y(p),
|
|
2090
|
-
children: [
|
|
2091
|
-
/* @__PURE__ */ l("div", { style: { background: X, border: `${G}` } }),
|
|
2092
|
-
/* @__PURE__ */ l("div", { style: { background: K, border: `${G}` } }),
|
|
2093
|
-
/* @__PURE__ */ l("div", { style: { background: se, border: `${G}` } }),
|
|
2094
|
-
/* @__PURE__ */ l("div", { style: { background: W, border: `${G}` } })
|
|
2095
|
-
]
|
|
2096
|
-
},
|
|
2097
|
-
p
|
|
2098
|
-
);
|
|
2099
|
-
}) }),
|
|
2100
|
-
/* @__PURE__ */ l("h5", { children: a.t("sheets-table.customStyle") }),
|
|
2101
|
-
/* @__PURE__ */ T("div", { className: D("univer-w-full univer-rounded-sm", H), children: [
|
|
2102
|
-
/* @__PURE__ */ T("div", { className: "univer-flex univer-flex-wrap univer-gap-2 univer-p-2", children: [
|
|
2103
|
-
/* @__PURE__ */ l(
|
|
2104
|
-
"div",
|
|
2105
|
-
{
|
|
2106
|
-
className: D("univer-h-10 univer-w-8 univer-cursor-pointer univer-p-px univer-text-center univer-leading-10", H),
|
|
2107
|
-
onClick: V,
|
|
2108
|
-
children: "+"
|
|
2109
|
-
}
|
|
2110
|
-
),
|
|
2111
|
-
C.map((p) => {
|
|
2112
|
-
var Ce, Se, Fe, Ve, He, Ae, Ue, We;
|
|
2113
|
-
const _ = u.getCustomRangeThemeStyle(e, p), X = (Se = (Ce = _ == null ? void 0 : _.getHeaderRowStyle()) == null ? void 0 : Ce.bg) == null ? void 0 : Se.rgb, K = (Ve = (Fe = _ == null ? void 0 : _.getFirstRowStyle()) == null ? void 0 : Fe.bg) == null ? void 0 : Ve.rgb, se = (Ae = (He = _ == null ? void 0 : _.getSecondRowStyle()) == null ? void 0 : He.bg) == null ? void 0 : Ae.rgb, W = (We = (Ue = _ == null ? void 0 : _.getLastRowStyle()) == null ? void 0 : Ue.bg) == null ? void 0 : We.rgb;
|
|
2114
|
-
return /* @__PURE__ */ T(
|
|
2115
|
-
"div",
|
|
2116
|
-
{
|
|
2117
|
-
className: D("univer-relative univer-h-10 univer-w-8 univer-cursor-pointer univer-border univer-border-solid univer-border-gray-200 univer-p-px", {
|
|
2118
|
-
"univer-border-blue-500": p === S.theme
|
|
2119
|
-
}),
|
|
2120
|
-
onClick: () => Y(p),
|
|
2121
|
-
onMouseEnter: () => L(p),
|
|
2122
|
-
onMouseLeave: () => L(null),
|
|
2123
|
-
children: [
|
|
2124
|
-
/* @__PURE__ */ l("div", { className: "univer-box-border univer-h-2.5", style: { background: X != null ? X : G, border: `${X ? G : et}` } }),
|
|
2125
|
-
/* @__PURE__ */ l("div", { className: "univer-box-border univer-h-2.5", style: { background: K != null ? K : G, border: `${K ? G : et}` } }),
|
|
2126
|
-
/* @__PURE__ */ l("div", { className: "univer-box-border univer-h-2.5", style: { background: se != null ? se : G, border: `${se ? G : et}` } }),
|
|
2127
|
-
/* @__PURE__ */ l("div", { className: "univer-box-border univer-h-2.5", style: { background: W != null ? W : G, border: `${W ? G : et}` } }),
|
|
2128
|
-
/* @__PURE__ */ l(
|
|
2129
|
-
"div",
|
|
2130
|
-
{
|
|
2131
|
-
className: "univer-absolute univer-right-[-3px] univer-top-[-3px] univer-size-3 univer-rounded-md univer-bg-gray-200 univer-text-center univer-text-xs univer-leading-[10px]",
|
|
2132
|
-
style: { display: O === p ? "block" : "none" },
|
|
2133
|
-
onClick: (En) => {
|
|
2134
|
-
En.stopPropagation(), ce(p);
|
|
2135
|
-
},
|
|
2136
|
-
children: "x"
|
|
2137
|
-
}
|
|
2138
|
-
)
|
|
2139
|
-
]
|
|
2140
|
-
},
|
|
2141
|
-
p
|
|
2142
|
-
);
|
|
2143
|
-
})
|
|
2144
|
-
] }),
|
|
2145
|
-
I && /* @__PURE__ */ T(Rt, { children: [
|
|
2146
|
-
/* @__PURE__ */ l("div", { className: "univer-h-px univer-w-full univer-bg-gray-200" }),
|
|
2147
|
-
/* @__PURE__ */ T("div", { className: "univer-flex univer-flex-col univer-gap-2 univer-p-2", children: [
|
|
2148
|
-
/* @__PURE__ */ T("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
|
|
2149
|
-
/* @__PURE__ */ l(
|
|
2150
|
-
"div",
|
|
2151
|
-
{
|
|
2152
|
-
className: D("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", H, {
|
|
2153
|
-
"univer-text-white": ue,
|
|
2154
|
-
"univer-text-gray-900": !ue
|
|
2155
|
-
}),
|
|
2156
|
-
style: {
|
|
2157
|
-
background: g
|
|
2158
|
-
},
|
|
2159
|
-
children: a.t("sheets-table.header")
|
|
2160
|
-
}
|
|
2161
|
-
),
|
|
2162
|
-
/* @__PURE__ */ l(
|
|
2163
|
-
Ne,
|
|
2164
|
-
{
|
|
2165
|
-
overlay: /* @__PURE__ */ l("div", { className: "univer-p-2", children: /* @__PURE__ */ l(
|
|
2166
|
-
Je,
|
|
2167
|
-
{
|
|
2168
|
-
value: g,
|
|
2169
|
-
onChange: (p) => {
|
|
2170
|
-
const _ = Pt("headerRowStyle", {
|
|
2171
|
-
bg: {
|
|
2172
|
-
rgb: p
|
|
2173
|
-
},
|
|
2174
|
-
cl: {
|
|
2175
|
-
rgb: new he(p).isDark() ? "#fff" : "#000"
|
|
2176
|
-
}
|
|
2177
|
-
});
|
|
2178
|
-
z(c.getTableStyleId(), { headerRowStyle: _ });
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
) }),
|
|
2182
|
-
children: /* @__PURE__ */ T(
|
|
2183
|
-
"div",
|
|
2184
|
-
{
|
|
2185
|
-
className: D("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", H),
|
|
2186
|
-
children: [
|
|
2187
|
-
/* @__PURE__ */ l(
|
|
2188
|
-
"div",
|
|
2189
|
-
{
|
|
2190
|
-
className: D("univer-size-4 univer-rounded-lg univer-bg-gray-400", H, {
|
|
2191
|
-
"univer-text-white": ue,
|
|
2192
|
-
"univer-text-gray-900": !ue
|
|
2193
|
-
}),
|
|
2194
|
-
style: {
|
|
2195
|
-
background: g
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
),
|
|
2199
|
-
/* @__PURE__ */ l(qe, { className: "univer-size-2" })
|
|
2200
|
-
]
|
|
2201
|
-
}
|
|
2202
|
-
)
|
|
2203
|
-
}
|
|
2204
|
-
)
|
|
2205
|
-
] }),
|
|
2206
|
-
/* @__PURE__ */ T("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
|
|
2207
|
-
/* @__PURE__ */ l(
|
|
2208
|
-
"div",
|
|
2209
|
-
{
|
|
2210
|
-
className: D("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", H, {
|
|
2211
|
-
"univer-text-white": fe,
|
|
2212
|
-
"univer-text-gray-900": !fe
|
|
2213
|
-
}),
|
|
2214
|
-
style: {
|
|
2215
|
-
background: x
|
|
2216
|
-
},
|
|
2217
|
-
children: a.t("sheets-table.firstLine")
|
|
2218
|
-
}
|
|
2219
|
-
),
|
|
2220
|
-
/* @__PURE__ */ l(
|
|
2221
|
-
Ne,
|
|
2222
|
-
{
|
|
2223
|
-
overlay: /* @__PURE__ */ l("div", { className: "univer-p-2", children: /* @__PURE__ */ l(
|
|
2224
|
-
Je,
|
|
2225
|
-
{
|
|
2226
|
-
value: x,
|
|
2227
|
-
onChange: (p) => {
|
|
2228
|
-
z(c.getTableStyleId(), {
|
|
2229
|
-
firstRowStyle: {
|
|
2230
|
-
bg: {
|
|
2231
|
-
rgb: p
|
|
2232
|
-
},
|
|
2233
|
-
cl: {
|
|
2234
|
-
rgb: new he(p).isDark() ? "#fff" : "#000"
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
});
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
) }),
|
|
2241
|
-
children: /* @__PURE__ */ T(
|
|
2242
|
-
"div",
|
|
2243
|
-
{
|
|
2244
|
-
className: D("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", H),
|
|
2245
|
-
children: [
|
|
2246
|
-
/* @__PURE__ */ l(
|
|
2247
|
-
"div",
|
|
2248
|
-
{
|
|
2249
|
-
className: D("univer-size-4 univer-rounded-lg univer-bg-gray-400", H),
|
|
2250
|
-
style: { background: x }
|
|
2251
|
-
}
|
|
2252
|
-
),
|
|
2253
|
-
/* @__PURE__ */ l(qe, { className: "univer-size-2" })
|
|
2254
|
-
]
|
|
2255
|
-
}
|
|
2256
|
-
)
|
|
2257
|
-
}
|
|
2258
|
-
)
|
|
2259
|
-
] }),
|
|
2260
|
-
/* @__PURE__ */ T("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
|
|
2261
|
-
/* @__PURE__ */ l(
|
|
2262
|
-
"div",
|
|
2263
|
-
{
|
|
2264
|
-
className: D("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", H, {
|
|
2265
|
-
"univer-text-white": de,
|
|
2266
|
-
"univer-text-gray-900": !de
|
|
2267
|
-
}),
|
|
2268
|
-
style: {
|
|
2269
|
-
background: y
|
|
2270
|
-
},
|
|
2271
|
-
children: a.t("sheets-table.secondLine")
|
|
2272
|
-
}
|
|
2273
|
-
),
|
|
2274
|
-
/* @__PURE__ */ l(
|
|
2275
|
-
Ne,
|
|
2276
|
-
{
|
|
2277
|
-
overlay: /* @__PURE__ */ l("div", { className: "univer-p-2", children: /* @__PURE__ */ l(
|
|
2278
|
-
Je,
|
|
2279
|
-
{
|
|
2280
|
-
value: y,
|
|
2281
|
-
onChange: (p) => z(c.getTableStyleId(), {
|
|
2282
|
-
secondRowStyle: {
|
|
2283
|
-
bg: {
|
|
2284
|
-
rgb: p
|
|
2285
|
-
},
|
|
2286
|
-
cl: {
|
|
2287
|
-
rgb: new he(p).isDark() ? "#fff" : "#000"
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
})
|
|
2291
|
-
}
|
|
2292
|
-
) }),
|
|
2293
|
-
children: /* @__PURE__ */ T(
|
|
2294
|
-
"div",
|
|
2295
|
-
{
|
|
2296
|
-
className: D("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", H),
|
|
2297
|
-
children: [
|
|
2298
|
-
/* @__PURE__ */ l(
|
|
2299
|
-
"div",
|
|
2300
|
-
{
|
|
2301
|
-
className: D("univer-size-4 univer-rounded-lg univer-bg-gray-400", H),
|
|
2302
|
-
style: { background: y }
|
|
2303
|
-
}
|
|
2304
|
-
),
|
|
2305
|
-
/* @__PURE__ */ l(qe, { className: "univer-size-2" })
|
|
2306
|
-
]
|
|
2307
|
-
}
|
|
2308
|
-
)
|
|
2309
|
-
}
|
|
2310
|
-
)
|
|
2311
|
-
] }),
|
|
2312
|
-
/* @__PURE__ */ T("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
|
|
2313
|
-
/* @__PURE__ */ l(
|
|
2314
|
-
"div",
|
|
2315
|
-
{
|
|
2316
|
-
className: D("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", H, {
|
|
2317
|
-
"univer-text-white": b,
|
|
2318
|
-
"univer-text-gray-900": !b
|
|
2319
|
-
}),
|
|
2320
|
-
style: {
|
|
2321
|
-
background: m
|
|
2322
|
-
},
|
|
2323
|
-
children: a.t("sheets-table.footer")
|
|
2324
|
-
}
|
|
2325
|
-
),
|
|
2326
|
-
/* @__PURE__ */ l(
|
|
2327
|
-
Ne,
|
|
2328
|
-
{
|
|
2329
|
-
overlay: /* @__PURE__ */ l("div", { className: "univer-p-2", children: /* @__PURE__ */ l(
|
|
2330
|
-
Je,
|
|
2331
|
-
{
|
|
2332
|
-
value: m,
|
|
2333
|
-
onChange: (p) => {
|
|
2334
|
-
const _ = Pt("lastRowStyle", {
|
|
2335
|
-
bg: {
|
|
2336
|
-
rgb: p
|
|
2337
|
-
},
|
|
2338
|
-
cl: {
|
|
2339
|
-
rgb: new he(p).isDark() ? "#fff" : "#000"
|
|
2340
|
-
}
|
|
2341
|
-
});
|
|
2342
|
-
z(c.getTableStyleId(), { lastRowStyle: _ });
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
) }),
|
|
2346
|
-
children: /* @__PURE__ */ T(
|
|
2347
|
-
"div",
|
|
2348
|
-
{
|
|
2349
|
-
className: D("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", H),
|
|
2350
|
-
children: [
|
|
2351
|
-
/* @__PURE__ */ l(
|
|
2352
|
-
"div",
|
|
2353
|
-
{
|
|
2354
|
-
className: D("univer-size-4 univer-rounded-lg univer-bg-gray-400", H),
|
|
2355
|
-
style: { background: m }
|
|
2356
|
-
}
|
|
2357
|
-
),
|
|
2358
|
-
/* @__PURE__ */ l(qe, { className: "univer-size-2" })
|
|
2359
|
-
]
|
|
2360
|
-
}
|
|
2361
|
-
)
|
|
2362
|
-
}
|
|
2363
|
-
)
|
|
2364
|
-
] })
|
|
2365
|
-
] })
|
|
2366
|
-
] })
|
|
2367
|
-
] })
|
|
2368
|
-
] });
|
|
2369
|
-
}, Rn = "sheet.table.context-insert_menu-id", Mn = "sheet.table.context-remove_menu-id";
|
|
2370
|
-
function Ui(r) {
|
|
2371
|
-
return {
|
|
2372
|
-
id: Et.id,
|
|
2373
|
-
type: ye.BUTTON,
|
|
2374
|
-
icon: gn,
|
|
2375
|
-
tooltip: "sheets-table.title",
|
|
2376
|
-
title: "sheets-table.title",
|
|
2377
|
-
hidden$: gr(r, Qe.UNIVER_SHEET),
|
|
2378
|
-
disabled$: cr(r, {}, !0)
|
|
2379
|
-
};
|
|
2380
|
-
}
|
|
2381
|
-
function Wi(r) {
|
|
2382
|
-
return {
|
|
2383
|
-
id: Rn,
|
|
2384
|
-
type: ye.SUBITEMS,
|
|
2385
|
-
icon: "InsertDoubleIcon",
|
|
2386
|
-
title: "sheets-table.insert.main",
|
|
2387
|
-
hidden$: xn(r)
|
|
2388
|
-
};
|
|
2389
|
-
}
|
|
2390
|
-
function Zi(r) {
|
|
2391
|
-
return {
|
|
2392
|
-
id: Mn,
|
|
2393
|
-
type: ye.SUBITEMS,
|
|
2394
|
-
icon: "ReduceDoubleIcon",
|
|
2395
|
-
title: "sheets-table.remove.main",
|
|
2396
|
-
hidden$: xn(r)
|
|
2397
|
-
};
|
|
2398
|
-
}
|
|
2399
|
-
function ji(r) {
|
|
2400
|
-
return {
|
|
2401
|
-
id: en.id,
|
|
2402
|
-
type: ye.BUTTON,
|
|
2403
|
-
title: "sheets-table.insert.row",
|
|
2404
|
-
hidden$: Nn(r)
|
|
2405
|
-
};
|
|
2406
|
-
}
|
|
2407
|
-
function qi(r) {
|
|
2408
|
-
return {
|
|
2409
|
-
id: Jt.id,
|
|
2410
|
-
title: "sheets-table.insert.col",
|
|
2411
|
-
type: ye.BUTTON
|
|
2412
|
-
};
|
|
2413
|
-
}
|
|
2414
|
-
function Yi(r) {
|
|
2415
|
-
return {
|
|
2416
|
-
id: Kt.id,
|
|
2417
|
-
type: ye.BUTTON,
|
|
2418
|
-
title: "sheets-table.remove.row",
|
|
2419
|
-
hidden$: Nn(r)
|
|
2420
|
-
};
|
|
2421
|
-
}
|
|
2422
|
-
function Qi(r) {
|
|
2423
|
-
return {
|
|
2424
|
-
id: Xt.id,
|
|
2425
|
-
title: "sheets-table.remove.col",
|
|
2426
|
-
type: ye.BUTTON
|
|
2427
|
-
};
|
|
2428
|
-
}
|
|
2429
|
-
function xn(r) {
|
|
2430
|
-
const e = r.get(ut);
|
|
2431
|
-
return r.get(pe).getCurrentTypeOfUnit$(Qe.UNIVER_SHEET).pipe(
|
|
2432
|
-
we((i) => i ? i.activeSheet$.pipe(
|
|
2433
|
-
we((a) => a ? e.selectionMoveEnd$.pipe(
|
|
2434
|
-
we((s) => {
|
|
2435
|
-
if (!s.length || s.length > 1) return J(!0);
|
|
2436
|
-
const u = s[0].range, d = r.get(tn).getContainerTableWithRange(i.getUnitId(), a.getSheetId(), u);
|
|
2437
|
-
return J(!d);
|
|
2438
|
-
})
|
|
2439
|
-
) : J(!0))
|
|
2440
|
-
) : J(!0))
|
|
2441
|
-
);
|
|
2442
|
-
}
|
|
2443
|
-
function Nn(r) {
|
|
2444
|
-
const e = r.get(ut);
|
|
2445
|
-
return r.get(pe).getCurrentTypeOfUnit$(Qe.UNIVER_SHEET).pipe(
|
|
2446
|
-
we((i) => i ? i.activeSheet$.pipe(
|
|
2447
|
-
we((a) => a ? e.selectionMoveEnd$.pipe(
|
|
2448
|
-
we((s) => {
|
|
2449
|
-
if (!s.length || s.length > 1) return J(!0);
|
|
2450
|
-
const u = s[0].range, d = r.get(tn).getContainerTableWithRange(i.getUnitId(), a.getSheetId(), u);
|
|
2451
|
-
if (!d)
|
|
2452
|
-
return J(!0);
|
|
2453
|
-
const v = d.getRange();
|
|
2454
|
-
return u.startRow === v.startRow ? J(!0) : J(!1);
|
|
2455
|
-
})
|
|
2456
|
-
) : J(!0))
|
|
2457
|
-
) : J(!0))
|
|
2458
|
-
);
|
|
2459
|
-
}
|
|
2460
|
-
const zi = {
|
|
2461
|
-
[pr.ORGANIZATION]: {
|
|
2462
|
-
[Et.id]: {
|
|
2463
|
-
order: 0,
|
|
2464
|
-
menuItemFactory: Ui
|
|
2465
|
-
}
|
|
2466
|
-
},
|
|
2467
|
-
[br.MAIN_AREA]: {
|
|
2468
|
-
[mr.LAYOUT]: {
|
|
2469
|
-
[Rn]: {
|
|
2470
|
-
order: 5,
|
|
2471
|
-
menuItemFactory: Wi,
|
|
2472
|
-
[en.id]: {
|
|
2473
|
-
order: 1,
|
|
2474
|
-
menuItemFactory: ji
|
|
2475
|
-
},
|
|
2476
|
-
[Jt.id]: {
|
|
2477
|
-
order: 2,
|
|
2478
|
-
menuItemFactory: qi
|
|
2479
|
-
}
|
|
2480
|
-
},
|
|
2481
|
-
[Mn]: {
|
|
2482
|
-
order: 6,
|
|
2483
|
-
menuItemFactory: Zi,
|
|
2484
|
-
[Kt.id]: {
|
|
2485
|
-
order: 1,
|
|
2486
|
-
menuItemFactory: Yi
|
|
2487
|
-
},
|
|
2488
|
-
[Xt.id]: {
|
|
2489
|
-
order: 2,
|
|
2490
|
-
menuItemFactory: Qi
|
|
2491
|
-
}
|
|
2492
|
-
}
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
};
|
|
2496
|
-
var Gi = Object.getOwnPropertyDescriptor, Xi = (r, e, t, n) => {
|
|
2497
|
-
for (var i = n > 1 ? void 0 : n ? Gi(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
2498
|
-
(s = r[a]) && (i = s(i) || i);
|
|
2499
|
-
return i;
|
|
2500
|
-
}, Zt = (r, e) => (t, n) => e(t, n, r);
|
|
2501
|
-
let ot = class extends ke {
|
|
2502
|
-
constructor(r, e) {
|
|
2503
|
-
super(), this._componentManager = r, this._menuManagerService = e, this._initComponents(), this._initMenu();
|
|
2504
|
-
}
|
|
2505
|
-
_initComponents() {
|
|
2506
|
-
[
|
|
2507
|
-
[gn, Tn],
|
|
2508
|
-
[xe, Hi],
|
|
2509
|
-
[bn, Ai]
|
|
2510
|
-
].forEach(([r, e]) => {
|
|
2511
|
-
this.disposeWithMe(this._componentManager.register(r, e));
|
|
2512
|
-
});
|
|
2513
|
-
}
|
|
2514
|
-
_initMenu() {
|
|
2515
|
-
this._menuManagerService.mergeMenu(zi);
|
|
2516
|
-
}
|
|
2517
|
-
};
|
|
2518
|
-
ot = Xi([
|
|
2519
|
-
Zt(0, N(nn)),
|
|
2520
|
-
Zt(1, N(fr))
|
|
2521
|
-
], ot);
|
|
2522
|
-
var Ki = Object.defineProperty, Ji = Object.getOwnPropertyDescriptor, ea = (r, e, t) => e in r ? Ki(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ta = (r, e, t, n) => {
|
|
2523
|
-
for (var i = n > 1 ? void 0 : n ? Ji(e, t) : e, a = r.length - 1, s; a >= 0; a--)
|
|
2524
|
-
(s = r[a]) && (i = s(i) || i);
|
|
2525
|
-
return i;
|
|
2526
|
-
}, rt = (r, e) => (t, n) => e(t, n, r), dt = (r, e, t) => ea(r, typeof e != "symbol" ? e + "" : e, t);
|
|
2527
|
-
let Le = class extends Fn {
|
|
2528
|
-
constructor(r = Ut, e, t, n, i) {
|
|
2529
|
-
super(), this._config = r, this._injector = e, this._commandService = t, this._configService = n, this._renderManagerService = i;
|
|
2530
|
-
const { menu: a, ...s } = Vn(
|
|
2531
|
-
{},
|
|
2532
|
-
Ut,
|
|
2533
|
-
this._config
|
|
2534
|
-
);
|
|
2535
|
-
a && this._configService.setConfig("menu", a, { merge: !0 }), this._configService.setConfig(yn, s), this._initRegisterCommand();
|
|
2536
|
-
}
|
|
2537
|
-
onStarting() {
|
|
2538
|
-
Hn(this._injector, [
|
|
2539
|
-
[$e],
|
|
2540
|
-
[Ee],
|
|
2541
|
-
[ot],
|
|
2542
|
-
[Ie],
|
|
2543
|
-
[st]
|
|
2544
|
-
]);
|
|
2545
|
-
}
|
|
2546
|
-
onReady() {
|
|
2547
|
-
An(this._injector, [
|
|
2548
|
-
[$e],
|
|
2549
|
-
[Ee],
|
|
2550
|
-
[ot],
|
|
2551
|
-
[Ie],
|
|
2552
|
-
[st]
|
|
2553
|
-
]);
|
|
2554
|
-
}
|
|
2555
|
-
onRendered() {
|
|
2556
|
-
this._registerRenderModules();
|
|
2557
|
-
}
|
|
2558
|
-
_registerRenderModules() {
|
|
2559
|
-
const r = [
|
|
2560
|
-
[Tt],
|
|
2561
|
-
[wt]
|
|
2562
|
-
];
|
|
2563
|
-
this._config.hideAnchor !== !0 && r.push([at]), r.forEach((e) => {
|
|
2564
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(Qe.UNIVER_SHEET, e));
|
|
2565
|
-
});
|
|
2566
|
-
}
|
|
2567
|
-
_initRegisterCommand() {
|
|
2568
|
-
[
|
|
2569
|
-
St,
|
|
2570
|
-
Et
|
|
2571
|
-
].forEach((r) => this._commandService.registerCommand(r));
|
|
2572
|
-
}
|
|
2573
|
-
};
|
|
2574
|
-
dt(Le, "pluginName", Zr);
|
|
2575
|
-
dt(Le, "packageName", vn.name);
|
|
2576
|
-
dt(Le, "version", vn.version);
|
|
2577
|
-
dt(Le, "type", Qe.UNIVER_SHEET);
|
|
2578
|
-
Le = ta([
|
|
2579
|
-
Bn(tr),
|
|
2580
|
-
rt(1, N(Pe)),
|
|
2581
|
-
rt(2, N(te)),
|
|
2582
|
-
rt(3, Qt),
|
|
2583
|
-
rt(4, Gt)
|
|
2584
|
-
], Le);
|
|
2585
|
-
export {
|
|
2586
|
-
Le as UniverSheetsTableUIPlugin
|
|
2587
|
-
};
|
|
1
|
+
import{ColorKit as e,CommandType as t,DependentOn as n,Disposable as r,ErrorService as i,ICommandService as a,IConfigService as o,IContextService as s,IPermissionService as c,IUniverInstanceService as l,Inject as u,Injector as d,InterceptorEffectEnum as f,LocaleService as p,ObjectMatrix as m,Plugin as h,Rectangle as g,RxDisposable as _,ThemeService as v,UniverInstanceType as y,VerticalAlign as b,cellToRange as x,merge as S,registerDependencies as C,touchDependencies as w}from"@univerjs/core";import{IRenderManagerService as T,Rect as ee,SHEET_VIEWPORT_KEY as E,Shape as D,convertTransformToOffsetX as te,convertTransformToOffsetY as O}from"@univerjs/engine-render";import{AddSheetTableCommand as ne,AddTableThemeCommand as k,DeleteSheetTableCommand as A,RemoveTableThemeCommand as re,SHEET_TABLE_CUSTOM_THEME_PREFIX as j,SetSheetTableCommand as ie,SetSheetTableFilterCommand as ae,SheetTableInsertColCommand as oe,SheetTableInsertRowCommand as se,SheetTableRemoveColCommand as ce,SheetTableRemoveRowCommand as le,SheetTableService as ue,SheetsTableButtonStateEnum as de,SheetsTableController as fe,SheetsTableSortStateEnum as pe,TableColumnFilterTypeEnum as me,TableConditionTypeEnum as M,TableDateCompareTypeEnum as N,TableManager as P,TableNumberCompareTypeEnum as F,TableStringCompareTypeEnum as I,UniverSheetsTablePlugin as he,customEmptyThemeWithBorderStyle as ge,isConditionFilter as _e,isManualTableFilter as ve,processStyleWithBorderStyle as ye}from"@univerjs/sheets-table";import{SelectAllCommand as be,SetScrollOperation as xe,SetZoomRatioOperation as Se,SheetCanvasPopManagerService as Ce,SheetScrollManagerService as we,SheetSkeletonManagerService as Te,getCoordByCell as Ee,getCurrentRangeDisable$ as De,getSheetObject as Oe}from"@univerjs/sheets-ui";import{BuiltInUIPart as ke,ComponentManager as Ae,ContextMenuGroup as je,ContextMenuPosition as Me,IDialogService as Ne,IMenuManagerService as Pe,ISidebarService as Fe,IUIPartsService as Ie,MenuItemType as L,RibbonDataGroup as Le,connectInjector as Re,getMenuHiddenObservable as ze,useDependency as R,useObservable as z}from"@univerjs/ui";import{BehaviorSubject as Be,Subject as Ve,debounceTime as He,distinctUntilChanged as Ue,filter as We,map as Ge,merge as Ke,of as B,startWith as qe,switchMap as V,takeUntil as Je}from"rxjs";import{Button as Ye,ButtonGroup as Xe,CascaderList as Ze,Checkbox as Qe,ColorPicker as $e,DatePicker as et,DateRangePicker as tt,Dropdown as nt,Input as rt,InputNumber as it,Segmented as at,Select as ot,borderClassName as H,clsx as U,scrollbarClassName as st}from"@univerjs/design";import{AscendingIcon as ct,DeleteIcon as lt,DescendingIcon as ut,DropdownIcon as dt,GridOutlineIcon as ft,MoreDownIcon as pt,PaintBucketDoubleIcon as mt,RenameIcon as ht,TableIcon as gt}from"@univerjs/icons";import{INTERCEPTOR_POINT as _t,RangeThemeStyle as vt,SetRangeThemeMutation as yt,SetRangeValuesMutation as bt,SetSelectionsOperation as xt,SetVerticalTextAlignCommand as St,SheetInterceptorService as Ct,SheetRangeThemeModel as wt,SheetsSelectionsService as Tt,WorkbookEditablePermission as Et,WorkbookPermissionService as Dt,expandToContinuousRange as Ot,getPrimaryForRange as kt,getSheetCommandTarget as At,isSingleCellSelection as jt}from"@univerjs/sheets";import{SortRangeCommand as Mt,SortType as Nt}from"@univerjs/sheets-sort";import{useCallback as Pt,useEffect as Ft,useMemo as It,useState as W}from"react";import{Fragment as Lt,jsx as G,jsxs as K}from"react/jsx-runtime";import{deserializeRangeWithSheet as Rt,serializeRange as zt}from"@univerjs/engine-formula";import{RangeSelector as Bt}from"@univerjs/sheets-formula-ui";var Vt=`@univerjs/sheets-table-ui`,Ht=`0.18.0`;const Ut=`SHEETS_TABLE_FILTER_PANEL_OPENED_KEY`,Wt=`TABLE_TOOLBAR_BUTTON`,Gt=`TABLE_SELECTOR_DIALOG`,Kt=`SHEET_TABLE_THEME_PANEL`,qt=`table-custom-`,Jt=`rgb(255, 255, 255)`,q=`none`,J=`1px solid rgb(var(--grey-200))`;let Yt=function(e){return e.Items=`items`,e.Condition=`condition`,e}({});function Xt(e){"@babel/helpers - typeof";return Xt=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Xt(e)}function Zt(e,t){if(Xt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Xt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Qt(e){var t=Zt(e,`string`);return Xt(t)==`symbol`?t:t+``}function Y(e,t,n){return(t=Qt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X(e,t){return function(n,r){t(n,r,e)}}function Z(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let $t=class extends r{constructor(e,t,n,r,i){super(),this._tableManager=e,this._sheetTableService=t,this._univerInstanceService=n,this._commandService=r,this._localeService=i,Y(this,`_itemsCache`,new Map),this._registerTableFilterChangeEvent()}_registerTableFilterChangeEvent(){this._commandService.onCommandExecuted(e=>{if(e.id===bt.id){let{unitId:t,subUnitId:n,cellValue:r}=e.params,i=this._tableManager.getTablesBySubunitId(t,n);if(!i.length)return;new m(r).forValue((e,t,n)=>{let r=x(e,t),a=i.find(e=>{let t=e.getTableFilterRange();return g.intersects(t,r)});if(a){let e=t-a.getRange().startColumn;this._itemsCache.delete(a.getId()+e)}})}else if(e.id===ae.id){let{unitId:t,tableId:n}=e.params,r=this._tableManager.getTable(t,n);if(!r)return;let i=r.getSubunitId();this._tableManager.getTablesBySubunitId(t,i).forEach(e=>{let t=e.getRange();for(let n=t.startColumn;n<=t.endColumn;n++)this._itemsCache.delete(e.getId()+n)})}})}getTableFilterPanelInitProps(e,t,n,r){let i=this._tableManager.getTable(e,n),a=i.getRange(),o=i.getTableFilterColumn(r-a.startColumn);return{unitId:e,subUnitId:t,tableFilter:o,currentFilterBy:_e(o)?Yt.Condition:Yt.Items,tableId:n,columnIndex:r-a.startColumn}}getTableFilterCheckedItems(e,t,n){let r=this._tableManager.getTable(e,t),i=[];if(r){let e=r.getTableFilterColumn(n);e&&ve(e)&&i.push(...e.values)}return i}setTableFilter(e,t,n,r){if(!this._tableManager.getTable(e,t))return;let i={unitId:e,tableId:t,column:n,tableFilter:r};this._commandService.executeCommand(ae.id,i)}getTableFilterItems(e,t,n,r){var i;if(this._itemsCache.has(n+r))return this._itemsCache.get(n+r)||{data:[],itemsCountMap:new Map,allItemsCount:0};let a=this._tableManager.getTable(e,n);if(!a)return{data:[],itemsCountMap:new Map,allItemsCount:0};let{startRow:o,endRow:s,startColumn:c}=a.getTableFilterRange(),l=c+r,u=(i=this._univerInstanceService.getUnit(e))==null?void 0:i.getSheetBySheetId(t);if(!u)return{data:[],itemsCountMap:new Map,allItemsCount:0};let d=[],f=new Map,p=0;for(let e=o;e<=s;e++){if(u.isRowFiltered(e))continue;let t=this._sheetTableService.getCellValueWithConditionType(u,e,l);t===void 0&&(t=this._localeService.t(`sheets-table.condition.empty`)),f.has(t)||d.push({title:t,key:`${l}_${e}`,leaf:!0}),p++,f.set(t,(f.get(t)||0)+1)}return this._itemsCache.set(n+r,{data:d,itemsCountMap:f,allItemsCount:p}),{data:d,itemsCountMap:f,allItemsCount:p}}};$t=Z([X(0,u(P)),X(1,u(ue)),X(2,u(l)),X(3,a),X(4,u(p))],$t);let Q=function(e){return e.DatePicker=`DatePicker`,e.DateRange=`DateRange`,e.Input=`Input`,e.Inputs=`Inputs`,e.Select=`Select`,e.None=`None`,e}({});function en(e){let t=e.get(p).t;return[{value:M.String,label:t(`sheets-table.condition.${M.String}`),children:[{value:I.Equal,label:t(`sheets-table.string.compare.${I.Equal}`)},{value:I.NotEqual,label:t(`sheets-table.string.compare.${I.NotEqual}`)},{value:I.Contains,label:t(`sheets-table.string.compare.${I.Contains}`)},{value:I.NotContains,label:t(`sheets-table.string.compare.${I.NotContains}`)},{value:I.StartsWith,label:t(`sheets-table.string.compare.${I.StartsWith}`)},{value:I.EndsWith,label:t(`sheets-table.string.compare.${I.EndsWith}`)}]},{value:M.Number,label:t(`sheets-table.condition.${M.Number}`),children:[{value:F.Equal,label:t(`sheets-table.number.compare.${F.Equal}`)},{value:F.NotEqual,label:t(`sheets-table.number.compare.${F.NotEqual}`)},{value:F.GreaterThan,label:t(`sheets-table.number.compare.${F.GreaterThan}`)},{value:F.GreaterThanOrEqual,label:t(`sheets-table.number.compare.${F.GreaterThanOrEqual}`)},{value:F.LessThan,label:t(`sheets-table.number.compare.${F.LessThan}`)},{value:F.LessThanOrEqual,label:t(`sheets-table.number.compare.${F.LessThanOrEqual}`)},{value:F.Between,label:t(`sheets-table.number.compare.${F.Between}`)},{value:F.NotBetween,label:t(`sheets-table.number.compare.${F.NotBetween}`)},{value:F.Above,label:t(`sheets-table.number.compare.${F.Above}`)},{value:F.Below,label:t(`sheets-table.number.compare.${F.Below}`)}]},{value:M.Date,label:t(`sheets-table.condition.${M.Date}`),children:[{value:N.Equal,label:t(`sheets-table.date.compare.${N.Equal}`)},{value:N.NotEqual,label:t(`sheets-table.date.compare.${N.NotEqual}`)},{value:N.After,label:t(`sheets-table.date.compare.${N.After}`)},{value:N.AfterOrEqual,label:t(`sheets-table.date.compare.${N.AfterOrEqual}`)},{value:N.Before,label:t(`sheets-table.date.compare.${N.Before}`)},{value:N.BeforeOrEqual,label:t(`sheets-table.date.compare.${N.BeforeOrEqual}`)},{value:N.Between,label:t(`sheets-table.date.compare.${N.Between}`)},{value:N.NotBetween,label:t(`sheets-table.date.compare.${N.NotBetween}`)},{value:N.Today,label:t(`sheets-table.date.compare.${N.Today}`)},{value:N.Yesterday,label:t(`sheets-table.date.compare.${N.Yesterday}`)},{value:N.Tomorrow,label:t(`sheets-table.date.compare.${N.Tomorrow}`)},{value:N.ThisWeek,label:t(`sheets-table.date.compare.${N.ThisWeek}`)},{value:N.LastWeek,label:t(`sheets-table.date.compare.${N.LastWeek}`)},{value:N.NextWeek,label:t(`sheets-table.date.compare.${N.NextWeek}`)},{value:N.ThisMonth,label:t(`sheets-table.date.compare.${N.ThisMonth}`)},{value:N.LastMonth,label:t(`sheets-table.date.compare.${N.LastMonth}`)},{value:N.NextMonth,label:t(`sheets-table.date.compare.${N.NextMonth}`)},{value:N.ThisYear,label:t(`sheets-table.date.compare.${N.ThisYear}`)},{value:N.LastYear,label:t(`sheets-table.date.compare.${N.LastYear}`)},{value:N.NextYear,label:t(`sheets-table.date.compare.${N.NextYear}`)},{value:N.Quarter,label:t(`sheets-table.date.compare.${N.Quarter}`)},{value:N.Month,label:t(`sheets-table.date.compare.${N.Month}`)}]}]}function tn(e,t){if(!t)return[];let n=e.get(p).t;switch(t){case N.Quarter:return[{value:N.Q1,label:n(`sheets-table.date.compare.${N.Q1}`)},{value:N.Q2,label:n(`sheets-table.date.compare.${N.Q2}`)},{value:N.Q3,label:n(`sheets-table.date.compare.${N.Q3}`)},{value:N.Q4,label:n(`sheets-table.date.compare.${N.Q4}`)}];case N.Month:return[{value:N.M1,label:n(`sheets-table.date.compare.${N.M1}`)},{value:N.M2,label:n(`sheets-table.date.compare.${N.M2}`)},{value:N.M3,label:n(`sheets-table.date.compare.${N.M3}`)},{value:N.M4,label:n(`sheets-table.date.compare.${N.M4}`)},{value:N.M5,label:n(`sheets-table.date.compare.${N.M5}`)},{value:N.M6,label:n(`sheets-table.date.compare.${N.M6}`)},{value:N.M7,label:n(`sheets-table.date.compare.${N.M7}`)},{value:N.M8,label:n(`sheets-table.date.compare.${N.M8}`)},{value:N.M9,label:n(`sheets-table.date.compare.${N.M9}`)},{value:N.M10,label:n(`sheets-table.date.compare.${N.M10}`)},{value:N.M11,label:n(`sheets-table.date.compare.${N.M11}`)},{value:N.M12,label:n(`sheets-table.date.compare.${N.M12}`)}];default:return[]}}const nn=new Set([N.Equal,N.NotEqual,N.After,N.AfterOrEqual,N.Before,N.BeforeOrEqual]);function rn(e,t){return t?e===M.String?Q.Input:e===M.Number?t===F.Between||t===F.NotBetween?Q.Inputs:Q.Input:e===M.Date?t===N.Between||t===N.NotBetween?Q.DateRange:t===N.Quarter||t===N.Month?Q.Select:nn.has(t)?Q.DatePicker:Q.None:Q.None:Q.None}function an(e){if(!e||e.filterType!==`condition`)return{type:M.String,compareType:I.Equal,info:{}};let t=e.filterInfo,{conditionType:n,compareType:r}=t;if(n===M.Date)if(r===N.Between||r===N.NotBetween){let e;return Array.isArray(t.expectedValue)&&(e=t.expectedValue.map(e=>typeof e==`string`?new Date(e):e)),{type:n,compare:r,info:{dateRange:e}}}else if(r===N.Today||r===N.Yesterday||r===N.Tomorrow||r===N.ThisWeek||r===N.LastWeek||r===N.NextWeek||r===N.ThisMonth||r===N.LastMonth||r===N.NextMonth||r===N.ThisYear||r===N.LastYear||r===N.NextYear)return{type:n,compare:r,info:{}};else if(nn.has(r)){let e;if(typeof t.expectedValue==`string`)e=new Date(t.expectedValue);else if(Array.isArray(t.expectedValue))for(let e=0;e<t.expectedValue.length;e++)typeof t.expectedValue[e]==`string`&&(t.expectedValue[e]=new Date(t.expectedValue[e]));return{type:n,compare:r,info:{date:e}}}else if(new Set([N.Q1,N.Q2,N.Q3,N.Q4]).has(r))return{type:n,compare:N.Quarter,info:{dateSelect:t.compareType}};else return{type:n,compare:N.Month,info:{dateSelect:t.compareType}};else if(n===M.Number)return r===F.Between||r===F.NotBetween?{type:n,compare:r,info:{numberRange:t.expectedValue}}:{type:n,compare:r,info:{number:t.expectedValue}};else if(n===M.String)return{type:n,compare:r,info:{string:t.expectedValue}};return{type:M.String,compare:I.Equal,info:{}}}const on=e=>{var t,n,r,i,a,o,s,c;let{conditionInfo:l,onChange:u}=e,f=R(p),[m,h]=W(!1),g=R(d),_=en(g),v=(e,t,n)=>{u({type:t==null?l.type:t,compare:n==null?l.compare:n,info:e})},y=e=>{var t;let n=e[0],r=e[1];r&&h(!1);let i={};n===M.Date?r===N.Quarter?i.dateSelect=N.Q1:r===N.Month?i.dateSelect=N.M1:nn.has(r)?i.date=new Date:i.dateRange=[new Date,new Date]:n===M.Number?i.number=0:n===M.String&&(i.string=``),v(i,e[0],(t=e[1])==null?I.Equal:t)},b=rn(l.type,l.compare),x=``;x=l.compare?`${f.t(`sheets-table.condition.${l.type}`)} - ${f.t(`sheets-table.${l.type}.compare.${l.compare}`)}`:f.t(`sheets-table.condition.${l.type}`);let S=tn(g,l.compare);return K(`div`,{children:[G(nt,{align:`start`,open:m,onOpenChange:h,overlay:G(Ze,{value:[l.type,l.compare],options:_,onChange:y,contentClassName:`univer-flex-1`,wrapperClassName:`!univer-h-[150px]`}),children:K(`div`,{className:U(`
|
|
2
|
+
univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between
|
|
3
|
+
univer-rounded-md univer-bg-white univer-px-2 univer-text-sm univer-transition-colors
|
|
4
|
+
univer-duration-200
|
|
5
|
+
hover:univer-border-primary-600
|
|
6
|
+
focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2
|
|
7
|
+
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
8
|
+
`,H),children:[G(`span`,{children:x}),G(pt,{})]})}),K(`div`,{className:`univer-mt-3 univer-w-full`,children:[b===Q.Input&&G(Lt,{children:l.type===M.String?G(rt,{className:`univer-w-full`,placeholder:`请输入`,value:l.info.string,onChange:e=>v({string:e})}):G(it,{className:`univer-h-7 univer-w-full`,value:l.info.number,controls:!1,onChange:e=>{e!==null&&v({number:e})}})}),b===Q.DatePicker&&G(`div`,{id:`univer-table-date-picker-wrapper`,children:G(et,{className:`univer-w-full`,value:(t=l.info.date)==null?new Date:t,onValueChange:e=>v({date:e})})}),b===Q.DateRange&&G(`div`,{id:`univer-table-date-range-wrapper`,children:G(tt,{className:`univer-w-full`,value:[(n=(r=l.info.dateRange)==null?void 0:r[0])==null?new Date:n,(i=(a=l.info.dateRange)==null?void 0:a[1])==null?new Date:i],onValueChange:e=>{v(e?{dateRange:e}:{})}})}),b===Q.Inputs&&K(`div`,{className:`univer-flex univer-items-center univer-gap-2`,children:[G(it,{className:`univer-w-full`,value:(o=l.info.numberRange)==null?void 0:o[0],onChange:e=>{if(e!==null){var t;v({numberRange:[e,(t=l.info.numberRange)==null?void 0:t[1]]})}},controls:!1}),G(`span`,{children:` - `}),G(it,{className:`univer-w-full`,value:(s=l.info.numberRange)==null?void 0:s[1],controls:!1,onChange:e=>{if(e!==null){var t;v({numberRange:[(t=l.info.numberRange)==null?void 0:t[0],e]})}}})]}),b===Q.Select&&G(ot,{className:`univer-w-full`,value:(c=l.info.dateSelect)==null?S[0].value:c,options:S,onChange:e=>v({dateSelect:e})})]})]})},sn=e=>{let t=0;return e.forEach(e=>{t+=e}),t};function cn(e){let{unitId:t,tableId:n,subUnitId:r,columnIndex:i,checkedItemSet:a,setCheckedItemSet:o,tableFilter:s}=e,c=R(p),{data:l,itemsCountMap:u,allItemsCount:d}=R($t).getTableFilterItems(t,r,n,i),[f,m]=W(s===void 0?!0:a.size===u.size),[h,g]=W(f?d:sn(u)),_=!f&&a.size>0,[v,y]=W(``),b=It(()=>v?l.filter(e=>String(e.title).toLowerCase().includes(v.toLowerCase())):l,[v,l]),x=Pt(()=>{f?(a.clear(),o(new Set(a)),m(!1)):(b.forEach(e=>{a.add(e.title)}),o(new Set(a)),m(!0))},[f]),S=Pt(e=>{e===``?(m(!0),l.forEach(e=>{a.add(e.title)}),g(d)):(a.clear(),m(!1),g(0)),y(e)},[]),C=e=>{if(f){m(!1);let t=new Set;for(let{title:n}of l)e!==n&&t.add(n);g(d-u.get(e)),o(t)}else a.has(e)?(a.delete(e),g(h-u.get(e))):(a.add(e),g(h+u.get(e))),o(new Set(a))};return K(`div`,{className:`univer-flex univer-h-full univer-flex-col`,children:[G(rt,{autoFocus:!0,value:v,placeholder:c.t(`sheets-table.filter.search-placeholder`),onChange:S}),G(`div`,{className:U(`
|
|
9
|
+
univer-mt-2 univer-box-border univer-flex univer-h-[180px] univer-max-h-[180px] univer-flex-grow
|
|
10
|
+
univer-flex-col univer-overflow-hidden univer-rounded-md univer-py-1.5 univer-pl-2
|
|
11
|
+
`,H),children:G(`div`,{className:U(`univer-h-40 univer-overflow-y-auto univer-py-1 univer-pl-2`,st),children:K(`div`,{className:`univer-h-full`,children:[G(`div`,{className:`univer-flex univer-items-center univer-px-2 univer-py-1`,children:G(Qe,{indeterminate:_,disabled:l.length===0,checked:f,onChange:x,children:K(`div`,{className:`univer-flex univer-h-5 univer-flex-1 univer-items-center univer-text-sm`,children:[G(`span`,{className:`univer-inline-block univer-truncate`,children:`${c.t(`sheets-table.filter.select-all`)}`}),G(`span`,{className:`univer-ml univer-text-gray-400`,children:`(${h}/${v?b.length:d})`})]})})}),b.map(e=>G(`div`,{className:`univer-flex univer-items-center univer-px-2 univer-py-1`,children:G(Qe,{checked:f||a.has(e.title),onChange:()=>{C(e.title)},children:K(`div`,{className:`univer-flex univer-h-5 univer-flex-1 univer-text-sm`,children:[G(`span`,{className:`univer-inline-block univer-truncate`,children:e.title}),G(`span`,{className:`univer-ml-1 univer-text-gray-400`,children:`(${u.get(e.title)||0})`})]})})},e.key))]})})})]})}function ln(){var e;let t=R(p),n=un(t),r=R($t),i=R(P),o=R(a),s=R(c),l=R(dn),u=l.getCurrentTableFilterInfo(),d=r.getTableFilterPanelInitProps(u.unitId,u.subUnitId,u.tableId,u.column),{unitId:f,subUnitId:m,tableId:h,tableFilter:g,currentFilterBy:_,columnIndex:v}=d,{data:y}=r.getTableFilterItems(f,m,h,v),b=r.getTableFilterCheckedItems(f,h,v),[x,S]=W(new Set(b)),[C,w]=W(_||Yt.Items),[T,ee]=W(()=>{let e=d.tableFilter;return an(e)}),E=i.getTable(f,h);if(!E)return null;let D=E.getTableFilters(),te=D.getSortState();te.columnIndex===v&&(te.sortState,pe.Asc),te.columnIndex===v&&(te.sortState,pe.Desc);let O=()=>{l.closeFilterPanel()},ne=()=>{O()},k=e=>{let t=E.getTableFilterRange();o.executeCommand(Mt.id,{unitId:f,subUnitId:m,range:t,orderRules:[{colIndex:v+t.startColumn,type:e?Nt.ASC:Nt.DESC}],hasTitle:!1}),D.setSortState(v,e?pe.Asc:pe.Desc),O()},A=()=>{if(C===Yt.Items){let e=[];for(let t of y)x.has(t.title)&&e.push(t.title);let t=E.getTableFilterColumn(v);if(t){if(t.values.join(`,`)===e.join(`,`)){O();return}}else if(e.length===0){O();return}let n={filterType:me.manual,values:e};r.setTableFilter(f,h,v,n)}else{let e;e=T.compare===N.Quarter||T.compare===N.Month?{conditionType:T.type,compareType:Object.values(T.info)[0]}:{conditionType:T.type,compareType:T.compare,expectedValue:Object.values(T.info)[0]};let t={filterType:me.condition,filterInfo:e};r.setTableFilter(f,h,v,t)}O()},re=()=>{r.setTableFilter(f,h,v,void 0),O()},j=new Et(f).id;return K(`div`,{className:`
|
|
12
|
+
univer-box-border univer-flex univer-min-w-[312px] univer-flex-col univer-rounded-[10px] univer-bg-white
|
|
13
|
+
univer-p-4 univer-shadow-lg
|
|
14
|
+
dark:!univer-border-gray-600 dark:!univer-bg-gray-700
|
|
15
|
+
`,children:[((e=s.getPermissionPoint(j))==null?void 0:e.value)&&G(`div`,{className:`univer-mb-3 univer-flex`,children:K(Xe,{className:`univer-mb-3 !univer-flex univer-w-full`,children:[K(Ye,{className:`univer-w-1/2`,onClick:()=>k(!0),children:[G(ct,{className:`univer-mr-1`}),t.t(`sheets-sort.general.sort-asc`)]}),K(Ye,{className:`univer-w-1/2`,onClick:()=>k(!1),children:[G(ut,{className:`univer-mr-1`}),t.t(`sheets-sort.general.sort-desc`)]})]})}),G(`div`,{className:`univer-w-full`,children:G(at,{value:C,items:n,onChange:e=>w(e)})}),G(`div`,{className:`univer-z-10 univer-h-60`,children:G(`div`,{className:`univer-mt-3 univer-size-full`,children:C===Yt.Items?G(cn,{tableFilter:g,unitId:f,subUnitId:m,tableId:h,columnIndex:v,checkedItemSet:x,setCheckedItemSet:S}):G(on,{tableFilter:g,unitId:f,subUnitId:m,tableId:h,columnIndex:v,conditionInfo:T,onChange:ee})})}),K(`div`,{className:`
|
|
16
|
+
univer-flex-wrap-nowrap univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0
|
|
17
|
+
univer-justify-between univer-gap-6 univer-overflow-hidden
|
|
18
|
+
`,children:[G(Ye,{disabled:g===void 0,onClick:re,children:t.t(`sheets-table.filter.clear-filter`)}),K(`div`,{children:[G(Ye,{className:`univer-mr-2`,onClick:ne,children:t.t(`sheets-table.filter.cancel`)}),G(Ye,{variant:`primary`,onClick:A,children:t.t(`sheets-table.filter.confirm`)})]})]})]})}function un(e){return It(()=>[{label:e.t(`sheets-table.filter.by-values`),value:Yt.Items},{label:e.t(`sheets-table.filter.by-conditions`),value:Yt.Condition}],[e.getCurrentLocale(),e])}let dn=class extends r{constructor(e,t,n,r){super(),this._componentManager=e,this._contextService=t,this._sheetCanvasPopupService=n,this._dialogService=r,Y(this,`_popupDisposable`,void 0),Y(this,`_currentTableFilterInfo`,null),this._initComponents(),this._initUIPopup()}setCurrentTableFilterInfo(e){this._currentTableFilterInfo=e}clearCurrentTableFilterInfo(){this._currentTableFilterInfo=null}getCurrentTableFilterInfo(){return this._currentTableFilterInfo}_initComponents(){[[Ut,ln]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}_initUIPopup(){this.disposeWithMe(this._contextService.subscribeContextValue$(Ut).pipe(qe(void 0),Ue()).subscribe(e=>{e?this._openFilterPopup():e===!1&&this._closeFilterPopup()}))}closeFilterPanel(){this._contextService.setContextValue(Ut,!1)}_openFilterPopup(){let e=this._currentTableFilterInfo;if(!e)throw Error(`[SheetsFilterUIController]: no filter model when opening filter popup!`);let{row:t,column:n}=e;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(t,n,{componentKey:Ut,direction:`horizontal`,onClickOutside:()=>{this._dialogService.close(`UNIVER_SHEET_Table_FILTER_PANEL_ID`),this._contextService.setContextValue(Ut,!1)},offset:[5,0],portal:!0})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null,this.clearCurrentTableFilterInfo()}};dn=Z([X(0,u(Ae)),X(1,s),X(2,u(Ce)),X(3,u(Ne))],dn);const fn={type:t.OPERATION,id:`sheet.operation.open-table-filter-panel`,async handler(e,t){if(!t)return!1;let{row:n,col:r,unitId:i,subUnitId:a,tableId:o}=t,c=e.get(P),l=e.get(s),u=e.get(dn);return c.getTable(i,o)?(l.getContextValue(`SHEETS_TABLE_FILTER_PANEL_OPENED_KEY`)||(u.setCurrentTableFilterInfo({unitId:i,subUnitId:a,row:n,tableId:o,column:r}),l.setContextValue(Ut,!0)),!0):!1}},pn={type:t.OPERATION,id:`sheet.operation.open-table-selector`,async handler(e){var t;let n=e.get(l),r=e.get(a),i=At(n);if(!i)return!1;let{unitId:o,subUnitId:s,worksheet:c}=i,u=e.get(Tt).getCurrentLastSelection(),d=(t=u==null?void 0:u.range)==null?{startRow:0,endRow:0,startColumn:0,endColumn:0}:t,f=await mn(e,o,s,jt(u)?Ot(d,{up:!0,left:!0,right:!0,down:!0},c):d);return f?(r.executeCommand(ne.id,{...f}),!0):!1}};async function mn(e,t,n,r,i){let a=e.get(Ne),o=e.get(p);return new Promise(e=>{let s={unitId:t,subUnitId:n,range:r,tableId:i,onConfirm:t=>{e(t),a.close(Gt)},onCancel:()=>{e(null),a.close(Gt)}};a.open({id:Gt,title:{title:o.t(`sheets-table.selectRange`)},draggable:!0,destroyOnClose:!0,mask:!1,maskClosable:!1,children:{label:{name:Gt,props:s}},width:300,onClose:()=>{e(null),a.close(Gt)}})})}const hn=`sheets-table-ui.config`;Symbol(hn);const gn={anchorHeight:24,anchorBackgroundColor:`rgb(134,139,156)`};let _n=class extends r{constructor(e){super(),this._commandService=e,Y(this,`_refreshTable`,new Ve),Y(this,`refreshTable$`,this._refreshTable.asObservable()),this._initListener()}_initListener(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===yt.id){let{styleName:t}=e.params;t.startsWith(j)&&this._refreshTable.next(Math.random())}}))}};_n=Z([X(0,u(a))],_n);const vn=()=>{var e,t;let[n,r]=W(``),[i,s]=W(``),c=R(Fe),[u,f]=W({}),m=R(d),h=z(R(yn).anchorPosition$),_=R(a),v=R(l),y=z(R(Dt).unitPermissionInitStateChange$,!1),b=R(P),S=R(wt),C=z(R(_n).refreshTable$),w=R(p),T=z(R(Tt).selectionChanged$,[{range:x(0,0),primary:null}]),[,ee]=W(Math.random()),E=R(o).getConfig(hn),D=(e=E==null?void 0:E.anchorHeight)==null?24:e,te=(t=E==null?void 0:E.anchorBackgroundColor)==null?`rgb(53,91,183)`:t,O=(e,t)=>{f(n=>({...n,[e]:t}))};if(Ft(()=>{ee(Math.random())},[C]),!(h!=null&&h.length))return null;let ne=At(v);if(!ne)return null;let{unitId:k,subUnitId:re}=ne,j=(e,t)=>{var n;if(((n=b.getTableById(k,e))==null?void 0:n.getDisplayName())===t){r(``),s(``);return}_.executeCommand(ie.id,{tableId:e,unitId:k,name:t}),s(``),r(``)},ae=async e=>{let t=b.getTableById(k,e);if(!t)return;let n=await mn(m,k,re,t.getRange(),e);n&&_.executeCommand(ie.id,{tableId:e,unitId:k,updateRange:{newRange:n.range}})};return y?G(`div`,{className:`univer-absolute univer-z-50 univer-size-0`,children:h.map(e=>{var t,a,o,l,d;let f=b.getTableById(k,e.tableId);if(!f)return null;let p=S.getRangeThemeStyle(k,f.getTableStyleId()),m=(t=p==null||(a=p.getHeaderRowStyle())==null||(a=a.bg)==null?void 0:a.rgb)==null?te:t,h=(o=p==null||(l=p.getHeaderRowStyle())==null||(l=l.cl)==null?void 0:l.rgb)==null?`rgb(255, 255, 255)`:o,v=f.getRange();if(!(T!=null&&T.length))return null;let y=T[T.length-1].range,x=!g.intersects(v,y)&&e.y<=20;return K(`div`,{className:U(`
|
|
19
|
+
univer-shadow-xs univer-absolute univer-box-border univer-cursor-pointer univer-items-center
|
|
20
|
+
univer-rounded-xl univer-px-2
|
|
21
|
+
`,H,{"univer-flex":!x,"univer-hidden":x}),style:{left:e.x,top:Math.max(e.y,0),backgroundColor:m,color:h,borderWidth:`0.5px`,height:D?`${D}px`:`24px`},children:[G(`div`,{className:`univer-text-nowrap`,children:n===e.tableId?G(rt,{className:`univer-h-[18px] univer-min-w-16 univer-rounded-none`,inputClass:`univer-h-[18px] univer-w-[80px]`,value:i,onChange:e=>s(e),onBlur:()=>j(e.tableId,i),onKeyDown:t=>{t.key===`Enter`&&j(e.tableId,i)},autoFocus:n===e.tableId}):G(`div`,{className:`univer-h-[18px] univer-max-w-24 univer-truncate univer-text-sm`,children:e.tableName})}),G(nt,{align:`start`,overlay:K(`div`,{className:`univer-py-2`,children:[K(`div`,{className:`
|
|
22
|
+
univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
|
|
23
|
+
univer-gap-2 univer-px-2 univer-py-1 univer-text-sm
|
|
24
|
+
hover:univer-bg-gray-200
|
|
25
|
+
`,onClick:()=>{r(e.tableId),s(e.tableName)},children:[G(ht,{}),w.t(`sheets-table.rename`)]}),G(`div`,{className:`univer-my-1 univer-h-px univer-w-full univer-bg-gray-200`}),K(`div`,{onClick:()=>ae(e.tableId),className:`
|
|
26
|
+
univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
|
|
27
|
+
univer-gap-2 univer-px-2 univer-py-1 univer-text-sm
|
|
28
|
+
hover:univer-bg-gray-200
|
|
29
|
+
`,children:[G(ft,{}),w.t(`sheets-table.updateRange`)]}),K(`div`,{className:`
|
|
30
|
+
univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
|
|
31
|
+
univer-gap-2 univer-px-2 univer-py-1 univer-text-sm
|
|
32
|
+
hover:univer-bg-gray-200
|
|
33
|
+
`,onClick:()=>{O(e.tableId,!1);let t=b.getTableById(k,e.tableId);if(!t)return;let n=t.getTableConfig(),r={id:`SHEET_TABLE_THEME_PANEL_ID`,header:{title:w.t(`sheets-table.tableStyle`)},children:{label:Kt,oldConfig:n,unitId:k,subUnitId:re,tableId:e.tableId},width:330};c.open(r)},children:[G(mt,{extend:{colorChannel1:`rgb(53,91,183)`}}),w.t(`sheets-table.setTheme`)]}),G(`div`,{className:`univer-my-1 univer-h-px univer-w-full univer-bg-gray-200`}),K(`div`,{className:`
|
|
34
|
+
univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
|
|
35
|
+
univer-px-2 univer-py-1 univer-text-sm
|
|
36
|
+
hover:univer-bg-gray-200
|
|
37
|
+
`,onClick:()=>{O(e.tableId,!1),_.executeCommand(A.id,{tableId:e.tableId,subUnitId:re,unitId:k})},children:[G(lt,{className:`univer-mr-2`}),w.t(`sheets-table.removeTable`)]})]}),open:(d=u[e.tableId])==null?!1:d,onOpenChange:t=>{O(e.tableId,t)},children:G(`div`,{children:G(pt,{})})},e.tableId)]},e.tableId)})}):null};let yn=class extends r{constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._renderManagerService=r,this._commandService=i,this._univerInstanceService=a,this._uiPartsService=o,this._tableManager=s,this._scrollManagerService=c,this._workbookPermissionService=l,this._permissionService=u,Y(this,`_anchorVisible$`,new Be(!0)),Y(this,`_timer`,void 0),Y(this,`_anchorPosition$`,new Be([])),Y(this,`anchorPosition$`,this._anchorPosition$.asObservable()),this._initUI(),this._initListener(),this._initTableAnchor()}_initUI(){this.disposeWithMe(this._uiPartsService.registerComponent(ke.CONTENT,()=>Re(vn,this._injector)))}_initListener(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{(e.id===Se.id||e.id===xe.id)&&(this._anchorVisible$.next(!1),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{this._anchorVisible$.next(!0)},300))}))}_initTableAnchor(){this.disposeWithMe(Ke(this._context.unit.activeSheet$,this._sheetSkeletonManagerService.currentSkeleton$,this._scrollManagerService.validViewportScrollInfo$,this._tableManager.tableAdd$,this._tableManager.tableDelete$,this._tableManager.tableNameChanged$,this._tableManager.tableRangeChanged$,this._tableManager.tableThemeChanged$,this._workbookPermissionService.unitPermissionInitStateChange$.pipe(We(e=>e)),this._permissionService.permissionPointUpdate$.pipe(He(300)),this._anchorVisible$).subscribe(()=>{var e;if(!this._anchorVisible$.getValue()){this._anchorPosition$.next([]);return}let t=this._context.unit,n=t.getActiveSheet(),r=n==null?void 0:n.getSheetId(),i=this._tableManager.getTableList(this._context.unitId).filter(e=>e.subUnitId===r),a=this._renderManagerService.getRenderById(this._context.unitId);if(!a){this._anchorPosition$.next([]);return}if(!((e=this._permissionService.getPermissionPoint(new Et(t.getUnitId()).id))!=null&&e.value)){this._anchorPosition$.next([]);return}let o=i.reduce((e,t)=>{let{startRow:n,startColumn:r}=t.range,i=a.with(Te),o=Oe(this._univerInstanceService,this._renderManagerService);if(!o)return e;let{scene:s}=o,c=s.getViewport(E.VIEW_MAIN);if(!c)return e;let l=s==null?void 0:s.scaleX,u=s==null?void 0:s.scaleY,d=s==null?void 0:s.getViewportScrollXY(c);if(!l||!s||!u||!d)return e;let f=i.getCurrentSkeleton();if(!f)return e;let p=f.getNoMergeCellWithCoordByIndex(n,r),m=te(p.startX,l,d),h=O(p.startY,u,d)-25-4;return h>=-10&&m>=45&&e.push({x:m,y:h,tableId:t.id,tableName:t.name}),e},[]);this._anchorPosition$.next(o)}))}};yn=Z([X(1,u(d)),X(2,u(Te)),X(3,T),X(4,a),X(5,l),X(6,Ie),X(7,u(P)),X(8,u(we)),X(9,u(Dt)),X(10,u(c))],yn),new Path2D(`M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z`);var bn=class{static drawNoSetting(e,t,n,r){e.save(),ee.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.lineCap=`square`,e.strokeStyle=n,e.scale(t/16,t/16),e.beginPath(),e.lineWidth=1,e.lineCap=`round`,e.moveTo(3,4),e.lineTo(13,4),e.moveTo(4.5,8),e.lineTo(11.5,8),e.moveTo(6,12),e.lineTo(10,12),e.stroke(),e.restore()}static drawIconByPath(e,t,n,r){e.save(),e.strokeStyle=n,e.fillStyle=r,ee.drawWith(e,{radius:2,width:16,height:16,fill:r}),t.forEach(t=>{let r=new Path2D(t);e.fillStyle=n,e.fill(r,`evenodd`)}),e.restore()}};const xn=[`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`],Sn=[`M12.4008 13.1831C12.6907 13.1831 12.9258 12.9481 12.9258 12.6581V4.60873L14.013 5.69597C14.218 5.901 14.5505 5.901 14.7555 5.69597C14.9605 5.49094 14.9605 5.15853 14.7555 4.95351L12.7721 2.97017C12.5671 2.76515 12.2347 2.76515 12.0297 2.97017L10.0463 4.95351C9.84132 5.15853 9.84132 5.49094 10.0463 5.69597C10.2514 5.901 10.5838 5.901 10.7888 5.69597L11.8758 4.60901V12.6581C11.8758 12.9481 12.1108 13.1831 12.4008 13.1831Z`,`M1.28069 4.85447C0.842195 4.33439 1.21191 3.5391 1.89218 3.5391H8.59333C9.2736 3.5391 9.64331 4.33439 9.20482 4.85447L6.51052 8.0501V11.6601C6.51052 12.2245 5.94174 12.6114 5.41683 12.404L4.48092 12.0343C4.1756 11.9136 3.97498 11.6187 3.97498 11.2904V8.0501L1.28069 4.85447Z`],Cn=[`M12.4008 2.81641C12.6907 2.81641 12.9258 3.05146 12.9258 3.34141V11.3908L14.013 10.3036C14.218 10.0986 14.5505 10.0986 14.7555 10.3036C14.9605 10.5086 14.9605 10.841 14.7555 11.046L12.7721 13.0294C12.5671 13.2344 12.2347 13.2344 12.0297 13.0294L10.0463 11.046C9.84132 10.841 9.84132 10.5086 10.0463 10.3036C10.2514 10.0986 10.5838 10.0986 10.7888 10.3036L11.8758 11.3905V3.34141C11.8758 3.05146 12.1108 2.81641 12.4008 2.81641Z`,`M1.28069 4.85444C0.842195 4.33435 1.21191 3.53906 1.89218 3.53906H8.59333C9.2736 3.53906 9.64331 4.33435 9.20482 4.85443L6.51052 8.05006V11.6601C6.51052 12.2245 5.94174 12.6113 5.41683 12.404L4.48092 12.0342C4.1756 11.9136 3.97498 11.6186 3.97498 11.2903V8.05006L1.28069 4.85444Z`],wn=[`M11.9003 13.7046C11.9003 13.9969 11.6633 14.2339 11.371 14.2339C11.0787 14.2339 10.8417 13.9969 10.8417 13.7046V3.57272L9.74577 4.66862C9.53906 4.87534 9.20391 4.87534 8.9972 4.66862C8.79048 4.46191 8.79048 4.12676 8.9972 3.92005L10.9969 1.92039C11.2036 1.71368 11.5387 1.71368 11.7454 1.92039L13.7451 3.92005C13.9518 4.12676 13.9518 4.46191 13.7451 4.66862C13.5384 4.87534 13.2032 4.87534 12.9965 4.66862L11.9003 3.57243V13.7046Z`,`M2.69779 10.0113C2.40546 10.0113 2.16847 9.77429 2.16847 9.48196C2.16847 9.18962 2.40546 8.95264 2.69779 8.95264H6.67804C6.89213 8.95264 7.08514 9.0816 7.16707 9.2794C7.249 9.47719 7.20371 9.70486 7.05233 9.85624L3.97569 12.9329H6.67804C6.97038 12.9329 7.20736 13.1699 7.20736 13.4622C7.20736 13.7545 6.97038 13.9915 6.67804 13.9915H2.69779C2.4837 13.9915 2.29069 13.8626 2.20876 13.6648C2.12684 13.467 2.17212 13.2393 2.32351 13.0879L5.40015 10.0113H2.69779Z`,`M5.51638 2.58693C5.23363 1.81542 4.14248 1.81543 3.85973 2.58693L2.13245 7.29995C2.03185 7.57443 2.17281 7.87849 2.4473 7.97909C2.72178 8.07969 3.02584 7.93872 3.12644 7.66424L3.64346 6.25351L3.64504 6.25351H5.73266L6.24968 7.66424C6.35027 7.93872 6.65433 8.07969 6.92882 7.97909C7.2033 7.87849 7.34426 7.57443 7.24367 7.29995L5.51638 2.58693ZM5.34467 5.19487L4.68806 3.40325L4.03144 5.19487H5.34467Z`],Tn=[`M11.9003 2.29495C11.9003 2.00261 11.6633 1.76562 11.371 1.76562C11.0787 1.76562 10.8417 2.00261 10.8417 2.29495V12.4268L9.74577 11.3309C9.53906 11.1242 9.20391 11.1242 8.9972 11.3309C8.79048 11.5376 8.79048 11.8727 8.9972 12.0795L10.9969 14.0791C11.2036 14.2858 11.5387 14.2858 11.7454 14.0791L13.7451 12.0795C13.9518 11.8727 13.9518 11.5376 13.7451 11.3309C13.5384 11.1242 13.2032 11.1242 12.9965 11.3309L11.9003 12.4271V2.29495Z`,`M2.69792 10.0113C2.40558 10.0113 2.16859 9.77429 2.16859 9.48196C2.16859 9.18962 2.40558 8.95264 2.69792 8.95264H6.67816C6.89225 8.95264 7.08526 9.0816 7.16719 9.2794C7.24912 9.47719 7.20384 9.70486 7.05245 9.85624L3.97581 12.9329H6.67816C6.9705 12.9329 7.20749 13.1699 7.20749 13.4622C7.20749 13.7545 6.9705 13.9915 6.67816 13.9915H2.69792C2.48383 13.9915 2.29082 13.8626 2.20889 13.6648C2.12696 13.467 2.17224 13.2393 2.32363 13.0879L5.40027 10.0113H2.69792Z`,`M5.5165 2.58693C5.23375 1.81542 4.1426 1.81543 3.85985 2.58693L2.13257 7.29995C2.03197 7.57443 2.17294 7.8785 2.44742 7.97909C2.7219 8.07969 3.02596 7.93872 3.12656 7.66424L3.64358 6.25351L3.64516 6.25351H5.73278L6.2498 7.66424C6.35039 7.93872 6.65446 8.07969 6.92894 7.97909C7.20342 7.8785 7.34438 7.57443 7.24379 7.29995L5.5165 2.58693ZM5.34479 5.19487L4.68818 3.40325L4.03156 5.19487H5.34479Z`];let En=class extends D{constructor(e,t,n,r,i){super(e,t),this._contextService=n,this._commandService=r,this._themeService=i,Y(this,`_cellWidth`,0),Y(this,`_cellHeight`,0),Y(this,`_filterParams`,void 0),Y(this,`_hovered`,!1),this.setShapeProps(t),this.onPointerDown$.subscribeEvent(e=>this.onPointerDown(e)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){e.cellHeight!==void 0&&(this._cellHeight=e.cellHeight),e.cellWidth!==void 0&&(this._cellWidth=e.cellWidth),e.filterParams!==void 0&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){let t=this._cellHeight,n=this._cellWidth,r=16-n,i=16-t;e.save();let a=new Path2D;a.rect(r,i,n,t),e.clip(a);let{buttonState:o}=this._filterParams,s=this._themeService.getColorFromTheme(`primary.600`),c=this._hovered?this._themeService.getColorFromTheme(`gray.50`):`rgba(255, 255, 255, 1.0)`,l;switch(o){case de.FilteredSortNone:l=xn;break;case de.FilteredSortAsc:l=Sn;break;case de.FilteredSortDesc:l=Cn;break;case de.FilterNoneSortNone:break;case de.FilterNoneSortAsc:l=wn;break;case de.FilterNoneSortDesc:l=Tn;break}l?bn.drawIconByPath(e,l,s,c):o!==void 0&&bn.drawNoSetting(e,16,s,c),e.restore()}onPointerDown(e){if(e.button===2)return;let{row:t,col:n,unitId:r,subUnitId:i,tableId:a}=this._filterParams;this._contextService.getContextValue(`SHEETS_TABLE_FILTER_PANEL_OPENED_KEY`)||!this._commandService.hasCommand(fn.id)||setTimeout(()=>{let e={row:t,col:n,unitId:r,subUnitId:i,tableId:a};this._commandService.executeCommand(fn.id,e)},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};En=Z([X(2,s),X(3,a),X(4,u(v))],En);const Dn=(e,t,n,r)=>{switch(r){case b.TOP:return e+1;case b.MIDDLE:return e+Math.max(0,(n-16)/2);case b.BOTTOM:default:return t-16-1}};let On=class extends _{constructor(e,t,n,r,i,a){super(),this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._sheetInterceptorService=r,this._tableManager=i,this._commandService=a,Y(this,`_buttonRenderDisposable`,null),Y(this,`_tableFilterButtonShapes`,[]),this._initRenderer(),this._initCommandExecuted()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){let e=this._tableManager;this._sheetSkeletonManagerService.currentSkeleton$.pipe(V(t=>{var n;if(!t)return B(null);let{unit:r,unitId:i}=this._context,a=((n=r.getActiveSheet())==null?void 0:n.getSheetId())||``,o=()=>({unitId:i,worksheetId:a,tableFilterRanges:this._tableManager.getSheetFilterRangeWithState(r.getUnitId(),a),skeleton:t.skeleton});return Ke(e.tableAdd$,e.tableNameChanged$,e.tableRangeChanged$,e.tableThemeChanged$,e.tableDelete$,e.tableFilterChanged$).pipe(Ge(()=>o()),qe(o()))}),Je(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.tableFilterRanges)&&this._renderButtons(e)})}_initCommandExecuted(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var t;if(e.id!==St.id)return;let{unit:n,unitId:r}=this._context,i=((t=n.getActiveSheet())==null?void 0:t.getSheetId())||``,a=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!a)return;let o={unitId:r,worksheetId:i,tableFilterRanges:this._tableManager.getSheetFilterRangeWithState(n.getUnitId(),i),skeleton:a};this._disposeRendering(),!(!o||!o.tableFilterRanges)&&this._renderButtons(o)}))}_renderButtons(e){let{tableFilterRanges:t,unitId:n,skeleton:r,worksheetId:i}=e,{unit:a,scene:o}=this._context,s=a.getSheetBySheetId(i);if(s){for(let{range:e,states:a,tableId:c}of t){let{startRow:t,startColumn:l,endColumn:u}=e;this._interceptCellContent(n,i,e);for(let e=l;e<=u;e++){let u=`sheets-table-filter-button-${t}-${e}`,d=Ee(t,e,o,r),f=s.getCellStyle(t,e),p=(f==null?void 0:f.vt)||b.BOTTOM,{startX:m,startY:h,endX:g,endY:_}=d,v=g-m,y=_-h;if(y<=1||v<=1)continue;let x=a[e-l],S={left:g-16-1,top:Dn(h,_,y,p),height:16,width:16,zIndex:5e3,cellHeight:y,cellWidth:v,filterParams:{unitId:n,subUnitId:i,row:t,col:e,buttonState:x,tableId:c}},C=this._injector.createInstance(En,u,S);this._tableFilterButtonShapes.push(C)}}o.addObjects(this._tableFilterButtonShapes),o.makeDirty()}}_interceptCellContent(e,t,n){let{startRow:r,startColumn:i,endColumn:a}=n;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(_t.CELL_CONTENT,{effect:f.Style,handler:(n,o,s)=>{let{row:c,col:l,unitId:u,subUnitId:d}=o;return u!==e||d!==t||c!==r||l<i||l>a?s(n):((!n||n===o.rawData)&&(n={...o.rawData}),n.fontRenderExtension={...n==null?void 0:n.fontRenderExtension,rightOffset:16},s(n))},priority:10})}_disposeRendering(){var e;this._tableFilterButtonShapes.forEach(e=>e.dispose()),(e=this._buttonRenderDisposable)==null||e.dispose(),this._buttonRenderDisposable=null,this._tableFilterButtonShapes=[]}};On=Z([X(1,u(d)),X(2,u(Te)),X(3,u(Ct)),X(4,u(P)),X(5,a)],On);let kn=class extends _{constructor(e,t,n,r,i){super(),this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._tableManager=r,this._sheetTableThemeUIController=i,this._initListener()}_dirtySkeleton(){var e;(e=this._context.mainComponent)==null||e.makeDirty();let t=this._sheetSkeletonManagerService.getCurrentParam();if(t){let e={...t,dirty:!0};this._sheetSkeletonManagerService.reCalculate(e)}}_initListener(){let e=this._tableManager,t=this._dirtySkeleton.bind(this);this.disposeWithMe(Ke(e.tableAdd$,e.tableDelete$,e.tableNameChanged$,e.tableRangeChanged$,e.tableThemeChanged$,e.tableFilterChanged$,e.tableInitStatus$,this._sheetTableThemeUIController.refreshTable$).subscribe(t))}};kn=Z([X(1,u(d)),X(2,u(Te)),X(3,u(P)),X(4,u(_n))],kn);let An=class extends r{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._tableManager=n,this._initSelectionChange()}_initSelectionChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===be.id){let t=At(this._univerInstanceService);if(!t)return{redos:[],undos:[]};let{range:n}=e.params,{unitId:r,subUnitId:i,worksheet:a}=t,o=this._tableManager.getTablesBySubunitId(r,i).find(e=>{let t=e.getRange();return g.contains(t,n)});if(o){let e=o.getRange(),t={...e,startRow:e.startRow+1};return g.equals(e,n)?{undos:[],redos:[]}:g.equals(t,n)?{undos:[],redos:[{id:xt.id,params:{unitId:r,subUnitId:i,selections:[{range:e,primary:kt(e,a)}]}}]}:{undos:[],redos:[{id:xt.id,params:{unitId:r,subUnitId:i,selections:[{range:t,primary:kt(t,a)}]}}]}}}return{redos:[],undos:[]}}}))}};An=Z([X(0,u(Ct)),X(1,u(l)),X(2,u(P))],An);const jn=e=>{let{unitId:t,subUnitId:n,range:r,onCancel:i,onConfirm:a,tableId:o}=e,s=R(P),[c,u]=W(r),[d,f]=W(``),m=R(p),h=R(l);return K(Lt,{children:[G(Bt,{maxRangeCount:1,unitId:t,subUnitId:n,initialValue:zt(r),onChange:(e,i)=>{let c=zt(r),l=Rt(i).range,d=At(h,{unitId:t,subUnitId:n});if(!d)return;if(d.worksheet.getMergeData().some(e=>g.intersects(l,e))){f(m.t(`sheets-table.tableRangeWithMergeError`));return}if(s.getTablesBySubunitId(t,n).some(e=>{if(e.getId()===o)return!1;let t=e.getRange();return g.intersects(l,t)})){f(m.t(`sheets-table.tableRangeWithOtherTableError`));return}let{startRow:p,endRow:_}=l;if(p===_){f(m.t(`sheets-table.tableRangeSingleRowError`));return}if(c!==i){if(o){let e=s.getTableById(t,o);if(e){let r=e.getRange();if(g.intersects(l,r)&&r.startRow===l.startRow){u(l),f(``),a({unitId:t,subUnitId:n,range:l});return}else{f(m.t(`sheets-table.updateError`));return}}}u(l),f(``)}},supportAcrossSheet:!1}),d&&G(`div`,{className:`univer-mt-1 univer-text-xs univer-text-red-500`,children:d}),K(`div`,{className:`univer-mt-4 univer-flex univer-justify-end`,children:[G(Ye,{onClick:i,children:m.t(`sheets-table.cancel`)}),G(Ye,{variant:`primary`,onClick:()=>{d||a({unitId:t,subUnitId:n,range:c})},className:`univer-ml-2`,children:m.t(`sheets-table.confirm`)})]})]})},Mn=t=>{var n,r,o,s,c,l,u,d;let{unitId:f,subUnitId:m,tableId:h}=t,g=R(a),_=R(p),v=R(P),y=v.getTableById(f,h),b=R(wt),x=R(_n),S=z(b.rangeThemeMapChange$),C=z(x.refreshTable$),w=R(i),[,T]=W(Math.random()),ee=z(v.tableThemeChanged$,{theme:y==null?void 0:y.getTableStyleId(),oldTheme:y==null?void 0:y.getTableStyleId(),unitId:f,subUnitId:m,tableId:h}),E=b.getRegisteredRangeThemes().filter(e=>e==null?void 0:e.startsWith(`table-default-`)),D=b.getALLRegisteredTheme(f).filter(e=>e==null?void 0:e.startsWith(qt)),te=y==null?void 0:y.getTableStyleId(),O=D.find(e=>e===te),ne=O||D[0],A=b.getCustomRangeThemeStyle(f,ne),j=(n=A==null||(r=A.getHeaderRowStyle())==null||(r=r.bg)==null?void 0:r.rgb)==null?Jt:n,ae=(o=A==null||(s=A.getFirstRowStyle())==null||(s=s.bg)==null?void 0:s.rgb)==null?Jt:o,oe=(c=A==null||(l=A.getSecondRowStyle())==null||(l=l.bg)==null?void 0:l.rgb)==null?Jt:c,se=(u=A==null||(d=A.getLastRowStyle())==null||(d=d.bg)==null?void 0:d.rgb)==null?Jt:u,[ce,le]=W(null),ue=e=>{g.executeCommand(ie.id,{unitId:f,tableId:h,theme:e})},de=()=>{if(D.length>=11){w.emit(_.t(`sheets-table.customTooMore`));return}let e=D[D.length-1],t=`${qt}1`;e&&(t=`${qt}${Number(e.split(`-`)[2])+1}`);let n=new vt(t,{...ge});g.executeCommand(k.id,{unitId:f,tableId:h,themeStyle:n})},fe=(e,t)=>{g.executeCommand(yt.id,{unitId:f,subUnitId:m,styleName:e,style:t})},pe=e=>{g.executeCommand(re.id,{unitId:f,tableId:h,themeName:e})};if(Ft(()=>{T(Math.random())},[S,C]),!y)return null;let me=new e(j).isDark(),M=new e(ae).isDark(),N=new e(oe).isDark(),F=new e(se).isDark();return K(`div`,{children:[G(`h5`,{children:_.t(`sheets-table.defaultStyle`)}),G(`div`,{className:`univer-flex univer-gap-2`,children:E.map(e=>{var t,n,r,i;let a=b.getDefaultRangeThemeStyle(e),o=(a==null||(t=a.getHeaderRowStyle())==null||(t=t.bg)==null?void 0:t.rgb)||`rgb(255, 255, 255)`,s=(a==null||(n=a.getFirstRowStyle())==null||(n=n.bg)==null?void 0:n.rgb)||`rgb(255, 255, 255)`,c=(a==null||(r=a.getSecondRowStyle())==null||(r=r.bg)==null?void 0:r.rgb)||`rgb(255, 255, 255)`,l=(a==null||(i=a.getLastRowStyle())==null||(i=i.bg)==null?void 0:i.rgb)||`rgb(255, 255, 255)`;return K(`div`,{className:U(`
|
|
38
|
+
univer-h-10 univer-w-8 univer-cursor-pointer univer-border univer-border-solid
|
|
39
|
+
univer-border-gray-200 univer-p-px
|
|
40
|
+
[&>div]:univer-box-border [&>div]:univer-h-2.5
|
|
41
|
+
`,{"univer-border-blue-500":e===ee.theme}),onClick:()=>ue(e),children:[G(`div`,{style:{background:o,border:`${o?q:J}`}}),G(`div`,{style:{background:s,border:`${s?q:J}`}}),G(`div`,{style:{background:c,border:`${c?q:J}`}}),G(`div`,{style:{background:l,border:`${l?q:J}`}})]},e)})}),G(`h5`,{children:_.t(`sheets-table.customStyle`)}),K(`div`,{className:U(`univer-w-full univer-rounded-sm`,H),children:[K(`div`,{className:`univer-flex univer-flex-wrap univer-gap-2 univer-p-2`,children:[G(`div`,{className:U(`
|
|
42
|
+
univer-h-10 univer-w-8 univer-cursor-pointer univer-p-px univer-text-center univer-leading-10
|
|
43
|
+
`,H),onClick:de,children:`+`}),D.map(e=>{var t,n,r,i;let a=b.getCustomRangeThemeStyle(f,e),o=a==null||(t=a.getHeaderRowStyle())==null||(t=t.bg)==null?void 0:t.rgb,s=a==null||(n=a.getFirstRowStyle())==null||(n=n.bg)==null?void 0:n.rgb,c=a==null||(r=a.getSecondRowStyle())==null||(r=r.bg)==null?void 0:r.rgb,l=a==null||(i=a.getLastRowStyle())==null||(i=i.bg)==null?void 0:i.rgb;return K(`div`,{className:U(`
|
|
44
|
+
univer-relative univer-h-10 univer-w-8 univer-cursor-pointer univer-border
|
|
45
|
+
univer-border-solid univer-border-gray-200 univer-p-px
|
|
46
|
+
`,{"univer-border-blue-500":e===ee.theme}),onClick:()=>ue(e),onMouseEnter:()=>le(e),onMouseLeave:()=>le(null),children:[G(`div`,{className:`univer-box-border univer-h-2.5`,style:{background:o==null?q:o,border:`${o?q:J}`}}),G(`div`,{className:`univer-box-border univer-h-2.5`,style:{background:s==null?q:s,border:`${s?q:J}`}}),G(`div`,{className:`univer-box-border univer-h-2.5`,style:{background:c==null?q:c,border:`${c?q:J}`}}),G(`div`,{className:`univer-box-border univer-h-2.5`,style:{background:l==null?q:l,border:`${l?q:J}`}}),G(`div`,{className:`
|
|
47
|
+
univer-absolute univer-right-[-3px] univer-top-[-3px] univer-size-3
|
|
48
|
+
univer-rounded-md univer-bg-gray-200 univer-text-center univer-text-xs
|
|
49
|
+
univer-leading-[10px]
|
|
50
|
+
`,style:{display:ce===e?`block`:`none`},onClick:t=>{t.stopPropagation(),pe(e)},children:`x`})]},e)})]}),O&&K(Lt,{children:[G(`div`,{className:`univer-h-px univer-w-full univer-bg-gray-200`}),K(`div`,{className:`univer-flex univer-flex-col univer-gap-2 univer-p-2`,children:[K(`div`,{className:`univer-flex univer-h-9 univer-gap-2`,children:[G(`div`,{className:U(`
|
|
51
|
+
univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center
|
|
52
|
+
univer-leading-9
|
|
53
|
+
`,H,{"univer-text-white":me,"univer-text-gray-900":!me}),style:{background:j},children:_.t(`sheets-table.header`)}),G(nt,{overlay:G(`div`,{className:`univer-p-2`,children:G($e,{value:j,onChange:t=>{let n=ye(`headerRowStyle`,{bg:{rgb:t},cl:{rgb:new e(t).isDark()?`#fff`:`#000`}});fe(y.getTableStyleId(),{headerRowStyle:n})}})}),children:K(`div`,{className:U(`
|
|
54
|
+
univer-flex univer-cursor-pointer univer-items-center univer-gap-2
|
|
55
|
+
univer-rounded-sm univer-bg-white univer-p-1
|
|
56
|
+
`,H),children:[G(`div`,{className:U(`univer-size-4 univer-rounded-lg univer-bg-gray-400`,H,{"univer-text-white":me,"univer-text-gray-900":!me}),style:{background:j}}),G(dt,{className:`univer-size-2`})]})})]}),K(`div`,{className:`univer-flex univer-h-9 univer-gap-2`,children:[G(`div`,{className:U(`
|
|
57
|
+
univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center
|
|
58
|
+
univer-leading-9
|
|
59
|
+
`,H,{"univer-text-white":M,"univer-text-gray-900":!M}),style:{background:ae},children:_.t(`sheets-table.firstLine`)}),G(nt,{overlay:G(`div`,{className:`univer-p-2`,children:G($e,{value:ae,onChange:t=>{fe(y.getTableStyleId(),{firstRowStyle:{bg:{rgb:t},cl:{rgb:new e(t).isDark()?`#fff`:`#000`}}})}})}),children:K(`div`,{className:U(`
|
|
60
|
+
univer-flex univer-cursor-pointer univer-items-center univer-gap-2
|
|
61
|
+
univer-rounded-sm univer-bg-white univer-p-1
|
|
62
|
+
`,H),children:[G(`div`,{className:U(`univer-size-4 univer-rounded-lg univer-bg-gray-400`,H),style:{background:ae}}),G(dt,{className:`univer-size-2`})]})})]}),K(`div`,{className:`univer-flex univer-h-9 univer-gap-2`,children:[G(`div`,{className:U(`
|
|
63
|
+
univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center
|
|
64
|
+
univer-leading-9
|
|
65
|
+
`,H,{"univer-text-white":N,"univer-text-gray-900":!N}),style:{background:oe},children:_.t(`sheets-table.secondLine`)}),G(nt,{overlay:G(`div`,{className:`univer-p-2`,children:G($e,{value:oe,onChange:t=>fe(y.getTableStyleId(),{secondRowStyle:{bg:{rgb:t},cl:{rgb:new e(t).isDark()?`#fff`:`#000`}}})})}),children:K(`div`,{className:U(`
|
|
66
|
+
univer-flex univer-cursor-pointer univer-items-center univer-gap-2
|
|
67
|
+
univer-rounded-sm univer-bg-white univer-p-1
|
|
68
|
+
`,H),children:[G(`div`,{className:U(`univer-size-4 univer-rounded-lg univer-bg-gray-400`,H),style:{background:oe}}),G(dt,{className:`univer-size-2`})]})})]}),K(`div`,{className:`univer-flex univer-h-9 univer-gap-2`,children:[G(`div`,{className:U(`
|
|
69
|
+
univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center
|
|
70
|
+
univer-leading-9
|
|
71
|
+
`,H,{"univer-text-white":F,"univer-text-gray-900":!F}),style:{background:se},children:_.t(`sheets-table.footer`)}),G(nt,{overlay:G(`div`,{className:`univer-p-2`,children:G($e,{value:se,onChange:t=>{let n=ye(`lastRowStyle`,{bg:{rgb:t},cl:{rgb:new e(t).isDark()?`#fff`:`#000`}});fe(y.getTableStyleId(),{lastRowStyle:n})}})}),children:K(`div`,{className:U(`
|
|
72
|
+
univer-flex univer-cursor-pointer univer-items-center univer-gap-2
|
|
73
|
+
univer-rounded-sm univer-bg-white univer-p-1
|
|
74
|
+
`,H),children:[G(`div`,{className:U(`univer-size-4 univer-rounded-lg univer-bg-gray-400`,H),style:{background:se}}),G(dt,{className:`univer-size-2`})]})})]})]})]})]})]})},Nn=`sheet.table.context-insert_menu-id`,Pn=`sheet.table.context-remove_menu-id`;function Fn(e){return{id:pn.id,type:L.BUTTON,icon:Wt,tooltip:`sheets-table.title`,title:`sheets-table.title`,hidden$:ze(e,y.UNIVER_SHEET),disabled$:De(e,{},!0)}}function In(e){return{id:Nn,type:L.SUBITEMS,icon:`InsertDoubleIcon`,title:`sheets-table.insert.main`,hidden$:Hn(e)}}function Ln(e){return{id:Pn,type:L.SUBITEMS,icon:`ReduceDoubleIcon`,title:`sheets-table.remove.main`,hidden$:Hn(e)}}function Rn(e){return{id:se.id,type:L.BUTTON,title:`sheets-table.insert.row`,hidden$:Un(e)}}function zn(e){return{id:oe.id,title:`sheets-table.insert.col`,type:L.BUTTON}}function Bn(e){return{id:le.id,type:L.BUTTON,title:`sheets-table.remove.row`,hidden$:Un(e)}}function Vn(e){return{id:ce.id,title:`sheets-table.remove.col`,type:L.BUTTON}}function Hn(e){let t=e.get(Tt);return e.get(l).getCurrentTypeOfUnit$(y.UNIVER_SHEET).pipe(V(n=>n?n.activeSheet$.pipe(V(r=>r?t.selectionMoveEnd$.pipe(V(t=>{if(!t.length||t.length>1)return B(!0);let i=t[0].range;return B(!e.get(fe).getContainerTableWithRange(n.getUnitId(),r.getSheetId(),i))})):B(!0))):B(!0)))}function Un(e){let t=e.get(Tt);return e.get(l).getCurrentTypeOfUnit$(y.UNIVER_SHEET).pipe(V(n=>n?n.activeSheet$.pipe(V(r=>r?t.selectionMoveEnd$.pipe(V(t=>{if(!t.length||t.length>1)return B(!0);let i=t[0].range,a=e.get(fe).getContainerTableWithRange(n.getUnitId(),r.getSheetId(),i);if(!a)return B(!0);let o=a.getRange();return i.startRow===o.startRow?B(!0):B(!1)})):B(!0))):B(!0)))}const Wn={[Le.ORGANIZATION]:{[pn.id]:{order:0,menuItemFactory:Fn}},[Me.MAIN_AREA]:{[je.LAYOUT]:{[Nn]:{order:5,menuItemFactory:In,[se.id]:{order:1,menuItemFactory:Rn},[oe.id]:{order:2,menuItemFactory:zn}},[Pn]:{order:6,menuItemFactory:Ln,[le.id]:{order:1,menuItemFactory:Bn},[ce.id]:{order:2,menuItemFactory:Vn}}}}};let Gn=class extends r{constructor(e,t){super(),this._componentManager=e,this._menuManagerService=t,this._initComponents(),this._initMenu()}_initComponents(){[[Wt,gt],[Gt,jn],[Kt,Mn]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}_initMenu(){this._menuManagerService.mergeMenu(Wn)}};Gn=Z([X(0,u(Ae)),X(1,u(Pe))],Gn);let $=class extends h{constructor(e=gn,t,n,r,i){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=r,this._renderManagerService=i;let{menu:a,...o}=S({},gn,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(hn,o),this._initRegisterCommand()}onStarting(){C(this._injector,[[dn],[$t],[Gn],[_n],[An]])}onReady(){w(this._injector,[[dn],[$t],[Gn],[_n],[An]])}onRendered(){this._registerRenderModules()}_registerRenderModules(){let e=[[On],[kn]];this._config.hideAnchor!==!0&&e.push([yn]),e.forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(y.UNIVER_SHEET,e))})}_initRegisterCommand(){[fn,pn].forEach(e=>this._commandService.registerCommand(e))}};Y($,`pluginName`,`SHEET_TABLE_UI_PLUGIN`),Y($,`packageName`,Vt),Y($,`version`,Ht),Y($,`type`,y.UNIVER_SHEET),$=Z([n(he),X(1,u(d)),X(2,u(a)),X(3,o),X(4,T)],$);export{$ as UniverSheetsTableUIPlugin};
|