@univerjs/sheets-table 0.25.0-insiders.20260623-012b5a8 → 0.25.1

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.
Files changed (30) hide show
  1. package/LICENSE +176 -0
  2. package/lib/cjs/facade.js +15 -4
  3. package/lib/cjs/index.js +114 -120
  4. package/lib/es/facade.js +16 -5
  5. package/lib/es/index.js +115 -115
  6. package/lib/facade.js +16 -5
  7. package/lib/index.js +115 -115
  8. package/lib/types/controllers/sheet-table-formula.controller.d.ts +1 -1
  9. package/lib/types/controllers/sheet-table-range.controller.d.ts +1 -1
  10. package/lib/types/controllers/sheet-table-ref-range.controller.d.ts +1 -1
  11. package/lib/types/controllers/sheet-table-theme.controller.d.ts +1 -1
  12. package/lib/types/controllers/sheets-table.controller.d.ts +2 -2
  13. package/lib/types/controllers/table-filter.controller.d.ts +1 -1
  14. package/lib/types/controllers/table-theme.factory.d.ts +4 -4
  15. package/lib/types/index.d.ts +4 -5
  16. package/lib/types/services/table.service.d.ts +1 -1
  17. package/lib/types/util.d.ts +1 -1
  18. package/lib/umd/facade.js +1 -1
  19. package/lib/umd/index.js +1 -1
  20. package/package.json +8 -8
  21. package/lib/types/locale/types.d.ts +0 -18
  22. /package/lib/types/{models → model}/filter-util/condition.d.ts +0 -0
  23. /package/lib/types/{models → model}/filter-util/date-filter-util.d.ts +0 -0
  24. /package/lib/types/{models → model}/filter-util/number-filter-util.d.ts +0 -0
  25. /package/lib/types/{models → model}/filter-util/text-filter-util.d.ts +0 -0
  26. /package/lib/types/{models → model}/filter-util/top-n.d.ts +0 -0
  27. /package/lib/types/{models → model}/table-column.d.ts +0 -0
  28. /package/lib/types/{models → model}/table-filter.d.ts +0 -0
  29. /package/lib/types/{models → model}/table-manager.d.ts +0 -0
  30. /package/lib/types/{models → model}/table.d.ts +0 -0
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/lib/cjs/facade.js CHANGED
@@ -16,12 +16,16 @@ var FWorkbookSheetsTableMixin = class extends _univerjs_sheets_facade.FWorkbook
16
16
  }
17
17
  async addTable(subUnitId, tableName, rangeInfo, tableId, options) {
18
18
  const sheetTableService = this._injector.get(_univerjs_sheets_table.SheetTableService);
19
+ const localeService = this._injector.get(_univerjs_core.LocaleService);
19
20
  const workbook = this._injector.get(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
20
21
  const sheetNameSet = /* @__PURE__ */ new Set();
21
22
  if (workbook) workbook.getSheets().forEach((sheet) => {
22
23
  sheetNameSet.add(sheet.getName());
23
24
  });
24
- if (!(0, _univerjs_core.customNameCharacterCheck)(tableName, sheetNameSet)) return;
25
+ if (!(0, _univerjs_core.customNameCharacterCheck)(tableName, sheetNameSet)) {
26
+ this._injector.get(_univerjs_core.ILogService).warn(localeService.t("sheets-table.tableNameError"));
27
+ return;
28
+ }
25
29
  const addTableParams = {
26
30
  unitId: this.getId(),
27
31
  name: tableName,
@@ -68,12 +72,15 @@ var FWorksheetTableMixin = class extends _univerjs_sheets_facade.FWorksheet {
68
72
  const subUnitId = this.getSheetId();
69
73
  const workbook = this.getWorkbook();
70
74
  const unitId = workbook.getUnitId();
71
- this._injector.get(_univerjs_core.LocaleService);
75
+ const localeService = this._injector.get(_univerjs_core.LocaleService);
72
76
  const sheetNameSet = /* @__PURE__ */ new Set();
73
77
  if (workbook) workbook.getSheets().forEach((sheet) => {
74
78
  sheetNameSet.add(sheet.getName());
75
79
  });
76
- if (!(0, _univerjs_core.customNameCharacterCheck)(tableName, sheetNameSet)) return false;
80
+ if (!(0, _univerjs_core.customNameCharacterCheck)(tableName, sheetNameSet)) {
81
+ this._injector.get(_univerjs_core.ILogService).warn(localeService.t("sheets-table.tableNameError"));
82
+ return false;
83
+ }
77
84
  const addTableParams = {
78
85
  unitId,
79
86
  subUnitId,
@@ -111,11 +118,15 @@ var FWorksheetTableMixin = class extends _univerjs_sheets_facade.FWorksheet {
111
118
  }
112
119
  setTableName(tableId, tableName) {
113
120
  const workbook = this.getWorkbook();
121
+ const localeService = this._injector.get(_univerjs_core.LocaleService);
114
122
  const sheetNameSet = /* @__PURE__ */ new Set();
115
123
  if (workbook) workbook.getSheets().forEach((sheet) => {
116
124
  sheetNameSet.add(sheet.getName());
117
125
  });
118
- if (!(0, _univerjs_core.customNameCharacterCheck)(tableName, sheetNameSet)) return false;
126
+ if (!(0, _univerjs_core.customNameCharacterCheck)(tableName, sheetNameSet)) {
127
+ this._injector.get(_univerjs_core.ILogService).warn(localeService.t("sheets-table.tableNameError"));
128
+ return false;
129
+ }
119
130
  const tableSetConfig = {
120
131
  unitId: this.getWorkbook().getUnitId(),
121
132
  tableId,
package/lib/cjs/index.js CHANGED
@@ -307,7 +307,7 @@ const tableThemeConfig = tableDefaultThemeStyleArr.map((item, index) => {
307
307
  });
308
308
 
309
309
  //#endregion
310
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
310
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
311
311
  function _typeof(o) {
312
312
  "@babel/helpers - typeof";
313
313
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -318,7 +318,7 @@ function _typeof(o) {
318
318
  }
319
319
 
320
320
  //#endregion
321
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
321
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
322
322
  function toPrimitive(t, r) {
323
323
  if ("object" != _typeof(t) || !t) return t;
324
324
  var e = t[Symbol.toPrimitive];
@@ -331,14 +331,14 @@ function toPrimitive(t, r) {
331
331
  }
332
332
 
333
333
  //#endregion
334
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
334
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
335
335
  function toPropertyKey(t) {
336
336
  var i = toPrimitive(t, "string");
337
337
  return "symbol" == _typeof(i) ? i : i + "";
338
338
  }
339
339
 
340
340
  //#endregion
341
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
341
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
342
342
  function _defineProperty(e, r, t) {
343
343
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
344
344
  value: t,
@@ -349,7 +349,7 @@ function _defineProperty(e, r, t) {
349
349
  }
350
350
 
351
351
  //#endregion
352
- //#region src/models/table-column.ts
352
+ //#region src/model/table-column.ts
353
353
  var TableColumn = class {
354
354
  constructor(id, name) {
355
355
  _defineProperty(this, "dataType", void 0);
@@ -417,7 +417,7 @@ const SHEET_TABLE_CUSTOM_THEME_PREFIX = "table-custom";
417
417
  const TABLE_FILTER_EMPTY_VALUE = "__UNIVER_TABLE_FILTER_EMPTY__";
418
418
 
419
419
  //#endregion
420
- //#region src/models/filter-util/date-filter-util.ts
420
+ //#region src/model/filter-util/date-filter-util.ts
421
421
  /**
422
422
  * The provided date is a date in Q1 of the year.
423
423
  * @param {Date} date - The date to compare.
@@ -889,7 +889,7 @@ function getDateFilterExecuteFunc(filterInfo) {
889
889
  }
890
890
 
891
891
  //#endregion
892
- //#region src/models/filter-util/top-n.ts
892
+ //#region src/model/filter-util/top-n.ts
893
893
  /**
894
894
  * Copyright 2023-present DreamNum Co., Ltd.
895
895
  *
@@ -1059,7 +1059,7 @@ const getLargestK = (list, k) => {
1059
1059
  };
1060
1060
 
1061
1061
  //#endregion
1062
- //#region src/models/filter-util/number-filter-util.ts
1062
+ //#region src/model/filter-util/number-filter-util.ts
1063
1063
  /**
1064
1064
  * @description Checks if a value is above the average.
1065
1065
  * @param {number} value - The value to check.
@@ -1145,7 +1145,7 @@ function getNumberFilterExecuteFunc(filter, calculatedOptions) {
1145
1145
  }
1146
1146
 
1147
1147
  //#endregion
1148
- //#region src/models/filter-util/text-filter-util.ts
1148
+ //#region src/model/filter-util/text-filter-util.ts
1149
1149
  const textEqual = (compareValue, expectedValue) => {
1150
1150
  return (0, _univerjs_core.createREGEXFromWildChar)(expectedValue).test(compareValue);
1151
1151
  };
@@ -1179,13 +1179,13 @@ function getTextFilterExecuteFunc(filter) {
1179
1179
  }
1180
1180
 
1181
1181
  //#endregion
1182
- //#region src/models/filter-util/condition.ts
1183
- const NumberDynamicFilterCompareTypeSet = /* @__PURE__ */ new Set([
1182
+ //#region src/model/filter-util/condition.ts
1183
+ const NumberDynamicFilterCompareTypeSet = new Set([
1184
1184
  "above",
1185
1185
  "below",
1186
1186
  "topN"
1187
1187
  ]);
1188
- const DateDynamicFilterCompareTypeSet = /* @__PURE__ */ new Set([
1188
+ const DateDynamicFilterCompareTypeSet = new Set([
1189
1189
  "today",
1190
1190
  "yesterday",
1191
1191
  "tomorrow",
@@ -1266,7 +1266,7 @@ function excelSerialToDateTime(serial) {
1266
1266
  }
1267
1267
 
1268
1268
  //#endregion
1269
- //#region src/models/table-filter.ts
1269
+ //#region src/model/table-filter.ts
1270
1270
  var TableFilters = class {
1271
1271
  constructor() {
1272
1272
  _defineProperty(this, "_tableColumnFilterList", void 0);
@@ -1374,7 +1374,7 @@ var TableFilters = class {
1374
1374
  };
1375
1375
 
1376
1376
  //#endregion
1377
- //#region src/models/table.ts
1377
+ //#region src/model/table.ts
1378
1378
  var Table = class {
1379
1379
  constructor(id, name, range, header, options = {}) {
1380
1380
  _defineProperty(this, "_id", void 0);
@@ -1601,7 +1601,7 @@ var Table = class {
1601
1601
  };
1602
1602
 
1603
1603
  //#endregion
1604
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
1604
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
1605
1605
  function __decorateParam(paramIndex, decorator) {
1606
1606
  return function(target, key) {
1607
1607
  decorator(target, key, paramIndex);
@@ -1609,7 +1609,7 @@ function __decorateParam(paramIndex, decorator) {
1609
1609
  }
1610
1610
 
1611
1611
  //#endregion
1612
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
1612
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
1613
1613
  function __decorate(decorators, target, key, desc) {
1614
1614
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1615
1615
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1618,7 +1618,7 @@ function __decorate(decorators, target, key, desc) {
1618
1618
  }
1619
1619
 
1620
1620
  //#endregion
1621
- //#region src/models/table-manager.ts
1621
+ //#region src/model/table-manager.ts
1622
1622
  let TableManager = class TableManager extends _univerjs_core.Disposable {
1623
1623
  constructor(_univerInstanceService, _localeService) {
1624
1624
  super();
@@ -3410,106 +3410,10 @@ const SheetTableRemoveColCommand = {
3410
3410
  }
3411
3411
  };
3412
3412
 
3413
- //#endregion
3414
- //#region src/controllers/sheet-table-theme.controller.ts
3415
- let SheetsTableThemeController = class SheetsTableThemeController extends _univerjs_core.Disposable {
3416
- constructor(_tableManager, _sheetRangeThemeService, _sheetRangeThemeModel, _configService) {
3417
- super();
3418
- this._tableManager = _tableManager;
3419
- this._sheetRangeThemeService = _sheetRangeThemeService;
3420
- this._sheetRangeThemeModel = _sheetRangeThemeModel;
3421
- this._configService = _configService;
3422
- _defineProperty(this, "_defaultThemeIndex", 0);
3423
- _defineProperty(this, "_allThemes", []);
3424
- this._initUserTableTheme();
3425
- this.registerTableChangeEvent();
3426
- this._initDefaultTableTheme();
3427
- }
3428
- registerTableChangeEvent() {
3429
- this.disposeWithMe(this._tableManager.tableAdd$.subscribe((event) => {
3430
- const { range, tableId, unitId, subUnitId, tableStyleId } = event;
3431
- const table = this._tableManager.getTable(unitId, tableId);
3432
- const _tableStyleId = tableStyleId || this._allThemes[this._defaultThemeIndex].name;
3433
- table.setTableStyleId(_tableStyleId);
3434
- this._sheetRangeThemeService.registerRangeThemeStyle(_tableStyleId, {
3435
- unitId,
3436
- subUnitId,
3437
- range: { ...range }
3438
- });
3439
- }));
3440
- this.disposeWithMe(this._tableManager.tableRangeChanged$.subscribe((event) => {
3441
- const { range, oldRange, tableId, unitId, subUnitId } = event;
3442
- const table = this._tableManager.getTable(unitId, tableId);
3443
- let tableStyleId = table.getTableStyleId();
3444
- if (!tableStyleId) {
3445
- tableStyleId = this._allThemes[this._defaultThemeIndex].name;
3446
- table.setTableStyleId(tableStyleId);
3447
- }
3448
- this._sheetRangeThemeService.removeRangeThemeRule(tableStyleId, {
3449
- unitId,
3450
- subUnitId,
3451
- range: { ...oldRange }
3452
- });
3453
- this._sheetRangeThemeService.registerRangeThemeStyle(tableStyleId, {
3454
- unitId,
3455
- subUnitId,
3456
- range: { ...range }
3457
- });
3458
- }));
3459
- this.disposeWithMe(this._tableManager.tableThemeChanged$.subscribe((event) => {
3460
- const { theme, oldTheme, tableId, unitId, subUnitId } = event;
3461
- const range = this._tableManager.getTable(unitId, tableId).getRange();
3462
- this._sheetRangeThemeService.removeRangeThemeRule(oldTheme, {
3463
- unitId,
3464
- subUnitId,
3465
- range: { ...range }
3466
- });
3467
- this._sheetRangeThemeService.registerRangeThemeStyle(theme, {
3468
- unitId,
3469
- subUnitId,
3470
- range: { ...range }
3471
- });
3472
- }));
3473
- this.disposeWithMe(this._tableManager.tableDelete$.subscribe((event) => {
3474
- const { range, unitId, subUnitId, tableStyleId = this._allThemes[this._defaultThemeIndex].name } = event;
3475
- this._sheetRangeThemeService.removeRangeThemeRule(tableStyleId, {
3476
- unitId,
3477
- subUnitId,
3478
- range: { ...range }
3479
- });
3480
- }));
3481
- }
3482
- _initUserTableTheme() {
3483
- const tableConfig = this._configService.getConfig("sheets-table.config") || {};
3484
- const defaultThemeIndex = tableConfig.defaultThemeIndex || 0;
3485
- const userThemes = tableConfig.userThemes || [];
3486
- this._defaultThemeIndex = defaultThemeIndex;
3487
- this._allThemes = userThemes.concat(tableThemeConfig);
3488
- }
3489
- _initDefaultTableTheme() {
3490
- for (let i = 0; i < this._allThemes.length; i++) {
3491
- const { name, style } = this._allThemes[i];
3492
- const rangeThemeStyle = new _univerjs_sheets.RangeThemeStyle(name, style);
3493
- this._sheetRangeThemeModel.registerDefaultRangeTheme(rangeThemeStyle);
3494
- }
3495
- }
3496
- dispose() {
3497
- super.dispose();
3498
- this._allThemes = [];
3499
- this._defaultThemeIndex = 0;
3500
- }
3501
- };
3502
- SheetsTableThemeController = __decorate([
3503
- __decorateParam(0, (0, _univerjs_core.Inject)(TableManager)),
3504
- __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeService)),
3505
- __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeModel)),
3506
- __decorateParam(3, _univerjs_core.IConfigService)
3507
- ], SheetsTableThemeController);
3508
-
3509
3413
  //#endregion
3510
3414
  //#region package.json
3511
3415
  var name = "@univerjs/sheets-table";
3512
- var version = "0.25.0-insiders.20260623-012b5a8";
3416
+ var version = "0.25.1";
3513
3417
 
3514
3418
  //#endregion
3515
3419
  //#region src/controllers/sheet-table-formula.controller.ts
@@ -4144,6 +4048,102 @@ SheetTableRefRangeController = __decorate([
4144
4048
  __decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
4145
4049
  ], SheetTableRefRangeController);
4146
4050
 
4051
+ //#endregion
4052
+ //#region src/controllers/sheet-table-theme.controller.ts
4053
+ let SheetsTableThemeController = class SheetsTableThemeController extends _univerjs_core.Disposable {
4054
+ constructor(_tableManager, _sheetRangeThemeService, _sheetRangeThemeModel, _configService) {
4055
+ super();
4056
+ this._tableManager = _tableManager;
4057
+ this._sheetRangeThemeService = _sheetRangeThemeService;
4058
+ this._sheetRangeThemeModel = _sheetRangeThemeModel;
4059
+ this._configService = _configService;
4060
+ _defineProperty(this, "_defaultThemeIndex", 0);
4061
+ _defineProperty(this, "_allThemes", []);
4062
+ this._initUserTableTheme();
4063
+ this.registerTableChangeEvent();
4064
+ this._initDefaultTableTheme();
4065
+ }
4066
+ registerTableChangeEvent() {
4067
+ this.disposeWithMe(this._tableManager.tableAdd$.subscribe((event) => {
4068
+ const { range, tableId, unitId, subUnitId, tableStyleId } = event;
4069
+ const table = this._tableManager.getTable(unitId, tableId);
4070
+ const _tableStyleId = tableStyleId || this._allThemes[this._defaultThemeIndex].name;
4071
+ table.setTableStyleId(_tableStyleId);
4072
+ this._sheetRangeThemeService.registerRangeThemeStyle(_tableStyleId, {
4073
+ unitId,
4074
+ subUnitId,
4075
+ range: { ...range }
4076
+ });
4077
+ }));
4078
+ this.disposeWithMe(this._tableManager.tableRangeChanged$.subscribe((event) => {
4079
+ const { range, oldRange, tableId, unitId, subUnitId } = event;
4080
+ const table = this._tableManager.getTable(unitId, tableId);
4081
+ let tableStyleId = table.getTableStyleId();
4082
+ if (!tableStyleId) {
4083
+ tableStyleId = this._allThemes[this._defaultThemeIndex].name;
4084
+ table.setTableStyleId(tableStyleId);
4085
+ }
4086
+ this._sheetRangeThemeService.removeRangeThemeRule(tableStyleId, {
4087
+ unitId,
4088
+ subUnitId,
4089
+ range: { ...oldRange }
4090
+ });
4091
+ this._sheetRangeThemeService.registerRangeThemeStyle(tableStyleId, {
4092
+ unitId,
4093
+ subUnitId,
4094
+ range: { ...range }
4095
+ });
4096
+ }));
4097
+ this.disposeWithMe(this._tableManager.tableThemeChanged$.subscribe((event) => {
4098
+ const { theme, oldTheme, tableId, unitId, subUnitId } = event;
4099
+ const range = this._tableManager.getTable(unitId, tableId).getRange();
4100
+ this._sheetRangeThemeService.removeRangeThemeRule(oldTheme, {
4101
+ unitId,
4102
+ subUnitId,
4103
+ range: { ...range }
4104
+ });
4105
+ this._sheetRangeThemeService.registerRangeThemeStyle(theme, {
4106
+ unitId,
4107
+ subUnitId,
4108
+ range: { ...range }
4109
+ });
4110
+ }));
4111
+ this.disposeWithMe(this._tableManager.tableDelete$.subscribe((event) => {
4112
+ const { range, unitId, subUnitId, tableStyleId = this._allThemes[this._defaultThemeIndex].name } = event;
4113
+ this._sheetRangeThemeService.removeRangeThemeRule(tableStyleId, {
4114
+ unitId,
4115
+ subUnitId,
4116
+ range: { ...range }
4117
+ });
4118
+ }));
4119
+ }
4120
+ _initUserTableTheme() {
4121
+ const tableConfig = this._configService.getConfig("sheets-table.config") || {};
4122
+ const defaultThemeIndex = tableConfig.defaultThemeIndex || 0;
4123
+ const userThemes = tableConfig.userThemes || [];
4124
+ this._defaultThemeIndex = defaultThemeIndex;
4125
+ this._allThemes = userThemes.concat(tableThemeConfig);
4126
+ }
4127
+ _initDefaultTableTheme() {
4128
+ for (let i = 0; i < this._allThemes.length; i++) {
4129
+ const { name, style } = this._allThemes[i];
4130
+ const rangeThemeStyle = new _univerjs_sheets.RangeThemeStyle(name, style);
4131
+ this._sheetRangeThemeModel.registerDefaultRangeTheme(rangeThemeStyle);
4132
+ }
4133
+ }
4134
+ dispose() {
4135
+ super.dispose();
4136
+ this._allThemes = [];
4137
+ this._defaultThemeIndex = 0;
4138
+ }
4139
+ };
4140
+ SheetsTableThemeController = __decorate([
4141
+ __decorateParam(0, (0, _univerjs_core.Inject)(TableManager)),
4142
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeService)),
4143
+ __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeModel)),
4144
+ __decorateParam(3, _univerjs_core.IConfigService)
4145
+ ], SheetsTableThemeController);
4146
+
4147
4147
  //#endregion
4148
4148
  //#region src/controllers/table-filter.controller.ts
4149
4149
  let TableFilterController = class TableFilterController extends _univerjs_core.Disposable {
@@ -4322,12 +4322,6 @@ Object.defineProperty(exports, 'SheetsTableController', {
4322
4322
  }
4323
4323
  });
4324
4324
  exports.SheetsTableSortStateEnum = SheetsTableSortStateEnum;
4325
- Object.defineProperty(exports, 'SheetsTableThemeController', {
4326
- enumerable: true,
4327
- get: function () {
4328
- return SheetsTableThemeController;
4329
- }
4330
- });
4331
4325
  exports.TABLE_FILTER_EMPTY_VALUE = TABLE_FILTER_EMPTY_VALUE;
4332
4326
  exports.TableColumnDataTypeEnum = TableColumnDataTypeEnum;
4333
4327
  exports.TableColumnFilterTypeEnum = TableColumnFilterTypeEnum;
package/lib/es/facade.js CHANGED
@@ -1,4 +1,4 @@
1
- import { IUniverInstanceService, LocaleService, Rectangle, UniverInstanceType, cellToRange, customNameCharacterCheck } from "@univerjs/core";
1
+ import { ILogService, IUniverInstanceService, LocaleService, Rectangle, UniverInstanceType, cellToRange, customNameCharacterCheck } from "@univerjs/core";
2
2
  import { AddSheetTableCommand, AddTableThemeCommand, DeleteSheetTableCommand, SetSheetTableCommand, SetSheetTableFilterCommand, SheetTableService, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from "@univerjs/sheets-table";
3
3
  import { FWorkbook, FWorksheet } from "@univerjs/sheets/facade";
4
4
  import { RangeThemeStyle } from "@univerjs/sheets";
@@ -16,12 +16,16 @@ var FWorkbookSheetsTableMixin = class extends FWorkbook {
16
16
  }
17
17
  async addTable(subUnitId, tableName, rangeInfo, tableId, options) {
18
18
  const sheetTableService = this._injector.get(SheetTableService);
19
+ const localeService = this._injector.get(LocaleService);
19
20
  const workbook = this._injector.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
20
21
  const sheetNameSet = /* @__PURE__ */ new Set();
21
22
  if (workbook) workbook.getSheets().forEach((sheet) => {
22
23
  sheetNameSet.add(sheet.getName());
23
24
  });
24
- if (!customNameCharacterCheck(tableName, sheetNameSet)) return;
25
+ if (!customNameCharacterCheck(tableName, sheetNameSet)) {
26
+ this._injector.get(ILogService).warn(localeService.t("sheets-table.tableNameError"));
27
+ return;
28
+ }
25
29
  const addTableParams = {
26
30
  unitId: this.getId(),
27
31
  name: tableName,
@@ -68,12 +72,15 @@ var FWorksheetTableMixin = class extends FWorksheet {
68
72
  const subUnitId = this.getSheetId();
69
73
  const workbook = this.getWorkbook();
70
74
  const unitId = workbook.getUnitId();
71
- this._injector.get(LocaleService);
75
+ const localeService = this._injector.get(LocaleService);
72
76
  const sheetNameSet = /* @__PURE__ */ new Set();
73
77
  if (workbook) workbook.getSheets().forEach((sheet) => {
74
78
  sheetNameSet.add(sheet.getName());
75
79
  });
76
- if (!customNameCharacterCheck(tableName, sheetNameSet)) return false;
80
+ if (!customNameCharacterCheck(tableName, sheetNameSet)) {
81
+ this._injector.get(ILogService).warn(localeService.t("sheets-table.tableNameError"));
82
+ return false;
83
+ }
77
84
  const addTableParams = {
78
85
  unitId,
79
86
  subUnitId,
@@ -111,11 +118,15 @@ var FWorksheetTableMixin = class extends FWorksheet {
111
118
  }
112
119
  setTableName(tableId, tableName) {
113
120
  const workbook = this.getWorkbook();
121
+ const localeService = this._injector.get(LocaleService);
114
122
  const sheetNameSet = /* @__PURE__ */ new Set();
115
123
  if (workbook) workbook.getSheets().forEach((sheet) => {
116
124
  sheetNameSet.add(sheet.getName());
117
125
  });
118
- if (!customNameCharacterCheck(tableName, sheetNameSet)) return false;
126
+ if (!customNameCharacterCheck(tableName, sheetNameSet)) {
127
+ this._injector.get(ILogService).warn(localeService.t("sheets-table.tableNameError"));
128
+ return false;
129
+ }
119
130
  const tableSetConfig = {
120
131
  unitId: this.getWorkbook().getUnitId(),
121
132
  tableId,