@univerjs/sheets-table 1.0.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BooleanNumber, BorderStyleTypes, CellValueType, ColorKit, CommandType, DEFAULT_STYLES, DateSystem, DependentOn, Disposable, ErrorService, FilterSelectionMode, FormulaType, ICommandService, IConfigService, ILogService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, Plugin, RTree, RecordValueType, Rectangle, UniverInstanceType, customNameCharacterCheck, excelSerialToDateTime, generateRandomId, getColorStyle, merge, numfmt, regexp, registerDependencies, sequenceExecute, toDisposable, touchDependencies } from "@univerjs/core";
1
+ import { BooleanNumber, BorderStyleTypes, CellValueType, ColorKit, CommandType, DEFAULT_STYLES, DateSystem, DependentOn, Disposable, ErrorService, FilterSelectionMode, FormulaType, ICommandService, IConfigService, ILogService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, Plugin, RTree, RecordValueType, Rectangle, Tools, UniverInstanceType, customNameCharacterCheck, excelSerialToDateTime, generateRandomId, getColorStyle, getRecordValueKey, merge, numfmt, regexp, registerDependencies, sequenceExecute, toDisposable, touchDependencies } from "@univerjs/core";
2
2
  import { IActiveDirtyManagerService, IDefinedNamesService, ISheetRowFilteredService, LexerTreeBuilder, RemoveSuperTableMutation, SetSuperTableMutation, extractFormulaError, serializeRange } from "@univerjs/engine-formula";
3
3
  import { AddRangeThemeMutation, CopySheetCommand, IExclusiveRangeService, INTERCEPTOR_POINT, InsertColCommand, InsertColMutation, InsertRowCommand, InsertRowMutation, MoveRangeCommand, RangeThemeStyle, RefRangeService, RemoveColCommand, RemoveColMutation, RemoveRangeThemeMutation, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetInterceptorService, SheetRangeThemeModel, SheetRangeThemeService, SheetsSelectionsService, UniverSheetsPlugin, WorkbookEditablePermission, ZebraCrossingCacheController, checkRangesEditablePermission, getMoveRangeCommandMutations, getMoveRangeUndoRedoMutations, getSheetCommandTarget } from "@univerjs/sheets";
4
4
  import { BehaviorSubject, Subject, filter, switchMap } from "rxjs";
@@ -130,6 +130,113 @@ let SheetsTableSortStateEnum = /* @__PURE__ */ function(SheetsTableSortStateEnum
130
130
  return SheetsTableSortStateEnum;
131
131
  }({});
132
132
 
133
+ //#endregion
134
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
135
+ function _typeof(o) {
136
+ "@babel/helpers - typeof";
137
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
138
+ return typeof o;
139
+ } : function(o) {
140
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
141
+ }, _typeof(o);
142
+ }
143
+
144
+ //#endregion
145
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
146
+ function toPrimitive(t, r) {
147
+ if ("object" != _typeof(t) || !t) return t;
148
+ var e = t[Symbol.toPrimitive];
149
+ if (void 0 !== e) {
150
+ var i = e.call(t, r || "default");
151
+ if ("object" != _typeof(i)) return i;
152
+ throw new TypeError("@@toPrimitive must return a primitive value.");
153
+ }
154
+ return ("string" === r ? String : Number)(t);
155
+ }
156
+
157
+ //#endregion
158
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
159
+ function toPropertyKey(t) {
160
+ var i = toPrimitive(t, "string");
161
+ return "symbol" == _typeof(i) ? i : i + "";
162
+ }
163
+
164
+ //#endregion
165
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
166
+ function _defineProperty(e, r, t) {
167
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
168
+ value: t,
169
+ enumerable: !0,
170
+ configurable: !0,
171
+ writable: !0
172
+ }) : e[r] = t, e;
173
+ }
174
+
175
+ //#endregion
176
+ //#region src/models/table-column.ts
177
+ var TableColumn = class {
178
+ constructor(id, name) {
179
+ _defineProperty(this, "dataType", void 0);
180
+ _defineProperty(this, "id", void 0);
181
+ _defineProperty(this, "displayName", void 0);
182
+ _defineProperty(this, "formula", void 0);
183
+ _defineProperty(this, "formulaIsArray", void 0);
184
+ _defineProperty(this, "totalsRowLabel", void 0);
185
+ _defineProperty(this, "totalsRowFunction", void 0);
186
+ _defineProperty(this, "totalsRowFormula", void 0);
187
+ _defineProperty(this, "showFilterButton", void 0);
188
+ _defineProperty(this, "meta", void 0);
189
+ _defineProperty(this, "style", void 0);
190
+ this.id = id;
191
+ this.displayName = name;
192
+ this.dataType = "string";
193
+ this.formula = "";
194
+ this.showFilterButton = true;
195
+ this.meta = {};
196
+ this.style = {};
197
+ }
198
+ getMeta() {
199
+ return this.meta;
200
+ }
201
+ setMeta(meta) {
202
+ this.meta = meta;
203
+ }
204
+ getDisplayName() {
205
+ return this.displayName;
206
+ }
207
+ toJSON() {
208
+ return {
209
+ id: this.id,
210
+ displayName: this.displayName,
211
+ dataType: this.dataType,
212
+ formula: this.formula,
213
+ formulaIsArray: this.formulaIsArray,
214
+ totalsRowLabel: this.totalsRowLabel,
215
+ totalsRowFunction: this.totalsRowFunction,
216
+ totalsRowFormula: this.totalsRowFormula,
217
+ showFilterButton: this.showFilterButton,
218
+ meta: this.meta,
219
+ style: this.style
220
+ };
221
+ }
222
+ fromJSON(json) {
223
+ this.id = json.id;
224
+ this.displayName = json.displayName;
225
+ this.dataType = json.dataType;
226
+ this.formula = json.formula;
227
+ this.formulaIsArray = json.formulaIsArray;
228
+ this.totalsRowLabel = json.totalsRowLabel;
229
+ this.totalsRowFunction = json.totalsRowFunction;
230
+ this.totalsRowFormula = json.totalsRowFormula;
231
+ this.showFilterButton = json.showFilterButton ?? true;
232
+ this.meta = json.meta;
233
+ this.style = json.style;
234
+ }
235
+ isShowFilterButton() {
236
+ return this.showFilterButton;
237
+ }
238
+ };
239
+
133
240
  //#endregion
134
241
  //#region src/util.ts
135
242
  function getColumnName(columnIndex, columnText) {
@@ -315,113 +422,6 @@ const tableThemeConfig = tableDefaultThemeStyleArr.map((item, index) => {
315
422
  };
316
423
  });
317
424
 
318
- //#endregion
319
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
320
- function _typeof(o) {
321
- "@babel/helpers - typeof";
322
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
323
- return typeof o;
324
- } : function(o) {
325
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
326
- }, _typeof(o);
327
- }
328
-
329
- //#endregion
330
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
331
- function toPrimitive(t, r) {
332
- if ("object" != _typeof(t) || !t) return t;
333
- var e = t[Symbol.toPrimitive];
334
- if (void 0 !== e) {
335
- var i = e.call(t, r || "default");
336
- if ("object" != _typeof(i)) return i;
337
- throw new TypeError("@@toPrimitive must return a primitive value.");
338
- }
339
- return ("string" === r ? String : Number)(t);
340
- }
341
-
342
- //#endregion
343
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
344
- function toPropertyKey(t) {
345
- var i = toPrimitive(t, "string");
346
- return "symbol" == _typeof(i) ? i : i + "";
347
- }
348
-
349
- //#endregion
350
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
351
- function _defineProperty(e, r, t) {
352
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
353
- value: t,
354
- enumerable: !0,
355
- configurable: !0,
356
- writable: !0
357
- }) : e[r] = t, e;
358
- }
359
-
360
- //#endregion
361
- //#region src/models/table-column.ts
362
- var TableColumn = class {
363
- constructor(id, name) {
364
- _defineProperty(this, "dataType", void 0);
365
- _defineProperty(this, "id", void 0);
366
- _defineProperty(this, "displayName", void 0);
367
- _defineProperty(this, "formula", void 0);
368
- _defineProperty(this, "formulaIsArray", void 0);
369
- _defineProperty(this, "totalsRowLabel", void 0);
370
- _defineProperty(this, "totalsRowFunction", void 0);
371
- _defineProperty(this, "totalsRowFormula", void 0);
372
- _defineProperty(this, "showFilterButton", void 0);
373
- _defineProperty(this, "meta", void 0);
374
- _defineProperty(this, "style", void 0);
375
- this.id = id;
376
- this.displayName = name;
377
- this.dataType = "string";
378
- this.formula = "";
379
- this.showFilterButton = true;
380
- this.meta = {};
381
- this.style = {};
382
- }
383
- getMeta() {
384
- return this.meta;
385
- }
386
- setMeta(meta) {
387
- this.meta = meta;
388
- }
389
- getDisplayName() {
390
- return this.displayName;
391
- }
392
- toJSON() {
393
- return {
394
- id: this.id,
395
- displayName: this.displayName,
396
- dataType: this.dataType,
397
- formula: this.formula,
398
- formulaIsArray: this.formulaIsArray,
399
- totalsRowLabel: this.totalsRowLabel,
400
- totalsRowFunction: this.totalsRowFunction,
401
- totalsRowFormula: this.totalsRowFormula,
402
- showFilterButton: this.showFilterButton,
403
- meta: this.meta,
404
- style: this.style
405
- };
406
- }
407
- fromJSON(json) {
408
- this.id = json.id;
409
- this.displayName = json.displayName;
410
- this.dataType = json.dataType;
411
- this.formula = json.formula;
412
- this.formulaIsArray = json.formulaIsArray;
413
- this.totalsRowLabel = json.totalsRowLabel;
414
- this.totalsRowFunction = json.totalsRowFunction;
415
- this.totalsRowFormula = json.totalsRowFormula;
416
- this.showFilterButton = json.showFilterButton ?? true;
417
- this.meta = json.meta;
418
- this.style = json.style;
419
- }
420
- isShowFilterButton() {
421
- return this.showFilterButton;
422
- }
423
- };
424
-
425
425
  //#endregion
426
426
  //#region src/const.ts
427
427
  /**
@@ -620,7 +620,6 @@ const getWeekStart = (date) => {
620
620
  weekStart.setDate(diff);
621
621
  return weekStart;
622
622
  };
623
- const perWeek = 6048e5;
624
623
  /**
625
624
  * The provided date is in the current week.
626
625
  * @param {Date} date - The date to compare.
@@ -640,7 +639,8 @@ const thisWeek = (date, anchorTime = /* @__PURE__ */ new Date()) => {
640
639
  */
641
640
  const nextWeek = (date, anchorTime = /* @__PURE__ */ new Date()) => {
642
641
  const weekStart = getWeekStart(date);
643
- const anchorTimeNextWeekStart = new Date(getWeekStart(anchorTime).getTime() + perWeek);
642
+ const anchorTimeNextWeekStart = getWeekStart(anchorTime);
643
+ anchorTimeNextWeekStart.setDate(anchorTimeNextWeekStart.getDate() + 7);
644
644
  return weekStart.toDateString() === anchorTimeNextWeekStart.toDateString();
645
645
  };
646
646
  /**
@@ -651,7 +651,8 @@ const nextWeek = (date, anchorTime = /* @__PURE__ */ new Date()) => {
651
651
  */
652
652
  const lastWeek = (date, anchorTime = /* @__PURE__ */ new Date()) => {
653
653
  const weekStart = getWeekStart(date);
654
- const anchorTimeLastWeekStart = /* @__PURE__ */ new Date(getWeekStart(anchorTime).getTime() - perWeek);
654
+ const anchorTimeLastWeekStart = getWeekStart(anchorTime);
655
+ anchorTimeLastWeekStart.setDate(anchorTimeLastWeekStart.getDate() - 7);
655
656
  return weekStart.toDateString() === anchorTimeLastWeekStart.toDateString();
656
657
  };
657
658
  /**
@@ -685,7 +686,7 @@ const nextMonth = (date, anchorTime = /* @__PURE__ */ new Date()) => {
685
686
  nextMonthStart.setHours(0, 0, 0, 0);
686
687
  nextMonthStart.setMonth(nextMonthStart.getMonth() + 1, 1);
687
688
  const monthEnd = new Date(nextMonthStart);
688
- monthEnd.setMonth(monthEnd.getMonth() + 1, 0);
689
+ monthEnd.setMonth(monthEnd.getMonth() + 1);
689
690
  const dateTime = date.getTime();
690
691
  return dateTime >= nextMonthStart.getTime() && dateTime < monthEnd.getTime();
691
692
  };
@@ -696,9 +697,9 @@ const nextMonth = (date, anchorTime = /* @__PURE__ */ new Date()) => {
696
697
  * @returns {boolean} return the date is match
697
698
  */
698
699
  const lastMonth = (date, anchorTime = /* @__PURE__ */ new Date()) => {
699
- const lastMonthStart = getMonthStart(anchorTime);
700
- const monthEnd = new Date(lastMonthStart);
701
- monthEnd.setMonth(monthEnd.getMonth() + 1, 0);
700
+ const monthEnd = getMonthStart(anchorTime);
701
+ const lastMonthStart = new Date(monthEnd);
702
+ lastMonthStart.setMonth(lastMonthStart.getMonth() - 1);
702
703
  const dateTime = date.getTime();
703
704
  return dateTime >= lastMonthStart.getTime() && dateTime < monthEnd.getTime();
704
705
  };
@@ -739,7 +740,7 @@ const nextQuarter = (date, anchorTime = /* @__PURE__ */ new Date()) => {
739
740
  const nextQuarterStart = new Date(quarterStart);
740
741
  nextQuarterStart.setMonth(nextQuarterStart.getMonth() + 3);
741
742
  const nextQuarterEnd = new Date(nextQuarterStart);
742
- nextQuarterEnd.setMonth(nextQuarterEnd.getMonth() + 3, 0);
743
+ nextQuarterEnd.setMonth(nextQuarterEnd.getMonth() + 3);
743
744
  const dateTime = date.getTime();
744
745
  return dateTime >= nextQuarterStart.getTime() && dateTime < nextQuarterEnd.getTime();
745
746
  };
@@ -753,10 +754,8 @@ const lastQuarter = (date, anchorTime = /* @__PURE__ */ new Date()) => {
753
754
  const quarterStart = getQuarterStart(anchorTime);
754
755
  const lastQuarterStart = new Date(quarterStart);
755
756
  lastQuarterStart.setMonth(lastQuarterStart.getMonth() - 3);
756
- const lastQuarterEnd = new Date(quarterStart);
757
- lastQuarterEnd.setDate(0);
758
757
  const dateTime = date.getTime();
759
- return dateTime >= lastQuarterStart.getTime() && dateTime < lastQuarterEnd.getTime();
758
+ return dateTime >= lastQuarterStart.getTime() && dateTime < quarterStart.getTime();
760
759
  };
761
760
  /**
762
761
  * The provided date is in the current year.
@@ -1339,35 +1338,13 @@ function getTableRecordValue(sheet, row, column) {
1339
1338
  };
1340
1339
  throw new TypeError("Invalid table record cell value.");
1341
1340
  }
1342
- function getTableRecordValueKey(_value) {
1343
- const value = _value;
1344
- if (!isRecord(value) || typeof value.type !== "string") throw new TypeError("Invalid table record value.");
1345
- switch (value.type) {
1346
- case RecordValueType.Blank:
1347
- if ("value" in value) throw new TypeError("Blank table record values cannot have a value.");
1348
- return "[\"blank\"]";
1349
- case RecordValueType.String:
1350
- case RecordValueType.Error:
1351
- if (typeof value.value !== "string") throw new TypeError("Invalid table record value.");
1352
- return JSON.stringify([value.type, value.value]);
1353
- case RecordValueType.Boolean:
1354
- if (typeof value.value !== "boolean") throw new TypeError("Invalid table record value.");
1355
- return JSON.stringify([value.type, value.value]);
1356
- case RecordValueType.Number:
1357
- case RecordValueType.Date:
1358
- if (typeof value.value !== "number") throw new TypeError("Invalid table record value.");
1359
- if (!Number.isFinite(value.value)) throw new RangeError("Table record numeric values must be finite.");
1360
- return JSON.stringify([value.type, value.value === 0 ? 0 : value.value]);
1361
- default: throw new TypeError("Unknown table record value type.");
1362
- }
1363
- }
1364
1341
  function compileTableRecordFilter(_filter) {
1365
1342
  const filter = _filter;
1366
1343
  if (!isRecord(filter) || filter.filterType !== "record") throw new TypeError("Invalid table record filter.");
1367
1344
  if (filter.mode !== FilterSelectionMode.Include && filter.mode !== FilterSelectionMode.Exclude || !Array.isArray(filter.values)) throw new TypeError("Invalid table record filter.");
1368
- const keys = new Set(filter.values.map((value) => getTableRecordValueKey(value)));
1369
- if (filter.mode === FilterSelectionMode.Include) return (value) => keys.has(getTableRecordValueKey(value));
1370
- return (value) => !keys.has(getTableRecordValueKey(value));
1345
+ const keys = new Set(filter.values.map((value) => getRecordValueKey(value)));
1346
+ if (filter.mode === FilterSelectionMode.Include) return (value) => keys.has(getRecordValueKey(value));
1347
+ return (value) => !keys.has(getRecordValueKey(value));
1371
1348
  }
1372
1349
  function cloneTableRecordFilter(filter) {
1373
1350
  compileTableRecordFilter(filter);
@@ -1495,7 +1472,7 @@ var TableFilters = class {
1495
1472
  }
1496
1473
  getExecuteFunc(sheet, range, columnIndex, filter) {
1497
1474
  if (filter.filterType === "manual") {
1498
- const valuesSet = new Set(filter.values);
1475
+ const valuesSet = new Set(filter.values.map(String));
1499
1476
  return (value) => {
1500
1477
  if (value == null) return valuesSet.has(TABLE_FILTER_EMPTY_VALUE);
1501
1478
  return valuesSet.has(String(value));
@@ -1724,10 +1701,7 @@ var Table = class {
1724
1701
  return this._tableFilters.getFilterStates(range);
1725
1702
  }
1726
1703
  toJSON() {
1727
- const columns = [];
1728
- this._columns.forEach((column) => {
1729
- columns.push(column.toJSON());
1730
- });
1704
+ const columns = this._columnOrder.map((columnId) => this._columns.get(columnId).toJSON());
1731
1705
  return {
1732
1706
  id: this._id,
1733
1707
  name: this._name,
@@ -1777,7 +1751,7 @@ var Table = class {
1777
1751
  };
1778
1752
 
1779
1753
  //#endregion
1780
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
1754
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
1781
1755
  function __decorateParam(paramIndex, decorator) {
1782
1756
  return function(target, key) {
1783
1757
  decorator(target, key, paramIndex);
@@ -1785,7 +1759,7 @@ function __decorateParam(paramIndex, decorator) {
1785
1759
  }
1786
1760
 
1787
1761
  //#endregion
1788
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
1762
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
1789
1763
  function __decorate(decorators, target, key, desc) {
1790
1764
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1791
1765
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -2313,13 +2287,19 @@ const AddSheetTableCommand = {
2313
2287
  const undos = [];
2314
2288
  const { unitId, subUnitId, range } = params;
2315
2289
  const header = tableManager.getColumnHeader(unitId, subUnitId, range, localeService.t("sheets-table.columnPrefix"));
2290
+ const options = Tools.deepClone(params.options ?? {});
2291
+ options.columns = header.map((name, index) => {
2292
+ var _options$columns;
2293
+ return ((_options$columns = options.columns) === null || _options$columns === void 0 ? void 0 : _options$columns[index]) ?? new TableColumn(generateRandomId(), name).toJSON();
2294
+ });
2316
2295
  redos.push({
2317
2296
  id: AddSheetTableMutation.id,
2318
2297
  params: {
2319
2298
  ...params,
2320
2299
  tableId,
2321
2300
  name: tableName,
2322
- header
2301
+ header,
2302
+ options
2323
2303
  }
2324
2304
  });
2325
2305
  undos.push({
@@ -2415,12 +2395,35 @@ const AddTableThemeCommand = {
2415
2395
  }
2416
2396
  };
2417
2397
 
2398
+ //#endregion
2399
+ //#region src/commands/mutations/set-table-filter.mutation.ts
2400
+ const SetSheetTableFilterMutation = {
2401
+ id: "sheet.mutation.set-table-filter",
2402
+ type: CommandType.MUTATION,
2403
+ handler: (accessor, params) => {
2404
+ const { tableId, unitId, column, tableFilter } = params;
2405
+ const tableManager = accessor.get(TableManager);
2406
+ const table = tableManager.getTable(unitId, tableId);
2407
+ tableManager.addFilter(unitId, tableId, column, tableFilter);
2408
+ if (table) {
2409
+ var _tableManager$toJSON$;
2410
+ const tableFilters = table.getTableFilters();
2411
+ if (params.filterOutRows) tableFilters.setFilterOutRows(params.filterOutRows);
2412
+ else params.filterOutRows = [...tableFilters.getFilterOutRows()];
2413
+ params.subUnitId = table.getSubunitId();
2414
+ params.tableFilteredOutRows = ((_tableManager$toJSON$ = tableManager.toJSON(unitId)[params.subUnitId]) === null || _tableManager$toJSON$ === void 0 ? void 0 : _tableManager$toJSON$.tableFilteredOutRows) ?? [];
2415
+ }
2416
+ return true;
2417
+ }
2418
+ };
2419
+
2418
2420
  //#endregion
2419
2421
  //#region src/commands/commands/delete-sheet-table.command.ts
2420
2422
  const DeleteSheetTableCommand = {
2421
2423
  id: "sheet.command.delete-table",
2422
2424
  type: CommandType.COMMAND,
2423
2425
  handler: (accessor, params) => {
2426
+ var _tableConfig$filters$;
2424
2427
  if (!params) return false;
2425
2428
  const undoRedoService = accessor.get(IUndoRedoService);
2426
2429
  const commandService = accessor.get(ICommandService);
@@ -2459,6 +2462,17 @@ const DeleteSheetTableCommand = {
2459
2462
  options: tableConfig.options
2460
2463
  }
2461
2464
  });
2465
+ (_tableConfig$filters$ = tableConfig.filters.tableColumnFilterList) === null || _tableConfig$filters$ === void 0 || _tableConfig$filters$.forEach((tableFilter, column) => {
2466
+ if (tableFilter) undos.push({
2467
+ id: SetSheetTableFilterMutation.id,
2468
+ params: {
2469
+ unitId: params.unitId,
2470
+ tableId: params.tableId,
2471
+ column,
2472
+ tableFilter
2473
+ }
2474
+ });
2475
+ });
2462
2476
  undos.push(...interceptorCommands.undos);
2463
2477
  if (sequenceExecute(redos, commandService).result) {
2464
2478
  undoRedoService.pushUndoRedo({
@@ -2801,28 +2815,6 @@ const SetSheetTableCommand = {
2801
2815
  }
2802
2816
  };
2803
2817
 
2804
- //#endregion
2805
- //#region src/commands/mutations/set-table-filter.mutation.ts
2806
- const SetSheetTableFilterMutation = {
2807
- id: "sheet.mutation.set-table-filter",
2808
- type: CommandType.MUTATION,
2809
- handler: (accessor, params) => {
2810
- const { tableId, unitId, column, tableFilter } = params;
2811
- const tableManager = accessor.get(TableManager);
2812
- const table = tableManager.getTable(unitId, tableId);
2813
- tableManager.addFilter(unitId, tableId, column, tableFilter);
2814
- if (table) {
2815
- var _tableManager$toJSON$;
2816
- const tableFilters = table.getTableFilters();
2817
- if (params.filterOutRows) tableFilters.setFilterOutRows(params.filterOutRows);
2818
- else params.filterOutRows = [...tableFilters.getFilterOutRows()];
2819
- params.subUnitId = table.getSubunitId();
2820
- params.tableFilteredOutRows = ((_tableManager$toJSON$ = tableManager.toJSON(unitId)[params.subUnitId]) === null || _tableManager$toJSON$ === void 0 ? void 0 : _tableManager$toJSON$.tableFilteredOutRows) ?? [];
2821
- }
2822
- return true;
2823
- }
2824
- };
2825
-
2826
2818
  //#endregion
2827
2819
  //#region src/commands/commands/set-table-filter.command.ts
2828
2820
  const SetSheetTableFilterCommand = {
@@ -3946,7 +3938,7 @@ SheetsTableThemeController = __decorate([
3946
3938
  //#endregion
3947
3939
  //#region package.json
3948
3940
  var name = "@univerjs/sheets-table";
3949
- var version = "1.0.4";
3941
+ var version = "1.2.0";
3950
3942
 
3951
3943
  //#endregion
3952
3944
  //#region src/commands/mutations/move-sheet-table.mutation.ts
@@ -4799,6 +4791,10 @@ let TableFilterController = class TableFilterController extends Disposable {
4799
4791
  }));
4800
4792
  }
4801
4793
  registerFilterChangeEvent() {
4794
+ this.disposeWithMe(this._tableManager.tableDelete$.subscribe(({ unitId, subUnitId }) => {
4795
+ this._refreshTableFilteredOutRows(unitId, subUnitId);
4796
+ this._zebraCrossingCacheController.updateZebraCrossingCache(unitId, subUnitId);
4797
+ }));
4802
4798
  this.disposeWithMe(this._tableManager.tableFilterChanged$.subscribe((event) => {
4803
4799
  const { unitId, subUnitId, tableId, oldSubUnitId } = event;
4804
4800
  const workbook = this._univerInstanceService.getUnit(unitId);
@@ -4919,4 +4915,4 @@ UniverSheetsTablePlugin = __decorate([
4919
4915
  ], UniverSheetsTablePlugin);
4920
4916
 
4921
4917
  //#endregion
4922
- export { AddSheetTableCommand, AddSheetTableMutation, AddTableThemeCommand, DeleteSheetTableCommand, DeleteSheetTableMutation, RemoveTableThemeCommand, SHEET_TABLE_CUSTOM_THEME_PREFIX, SetSheetTableCommand, SetSheetTableFilterCommand, SetSheetTableFilterMutation, SetSheetTableMutation, SetSheetTableSortStateCommand, SheetTableInsertColCommand, SheetTableInsertColumnAtCommand, SheetTableInsertRowAtCommand, SheetTableInsertRowCommand, SheetTableRemoveColCommand, SheetTableRemoveColumnAtCommand, SheetTableRemoveRowCommand, SheetTableService, SheetsTableButtonStateEnum, SheetsTableController, SheetsTableSortStateEnum, SheetsTableThemeController, TABLE_FILTER_EMPTY_VALUE, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableManager, TableNumberCompareTypeEnum, TableStringCompareTypeEnum, UniverSheetsTablePlugin, compileTableRecordFilter, customEmptyThemeWithBorderStyle, getExistingNamesSet, getTableRecordValue, getTableRecordValueKey, isColorTableFilter, isConditionFilter, isManualTableFilter, isRecordTableFilter, processStyleWithBorderStyle, validateSheetTableName };
4918
+ export { AddSheetTableCommand, AddSheetTableMutation, AddTableThemeCommand, DeleteSheetTableCommand, DeleteSheetTableMutation, RemoveTableThemeCommand, SHEET_TABLE_CUSTOM_THEME_PREFIX, SetSheetTableCommand, SetSheetTableFilterCommand, SetSheetTableFilterMutation, SetSheetTableMutation, SetSheetTableSortStateCommand, SheetTableInsertColCommand, SheetTableInsertColumnAtCommand, SheetTableInsertRowAtCommand, SheetTableInsertRowCommand, SheetTableRemoveColCommand, SheetTableRemoveColumnAtCommand, SheetTableRemoveRowCommand, SheetTableService, SheetsTableButtonStateEnum, SheetsTableController, SheetsTableSortStateEnum, SheetsTableThemeController, TABLE_FILTER_EMPTY_VALUE, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableManager, TableNumberCompareTypeEnum, TableStringCompareTypeEnum, UniverSheetsTablePlugin, compileTableRecordFilter, customEmptyThemeWithBorderStyle, getExistingNamesSet, getTableRecordValue, isColorTableFilter, isConditionFilter, isManualTableFilter, isRecordTableFilter, processStyleWithBorderStyle, validateSheetTableName };