@univerjs/sheets-table-ui 0.23.0 → 0.24.0-insiders.20260527-b1d726f
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 +924 -474
- package/lib/cjs/locale/ar-SA.js +125 -0
- package/lib/cjs/locale/ca-ES.js +7 -1
- package/lib/cjs/locale/de-DE.js +125 -0
- package/lib/cjs/locale/en-US.js +7 -1
- package/lib/cjs/locale/es-ES.js +7 -1
- package/lib/cjs/locale/fa-IR.js +7 -1
- package/lib/cjs/locale/fr-FR.js +7 -1
- package/lib/cjs/locale/id-ID.js +125 -0
- package/lib/cjs/locale/it-IT.js +125 -0
- package/lib/cjs/locale/ja-JP.js +7 -1
- package/lib/cjs/locale/ko-KR.js +7 -1
- package/lib/cjs/locale/pl-PL.js +125 -0
- package/lib/cjs/locale/pt-BR.js +125 -0
- package/lib/cjs/locale/ru-RU.js +7 -1
- package/lib/cjs/locale/sk-SK.js +7 -1
- package/lib/cjs/locale/vi-VN.js +7 -1
- package/lib/cjs/locale/zh-CN.js +7 -1
- package/lib/cjs/locale/zh-HK.js +125 -0
- package/lib/cjs/locale/zh-TW.js +7 -1
- package/lib/es/index.js +932 -482
- package/lib/es/locale/ar-SA.js +124 -0
- package/lib/es/locale/ca-ES.js +7 -1
- package/lib/es/locale/de-DE.js +124 -0
- package/lib/es/locale/en-US.js +7 -1
- package/lib/es/locale/es-ES.js +7 -1
- package/lib/es/locale/fa-IR.js +7 -1
- package/lib/es/locale/fr-FR.js +7 -1
- package/lib/es/locale/id-ID.js +124 -0
- package/lib/es/locale/it-IT.js +124 -0
- package/lib/es/locale/ja-JP.js +7 -1
- package/lib/es/locale/ko-KR.js +7 -1
- package/lib/es/locale/pl-PL.js +124 -0
- package/lib/es/locale/pt-BR.js +124 -0
- package/lib/es/locale/ru-RU.js +7 -1
- package/lib/es/locale/sk-SK.js +7 -1
- package/lib/es/locale/vi-VN.js +7 -1
- package/lib/es/locale/zh-CN.js +7 -1
- package/lib/es/locale/zh-HK.js +124 -0
- package/lib/es/locale/zh-TW.js +7 -1
- package/lib/index.css +63 -47
- package/lib/index.js +932 -482
- package/lib/locale/ar-SA.js +124 -0
- package/lib/locale/ca-ES.js +7 -1
- package/lib/locale/de-DE.js +124 -0
- package/lib/locale/en-US.js +7 -1
- package/lib/locale/es-ES.js +7 -1
- package/lib/locale/fa-IR.js +7 -1
- package/lib/locale/fr-FR.js +7 -1
- package/lib/locale/id-ID.js +124 -0
- package/lib/locale/it-IT.js +124 -0
- package/lib/locale/ja-JP.js +7 -1
- package/lib/locale/ko-KR.js +7 -1
- package/lib/locale/pl-PL.js +124 -0
- package/lib/locale/pt-BR.js +124 -0
- package/lib/locale/ru-RU.js +7 -1
- package/lib/locale/sk-SK.js +7 -1
- package/lib/locale/vi-VN.js +7 -1
- package/lib/locale/zh-CN.js +7 -1
- package/lib/locale/zh-HK.js +124 -0
- package/lib/locale/zh-TW.js +7 -1
- package/lib/types/const.d.ts +2 -0
- package/lib/types/controllers/sheet-table-component.controller.d.ts +2 -0
- package/lib/types/controllers/sheet-table-controls-render.controller.d.ts +60 -0
- package/lib/types/controllers/sheet-table-filter-button-render.controller.d.ts +3 -2
- package/lib/types/{views/components/SheetTableAnchor.d.ts → locale/ar-SA.d.ts} +3 -1
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +7 -1
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/views/components/SheetTableRenameDialog.d.ts +21 -0
- package/lib/types/views/widgets/table-controls-util.d.ts +44 -0
- package/lib/types/views/widgets/table-controls.shape.d.ts +63 -0
- package/lib/types/views/widgets/table-filter-button.shape.d.ts +10 -5
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -0
- 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/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- 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-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -13
- package/LICENSE +0 -176
- package/lib/types/controllers/sheet-table-anchor.controller.d.ts +0 -50
- /package/lib/types/services/{sheets-table-ui-service.d.ts → sheets-table-ui.service.d.ts} +0 -0
package/lib/cjs/index.js
CHANGED
|
@@ -16,7 +16,7 @@ let _univerjs_sheets_formula_ui = require("@univerjs/sheets-formula-ui");
|
|
|
16
16
|
|
|
17
17
|
//#region package.json
|
|
18
18
|
var name = "@univerjs/sheets-table-ui";
|
|
19
|
-
var version = "0.
|
|
19
|
+
var version = "0.24.0-insiders.20260527-b1d726f";
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/const.ts
|
|
@@ -40,6 +40,8 @@ const SHEETS_TABLE_FILTER_PANEL_OPENED_KEY = "SHEETS_TABLE_FILTER_PANEL_OPENED_K
|
|
|
40
40
|
const UNIVER_SHEET_TABLE_FILTER_PANEL_ID = "UNIVER_SHEET_Table_FILTER_PANEL_ID";
|
|
41
41
|
const TABLE_TOOLBAR_BUTTON = "TABLE_TOOLBAR_BUTTON";
|
|
42
42
|
const TABLE_SELECTOR_DIALOG = "TABLE_SELECTOR_DIALOG";
|
|
43
|
+
const SHEET_TABLE_RENAME_DIALOG = "SHEET_TABLE_RENAME_DIALOG";
|
|
44
|
+
const SHEET_TABLE_RENAME_DIALOG_ID = "SHEET_TABLE_RENAME_DIALOG_ID";
|
|
43
45
|
const SHEET_TABLE_THEME_PANEL_ID = "SHEET_TABLE_THEME_PANEL_ID";
|
|
44
46
|
const SHEET_TABLE_THEME_PANEL = "SHEET_TABLE_THEME_PANEL";
|
|
45
47
|
const TABLE_CUSTOM_NAME_PREFIX = "table-custom-";
|
|
@@ -108,7 +110,7 @@ function __decorate(decorators, target, key, desc) {
|
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
//#endregion
|
|
111
|
-
//#region src/services/sheets-table-ui
|
|
113
|
+
//#region src/services/sheets-table-ui.service.ts
|
|
112
114
|
let SheetsTableUiService = class SheetsTableUiService extends _univerjs_core.Disposable {
|
|
113
115
|
constructor(_tableManager, _sheetTableService, _univerInstanceService, _commandService, _localeService) {
|
|
114
116
|
super();
|
|
@@ -208,7 +210,7 @@ let SheetsTableUiService = class SheetsTableUiService extends _univerjs_core.Dis
|
|
|
208
210
|
for (let row = startRow; row <= endRow; row++) {
|
|
209
211
|
if (worksheet.isRowFiltered(row)) continue;
|
|
210
212
|
let stringItem = this._sheetTableService.getCellValueWithConditionType(worksheet, row, column);
|
|
211
|
-
if (stringItem === void 0) stringItem = this._localeService.t("sheets-table.condition.empty");
|
|
213
|
+
if (stringItem === void 0) stringItem = this._localeService.t("sheets-table-ui.condition.empty");
|
|
212
214
|
if (!map.has(stringItem)) data.push({
|
|
213
215
|
title: stringItem,
|
|
214
216
|
key: `${column}_${row}`,
|
|
@@ -244,171 +246,171 @@ function getCascaderListOptions(injector) {
|
|
|
244
246
|
return [
|
|
245
247
|
{
|
|
246
248
|
value: _univerjs_sheets_table.TableConditionTypeEnum.String,
|
|
247
|
-
label: t(`sheets-table.condition.${_univerjs_sheets_table.TableConditionTypeEnum.String}`),
|
|
249
|
+
label: t(`sheets-table-ui.condition.${_univerjs_sheets_table.TableConditionTypeEnum.String}`),
|
|
248
250
|
children: [
|
|
249
251
|
{
|
|
250
252
|
value: _univerjs_sheets_table.TableStringCompareTypeEnum.Equal,
|
|
251
|
-
label: t(`sheets-table.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.Equal}`)
|
|
253
|
+
label: t(`sheets-table-ui.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.Equal}`)
|
|
252
254
|
},
|
|
253
255
|
{
|
|
254
256
|
value: _univerjs_sheets_table.TableStringCompareTypeEnum.NotEqual,
|
|
255
|
-
label: t(`sheets-table.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.NotEqual}`)
|
|
257
|
+
label: t(`sheets-table-ui.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.NotEqual}`)
|
|
256
258
|
},
|
|
257
259
|
{
|
|
258
260
|
value: _univerjs_sheets_table.TableStringCompareTypeEnum.Contains,
|
|
259
|
-
label: t(`sheets-table.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.Contains}`)
|
|
261
|
+
label: t(`sheets-table-ui.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.Contains}`)
|
|
260
262
|
},
|
|
261
263
|
{
|
|
262
264
|
value: _univerjs_sheets_table.TableStringCompareTypeEnum.NotContains,
|
|
263
|
-
label: t(`sheets-table.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.NotContains}`)
|
|
265
|
+
label: t(`sheets-table-ui.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.NotContains}`)
|
|
264
266
|
},
|
|
265
267
|
{
|
|
266
268
|
value: _univerjs_sheets_table.TableStringCompareTypeEnum.StartsWith,
|
|
267
|
-
label: t(`sheets-table.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.StartsWith}`)
|
|
269
|
+
label: t(`sheets-table-ui.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.StartsWith}`)
|
|
268
270
|
},
|
|
269
271
|
{
|
|
270
272
|
value: _univerjs_sheets_table.TableStringCompareTypeEnum.EndsWith,
|
|
271
|
-
label: t(`sheets-table.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.EndsWith}`)
|
|
273
|
+
label: t(`sheets-table-ui.string.compare.${_univerjs_sheets_table.TableStringCompareTypeEnum.EndsWith}`)
|
|
272
274
|
}
|
|
273
275
|
]
|
|
274
276
|
},
|
|
275
277
|
{
|
|
276
278
|
value: _univerjs_sheets_table.TableConditionTypeEnum.Number,
|
|
277
|
-
label: t(`sheets-table.condition.${_univerjs_sheets_table.TableConditionTypeEnum.Number}`),
|
|
279
|
+
label: t(`sheets-table-ui.condition.${_univerjs_sheets_table.TableConditionTypeEnum.Number}`),
|
|
278
280
|
children: [
|
|
279
281
|
{
|
|
280
282
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.Equal,
|
|
281
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Equal}`)
|
|
283
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Equal}`)
|
|
282
284
|
},
|
|
283
285
|
{
|
|
284
286
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.NotEqual,
|
|
285
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.NotEqual}`)
|
|
287
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.NotEqual}`)
|
|
286
288
|
},
|
|
287
289
|
{
|
|
288
290
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.GreaterThan,
|
|
289
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.GreaterThan}`)
|
|
291
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.GreaterThan}`)
|
|
290
292
|
},
|
|
291
293
|
{
|
|
292
294
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.GreaterThanOrEqual,
|
|
293
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.GreaterThanOrEqual}`)
|
|
295
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.GreaterThanOrEqual}`)
|
|
294
296
|
},
|
|
295
297
|
{
|
|
296
298
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.LessThan,
|
|
297
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.LessThan}`)
|
|
299
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.LessThan}`)
|
|
298
300
|
},
|
|
299
301
|
{
|
|
300
302
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.LessThanOrEqual,
|
|
301
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.LessThanOrEqual}`)
|
|
303
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.LessThanOrEqual}`)
|
|
302
304
|
},
|
|
303
305
|
{
|
|
304
306
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.Between,
|
|
305
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Between}`)
|
|
307
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Between}`)
|
|
306
308
|
},
|
|
307
309
|
{
|
|
308
310
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.NotBetween,
|
|
309
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.NotBetween}`)
|
|
311
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.NotBetween}`)
|
|
310
312
|
},
|
|
311
313
|
{
|
|
312
314
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.Above,
|
|
313
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Above}`)
|
|
315
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Above}`)
|
|
314
316
|
},
|
|
315
317
|
{
|
|
316
318
|
value: _univerjs_sheets_table.TableNumberCompareTypeEnum.Below,
|
|
317
|
-
label: t(`sheets-table.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Below}`)
|
|
319
|
+
label: t(`sheets-table-ui.number.compare.${_univerjs_sheets_table.TableNumberCompareTypeEnum.Below}`)
|
|
318
320
|
}
|
|
319
321
|
]
|
|
320
322
|
},
|
|
321
323
|
{
|
|
322
324
|
value: _univerjs_sheets_table.TableConditionTypeEnum.Date,
|
|
323
|
-
label: t(`sheets-table.condition.${_univerjs_sheets_table.TableConditionTypeEnum.Date}`),
|
|
325
|
+
label: t(`sheets-table-ui.condition.${_univerjs_sheets_table.TableConditionTypeEnum.Date}`),
|
|
324
326
|
children: [
|
|
325
327
|
{
|
|
326
328
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Equal,
|
|
327
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Equal}`)
|
|
329
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Equal}`)
|
|
328
330
|
},
|
|
329
331
|
{
|
|
330
332
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.NotEqual,
|
|
331
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NotEqual}`)
|
|
333
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NotEqual}`)
|
|
332
334
|
},
|
|
333
335
|
{
|
|
334
336
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.After,
|
|
335
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.After}`)
|
|
337
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.After}`)
|
|
336
338
|
},
|
|
337
339
|
{
|
|
338
340
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.AfterOrEqual,
|
|
339
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.AfterOrEqual}`)
|
|
341
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.AfterOrEqual}`)
|
|
340
342
|
},
|
|
341
343
|
{
|
|
342
344
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Before,
|
|
343
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Before}`)
|
|
345
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Before}`)
|
|
344
346
|
},
|
|
345
347
|
{
|
|
346
348
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.BeforeOrEqual,
|
|
347
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.BeforeOrEqual}`)
|
|
349
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.BeforeOrEqual}`)
|
|
348
350
|
},
|
|
349
351
|
{
|
|
350
352
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Between,
|
|
351
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Between}`)
|
|
353
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Between}`)
|
|
352
354
|
},
|
|
353
355
|
{
|
|
354
356
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.NotBetween,
|
|
355
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NotBetween}`)
|
|
357
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NotBetween}`)
|
|
356
358
|
},
|
|
357
359
|
{
|
|
358
360
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Today,
|
|
359
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Today}`)
|
|
361
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Today}`)
|
|
360
362
|
},
|
|
361
363
|
{
|
|
362
364
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Yesterday,
|
|
363
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Yesterday}`)
|
|
365
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Yesterday}`)
|
|
364
366
|
},
|
|
365
367
|
{
|
|
366
368
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Tomorrow,
|
|
367
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Tomorrow}`)
|
|
369
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Tomorrow}`)
|
|
368
370
|
},
|
|
369
371
|
{
|
|
370
372
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.ThisWeek,
|
|
371
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.ThisWeek}`)
|
|
373
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.ThisWeek}`)
|
|
372
374
|
},
|
|
373
375
|
{
|
|
374
376
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.LastWeek,
|
|
375
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.LastWeek}`)
|
|
377
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.LastWeek}`)
|
|
376
378
|
},
|
|
377
379
|
{
|
|
378
380
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.NextWeek,
|
|
379
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NextWeek}`)
|
|
381
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NextWeek}`)
|
|
380
382
|
},
|
|
381
383
|
{
|
|
382
384
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.ThisMonth,
|
|
383
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.ThisMonth}`)
|
|
385
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.ThisMonth}`)
|
|
384
386
|
},
|
|
385
387
|
{
|
|
386
388
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.LastMonth,
|
|
387
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.LastMonth}`)
|
|
389
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.LastMonth}`)
|
|
388
390
|
},
|
|
389
391
|
{
|
|
390
392
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.NextMonth,
|
|
391
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NextMonth}`)
|
|
393
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NextMonth}`)
|
|
392
394
|
},
|
|
393
395
|
{
|
|
394
396
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.ThisYear,
|
|
395
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.ThisYear}`)
|
|
397
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.ThisYear}`)
|
|
396
398
|
},
|
|
397
399
|
{
|
|
398
400
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.LastYear,
|
|
399
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.LastYear}`)
|
|
401
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.LastYear}`)
|
|
400
402
|
},
|
|
401
403
|
{
|
|
402
404
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.NextYear,
|
|
403
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NextYear}`)
|
|
405
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.NextYear}`)
|
|
404
406
|
},
|
|
405
407
|
{
|
|
406
408
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Quarter,
|
|
407
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Quarter}`)
|
|
409
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Quarter}`)
|
|
408
410
|
},
|
|
409
411
|
{
|
|
410
412
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Month,
|
|
411
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Month}`)
|
|
413
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Month}`)
|
|
412
414
|
}
|
|
413
415
|
]
|
|
414
416
|
}
|
|
@@ -421,69 +423,69 @@ function getConditionDateSelect(injector, dateType) {
|
|
|
421
423
|
case _univerjs_sheets_table.TableDateCompareTypeEnum.Quarter: return [
|
|
422
424
|
{
|
|
423
425
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Q1,
|
|
424
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q1}`)
|
|
426
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q1}`)
|
|
425
427
|
},
|
|
426
428
|
{
|
|
427
429
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Q2,
|
|
428
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q2}`)
|
|
430
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q2}`)
|
|
429
431
|
},
|
|
430
432
|
{
|
|
431
433
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Q3,
|
|
432
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q3}`)
|
|
434
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q3}`)
|
|
433
435
|
},
|
|
434
436
|
{
|
|
435
437
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.Q4,
|
|
436
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q4}`)
|
|
438
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.Q4}`)
|
|
437
439
|
}
|
|
438
440
|
];
|
|
439
441
|
case _univerjs_sheets_table.TableDateCompareTypeEnum.Month: return [
|
|
440
442
|
{
|
|
441
443
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M1,
|
|
442
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M1}`)
|
|
444
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M1}`)
|
|
443
445
|
},
|
|
444
446
|
{
|
|
445
447
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M2,
|
|
446
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M2}`)
|
|
448
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M2}`)
|
|
447
449
|
},
|
|
448
450
|
{
|
|
449
451
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M3,
|
|
450
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M3}`)
|
|
452
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M3}`)
|
|
451
453
|
},
|
|
452
454
|
{
|
|
453
455
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M4,
|
|
454
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M4}`)
|
|
456
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M4}`)
|
|
455
457
|
},
|
|
456
458
|
{
|
|
457
459
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M5,
|
|
458
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M5}`)
|
|
460
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M5}`)
|
|
459
461
|
},
|
|
460
462
|
{
|
|
461
463
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M6,
|
|
462
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M6}`)
|
|
464
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M6}`)
|
|
463
465
|
},
|
|
464
466
|
{
|
|
465
467
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M7,
|
|
466
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M7}`)
|
|
468
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M7}`)
|
|
467
469
|
},
|
|
468
470
|
{
|
|
469
471
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M8,
|
|
470
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M8}`)
|
|
472
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M8}`)
|
|
471
473
|
},
|
|
472
474
|
{
|
|
473
475
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M9,
|
|
474
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M9}`)
|
|
476
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M9}`)
|
|
475
477
|
},
|
|
476
478
|
{
|
|
477
479
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M10,
|
|
478
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M10}`)
|
|
480
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M10}`)
|
|
479
481
|
},
|
|
480
482
|
{
|
|
481
483
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M11,
|
|
482
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M11}`)
|
|
484
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M11}`)
|
|
483
485
|
},
|
|
484
486
|
{
|
|
485
487
|
value: _univerjs_sheets_table.TableDateCompareTypeEnum.M12,
|
|
486
|
-
label: t(`sheets-table.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M12}`)
|
|
488
|
+
label: t(`sheets-table-ui.date.compare.${_univerjs_sheets_table.TableDateCompareTypeEnum.M12}`)
|
|
487
489
|
}
|
|
488
490
|
];
|
|
489
491
|
default: return [];
|
|
@@ -611,8 +613,8 @@ const SheetTableConditionPanel = (props) => {
|
|
|
611
613
|
};
|
|
612
614
|
const subComponentType = getSubComponentType(conditionInfo.type, conditionInfo.compare);
|
|
613
615
|
let selectType = "";
|
|
614
|
-
if (conditionInfo.compare) selectType = `${localeService.t(`sheets-table.condition.${conditionInfo.type}`)} - ${localeService.t(`sheets-table.${conditionInfo.type}.compare.${conditionInfo.compare}`)}`;
|
|
615
|
-
else selectType = localeService.t(`sheets-table.condition.${conditionInfo.type}`);
|
|
616
|
+
if (conditionInfo.compare) selectType = `${localeService.t(`sheets-table-ui.condition.${conditionInfo.type}`)} - ${localeService.t(`sheets-table-ui.${conditionInfo.type}.compare.${conditionInfo.compare}`)}`;
|
|
617
|
+
else selectType = localeService.t(`sheets-table-ui.condition.${conditionInfo.type}`);
|
|
616
618
|
const conditionDateOptions = getConditionDateSelect(injector, conditionInfo.compare);
|
|
617
619
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
618
620
|
align: "start",
|
|
@@ -774,7 +776,7 @@ function SheetTableItemsFilterPanel(props) {
|
|
|
774
776
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
775
777
|
autoFocus: true,
|
|
776
778
|
value: searchText,
|
|
777
|
-
placeholder: localeService.t("sheets-table.filter.search-placeholder"),
|
|
779
|
+
placeholder: localeService.t("sheets-table-ui.filter.search-placeholder"),
|
|
778
780
|
onChange: onSearchValueChange
|
|
779
781
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
780
782
|
className: (0, _univerjs_design.clsx)("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", _univerjs_design.borderClassName),
|
|
@@ -793,7 +795,7 @@ function SheetTableItemsFilterPanel(props) {
|
|
|
793
795
|
className: "univer-flex univer-h-5 univer-flex-1 univer-items-center univer-text-sm",
|
|
794
796
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
795
797
|
className: "univer-inline-block univer-truncate",
|
|
796
|
-
children: `${localeService.t("sheets-table.filter.select-all")}`
|
|
798
|
+
children: `${localeService.t("sheets-table-ui.filter.select-all")}`
|
|
797
799
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
798
800
|
className: "univer-ml univer-text-gray-400",
|
|
799
801
|
children: `(${checkedCount}/${searchText ? displayItems.length : allItemsCount})`
|
|
@@ -852,9 +854,12 @@ function SheetTableFilterPanel() {
|
|
|
852
854
|
const table = tableManager.getTable(unitId, tableId);
|
|
853
855
|
if (!table) return null;
|
|
854
856
|
const tableFilters = table.getTableFilters();
|
|
857
|
+
const tableRange = table.getRange();
|
|
855
858
|
const sortState = tableFilters.getSortState();
|
|
856
859
|
sortState.columnIndex === columnIndex && (sortState.sortState, _univerjs_sheets_table.SheetsTableSortStateEnum.Asc);
|
|
857
860
|
sortState.columnIndex === columnIndex && (sortState.sortState, _univerjs_sheets_table.SheetsTableSortStateEnum.Desc);
|
|
861
|
+
const absoluteColumn = tableFilterPanelInfo.column;
|
|
862
|
+
const canDeleteColumn = tableRange.endColumn > tableRange.startColumn;
|
|
858
863
|
const closeDialog = () => {
|
|
859
864
|
sheetsTableComponentController.closeFilterPanel();
|
|
860
865
|
};
|
|
@@ -876,6 +881,27 @@ function SheetTableFilterPanel() {
|
|
|
876
881
|
tableFilters.setSortState(columnIndex, asc ? _univerjs_sheets_table.SheetsTableSortStateEnum.Asc : _univerjs_sheets_table.SheetsTableSortStateEnum.Desc);
|
|
877
882
|
closeDialog();
|
|
878
883
|
};
|
|
884
|
+
const insertColumn = (side) => {
|
|
885
|
+
commandService.executeCommand(_univerjs_sheets_table.SheetTableInsertColumnAtCommand.id, {
|
|
886
|
+
unitId,
|
|
887
|
+
subUnitId,
|
|
888
|
+
tableId,
|
|
889
|
+
index: side === "left" ? absoluteColumn : absoluteColumn + 1,
|
|
890
|
+
count: 1
|
|
891
|
+
});
|
|
892
|
+
closeDialog();
|
|
893
|
+
};
|
|
894
|
+
const deleteColumn = () => {
|
|
895
|
+
if (!canDeleteColumn) return;
|
|
896
|
+
commandService.executeCommand(_univerjs_sheets_table.SheetTableRemoveColumnAtCommand.id, {
|
|
897
|
+
unitId,
|
|
898
|
+
subUnitId,
|
|
899
|
+
tableId,
|
|
900
|
+
index: absoluteColumn,
|
|
901
|
+
count: 1
|
|
902
|
+
});
|
|
903
|
+
closeDialog();
|
|
904
|
+
};
|
|
879
905
|
const onApply = () => {
|
|
880
906
|
if (filterBy === "items") {
|
|
881
907
|
const filteredItems = [];
|
|
@@ -922,7 +948,39 @@ function SheetTableFilterPanel() {
|
|
|
922
948
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
923
949
|
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",
|
|
924
950
|
children: [
|
|
925
|
-
((_permissionService$ge = permissionService.getPermissionPoint(workbookEditableId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) && /* @__PURE__ */ (0, react_jsx_runtime.
|
|
951
|
+
((_permissionService$ge = permissionService.getPermissionPoint(workbookEditableId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
952
|
+
className: "-univer-mx-4 -univer-mt-2 univer-mb-3 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-py-1",
|
|
953
|
+
children: [
|
|
954
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
955
|
+
type: "button",
|
|
956
|
+
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-white dark:hover:!univer-bg-gray-600",
|
|
957
|
+
onClick: () => insertColumn("left"),
|
|
958
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.LeftInsertColumnDoubleIcon, {
|
|
959
|
+
className: "univer-size-5",
|
|
960
|
+
extend: { colorChannel1: "var(--univer-primary-600)" }
|
|
961
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("sheets-table-ui.columnMenu.insert-left") })]
|
|
962
|
+
}),
|
|
963
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
964
|
+
type: "button",
|
|
965
|
+
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-white dark:hover:!univer-bg-gray-600",
|
|
966
|
+
onClick: () => insertColumn("right"),
|
|
967
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.RightInsertColumnDoubleIcon, {
|
|
968
|
+
className: "univer-size-5",
|
|
969
|
+
extend: { colorChannel1: "var(--univer-primary-600)" }
|
|
970
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("sheets-table-ui.columnMenu.insert-right") })]
|
|
971
|
+
}),
|
|
972
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
973
|
+
type: "button",
|
|
974
|
+
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-white dark:hover:!univer-bg-gray-600",
|
|
975
|
+
disabled: !canDeleteColumn,
|
|
976
|
+
onClick: deleteColumn,
|
|
977
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteColumnDoubleIcon, {
|
|
978
|
+
className: "univer-size-5",
|
|
979
|
+
extend: { colorChannel1: "var(--univer-primary-600)" }
|
|
980
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("sheets-table-ui.columnMenu.delete") })]
|
|
981
|
+
})
|
|
982
|
+
]
|
|
983
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
926
984
|
className: "univer-mb-3 univer-flex",
|
|
927
985
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.ButtonGroup, {
|
|
928
986
|
className: "univer-mb-3 !univer-flex univer-w-full",
|
|
@@ -936,7 +994,7 @@ function SheetTableFilterPanel() {
|
|
|
936
994
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DescendingIcon, { className: "univer-mr-1" }), localeService.t("sheets-sort.general.sort-desc")]
|
|
937
995
|
})]
|
|
938
996
|
})
|
|
939
|
-
}),
|
|
997
|
+
})] }),
|
|
940
998
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
941
999
|
className: "univer-w-full",
|
|
942
1000
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Segmented, {
|
|
@@ -973,15 +1031,15 @@ function SheetTableFilterPanel() {
|
|
|
973
1031
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
974
1032
|
disabled: tableFilter === void 0,
|
|
975
1033
|
onClick: onClearFilter,
|
|
976
|
-
children: localeService.t("sheets-table.filter.clear-filter")
|
|
1034
|
+
children: localeService.t("sheets-table-ui.filter.clear-filter")
|
|
977
1035
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
978
1036
|
className: "univer-mr-2",
|
|
979
1037
|
onClick: onCancel,
|
|
980
|
-
children: localeService.t("sheets-table.filter.cancel")
|
|
1038
|
+
children: localeService.t("sheets-table-ui.filter.cancel")
|
|
981
1039
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
982
1040
|
variant: "primary",
|
|
983
1041
|
onClick: onApply,
|
|
984
|
-
children: localeService.t("sheets-table.filter.confirm")
|
|
1042
|
+
children: localeService.t("sheets-table-ui.filter.confirm")
|
|
985
1043
|
})] })]
|
|
986
1044
|
})
|
|
987
1045
|
]
|
|
@@ -989,14 +1047,97 @@ function SheetTableFilterPanel() {
|
|
|
989
1047
|
}
|
|
990
1048
|
function useFilterByOptions(localeService) {
|
|
991
1049
|
return (0, react.useMemo)(() => [{
|
|
992
|
-
label: localeService.t("sheets-table.filter.by-values"),
|
|
1050
|
+
label: localeService.t("sheets-table-ui.filter.by-values"),
|
|
993
1051
|
value: "items"
|
|
994
1052
|
}, {
|
|
995
|
-
label: localeService.t("sheets-table.filter.by-conditions"),
|
|
1053
|
+
label: localeService.t("sheets-table-ui.filter.by-conditions"),
|
|
996
1054
|
value: "condition"
|
|
997
1055
|
}], [localeService.getCurrentLocale(), localeService]);
|
|
998
1056
|
}
|
|
999
1057
|
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region src/views/components/SheetTableRenameDialog.tsx
|
|
1060
|
+
function SheetTableRenameDialog(props) {
|
|
1061
|
+
var _table$getDisplayName;
|
|
1062
|
+
const { unitId, tableId, onClose } = props;
|
|
1063
|
+
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
1064
|
+
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
1065
|
+
const tableManager = (0, _univerjs_ui.useDependency)(_univerjs_sheets_table.TableManager);
|
|
1066
|
+
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
1067
|
+
const definedNamesService = (0, _univerjs_ui.useDependency)(_univerjs_engine_formula.IDefinedNamesService);
|
|
1068
|
+
const table = tableManager.getTableById(unitId, tableId);
|
|
1069
|
+
const [value, setValue] = (0, react.useState)((_table$getDisplayName = table === null || table === void 0 ? void 0 : table.getDisplayName()) !== null && _table$getDisplayName !== void 0 ? _table$getDisplayName : "");
|
|
1070
|
+
const [error, setError] = (0, react.useState)("");
|
|
1071
|
+
const existingNames = (0, react.useMemo)(() => {
|
|
1072
|
+
const names = (0, _univerjs_sheets_table.getExistingNamesSet)(unitId, {
|
|
1073
|
+
univerInstanceService,
|
|
1074
|
+
tableManager,
|
|
1075
|
+
definedNamesService
|
|
1076
|
+
});
|
|
1077
|
+
const currentName = table === null || table === void 0 ? void 0 : table.getDisplayName().toLowerCase();
|
|
1078
|
+
if (currentName) names.delete(currentName);
|
|
1079
|
+
return names;
|
|
1080
|
+
}, [
|
|
1081
|
+
definedNamesService,
|
|
1082
|
+
table,
|
|
1083
|
+
tableManager,
|
|
1084
|
+
unitId,
|
|
1085
|
+
univerInstanceService
|
|
1086
|
+
]);
|
|
1087
|
+
const handleConfirm = () => {
|
|
1088
|
+
const nextName = value.trim();
|
|
1089
|
+
if (!table || nextName === table.getDisplayName()) {
|
|
1090
|
+
onClose();
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
if (!(0, _univerjs_sheets_table.validateSheetTableName)(nextName, existingNames).valid) {
|
|
1094
|
+
setError(localeService.t("sheets-table-ui.tableNameError"));
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
|
|
1098
|
+
unitId,
|
|
1099
|
+
tableId,
|
|
1100
|
+
name: nextName
|
|
1101
|
+
});
|
|
1102
|
+
onClose();
|
|
1103
|
+
};
|
|
1104
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1105
|
+
className: "univer-box-border univer-flex univer-w-full univer-flex-col univer-gap-4 univer-pb-3 univer-pt-2",
|
|
1106
|
+
children: [
|
|
1107
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
1108
|
+
size: "middle",
|
|
1109
|
+
value,
|
|
1110
|
+
placeholder: localeService.t("sheets-table-ui.renamePlaceholder"),
|
|
1111
|
+
onChange: (nextValue) => {
|
|
1112
|
+
setValue(nextValue);
|
|
1113
|
+
setError("");
|
|
1114
|
+
},
|
|
1115
|
+
onKeyDown: (event) => {
|
|
1116
|
+
if (event.key === "Enter") handleConfirm();
|
|
1117
|
+
},
|
|
1118
|
+
autoFocus: true
|
|
1119
|
+
}),
|
|
1120
|
+
error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1121
|
+
className: "-univer-mt-2 univer-text-sm univer-text-red-500",
|
|
1122
|
+
children: error
|
|
1123
|
+
}) : null,
|
|
1124
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1125
|
+
className: "univer-flex univer-w-full univer-items-center univer-justify-end univer-gap-2",
|
|
1126
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
1127
|
+
className: "univer-min-w-16",
|
|
1128
|
+
onClick: onClose,
|
|
1129
|
+
children: localeService.t("sheets-table-ui.cancel")
|
|
1130
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
1131
|
+
className: "univer-min-w-16",
|
|
1132
|
+
variant: "primary",
|
|
1133
|
+
onClick: handleConfirm,
|
|
1134
|
+
children: localeService.t("sheets-table-ui.confirm")
|
|
1135
|
+
})]
|
|
1136
|
+
})
|
|
1137
|
+
]
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1000
1141
|
//#endregion
|
|
1001
1142
|
//#region src/controllers/sheet-table-component.controller.ts
|
|
1002
1143
|
let SheetsTableComponentController = class SheetsTableComponentController extends _univerjs_core.Disposable {
|
|
@@ -1014,6 +1155,22 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
|
|
|
1014
1155
|
setCurrentTableFilterInfo(info) {
|
|
1015
1156
|
this._currentTableFilterInfo = info;
|
|
1016
1157
|
}
|
|
1158
|
+
openOrToggleFilterPanel(info) {
|
|
1159
|
+
const opened = this._contextService.getContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY);
|
|
1160
|
+
if (opened && this._isSameFilterPanelInfo(this._currentTableFilterInfo, info)) {
|
|
1161
|
+
this.closeFilterPanel();
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
this.setCurrentTableFilterInfo(info);
|
|
1165
|
+
if (opened) {
|
|
1166
|
+
var _this$_popupDisposabl;
|
|
1167
|
+
(_this$_popupDisposabl = this._popupDisposable) === null || _this$_popupDisposabl === void 0 || _this$_popupDisposabl.dispose();
|
|
1168
|
+
this._popupDisposable = null;
|
|
1169
|
+
this._openFilterPopup();
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
this._contextService.setContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, true);
|
|
1173
|
+
}
|
|
1017
1174
|
clearCurrentTableFilterInfo() {
|
|
1018
1175
|
this._currentTableFilterInfo = null;
|
|
1019
1176
|
}
|
|
@@ -1021,7 +1178,7 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
|
|
|
1021
1178
|
return this._currentTableFilterInfo;
|
|
1022
1179
|
}
|
|
1023
1180
|
_initComponents() {
|
|
1024
|
-
[[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel]].forEach(([key, comp]) => {
|
|
1181
|
+
[[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel], [SHEET_TABLE_RENAME_DIALOG, SheetTableRenameDialog]].forEach(([key, comp]) => {
|
|
1025
1182
|
this.disposeWithMe(this._componentManager.register(key, comp));
|
|
1026
1183
|
});
|
|
1027
1184
|
}
|
|
@@ -1050,11 +1207,14 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
|
|
|
1050
1207
|
});
|
|
1051
1208
|
}
|
|
1052
1209
|
_closeFilterPopup() {
|
|
1053
|
-
var _this$
|
|
1054
|
-
(_this$
|
|
1210
|
+
var _this$_popupDisposabl2;
|
|
1211
|
+
(_this$_popupDisposabl2 = this._popupDisposable) === null || _this$_popupDisposabl2 === void 0 || _this$_popupDisposabl2.dispose();
|
|
1055
1212
|
this._popupDisposable = null;
|
|
1056
1213
|
this.clearCurrentTableFilterInfo();
|
|
1057
1214
|
}
|
|
1215
|
+
_isSameFilterPanelInfo(a, b) {
|
|
1216
|
+
return Boolean(a && a.unitId === b.unitId && a.subUnitId === b.subUnitId && a.tableId === b.tableId && a.column === b.column && a.row === b.row);
|
|
1217
|
+
}
|
|
1058
1218
|
};
|
|
1059
1219
|
SheetsTableComponentController = __decorate([
|
|
1060
1220
|
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)),
|
|
@@ -1072,19 +1232,15 @@ const OpenTableFilterPanelOperation = {
|
|
|
1072
1232
|
if (!params) return false;
|
|
1073
1233
|
const { row, col, unitId, subUnitId, tableId } = params;
|
|
1074
1234
|
const tableManager = accessor.get(_univerjs_sheets_table.TableManager);
|
|
1075
|
-
const contextService = accessor.get(_univerjs_core.IContextService);
|
|
1076
1235
|
const sheetsTableComponentController = accessor.get(SheetsTableComponentController);
|
|
1077
1236
|
if (!tableManager.getTable(unitId, tableId)) return false;
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
});
|
|
1086
|
-
contextService.setContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, true);
|
|
1087
|
-
}
|
|
1237
|
+
sheetsTableComponentController.openOrToggleFilterPanel({
|
|
1238
|
+
unitId,
|
|
1239
|
+
subUnitId,
|
|
1240
|
+
row,
|
|
1241
|
+
tableId,
|
|
1242
|
+
column: col
|
|
1243
|
+
});
|
|
1088
1244
|
return true;
|
|
1089
1245
|
}
|
|
1090
1246
|
};
|
|
@@ -1139,7 +1295,7 @@ async function openRangeSelector(accessor, unitId, subUnitId, range, tableId) {
|
|
|
1139
1295
|
};
|
|
1140
1296
|
dialogService.open({
|
|
1141
1297
|
id: TABLE_SELECTOR_DIALOG,
|
|
1142
|
-
title: { title: localeService.t("sheets-table.selectRange") },
|
|
1298
|
+
title: { title: localeService.t("sheets-table-ui.selectRange") },
|
|
1143
1299
|
draggable: true,
|
|
1144
1300
|
destroyOnClose: true,
|
|
1145
1301
|
mask: false,
|
|
@@ -1166,6 +1322,296 @@ const defaultPluginConfig = {
|
|
|
1166
1322
|
anchorBackgroundColor: "rgb(134,139,156)"
|
|
1167
1323
|
};
|
|
1168
1324
|
|
|
1325
|
+
//#endregion
|
|
1326
|
+
//#region src/views/widgets/table-controls-util.ts
|
|
1327
|
+
const TABLE_CONTROL_MENU_WIDTH = 168;
|
|
1328
|
+
const TABLE_CONTROL_MENU_ITEM_HEIGHT = 32;
|
|
1329
|
+
const TABLE_CONTROL_MENU_ACTIONS = [
|
|
1330
|
+
"rename",
|
|
1331
|
+
"update-range",
|
|
1332
|
+
"set-theme",
|
|
1333
|
+
"delete"
|
|
1334
|
+
];
|
|
1335
|
+
function isPointInTableControlRegion(region, x, y) {
|
|
1336
|
+
return x >= region.left && x <= region.left + region.width && y >= region.top && y <= region.top + region.height;
|
|
1337
|
+
}
|
|
1338
|
+
function hitTestTableControl(regions, x, y) {
|
|
1339
|
+
for (let i = regions.length - 1; i >= 0; i--) if (isPointInTableControlRegion(regions[i], x, y)) return regions[i];
|
|
1340
|
+
return null;
|
|
1341
|
+
}
|
|
1342
|
+
function buildTableMenuRegions(tableId, left, top) {
|
|
1343
|
+
return TABLE_CONTROL_MENU_ACTIONS.map((action, index) => ({
|
|
1344
|
+
type: "menu-item",
|
|
1345
|
+
tableId,
|
|
1346
|
+
action,
|
|
1347
|
+
left,
|
|
1348
|
+
top: top + index * 32,
|
|
1349
|
+
width: 168,
|
|
1350
|
+
height: 32
|
|
1351
|
+
}));
|
|
1352
|
+
}
|
|
1353
|
+
function buildCenteredPlusSegments(centerX, centerY, size) {
|
|
1354
|
+
const halfSize = size / 2;
|
|
1355
|
+
return [{
|
|
1356
|
+
fromX: centerX - halfSize,
|
|
1357
|
+
fromY: centerY,
|
|
1358
|
+
toX: centerX + halfSize,
|
|
1359
|
+
toY: centerY
|
|
1360
|
+
}, {
|
|
1361
|
+
fromX: centerX,
|
|
1362
|
+
fromY: centerY - halfSize,
|
|
1363
|
+
toX: centerX,
|
|
1364
|
+
toY: centerY + halfSize
|
|
1365
|
+
}];
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
//#endregion
|
|
1369
|
+
//#region src/views/widgets/table-controls.shape.ts
|
|
1370
|
+
const ANCHOR_MIN_WIDTH = 122;
|
|
1371
|
+
const ANCHOR_MAX_WIDTH = 240;
|
|
1372
|
+
const ANCHOR_PADDING_X = 12;
|
|
1373
|
+
const ANCHOR_TOGGLE_WIDTH = 30;
|
|
1374
|
+
const ANCHOR_OFFSET_Y = 0;
|
|
1375
|
+
const ANCHOR_BORDER = "rgba(0, 0, 0, 0.22)";
|
|
1376
|
+
const ANCHOR_DIVIDER = "rgba(0, 0, 0, 0.20)";
|
|
1377
|
+
const ANCHOR_TOGGLE_BG_ACTIVE = "rgba(0, 0, 0, 0.12)";
|
|
1378
|
+
const MENU_RADIUS = 8;
|
|
1379
|
+
const MENU_BORDER = "#d9dee7";
|
|
1380
|
+
const MENU_HOVER_BG = "#f1f3f4";
|
|
1381
|
+
const INSERT_BUTTON_VISUAL_SIZE = 18;
|
|
1382
|
+
const INSERT_BUTTON_PLUS_SIZE = 8;
|
|
1383
|
+
var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
1384
|
+
constructor(key, _getSkeleton) {
|
|
1385
|
+
super(key, {
|
|
1386
|
+
evented: true,
|
|
1387
|
+
fill: "rgba(0, 0, 0, 0)",
|
|
1388
|
+
zIndex: 5001
|
|
1389
|
+
});
|
|
1390
|
+
this._getSkeleton = _getSkeleton;
|
|
1391
|
+
_defineProperty(this, "_items", []);
|
|
1392
|
+
_defineProperty(this, "_regions", []);
|
|
1393
|
+
_defineProperty(this, "_openedMenuTableId", null);
|
|
1394
|
+
_defineProperty(this, "_hoveredRegion", null);
|
|
1395
|
+
_defineProperty(this, "_hoveredInsertRegion", null);
|
|
1396
|
+
_defineProperty(this, "_menuLabels", {
|
|
1397
|
+
rename: "Rename table",
|
|
1398
|
+
"update-range": "Update range",
|
|
1399
|
+
"set-theme": "Set theme",
|
|
1400
|
+
delete: "Remove table"
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
setItems(items) {
|
|
1404
|
+
this._items = items;
|
|
1405
|
+
this.makeDirty(true);
|
|
1406
|
+
}
|
|
1407
|
+
setMenuLabels(labels) {
|
|
1408
|
+
this._menuLabels = labels;
|
|
1409
|
+
this.makeDirty(true);
|
|
1410
|
+
}
|
|
1411
|
+
setOpenedMenuTableId(tableId) {
|
|
1412
|
+
if (this._openedMenuTableId === tableId) return;
|
|
1413
|
+
this._openedMenuTableId = tableId;
|
|
1414
|
+
this.makeDirty(true);
|
|
1415
|
+
}
|
|
1416
|
+
getOpenedMenuTableId() {
|
|
1417
|
+
return this._openedMenuTableId;
|
|
1418
|
+
}
|
|
1419
|
+
setHoveredRegion(region) {
|
|
1420
|
+
if (this._hoveredRegion === region) return;
|
|
1421
|
+
this._hoveredRegion = region;
|
|
1422
|
+
this.makeDirty(true);
|
|
1423
|
+
}
|
|
1424
|
+
setHoveredInsertRegion(region) {
|
|
1425
|
+
if (this._hoveredInsertRegion === region) return;
|
|
1426
|
+
this._hoveredInsertRegion = region;
|
|
1427
|
+
this.makeDirty(true);
|
|
1428
|
+
}
|
|
1429
|
+
hitTest(x, y) {
|
|
1430
|
+
return hitTestTableControl(this._regions, x, y);
|
|
1431
|
+
}
|
|
1432
|
+
isHit(coord) {
|
|
1433
|
+
return this.hitTest(coord.x, coord.y) != null;
|
|
1434
|
+
}
|
|
1435
|
+
refreshBounds() {
|
|
1436
|
+
const skeleton = this._getSkeleton();
|
|
1437
|
+
if (!skeleton) {
|
|
1438
|
+
this.hide();
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
this.show();
|
|
1442
|
+
this.transformByState({
|
|
1443
|
+
left: 0,
|
|
1444
|
+
top: 0,
|
|
1445
|
+
width: skeleton.rowHeaderWidth + skeleton.columnTotalWidth,
|
|
1446
|
+
height: skeleton.columnHeaderHeight + skeleton.rowTotalHeight
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
_draw(ctx) {
|
|
1450
|
+
this._regions = [];
|
|
1451
|
+
const skeleton = this._getSkeleton();
|
|
1452
|
+
if (!skeleton) return;
|
|
1453
|
+
ctx.save();
|
|
1454
|
+
ctx.textBaseline = "middle";
|
|
1455
|
+
for (const item of this._items) this._drawAnchor(ctx, skeleton, item);
|
|
1456
|
+
if (this._hoveredInsertRegion) {
|
|
1457
|
+
var _item$fill;
|
|
1458
|
+
const item = this._items.find((renderItem) => {
|
|
1459
|
+
var _this$_hoveredInsertR;
|
|
1460
|
+
return renderItem.tableId === ((_this$_hoveredInsertR = this._hoveredInsertRegion) === null || _this$_hoveredInsertR === void 0 ? void 0 : _this$_hoveredInsertR.tableId);
|
|
1461
|
+
});
|
|
1462
|
+
this._drawInsertButton(ctx, this._hoveredInsertRegion, (_item$fill = item === null || item === void 0 ? void 0 : item.fill) !== null && _item$fill !== void 0 ? _item$fill : "#355bb7");
|
|
1463
|
+
this._regions.push(this._hoveredInsertRegion);
|
|
1464
|
+
}
|
|
1465
|
+
ctx.restore();
|
|
1466
|
+
}
|
|
1467
|
+
_drawAnchor(ctx, skeleton, item) {
|
|
1468
|
+
const position = skeleton.getNoMergeCellWithCoordByIndex(item.range.startRow, item.range.startColumn);
|
|
1469
|
+
const left = position.startX;
|
|
1470
|
+
const rawTop = position.startY - 28 - ANCHOR_OFFSET_Y;
|
|
1471
|
+
const top = Math.max(0, rawTop);
|
|
1472
|
+
const width = Math.max(ANCHOR_MIN_WIDTH, Math.min(ANCHOR_MAX_WIDTH, item.tableName.length * 8.5 + ANCHOR_PADDING_X * 2 + ANCHOR_TOGGLE_WIDTH));
|
|
1473
|
+
const toggleRegion = {
|
|
1474
|
+
type: "anchor-menu-toggle",
|
|
1475
|
+
tableId: item.tableId,
|
|
1476
|
+
left: left + width - ANCHOR_TOGGLE_WIDTH,
|
|
1477
|
+
top,
|
|
1478
|
+
width: ANCHOR_TOGGLE_WIDTH,
|
|
1479
|
+
height: 28
|
|
1480
|
+
};
|
|
1481
|
+
ctx.save();
|
|
1482
|
+
ctx.translateWithPrecision(left, top);
|
|
1483
|
+
this._drawTopRoundedRect(ctx, width, 28, 14, item.fill, ANCHOR_BORDER);
|
|
1484
|
+
this._drawAnchorToggle(ctx, width, item.text, this._openedMenuTableId === item.tableId || this._isSameRegion(this._hoveredRegion, toggleRegion));
|
|
1485
|
+
ctx.font = `600 13px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
|
|
1486
|
+
ctx.fillStyle = item.text;
|
|
1487
|
+
ctx.textAlign = "left";
|
|
1488
|
+
ctx.fillText(item.tableName, ANCHOR_PADDING_X, 28 / 2);
|
|
1489
|
+
ctx.restore();
|
|
1490
|
+
this._regions.push({
|
|
1491
|
+
type: "anchor-main",
|
|
1492
|
+
tableId: item.tableId,
|
|
1493
|
+
left,
|
|
1494
|
+
top,
|
|
1495
|
+
width,
|
|
1496
|
+
height: 28
|
|
1497
|
+
});
|
|
1498
|
+
this._regions.push(toggleRegion);
|
|
1499
|
+
if (this._openedMenuTableId === item.tableId) this._drawMenu(ctx, item.tableId, left, top + 28);
|
|
1500
|
+
}
|
|
1501
|
+
_drawAnchorToggle(ctx, anchorWidth, color, active) {
|
|
1502
|
+
const toggleLeft = anchorWidth - ANCHOR_TOGGLE_WIDTH;
|
|
1503
|
+
if (active) this._drawRightTopRoundedRect(ctx, toggleLeft, anchorWidth, 28, 14, ANCHOR_TOGGLE_BG_ACTIVE);
|
|
1504
|
+
ctx.save();
|
|
1505
|
+
ctx.beginPath();
|
|
1506
|
+
ctx.strokeStyle = ANCHOR_DIVIDER;
|
|
1507
|
+
ctx.lineWidth = 1;
|
|
1508
|
+
ctx.moveTo(toggleLeft + .5, 5);
|
|
1509
|
+
ctx.lineTo(toggleLeft + .5, 28 - 5);
|
|
1510
|
+
ctx.stroke();
|
|
1511
|
+
ctx.restore();
|
|
1512
|
+
const centerX = anchorWidth - ANCHOR_TOGGLE_WIDTH / 2;
|
|
1513
|
+
const centerY = 28 / 2;
|
|
1514
|
+
ctx.save();
|
|
1515
|
+
ctx.beginPath();
|
|
1516
|
+
ctx.strokeStyle = color;
|
|
1517
|
+
ctx.lineWidth = 1.6;
|
|
1518
|
+
ctx.lineCap = "round";
|
|
1519
|
+
ctx.moveTo(centerX - 5, centerY - 4);
|
|
1520
|
+
ctx.lineTo(centerX + 5, centerY - 4);
|
|
1521
|
+
ctx.moveTo(centerX - 5, centerY);
|
|
1522
|
+
ctx.lineTo(centerX + 5, centerY);
|
|
1523
|
+
ctx.moveTo(centerX - 5, centerY + 4);
|
|
1524
|
+
ctx.lineTo(centerX + 5, centerY + 4);
|
|
1525
|
+
ctx.stroke();
|
|
1526
|
+
ctx.restore();
|
|
1527
|
+
}
|
|
1528
|
+
_drawTopRoundedRect(ctx, width, height, radius, fill, stroke) {
|
|
1529
|
+
const r = Math.min(radius, width / 2, height);
|
|
1530
|
+
ctx.beginPath();
|
|
1531
|
+
ctx.moveTo(0, height);
|
|
1532
|
+
ctx.lineTo(0, r);
|
|
1533
|
+
ctx.arcTo(0, 0, r, 0, r);
|
|
1534
|
+
ctx.lineTo(width - r, 0);
|
|
1535
|
+
ctx.arcTo(width, 0, width, r, r);
|
|
1536
|
+
ctx.lineTo(width, height);
|
|
1537
|
+
ctx.closePath();
|
|
1538
|
+
ctx.fillStyle = fill;
|
|
1539
|
+
ctx.fill();
|
|
1540
|
+
if (stroke) {
|
|
1541
|
+
ctx.strokeStyle = stroke;
|
|
1542
|
+
ctx.lineWidth = 1;
|
|
1543
|
+
ctx.stroke();
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
_drawRightTopRoundedRect(ctx, left, width, height, radius, fill) {
|
|
1547
|
+
const r = Math.min(radius, width - left, height);
|
|
1548
|
+
ctx.save();
|
|
1549
|
+
ctx.beginPath();
|
|
1550
|
+
ctx.moveTo(left, height);
|
|
1551
|
+
ctx.lineTo(left, 0);
|
|
1552
|
+
ctx.lineTo(width - r, 0);
|
|
1553
|
+
ctx.arcTo(width, 0, width, r, r);
|
|
1554
|
+
ctx.lineTo(width, height);
|
|
1555
|
+
ctx.closePath();
|
|
1556
|
+
ctx.fillStyle = fill;
|
|
1557
|
+
ctx.fill();
|
|
1558
|
+
ctx.restore();
|
|
1559
|
+
}
|
|
1560
|
+
_drawMenu(ctx, tableId, left, top) {
|
|
1561
|
+
const regions = buildTableMenuRegions(tableId, left, top);
|
|
1562
|
+
ctx.save();
|
|
1563
|
+
ctx.translateWithPrecision(left, top);
|
|
1564
|
+
_univerjs_engine_render.Rect.drawWith(ctx, {
|
|
1565
|
+
width: 168,
|
|
1566
|
+
height: regions.length * 32,
|
|
1567
|
+
radius: MENU_RADIUS,
|
|
1568
|
+
fill: "#fff",
|
|
1569
|
+
stroke: MENU_BORDER
|
|
1570
|
+
});
|
|
1571
|
+
ctx.restore();
|
|
1572
|
+
for (const region of regions) {
|
|
1573
|
+
if (this._isSameRegion(this._hoveredRegion, region)) {
|
|
1574
|
+
ctx.save();
|
|
1575
|
+
ctx.fillStyle = MENU_HOVER_BG;
|
|
1576
|
+
ctx.fillRectByPrecision(region.left, region.top, region.width, region.height);
|
|
1577
|
+
ctx.restore();
|
|
1578
|
+
}
|
|
1579
|
+
ctx.save();
|
|
1580
|
+
ctx.font = `12px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
|
|
1581
|
+
ctx.fillStyle = region.action === "delete" ? "#d92d20" : "#344054";
|
|
1582
|
+
ctx.textAlign = "left";
|
|
1583
|
+
ctx.fillText(this._menuLabels[region.action], region.left + 12, region.top + region.height / 2);
|
|
1584
|
+
ctx.restore();
|
|
1585
|
+
}
|
|
1586
|
+
this._regions.push(...regions);
|
|
1587
|
+
}
|
|
1588
|
+
_drawInsertButton(ctx, region, fill) {
|
|
1589
|
+
const centerX = region.left + region.width / 2;
|
|
1590
|
+
const centerY = region.top + region.height / 2;
|
|
1591
|
+
const radius = INSERT_BUTTON_VISUAL_SIZE / 2;
|
|
1592
|
+
ctx.save();
|
|
1593
|
+
ctx.beginPath();
|
|
1594
|
+
ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
1595
|
+
ctx.fillStyle = "#fff";
|
|
1596
|
+
ctx.fill();
|
|
1597
|
+
ctx.strokeStyle = fill;
|
|
1598
|
+
ctx.stroke();
|
|
1599
|
+
ctx.beginPath();
|
|
1600
|
+
ctx.strokeStyle = fill;
|
|
1601
|
+
ctx.lineWidth = 1;
|
|
1602
|
+
ctx.lineCap = "round";
|
|
1603
|
+
for (const segment of buildCenteredPlusSegments(centerX, centerY, INSERT_BUTTON_PLUS_SIZE)) {
|
|
1604
|
+
ctx.moveTo(segment.fromX, segment.fromY);
|
|
1605
|
+
ctx.lineTo(segment.toX, segment.toY);
|
|
1606
|
+
}
|
|
1607
|
+
ctx.stroke();
|
|
1608
|
+
ctx.restore();
|
|
1609
|
+
}
|
|
1610
|
+
_isSameRegion(a, b) {
|
|
1611
|
+
return Boolean(a && a.type === b.type && a.tableId === b.tableId && a.action === b.action && a.index === b.index);
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1169
1615
|
//#endregion
|
|
1170
1616
|
//#region src/controllers/sheet-table-theme-ui.controller.ts
|
|
1171
1617
|
let SheetTableThemeUIController = class SheetTableThemeUIController extends _univerjs_core.Disposable {
|
|
@@ -1188,372 +1634,364 @@ let SheetTableThemeUIController = class SheetTableThemeUIController extends _uni
|
|
|
1188
1634
|
SheetTableThemeUIController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService))], SheetTableThemeUIController);
|
|
1189
1635
|
|
|
1190
1636
|
//#endregion
|
|
1191
|
-
//#region src/
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
1202
|
-
const workbookPermissionInitState = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(_univerjs_sheets.WorkbookPermissionService).unitPermissionInitStateChange$, false);
|
|
1203
|
-
const tableManager = (0, _univerjs_ui.useDependency)(_univerjs_sheets_table.TableManager);
|
|
1204
|
-
const rangeThemeModel = (0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetRangeThemeModel);
|
|
1205
|
-
const tableRefresh$ = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(SheetTableThemeUIController).refreshTable$);
|
|
1206
|
-
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
1207
|
-
const selections = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetsSelectionsService).selectionChanged$, [{
|
|
1208
|
-
range: (0, _univerjs_core.cellToRange)(0, 0),
|
|
1209
|
-
primary: null
|
|
1210
|
-
}]);
|
|
1211
|
-
const [, setRefresh] = (0, react.useState)(Math.random());
|
|
1212
|
-
const tableConfig = (0, _univerjs_ui.useDependency)(_univerjs_core.IConfigService).getConfig(SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY);
|
|
1213
|
-
const anchorHeight = (_tableConfig$anchorHe = tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.anchorHeight) !== null && _tableConfig$anchorHe !== void 0 ? _tableConfig$anchorHe : 24;
|
|
1214
|
-
const anchorBackgroundColor = (_tableConfig$anchorBa = tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.anchorBackgroundColor) !== null && _tableConfig$anchorBa !== void 0 ? _tableConfig$anchorBa : "rgb(53,91,183)";
|
|
1215
|
-
const updateOpenState = (tableId, isOpen) => {
|
|
1216
|
-
setOpenStates((prev) => ({
|
|
1217
|
-
...prev,
|
|
1218
|
-
[tableId]: isOpen
|
|
1219
|
-
}));
|
|
1220
|
-
};
|
|
1221
|
-
(0, react.useEffect)(() => {
|
|
1222
|
-
setRefresh(Math.random());
|
|
1223
|
-
}, [tableRefresh$]);
|
|
1224
|
-
if (!(anchorPosition === null || anchorPosition === void 0 ? void 0 : anchorPosition.length)) return null;
|
|
1225
|
-
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
1226
|
-
if (!target) return null;
|
|
1227
|
-
const { unitId, subUnitId } = target;
|
|
1228
|
-
const handleChangeTableName = (tableId, name) => {
|
|
1229
|
-
var _tableManager$getTabl;
|
|
1230
|
-
if (((_tableManager$getTabl = tableManager.getTableById(unitId, tableId)) === null || _tableManager$getTabl === void 0 ? void 0 : _tableManager$getTabl.getDisplayName()) === name) {
|
|
1231
|
-
setInputFocusId("");
|
|
1232
|
-
setInputValue("");
|
|
1233
|
-
return;
|
|
1234
|
-
}
|
|
1235
|
-
commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
|
|
1236
|
-
tableId,
|
|
1237
|
-
unitId,
|
|
1238
|
-
name
|
|
1239
|
-
});
|
|
1240
|
-
setInputValue("");
|
|
1241
|
-
setInputFocusId("");
|
|
1242
|
-
};
|
|
1243
|
-
const handleChangeRange = async (tableId) => {
|
|
1244
|
-
const table = tableManager.getTableById(unitId, tableId);
|
|
1245
|
-
if (!table) return;
|
|
1246
|
-
const selection = await openRangeSelector(injector, unitId, subUnitId, table.getRange(), tableId);
|
|
1247
|
-
if (!selection) return;
|
|
1248
|
-
commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
|
|
1249
|
-
tableId,
|
|
1250
|
-
unitId,
|
|
1251
|
-
updateRange: { newRange: selection.range }
|
|
1252
|
-
});
|
|
1253
|
-
};
|
|
1254
|
-
if (!workbookPermissionInitState) return null;
|
|
1255
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1256
|
-
className: "univer-absolute univer-z-50 univer-size-0",
|
|
1257
|
-
children: anchorPosition.map((item) => {
|
|
1258
|
-
var _rangeTheme$getHeader, _rangeTheme$getHeader2, _rangeTheme$getHeader3, _rangeTheme$getHeader4, _openStates$item$tabl;
|
|
1259
|
-
const table = tableManager.getTableById(unitId, item.tableId);
|
|
1260
|
-
if (!table) return null;
|
|
1261
|
-
const rangeTheme = rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId());
|
|
1262
|
-
const headerBgColor = (_rangeTheme$getHeader = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader2 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader2 === void 0 || (_rangeTheme$getHeader2 = _rangeTheme$getHeader2.bg) === null || _rangeTheme$getHeader2 === void 0 ? void 0 : _rangeTheme$getHeader2.rgb) !== null && _rangeTheme$getHeader !== void 0 ? _rangeTheme$getHeader : anchorBackgroundColor;
|
|
1263
|
-
const headerTextColor = (_rangeTheme$getHeader3 = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader4 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader4 === void 0 || (_rangeTheme$getHeader4 = _rangeTheme$getHeader4.cl) === null || _rangeTheme$getHeader4 === void 0 ? void 0 : _rangeTheme$getHeader4.rgb) !== null && _rangeTheme$getHeader3 !== void 0 ? _rangeTheme$getHeader3 : "rgb(255, 255, 255)";
|
|
1264
|
-
const tableRange = table.getRange();
|
|
1265
|
-
if (!(selections === null || selections === void 0 ? void 0 : selections.length)) return null;
|
|
1266
|
-
const lastRange = selections[selections.length - 1].range;
|
|
1267
|
-
const shouldHidden = !_univerjs_core.Rectangle.intersects(tableRange, lastRange) && item.y <= 20;
|
|
1268
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1269
|
-
className: (0, _univerjs_design.clsx)("univer-shadow-xs univer-absolute univer-box-border univer-cursor-pointer univer-items-center univer-rounded-xl univer-px-2", _univerjs_design.borderClassName, {
|
|
1270
|
-
"univer-flex": !shouldHidden,
|
|
1271
|
-
"univer-hidden": shouldHidden
|
|
1272
|
-
}),
|
|
1273
|
-
style: {
|
|
1274
|
-
left: item.x,
|
|
1275
|
-
top: Math.max(item.y, 0),
|
|
1276
|
-
backgroundColor: headerBgColor,
|
|
1277
|
-
color: headerTextColor,
|
|
1278
|
-
borderWidth: "0.5px",
|
|
1279
|
-
height: anchorHeight ? `${anchorHeight}px` : "24px"
|
|
1280
|
-
},
|
|
1281
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1282
|
-
className: "univer-text-nowrap",
|
|
1283
|
-
children: inputFocusId === item.tableId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
1284
|
-
className: "univer-h-[18px] univer-min-w-16 univer-rounded-none",
|
|
1285
|
-
inputClass: "univer-h-[18px] univer-w-[80px]",
|
|
1286
|
-
value: inputValue,
|
|
1287
|
-
onChange: (v) => setInputValue(v),
|
|
1288
|
-
onBlur: () => handleChangeTableName(item.tableId, inputValue),
|
|
1289
|
-
onKeyDown: (e) => {
|
|
1290
|
-
if (e.key === "Enter") handleChangeTableName(item.tableId, inputValue);
|
|
1291
|
-
},
|
|
1292
|
-
autoFocus: inputFocusId === item.tableId
|
|
1293
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1294
|
-
className: "univer-h-[18px] univer-max-w-24 univer-truncate univer-text-sm",
|
|
1295
|
-
children: item.tableName
|
|
1296
|
-
})
|
|
1297
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
1298
|
-
align: "start",
|
|
1299
|
-
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1300
|
-
className: "univer-py-2",
|
|
1301
|
-
children: [
|
|
1302
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1303
|
-
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",
|
|
1304
|
-
onClick: () => {
|
|
1305
|
-
setInputFocusId(item.tableId);
|
|
1306
|
-
setInputValue(item.tableName);
|
|
1307
|
-
},
|
|
1308
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.RenameIcon, {}), localeService.t("sheets-table.rename")]
|
|
1309
|
-
}),
|
|
1310
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200" }),
|
|
1311
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1312
|
-
onClick: () => handleChangeRange(item.tableId),
|
|
1313
|
-
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",
|
|
1314
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.GridOutlineIcon, {}), localeService.t("sheets-table.updateRange")]
|
|
1315
|
-
}),
|
|
1316
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1317
|
-
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",
|
|
1318
|
-
onClick: () => {
|
|
1319
|
-
updateOpenState(item.tableId, false);
|
|
1320
|
-
const table = tableManager.getTableById(unitId, item.tableId);
|
|
1321
|
-
if (!table) return;
|
|
1322
|
-
const tableConfig = table.getTableConfig();
|
|
1323
|
-
const sidebarConfig = {
|
|
1324
|
-
id: SHEET_TABLE_THEME_PANEL_ID,
|
|
1325
|
-
header: { title: localeService.t("sheets-table.tableStyle") },
|
|
1326
|
-
children: {
|
|
1327
|
-
label: SHEET_TABLE_THEME_PANEL,
|
|
1328
|
-
oldConfig: tableConfig,
|
|
1329
|
-
unitId,
|
|
1330
|
-
subUnitId,
|
|
1331
|
-
tableId: item.tableId
|
|
1332
|
-
},
|
|
1333
|
-
width: 330
|
|
1334
|
-
};
|
|
1335
|
-
sidebarService.open(sidebarConfig);
|
|
1336
|
-
},
|
|
1337
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.PaintBucketDoubleIcon, { extend: { colorChannel1: "rgb(53,91,183)" } }), localeService.t("sheets-table.setTheme")]
|
|
1338
|
-
}),
|
|
1339
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200" }),
|
|
1340
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1341
|
-
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",
|
|
1342
|
-
onClick: () => {
|
|
1343
|
-
updateOpenState(item.tableId, false);
|
|
1344
|
-
commandService.executeCommand(_univerjs_sheets_table.DeleteSheetTableCommand.id, {
|
|
1345
|
-
tableId: item.tableId,
|
|
1346
|
-
subUnitId,
|
|
1347
|
-
unitId
|
|
1348
|
-
});
|
|
1349
|
-
},
|
|
1350
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteIcon, { className: "univer-mr-2" }), localeService.t("sheets-table.removeTable")]
|
|
1351
|
-
})
|
|
1352
|
-
]
|
|
1353
|
-
}),
|
|
1354
|
-
open: (_openStates$item$tabl = openStates[item.tableId]) !== null && _openStates$item$tabl !== void 0 ? _openStates$item$tabl : false,
|
|
1355
|
-
onOpenChange: (isOpen) => {
|
|
1356
|
-
updateOpenState(item.tableId, isOpen);
|
|
1357
|
-
},
|
|
1358
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {}) })
|
|
1359
|
-
}, item.tableId)]
|
|
1360
|
-
}, item.tableId);
|
|
1361
|
-
})
|
|
1362
|
-
});
|
|
1363
|
-
};
|
|
1364
|
-
|
|
1365
|
-
//#endregion
|
|
1366
|
-
//#region src/controllers/sheet-table-anchor.controller.ts
|
|
1367
|
-
let SheetTableAnchorController = class SheetTableAnchorController extends _univerjs_core.Disposable {
|
|
1368
|
-
constructor(_context, _injector, _sheetSkeletonManagerService, _renderManagerService, _commandService, _univerInstanceService, _uiPartsService, _tableManager, _scrollManagerService, _workbookPermissionService, _permissionService) {
|
|
1637
|
+
//#region src/controllers/sheet-table-controls-render.controller.ts
|
|
1638
|
+
const TABLE_CONTROLS_LAYER_INDEX = 5002;
|
|
1639
|
+
const TABLE_CONTROL_GAP_ROW = 0;
|
|
1640
|
+
const TABLE_RENDER_REFRESH_COMMANDS = new Set([_univerjs_sheets_ui.SetScrollOperation.id, _univerjs_sheets_ui.SetZoomRatioOperation.id]);
|
|
1641
|
+
function isSameTopGap(left, right) {
|
|
1642
|
+
if (left === null || right === null) return left === right;
|
|
1643
|
+
return left.size === right.size && left.color === right.color && left.stripeColor === right.stripeColor;
|
|
1644
|
+
}
|
|
1645
|
+
let SheetTableControlsRenderController = class SheetTableControlsRenderController extends _univerjs_core.Disposable {
|
|
1646
|
+
constructor(_context, _injector, _sheetSkeletonManagerService, _commandService, _tableManager, _rangeThemeModel, _workbookPermissionService, _permissionService, _sheetsSelectionsService, _selectionRenderService, _sheetTableThemeUIController, _localeService, _dialogService, _sidebarService) {
|
|
1369
1647
|
super();
|
|
1370
1648
|
this._context = _context;
|
|
1371
1649
|
this._injector = _injector;
|
|
1372
1650
|
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
1373
|
-
this._renderManagerService = _renderManagerService;
|
|
1374
1651
|
this._commandService = _commandService;
|
|
1375
|
-
this._univerInstanceService = _univerInstanceService;
|
|
1376
|
-
this._uiPartsService = _uiPartsService;
|
|
1377
1652
|
this._tableManager = _tableManager;
|
|
1378
|
-
this.
|
|
1653
|
+
this._rangeThemeModel = _rangeThemeModel;
|
|
1379
1654
|
this._workbookPermissionService = _workbookPermissionService;
|
|
1380
1655
|
this._permissionService = _permissionService;
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
this.
|
|
1386
|
-
this.
|
|
1387
|
-
this
|
|
1656
|
+
this._sheetsSelectionsService = _sheetsSelectionsService;
|
|
1657
|
+
this._selectionRenderService = _selectionRenderService;
|
|
1658
|
+
this._sheetTableThemeUIController = _sheetTableThemeUIController;
|
|
1659
|
+
this._localeService = _localeService;
|
|
1660
|
+
this._dialogService = _dialogService;
|
|
1661
|
+
this._sidebarService = _sidebarService;
|
|
1662
|
+
_defineProperty(this, "_shape", void 0);
|
|
1663
|
+
_defineProperty(this, "_topGapBaseBySkeleton", /* @__PURE__ */ new WeakMap());
|
|
1664
|
+
this._shape = new SheetTableControlsShape("SheetTableControlsShape", () => this._sheetSkeletonManagerService.getCurrentSkeleton() || null);
|
|
1665
|
+
this._initShape();
|
|
1666
|
+
this._initRefresh();
|
|
1667
|
+
this._refresh();
|
|
1388
1668
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1669
|
+
_initShape() {
|
|
1670
|
+
var _this$_context$compon, _this$_context$compon2;
|
|
1671
|
+
this._context.scene.addObjects([this._shape], TABLE_CONTROLS_LAYER_INDEX);
|
|
1672
|
+
this.disposeWithMe((0, _univerjs_core.toDisposable)(() => {
|
|
1673
|
+
this._context.scene.removeObjects([this._shape]);
|
|
1674
|
+
}));
|
|
1675
|
+
this.disposeWithMe(this._shape.onPointerMove$.subscribeEvent((evt, state) => {
|
|
1676
|
+
this._handlePointerMove(evt, state);
|
|
1677
|
+
}));
|
|
1678
|
+
this.disposeWithMe(this._shape.onPointerLeave$.subscribeEvent((_evt, state) => {
|
|
1679
|
+
this._handlePointerLeave(state);
|
|
1680
|
+
}));
|
|
1681
|
+
this.disposeWithMe(this._shape.onPointerDown$.subscribeEvent((evt, state) => {
|
|
1682
|
+
this._handlePointerDown(evt, state);
|
|
1683
|
+
}));
|
|
1684
|
+
this.disposeWithMe((_this$_context$compon = (_this$_context$compon2 = this._context.components.get(_univerjs_sheets_ui.SHEET_VIEW_KEY.MAIN)) === null || _this$_context$compon2 === void 0 ? void 0 : _this$_context$compon2.onPointerMove$.subscribeEvent((evt) => {
|
|
1685
|
+
const point = this._getLocalPoint(evt);
|
|
1686
|
+
const insertRegion = this._getInsertRegionFromPoint(point.x, point.y);
|
|
1687
|
+
this._shape.setHoveredInsertRegion(insertRegion);
|
|
1688
|
+
})) !== null && _this$_context$compon !== void 0 ? _this$_context$compon : (0, _univerjs_core.toDisposable)(() => {}));
|
|
1391
1689
|
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
if (command.
|
|
1395
|
-
this.
|
|
1396
|
-
|
|
1397
|
-
this._timer = setTimeout(() => {
|
|
1398
|
-
this._anchorVisible$.next(true);
|
|
1399
|
-
}, 300);
|
|
1690
|
+
_initRefresh() {
|
|
1691
|
+
const commandExecuted$ = (0, _univerjs_core.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0, rxjs.filter)(([command]) => {
|
|
1692
|
+
if (command.type === _univerjs_core.CommandType.OPERATION && TABLE_RENDER_REFRESH_COMMANDS.has(command.id)) {
|
|
1693
|
+
this._closeFloatingControls();
|
|
1694
|
+
return true;
|
|
1400
1695
|
}
|
|
1696
|
+
return command.type === _univerjs_core.CommandType.MUTATION || command.type === _univerjs_core.CommandType.COMMAND;
|
|
1697
|
+
}));
|
|
1698
|
+
this.disposeWithMe((0, rxjs.merge)(this._context.unit.activeSheet$, this._sheetSkeletonManagerService.currentSkeleton$, this._tableManager.tableAdd$, this._tableManager.tableDelete$, this._tableManager.tableNameChanged$, this._tableManager.tableRangeChanged$, this._tableManager.tableThemeChanged$, this._sheetTableThemeUIController.refreshTable$, this._workbookPermissionService.unitPermissionInitStateChange$, this._permissionService.permissionPointUpdate$, this._sheetsSelectionsService.selectionChanged$, commandExecuted$).subscribe(() => {
|
|
1699
|
+
this._closeFloatingControls();
|
|
1700
|
+
this._refresh();
|
|
1401
1701
|
}));
|
|
1402
1702
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1703
|
+
_refresh() {
|
|
1704
|
+
const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
1705
|
+
const worksheet = this._context.unit.getActiveSheet();
|
|
1706
|
+
if (!skeleton || !worksheet || !this._canEditWorkbook()) {
|
|
1707
|
+
this._shape.setItems([]);
|
|
1708
|
+
this._shape.refreshBounds();
|
|
1709
|
+
this._context.scene.makeDirty();
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
this._syncTopTableGap(skeleton);
|
|
1713
|
+
this._shape.setMenuLabels({
|
|
1714
|
+
rename: this._localeService.t("sheets-table-ui.rename"),
|
|
1715
|
+
"update-range": this._localeService.t("sheets-table-ui.updateRange"),
|
|
1716
|
+
"set-theme": this._localeService.t("sheets-table-ui.setTheme"),
|
|
1717
|
+
delete: this._localeService.t("sheets-table-ui.removeTable")
|
|
1718
|
+
});
|
|
1719
|
+
const unitId = this._context.unit.getUnitId();
|
|
1720
|
+
const subUnitId = worksheet.getSheetId();
|
|
1721
|
+
const items = this._tableManager.getTablesBySubunitId(unitId, subUnitId).map((table) => {
|
|
1722
|
+
var _rangeTheme$getHeader, _rangeTheme$getHeader2, _rangeTheme$getHeader3, _rangeTheme$getHeader4;
|
|
1723
|
+
const rangeTheme = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId());
|
|
1724
|
+
return {
|
|
1725
|
+
tableId: table.getId(),
|
|
1726
|
+
tableName: table.getDisplayName(),
|
|
1727
|
+
range: table.getRange(),
|
|
1728
|
+
fill: (_rangeTheme$getHeader = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader2 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader2 === void 0 || (_rangeTheme$getHeader2 = _rangeTheme$getHeader2.bg) === null || _rangeTheme$getHeader2 === void 0 ? void 0 : _rangeTheme$getHeader2.rgb) !== null && _rangeTheme$getHeader !== void 0 ? _rangeTheme$getHeader : "rgb(53,91,183)",
|
|
1729
|
+
text: (_rangeTheme$getHeader3 = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader4 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader4 === void 0 || (_rangeTheme$getHeader4 = _rangeTheme$getHeader4.cl) === null || _rangeTheme$getHeader4 === void 0 ? void 0 : _rangeTheme$getHeader4.rgb) !== null && _rangeTheme$getHeader3 !== void 0 ? _rangeTheme$getHeader3 : "rgb(255,255,255)"
|
|
1730
|
+
};
|
|
1731
|
+
});
|
|
1732
|
+
this._shape.setItems(items);
|
|
1733
|
+
this._shape.refreshBounds();
|
|
1734
|
+
this._shape.makeDirty(true);
|
|
1735
|
+
this._context.scene.makeDirty();
|
|
1736
|
+
}
|
|
1737
|
+
_canEditWorkbook() {
|
|
1738
|
+
var _this$_permissionServ;
|
|
1739
|
+
const unitId = this._context.unit.getUnitId();
|
|
1740
|
+
return ((_this$_permissionServ = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookEditablePermission(unitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) !== false;
|
|
1741
|
+
}
|
|
1742
|
+
_handlePointerMove(evt, state) {
|
|
1743
|
+
const point = this._getLocalPoint(evt);
|
|
1744
|
+
const hit = this._shape.hitTest(point.x, point.y);
|
|
1745
|
+
const insertRegion = this._isInsertHit(hit) ? hit : hit ? null : this._getInsertRegionFromPoint(point.x, point.y);
|
|
1746
|
+
const activeHit = hit !== null && hit !== void 0 ? hit : insertRegion;
|
|
1747
|
+
this._shape.setHoveredRegion(this._isInsertHit(hit) ? null : hit);
|
|
1748
|
+
this._shape.setHoveredInsertRegion(insertRegion);
|
|
1749
|
+
if (activeHit) {
|
|
1750
|
+
state.stopPropagation();
|
|
1751
|
+
this._context.scene.setCursor(_univerjs_engine_render.CURSOR_TYPE.POINTER);
|
|
1752
|
+
} else this._context.scene.resetCursor();
|
|
1753
|
+
}
|
|
1754
|
+
_isInsertHit(hit) {
|
|
1755
|
+
return (hit === null || hit === void 0 ? void 0 : hit.type) === "insert-row" || (hit === null || hit === void 0 ? void 0 : hit.type) === "insert-column";
|
|
1756
|
+
}
|
|
1757
|
+
_handlePointerLeave(state) {
|
|
1758
|
+
state.stopPropagation();
|
|
1759
|
+
this._shape.setHoveredRegion(null);
|
|
1760
|
+
this._shape.setHoveredInsertRegion(null);
|
|
1761
|
+
this._context.scene.resetCursor();
|
|
1762
|
+
}
|
|
1763
|
+
_handlePointerDown(evt, state) {
|
|
1764
|
+
var _this$_shape$hitTest;
|
|
1765
|
+
if (evt.button === 2) return;
|
|
1766
|
+
const point = this._getLocalPoint(evt);
|
|
1767
|
+
const hit = (_this$_shape$hitTest = this._shape.hitTest(point.x, point.y)) !== null && _this$_shape$hitTest !== void 0 ? _this$_shape$hitTest : this._getInsertRegionFromPoint(point.x, point.y);
|
|
1768
|
+
if (!hit) {
|
|
1769
|
+
this._closeFloatingControls();
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
state.stopPropagation();
|
|
1773
|
+
evt.stopPropagation();
|
|
1774
|
+
evt.preventDefault();
|
|
1775
|
+
this._handleHit(hit);
|
|
1776
|
+
}
|
|
1777
|
+
_handleHit(hit) {
|
|
1778
|
+
const worksheet = this._context.unit.getActiveSheet();
|
|
1779
|
+
if (!worksheet) return;
|
|
1780
|
+
const unitId = this._context.unit.getUnitId();
|
|
1781
|
+
const subUnitId = worksheet.getSheetId();
|
|
1782
|
+
if (hit.type === "anchor-menu-toggle" || hit.type === "anchor-main") {
|
|
1783
|
+
this._shape.setOpenedMenuTableId(this._shape.getOpenedMenuTableId() === hit.tableId ? null : hit.tableId);
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
if (hit.type === "insert-row") {
|
|
1787
|
+
this._commandService.executeCommand(_univerjs_sheets_table.SheetTableInsertRowAtCommand.id, {
|
|
1788
|
+
unitId,
|
|
1789
|
+
subUnitId,
|
|
1790
|
+
tableId: hit.tableId,
|
|
1791
|
+
index: hit.index,
|
|
1792
|
+
count: 1
|
|
1415
1793
|
});
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
tableName: table.name
|
|
1794
|
+
this._closeFloatingControls();
|
|
1795
|
+
return;
|
|
1796
|
+
}
|
|
1797
|
+
if (hit.type === "insert-column") {
|
|
1798
|
+
this._commandService.executeCommand(_univerjs_sheets_table.SheetTableInsertColumnAtCommand.id, {
|
|
1799
|
+
unitId,
|
|
1800
|
+
subUnitId,
|
|
1801
|
+
tableId: hit.tableId,
|
|
1802
|
+
index: hit.index,
|
|
1803
|
+
count: 1
|
|
1804
|
+
});
|
|
1805
|
+
this._closeFloatingControls();
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
if (hit.type !== "menu-item") return;
|
|
1809
|
+
switch (hit.action) {
|
|
1810
|
+
case "rename":
|
|
1811
|
+
this._openRenameDialog(unitId, hit.tableId);
|
|
1812
|
+
break;
|
|
1813
|
+
case "update-range":
|
|
1814
|
+
this._openRangeSelector(unitId, subUnitId, hit.tableId);
|
|
1815
|
+
break;
|
|
1816
|
+
case "set-theme":
|
|
1817
|
+
this._openThemePanel(unitId, subUnitId, hit.tableId);
|
|
1818
|
+
break;
|
|
1819
|
+
case "delete":
|
|
1820
|
+
this._commandService.executeCommand(_univerjs_sheets_table.DeleteSheetTableCommand.id, {
|
|
1821
|
+
tableId: hit.tableId,
|
|
1822
|
+
subUnitId,
|
|
1823
|
+
unitId
|
|
1447
1824
|
});
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
}));
|
|
1825
|
+
break;
|
|
1826
|
+
}
|
|
1827
|
+
this._closeFloatingControls();
|
|
1452
1828
|
}
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
const PIVOT_BUTTON_EMPTY = new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");
|
|
1471
|
-
var TableButton = class {
|
|
1472
|
-
static drawNoSetting(ctx, size, fgColor, bgColor) {
|
|
1473
|
-
ctx.save();
|
|
1474
|
-
_univerjs_engine_render.Rect.drawWith(ctx, {
|
|
1475
|
-
radius: 2,
|
|
1476
|
-
width: BUTTON_VIEWPORT,
|
|
1477
|
-
height: BUTTON_VIEWPORT,
|
|
1478
|
-
fill: bgColor
|
|
1829
|
+
_openRenameDialog(unitId, tableId) {
|
|
1830
|
+
this._dialogService.open({
|
|
1831
|
+
id: SHEET_TABLE_RENAME_DIALOG_ID,
|
|
1832
|
+
title: { title: this._localeService.t("sheets-table-ui.rename") },
|
|
1833
|
+
draggable: true,
|
|
1834
|
+
destroyOnClose: true,
|
|
1835
|
+
mask: true,
|
|
1836
|
+
children: { label: {
|
|
1837
|
+
name: SHEET_TABLE_RENAME_DIALOG,
|
|
1838
|
+
props: {
|
|
1839
|
+
unitId,
|
|
1840
|
+
tableId,
|
|
1841
|
+
onClose: () => this._dialogService.close(SHEET_TABLE_RENAME_DIALOG_ID)
|
|
1842
|
+
}
|
|
1843
|
+
} },
|
|
1844
|
+
width: 360,
|
|
1845
|
+
onClose: () => this._dialogService.close(SHEET_TABLE_RENAME_DIALOG_ID)
|
|
1479
1846
|
});
|
|
1480
|
-
ctx.lineCap = "square";
|
|
1481
|
-
ctx.strokeStyle = fgColor;
|
|
1482
|
-
ctx.scale(size / BUTTON_VIEWPORT, size / BUTTON_VIEWPORT);
|
|
1483
|
-
ctx.beginPath();
|
|
1484
|
-
ctx.lineWidth = 1;
|
|
1485
|
-
ctx.lineCap = "round";
|
|
1486
|
-
ctx.moveTo(3, 4);
|
|
1487
|
-
ctx.lineTo(13, 4);
|
|
1488
|
-
ctx.moveTo(4.5, 8);
|
|
1489
|
-
ctx.lineTo(11.5, 8);
|
|
1490
|
-
ctx.moveTo(6, 12);
|
|
1491
|
-
ctx.lineTo(10, 12);
|
|
1492
|
-
ctx.stroke();
|
|
1493
|
-
ctx.restore();
|
|
1494
1847
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1848
|
+
async _openRangeSelector(unitId, subUnitId, tableId) {
|
|
1849
|
+
const table = this._tableManager.getTableById(unitId, tableId);
|
|
1850
|
+
if (!table) return;
|
|
1851
|
+
const selection = await openRangeSelector(this._injector, unitId, subUnitId, table.getRange(), tableId);
|
|
1852
|
+
if (!selection) return;
|
|
1853
|
+
this._commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
|
|
1854
|
+
tableId,
|
|
1855
|
+
unitId,
|
|
1856
|
+
updateRange: { newRange: selection.range }
|
|
1504
1857
|
});
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1858
|
+
}
|
|
1859
|
+
_openThemePanel(unitId, subUnitId, tableId) {
|
|
1860
|
+
const table = this._tableManager.getTableById(unitId, tableId);
|
|
1861
|
+
if (!table) return;
|
|
1862
|
+
this._sidebarService.open({
|
|
1863
|
+
id: SHEET_TABLE_THEME_PANEL_ID,
|
|
1864
|
+
header: { title: this._localeService.t("sheets-table-ui.tableStyle") },
|
|
1865
|
+
children: {
|
|
1866
|
+
label: SHEET_TABLE_THEME_PANEL,
|
|
1867
|
+
oldConfig: table.getTableConfig(),
|
|
1868
|
+
unitId,
|
|
1869
|
+
subUnitId,
|
|
1870
|
+
tableId
|
|
1871
|
+
},
|
|
1872
|
+
width: 330
|
|
1509
1873
|
});
|
|
1510
|
-
|
|
1874
|
+
}
|
|
1875
|
+
_getInsertRegionFromPoint(x, y) {
|
|
1876
|
+
const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
1877
|
+
const worksheet = this._context.unit.getActiveSheet();
|
|
1878
|
+
if (!skeleton || !worksheet) return null;
|
|
1879
|
+
const unitId = this._context.unit.getUnitId();
|
|
1880
|
+
const subUnitId = worksheet.getSheetId();
|
|
1881
|
+
const tables = this._tableManager.getTablesBySubunitId(unitId, subUnitId);
|
|
1882
|
+
for (const table of tables) {
|
|
1883
|
+
const range = table.getRange();
|
|
1884
|
+
const tableBounds = this._getRangeBounds(skeleton, range);
|
|
1885
|
+
if (x < tableBounds.left || x > tableBounds.right || y < tableBounds.top || y > tableBounds.bottom) continue;
|
|
1886
|
+
if (y > this._getRangeBounds(skeleton, {
|
|
1887
|
+
...range,
|
|
1888
|
+
endRow: range.startRow
|
|
1889
|
+
}).bottom) for (let row = range.startRow + 1; row <= range.endRow; row++) {
|
|
1890
|
+
const cell = skeleton.getNoMergeCellWithCoordByIndex(row, range.startColumn);
|
|
1891
|
+
if (y >= cell.startY && y <= cell.endY) return {
|
|
1892
|
+
type: "insert-row",
|
|
1893
|
+
tableId: table.getId(),
|
|
1894
|
+
index: row + 1,
|
|
1895
|
+
left: tableBounds.left - 22 / 2,
|
|
1896
|
+
top: cell.endY - 22 / 2,
|
|
1897
|
+
width: 22,
|
|
1898
|
+
height: 22
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
return null;
|
|
1903
|
+
}
|
|
1904
|
+
_getRangeBounds(skeleton, range) {
|
|
1905
|
+
const startCell = skeleton.getNoMergeCellWithCoordByIndex(range.startRow, range.startColumn);
|
|
1906
|
+
const endCell = skeleton.getNoMergeCellWithCoordByIndex(range.endRow, range.endColumn);
|
|
1907
|
+
return {
|
|
1908
|
+
left: startCell.startX,
|
|
1909
|
+
top: startCell.startY,
|
|
1910
|
+
right: endCell.endX,
|
|
1911
|
+
bottom: endCell.endY
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
_syncTopTableGap(skeleton) {
|
|
1915
|
+
const worksheet = this._context.unit.getActiveSheet();
|
|
1916
|
+
if (!worksheet) return;
|
|
1917
|
+
const unitId = this._context.unit.getUnitId();
|
|
1918
|
+
const subUnitId = worksheet.getSheetId();
|
|
1919
|
+
const hasTopTable = this._tableManager.getTablesBySubunitId(unitId, subUnitId).some((table) => table.getRange().startRow === 0);
|
|
1920
|
+
const current = skeleton.gapConfig;
|
|
1921
|
+
const rowGaps = { ...current.rowGaps };
|
|
1922
|
+
const previousTopGap = rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null;
|
|
1923
|
+
let shouldSync = false;
|
|
1924
|
+
if (hasTopTable) {
|
|
1925
|
+
var _baseGap$size;
|
|
1926
|
+
if (!this._topGapBaseBySkeleton.has(skeleton)) this._topGapBaseBySkeleton.set(skeleton, rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null);
|
|
1927
|
+
const baseGap = this._topGapBaseBySkeleton.get(skeleton);
|
|
1928
|
+
rowGaps[TABLE_CONTROL_GAP_ROW] = {
|
|
1929
|
+
...baseGap !== null && baseGap !== void 0 ? baseGap : rowGaps[TABLE_CONTROL_GAP_ROW],
|
|
1930
|
+
size: ((_baseGap$size = baseGap === null || baseGap === void 0 ? void 0 : baseGap.size) !== null && _baseGap$size !== void 0 ? _baseGap$size : 0) + 32
|
|
1931
|
+
};
|
|
1932
|
+
shouldSync = true;
|
|
1933
|
+
} else if (this._topGapBaseBySkeleton.has(skeleton)) {
|
|
1934
|
+
const baseGap = this._topGapBaseBySkeleton.get(skeleton);
|
|
1935
|
+
if (baseGap) rowGaps[TABLE_CONTROL_GAP_ROW] = { ...baseGap };
|
|
1936
|
+
else delete rowGaps[TABLE_CONTROL_GAP_ROW];
|
|
1937
|
+
this._topGapBaseBySkeleton.delete(skeleton);
|
|
1938
|
+
shouldSync = true;
|
|
1939
|
+
}
|
|
1940
|
+
if (!shouldSync) return;
|
|
1941
|
+
if (isSameTopGap(previousTopGap, rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null)) return;
|
|
1942
|
+
skeleton.setGapConfig({
|
|
1943
|
+
...current,
|
|
1944
|
+
rowGaps
|
|
1945
|
+
});
|
|
1946
|
+
this._refreshSelections();
|
|
1947
|
+
}
|
|
1948
|
+
_refreshSelections() {
|
|
1949
|
+
this._selectionRenderService.resetSelectionsByModelData(this._sheetsSelectionsService.getCurrentSelections());
|
|
1950
|
+
}
|
|
1951
|
+
_closeFloatingControls() {
|
|
1952
|
+
this._shape.setOpenedMenuTableId(null);
|
|
1953
|
+
this._shape.setHoveredInsertRegion(null);
|
|
1954
|
+
this._shape.setHoveredRegion(null);
|
|
1955
|
+
}
|
|
1956
|
+
_getLocalPoint(evt) {
|
|
1957
|
+
const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
1958
|
+
if (skeleton) return (0, _univerjs_sheets_ui.getTransformCoord)(evt.offsetX, evt.offsetY, this._context.scene, skeleton);
|
|
1959
|
+
return {
|
|
1960
|
+
x: evt.offsetX,
|
|
1961
|
+
y: evt.offsetY
|
|
1962
|
+
};
|
|
1511
1963
|
}
|
|
1512
1964
|
};
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
* See the License for the specific language governing permissions and
|
|
1529
|
-
* limitations under the License.
|
|
1530
|
-
*/
|
|
1531
|
-
const filterPartial = ["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"];
|
|
1532
|
-
const filteredSortAsc = ["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"];
|
|
1533
|
-
const filteredSortDesc = ["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"];
|
|
1534
|
-
const filterNoneSortAsc = [
|
|
1535
|
-
"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",
|
|
1536
|
-
"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",
|
|
1537
|
-
"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"
|
|
1538
|
-
];
|
|
1539
|
-
const filterNoneSortDesc = [
|
|
1540
|
-
"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",
|
|
1541
|
-
"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",
|
|
1542
|
-
"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"
|
|
1543
|
-
];
|
|
1965
|
+
SheetTableControlsRenderController = __decorate([
|
|
1966
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
1967
|
+
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetSkeletonManagerService)),
|
|
1968
|
+
__decorateParam(3, _univerjs_core.ICommandService),
|
|
1969
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_table.TableManager)),
|
|
1970
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeModel)),
|
|
1971
|
+
__decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_sheets.WorkbookPermissionService)),
|
|
1972
|
+
__decorateParam(7, (0, _univerjs_core.Inject)(_univerjs_core.IPermissionService)),
|
|
1973
|
+
__decorateParam(8, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
1974
|
+
__decorateParam(9, _univerjs_sheets_ui.ISheetSelectionRenderService),
|
|
1975
|
+
__decorateParam(10, (0, _univerjs_core.Inject)(SheetTableThemeUIController)),
|
|
1976
|
+
__decorateParam(11, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
|
|
1977
|
+
__decorateParam(12, _univerjs_ui.IDialogService),
|
|
1978
|
+
__decorateParam(13, _univerjs_ui.ISidebarService)
|
|
1979
|
+
], SheetTableControlsRenderController);
|
|
1544
1980
|
|
|
1545
1981
|
//#endregion
|
|
1546
1982
|
//#region src/views/widgets/table-filter-button.shape.ts
|
|
1547
1983
|
const FILTER_ICON_SIZE = 16;
|
|
1984
|
+
const FILTER_TRIGGER_HOVER_RADIUS = 4;
|
|
1548
1985
|
let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _univerjs_engine_render.Shape {
|
|
1549
|
-
constructor(key, props,
|
|
1986
|
+
constructor(key, props, _commandService) {
|
|
1550
1987
|
super(key, props);
|
|
1551
|
-
this._contextService = _contextService;
|
|
1552
1988
|
this._commandService = _commandService;
|
|
1553
|
-
this._themeService = _themeService;
|
|
1554
1989
|
_defineProperty(this, "_cellWidth", 0);
|
|
1555
1990
|
_defineProperty(this, "_cellHeight", 0);
|
|
1556
1991
|
_defineProperty(this, "_filterParams", void 0);
|
|
1992
|
+
_defineProperty(this, "_iconColor", "#fff");
|
|
1993
|
+
_defineProperty(this, "_hoverBackground", "rgba(255, 255, 255, 0.92)");
|
|
1994
|
+
_defineProperty(this, "_hoverIconColor", "#202124");
|
|
1557
1995
|
_defineProperty(this, "_hovered", false);
|
|
1558
1996
|
this.setShapeProps(props);
|
|
1559
1997
|
this.onPointerDown$.subscribeEvent((evt) => this.onPointerDown(evt));
|
|
@@ -1564,6 +2002,9 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _u
|
|
|
1564
2002
|
if (typeof props.cellHeight !== "undefined") this._cellHeight = props.cellHeight;
|
|
1565
2003
|
if (typeof props.cellWidth !== "undefined") this._cellWidth = props.cellWidth;
|
|
1566
2004
|
if (typeof props.filterParams !== "undefined") this._filterParams = props.filterParams;
|
|
2005
|
+
if (typeof props.iconColor !== "undefined") this._iconColor = props.iconColor;
|
|
2006
|
+
if (typeof props.hoverBackground !== "undefined") this._hoverBackground = props.hoverBackground;
|
|
2007
|
+
if (typeof props.hoverIconColor !== "undefined") this._hoverIconColor = props.hoverIconColor;
|
|
1567
2008
|
this.transformByState({
|
|
1568
2009
|
width: props.width,
|
|
1569
2010
|
height: props.height
|
|
@@ -1578,36 +2019,38 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _u
|
|
|
1578
2019
|
const cellRegion = new Path2D();
|
|
1579
2020
|
cellRegion.rect(left, top, cellWidth, cellHeight);
|
|
1580
2021
|
ctx.clip(cellRegion);
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
icons = filteredSortAsc;
|
|
1591
|
-
break;
|
|
1592
|
-
case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilteredSortDesc:
|
|
1593
|
-
icons = filteredSortDesc;
|
|
1594
|
-
break;
|
|
1595
|
-
case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilterNoneSortNone: break;
|
|
1596
|
-
case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilterNoneSortAsc:
|
|
1597
|
-
icons = filterNoneSortAsc;
|
|
1598
|
-
break;
|
|
1599
|
-
case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilterNoneSortDesc:
|
|
1600
|
-
icons = filterNoneSortDesc;
|
|
1601
|
-
break;
|
|
2022
|
+
if (this._hovered) {
|
|
2023
|
+
var _ctx$roundRect;
|
|
2024
|
+
ctx.save();
|
|
2025
|
+
ctx.fillStyle = this._hoverBackground;
|
|
2026
|
+
ctx.beginPath();
|
|
2027
|
+
(_ctx$roundRect = ctx.roundRect) === null || _ctx$roundRect === void 0 || _ctx$roundRect.call(ctx, 0, 0, 16, 16, FILTER_TRIGGER_HOVER_RADIUS);
|
|
2028
|
+
if (!ctx.roundRect) ctx.rect(0, 0, 16, 16);
|
|
2029
|
+
ctx.fill();
|
|
2030
|
+
ctx.restore();
|
|
1602
2031
|
}
|
|
1603
|
-
|
|
1604
|
-
|
|
2032
|
+
this._drawChevron(ctx, this._hovered ? this._hoverIconColor : this._iconColor);
|
|
2033
|
+
ctx.restore();
|
|
2034
|
+
}
|
|
2035
|
+
_drawChevron(ctx, color) {
|
|
2036
|
+
const centerX = 16 / 2;
|
|
2037
|
+
const centerY = 16 / 2 + 1;
|
|
2038
|
+
ctx.save();
|
|
2039
|
+
ctx.beginPath();
|
|
2040
|
+
ctx.strokeStyle = color;
|
|
2041
|
+
ctx.lineWidth = 1.8;
|
|
2042
|
+
ctx.lineCap = "round";
|
|
2043
|
+
ctx.lineJoin = "round";
|
|
2044
|
+
ctx.moveTo(centerX - 4.5, centerY - 2.5);
|
|
2045
|
+
ctx.lineTo(centerX, centerY + 2);
|
|
2046
|
+
ctx.lineTo(centerX + 4.5, centerY - 2.5);
|
|
2047
|
+
ctx.stroke();
|
|
1605
2048
|
ctx.restore();
|
|
1606
2049
|
}
|
|
1607
2050
|
onPointerDown(evt) {
|
|
1608
2051
|
if (evt.button === 2) return;
|
|
1609
2052
|
const { row, col, unitId, subUnitId, tableId } = this._filterParams;
|
|
1610
|
-
if (
|
|
2053
|
+
if (!this._commandService.hasCommand(OpenTableFilterPanelOperation.id)) return;
|
|
1611
2054
|
setTimeout(() => {
|
|
1612
2055
|
const cmdParams = {
|
|
1613
2056
|
row,
|
|
@@ -1628,11 +2071,7 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _u
|
|
|
1628
2071
|
this.makeDirty(true);
|
|
1629
2072
|
}
|
|
1630
2073
|
};
|
|
1631
|
-
SheetsTableFilterButtonShape = __decorate([
|
|
1632
|
-
__decorateParam(2, _univerjs_core.IContextService),
|
|
1633
|
-
__decorateParam(3, _univerjs_core.ICommandService),
|
|
1634
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.ThemeService))
|
|
1635
|
-
], SheetsTableFilterButtonShape);
|
|
2074
|
+
SheetsTableFilterButtonShape = __decorate([__decorateParam(2, _univerjs_core.ICommandService)], SheetsTableFilterButtonShape);
|
|
1636
2075
|
|
|
1637
2076
|
//#endregion
|
|
1638
2077
|
//#region src/controllers/sheet-table-filter-button-render.controller.ts
|
|
@@ -1646,13 +2085,14 @@ const computeIconTop = (startY, endY, cellHeight, verticalAlign) => {
|
|
|
1646
2085
|
}
|
|
1647
2086
|
};
|
|
1648
2087
|
let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRenderController extends _univerjs_core.RxDisposable {
|
|
1649
|
-
constructor(_context, _injector, _sheetSkeletonManagerService, _sheetInterceptorService, _tableManager, _commandService) {
|
|
2088
|
+
constructor(_context, _injector, _sheetSkeletonManagerService, _sheetInterceptorService, _tableManager, _rangeThemeModel, _commandService) {
|
|
1650
2089
|
super();
|
|
1651
2090
|
this._context = _context;
|
|
1652
2091
|
this._injector = _injector;
|
|
1653
2092
|
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
1654
2093
|
this._sheetInterceptorService = _sheetInterceptorService;
|
|
1655
2094
|
this._tableManager = _tableManager;
|
|
2095
|
+
this._rangeThemeModel = _rangeThemeModel;
|
|
1656
2096
|
this._commandService = _commandService;
|
|
1657
2097
|
_defineProperty(this, "_buttonRenderDisposable", null);
|
|
1658
2098
|
_defineProperty(this, "_tableFilterButtonShapes", []);
|
|
@@ -1708,7 +2148,12 @@ let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRende
|
|
|
1708
2148
|
const worksheet = workbook.getSheetBySheetId(worksheetId);
|
|
1709
2149
|
if (!worksheet) return;
|
|
1710
2150
|
for (const { range, states, tableId } of tableFilterRanges) {
|
|
2151
|
+
var _this$_rangeThemeMode, _headerStyle$cl$rgb, _headerStyle$cl, _headerStyle$bg$rgb, _headerStyle$bg;
|
|
1711
2152
|
const { startRow, startColumn, endColumn } = range;
|
|
2153
|
+
const table = this._tableManager.getTableById(unitId, tableId);
|
|
2154
|
+
const headerStyle = table ? (_this$_rangeThemeMode = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId())) === null || _this$_rangeThemeMode === void 0 ? void 0 : _this$_rangeThemeMode.getHeaderRowStyle() : null;
|
|
2155
|
+
const iconColor = (_headerStyle$cl$rgb = headerStyle === null || headerStyle === void 0 || (_headerStyle$cl = headerStyle.cl) === null || _headerStyle$cl === void 0 ? void 0 : _headerStyle$cl.rgb) !== null && _headerStyle$cl$rgb !== void 0 ? _headerStyle$cl$rgb : "#fff";
|
|
2156
|
+
const hoverIconColor = (_headerStyle$bg$rgb = headerStyle === null || headerStyle === void 0 || (_headerStyle$bg = headerStyle.bg) === null || _headerStyle$bg === void 0 ? void 0 : _headerStyle$bg.rgb) !== null && _headerStyle$bg$rgb !== void 0 ? _headerStyle$bg$rgb : "#202124";
|
|
1712
2157
|
this._interceptCellContent(unitId, worksheetId, range);
|
|
1713
2158
|
for (let col = startColumn; col <= endColumn; col++) {
|
|
1714
2159
|
const key = `sheets-table-filter-button-${startRow}-${col}`;
|
|
@@ -1726,6 +2171,9 @@ let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRende
|
|
|
1726
2171
|
height: 16,
|
|
1727
2172
|
width: 16,
|
|
1728
2173
|
zIndex: SHEETS_FILTER_BUTTON_Z_INDEX,
|
|
2174
|
+
iconColor,
|
|
2175
|
+
hoverBackground: iconColor,
|
|
2176
|
+
hoverIconColor,
|
|
1729
2177
|
cellHeight,
|
|
1730
2178
|
cellWidth,
|
|
1731
2179
|
filterParams: {
|
|
@@ -1774,7 +2222,8 @@ SheetsTableFilterButtonRenderController = __decorate([
|
|
|
1774
2222
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetSkeletonManagerService)),
|
|
1775
2223
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetInterceptorService)),
|
|
1776
2224
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_table.TableManager)),
|
|
1777
|
-
__decorateParam(5, _univerjs_core.
|
|
2225
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeModel)),
|
|
2226
|
+
__decorateParam(6, _univerjs_core.ICommandService)
|
|
1778
2227
|
], SheetsTableFilterButtonRenderController);
|
|
1779
2228
|
|
|
1780
2229
|
//#endregion
|
|
@@ -1917,7 +2366,7 @@ const SheetTableSelector = (props) => {
|
|
|
1917
2366
|
if (target.worksheet.getMergeData().some((merge) => {
|
|
1918
2367
|
return _univerjs_core.Rectangle.intersects(newRange, merge);
|
|
1919
2368
|
})) {
|
|
1920
|
-
setRangeError(localeService.t("sheets-table.tableRangeWithMergeError"));
|
|
2369
|
+
setRangeError(localeService.t("sheets-table-ui.tableRangeWithMergeError"));
|
|
1921
2370
|
return;
|
|
1922
2371
|
}
|
|
1923
2372
|
if (tableManager.getTablesBySubunitId(unitId, subUnitId).some((table) => {
|
|
@@ -1925,12 +2374,12 @@ const SheetTableSelector = (props) => {
|
|
|
1925
2374
|
const tableRange = table.getRange();
|
|
1926
2375
|
return _univerjs_core.Rectangle.intersects(newRange, tableRange);
|
|
1927
2376
|
})) {
|
|
1928
|
-
setRangeError(localeService.t("sheets-table.tableRangeWithOtherTableError"));
|
|
2377
|
+
setRangeError(localeService.t("sheets-table-ui.tableRangeWithOtherTableError"));
|
|
1929
2378
|
return;
|
|
1930
2379
|
}
|
|
1931
2380
|
const { startRow, endRow } = newRange;
|
|
1932
2381
|
if (startRow === endRow) {
|
|
1933
|
-
setRangeError(localeService.t("sheets-table.tableRangeSingleRowError"));
|
|
2382
|
+
setRangeError(localeService.t("sheets-table-ui.tableRangeSingleRowError"));
|
|
1934
2383
|
return;
|
|
1935
2384
|
}
|
|
1936
2385
|
if (originValue === text) return;
|
|
@@ -1948,7 +2397,7 @@ const SheetTableSelector = (props) => {
|
|
|
1948
2397
|
});
|
|
1949
2398
|
return;
|
|
1950
2399
|
} else {
|
|
1951
|
-
setRangeError(localeService.t("sheets-table.updateError"));
|
|
2400
|
+
setRangeError(localeService.t("sheets-table-ui.updateError"));
|
|
1952
2401
|
return;
|
|
1953
2402
|
}
|
|
1954
2403
|
}
|
|
@@ -1966,7 +2415,7 @@ const SheetTableSelector = (props) => {
|
|
|
1966
2415
|
className: "univer-mt-4 univer-flex univer-justify-end",
|
|
1967
2416
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
1968
2417
|
onClick: onCancel,
|
|
1969
|
-
children: localeService.t("sheets-table.cancel")
|
|
2418
|
+
children: localeService.t("sheets-table-ui.cancel")
|
|
1970
2419
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
1971
2420
|
variant: "primary",
|
|
1972
2421
|
onClick: () => {
|
|
@@ -1978,7 +2427,7 @@ const SheetTableSelector = (props) => {
|
|
|
1978
2427
|
});
|
|
1979
2428
|
},
|
|
1980
2429
|
className: "univer-ml-2",
|
|
1981
|
-
children: localeService.t("sheets-table.confirm")
|
|
2430
|
+
children: localeService.t("sheets-table-ui.confirm")
|
|
1982
2431
|
})]
|
|
1983
2432
|
})
|
|
1984
2433
|
] });
|
|
@@ -2026,7 +2475,7 @@ const SheetTableThemePanel = (props) => {
|
|
|
2026
2475
|
};
|
|
2027
2476
|
const handleAddCustomTheme = () => {
|
|
2028
2477
|
if (customRangeThemes.length >= 11) {
|
|
2029
|
-
errorService.emit(localeService.t("sheets-table.customTooMore"));
|
|
2478
|
+
errorService.emit(localeService.t("sheets-table-ui.customTooMore"));
|
|
2030
2479
|
return;
|
|
2031
2480
|
}
|
|
2032
2481
|
const lastCustomTheme = customRangeThemes[customRangeThemes.length - 1];
|
|
@@ -2063,7 +2512,7 @@ const SheetTableThemePanel = (props) => {
|
|
|
2063
2512
|
const secondRowBgIsDark = new _univerjs_core.ColorKit(secondRowBg).isDark();
|
|
2064
2513
|
const lastRowBgIsDark = new _univerjs_core.ColorKit(lastRowBg).isDark();
|
|
2065
2514
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
2066
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: localeService.t("sheets-table.defaultStyle") }),
|
|
2515
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: localeService.t("sheets-table-ui.defaultStyle") }),
|
|
2067
2516
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2068
2517
|
className: "univer-flex univer-gap-2",
|
|
2069
2518
|
children: defaultRangeThemes.map((item) => {
|
|
@@ -2097,7 +2546,7 @@ const SheetTableThemePanel = (props) => {
|
|
|
2097
2546
|
}, item);
|
|
2098
2547
|
})
|
|
2099
2548
|
}),
|
|
2100
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: localeService.t("sheets-table.customStyle") }),
|
|
2549
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: localeService.t("sheets-table-ui.customStyle") }),
|
|
2101
2550
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2102
2551
|
className: (0, _univerjs_design.clsx)("univer-w-full univer-rounded-sm", _univerjs_design.borderClassName),
|
|
2103
2552
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -2170,7 +2619,7 @@ const SheetTableThemePanel = (props) => {
|
|
|
2170
2619
|
"univer-text-gray-900": !headerBgIsDark
|
|
2171
2620
|
}),
|
|
2172
2621
|
style: { background: headerBg },
|
|
2173
|
-
children: localeService.t("sheets-table.header")
|
|
2622
|
+
children: localeService.t("sheets-table-ui.header")
|
|
2174
2623
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
2175
2624
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2176
2625
|
className: "univer-p-2",
|
|
@@ -2205,7 +2654,7 @@ const SheetTableThemePanel = (props) => {
|
|
|
2205
2654
|
"univer-text-gray-900": !firstRowBgIsDark
|
|
2206
2655
|
}),
|
|
2207
2656
|
style: { background: firstRowBg },
|
|
2208
|
-
children: localeService.t("sheets-table.firstLine")
|
|
2657
|
+
children: localeService.t("sheets-table-ui.firstLine")
|
|
2209
2658
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
2210
2659
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2211
2660
|
className: "univer-p-2",
|
|
@@ -2236,7 +2685,7 @@ const SheetTableThemePanel = (props) => {
|
|
|
2236
2685
|
"univer-text-gray-900": !secondRowBgIsDark
|
|
2237
2686
|
}),
|
|
2238
2687
|
style: { background: secondRowBg },
|
|
2239
|
-
children: localeService.t("sheets-table.secondLine")
|
|
2688
|
+
children: localeService.t("sheets-table-ui.secondLine")
|
|
2240
2689
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
2241
2690
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2242
2691
|
className: "univer-p-2",
|
|
@@ -2265,7 +2714,7 @@ const SheetTableThemePanel = (props) => {
|
|
|
2265
2714
|
"univer-text-gray-900": !lastRowBgIsDark
|
|
2266
2715
|
}),
|
|
2267
2716
|
style: { background: lastRowBg },
|
|
2268
|
-
children: localeService.t("sheets-table.footer")
|
|
2717
|
+
children: localeService.t("sheets-table-ui.footer")
|
|
2269
2718
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
2270
2719
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2271
2720
|
className: "univer-p-2",
|
|
@@ -2304,8 +2753,8 @@ function sheetTableToolbarInsertMenuFactory(accessor) {
|
|
|
2304
2753
|
id: OpenTableSelectorOperation.id,
|
|
2305
2754
|
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
2306
2755
|
icon: TABLE_TOOLBAR_BUTTON,
|
|
2307
|
-
tooltip: "sheets-table.title",
|
|
2308
|
-
title: "sheets-table.title",
|
|
2756
|
+
tooltip: "sheets-table-ui.title",
|
|
2757
|
+
title: "sheets-table-ui.title",
|
|
2309
2758
|
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
2310
2759
|
disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {}, true)
|
|
2311
2760
|
};
|
|
@@ -2315,7 +2764,7 @@ function SheetTableInsertContextMenuFactory(accessor) {
|
|
|
2315
2764
|
id: SHEET_TABLE_CONTEXT_INSERT_MENU_ID,
|
|
2316
2765
|
type: _univerjs_ui.MenuItemType.SUBITEMS,
|
|
2317
2766
|
icon: "InsertDoubleIcon",
|
|
2318
|
-
title: "sheets-table.insert.main",
|
|
2767
|
+
title: "sheets-table-ui.insert.main",
|
|
2319
2768
|
hidden$: getSheetTableRowColOperationHidden$(accessor)
|
|
2320
2769
|
};
|
|
2321
2770
|
}
|
|
@@ -2324,7 +2773,7 @@ function SheetTableRemoveContextMenuFactory(accessor) {
|
|
|
2324
2773
|
id: SHEET_TABLE_CONTEXT_REMOVE_MENU_ID,
|
|
2325
2774
|
type: _univerjs_ui.MenuItemType.SUBITEMS,
|
|
2326
2775
|
icon: "ReduceDoubleIcon",
|
|
2327
|
-
title: "sheets-table.remove.main",
|
|
2776
|
+
title: "sheets-table-ui.remove.main",
|
|
2328
2777
|
hidden$: getSheetTableRowColOperationHidden$(accessor)
|
|
2329
2778
|
};
|
|
2330
2779
|
}
|
|
@@ -2332,14 +2781,14 @@ function SheetTableInsertRowMenuFactory(accessor) {
|
|
|
2332
2781
|
return {
|
|
2333
2782
|
id: _univerjs_sheets_table.SheetTableInsertRowCommand.id,
|
|
2334
2783
|
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
2335
|
-
title: "sheets-table.insert.row",
|
|
2784
|
+
title: "sheets-table-ui.insert.row",
|
|
2336
2785
|
hidden$: getSheetTableHeaderOperationHidden$(accessor)
|
|
2337
2786
|
};
|
|
2338
2787
|
}
|
|
2339
2788
|
function SheetTableInsertColMenuFactory(accessor) {
|
|
2340
2789
|
return {
|
|
2341
2790
|
id: _univerjs_sheets_table.SheetTableInsertColCommand.id,
|
|
2342
|
-
title: "sheets-table.insert.col",
|
|
2791
|
+
title: "sheets-table-ui.insert.col",
|
|
2343
2792
|
type: _univerjs_ui.MenuItemType.BUTTON
|
|
2344
2793
|
};
|
|
2345
2794
|
}
|
|
@@ -2347,14 +2796,14 @@ function SheetTableRemoveRowMenuFactory(accessor) {
|
|
|
2347
2796
|
return {
|
|
2348
2797
|
id: _univerjs_sheets_table.SheetTableRemoveRowCommand.id,
|
|
2349
2798
|
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
2350
|
-
title: "sheets-table.remove.row",
|
|
2799
|
+
title: "sheets-table-ui.remove.row",
|
|
2351
2800
|
hidden$: getSheetTableHeaderOperationHidden$(accessor)
|
|
2352
2801
|
};
|
|
2353
2802
|
}
|
|
2354
2803
|
function SheetTableRemoveColMenuFactory(accessor) {
|
|
2355
2804
|
return {
|
|
2356
2805
|
id: _univerjs_sheets_table.SheetTableRemoveColCommand.id,
|
|
2357
|
-
title: "sheets-table.remove.col",
|
|
2806
|
+
title: "sheets-table-ui.remove.col",
|
|
2358
2807
|
type: _univerjs_ui.MenuItemType.BUTTON
|
|
2359
2808
|
};
|
|
2360
2809
|
}
|
|
@@ -2503,8 +2952,9 @@ let UniverSheetsTableUIPlugin = class UniverSheetsTableUIPlugin extends _univerj
|
|
|
2503
2952
|
this._registerRenderModules();
|
|
2504
2953
|
}
|
|
2505
2954
|
_registerRenderModules() {
|
|
2506
|
-
const renderDependencies = [
|
|
2507
|
-
if (this._config.hideAnchor !== true) renderDependencies.push([
|
|
2955
|
+
const renderDependencies = [];
|
|
2956
|
+
if (this._config.hideAnchor !== true) renderDependencies.push([SheetTableControlsRenderController]);
|
|
2957
|
+
renderDependencies.push([SheetsTableFilterButtonRenderController], [SheetsTableRenderController]);
|
|
2508
2958
|
renderDependencies.forEach((m) => {
|
|
2509
2959
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_SHEET, m));
|
|
2510
2960
|
});
|