@univerjs/sheets-table 1.0.0-rc.0 → 1.0.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.
Files changed (52) hide show
  1. package/lib/cjs/facade.js +23 -1
  2. package/lib/cjs/index.js +484 -74
  3. package/lib/cjs/locale/ar-SA.js +0 -1
  4. package/lib/cjs/locale/ca-ES.js +0 -1
  5. package/lib/cjs/locale/de-DE.js +0 -1
  6. package/lib/cjs/locale/en-US.js +0 -1
  7. package/lib/cjs/locale/es-ES.js +0 -1
  8. package/lib/cjs/locale/fa-IR.js +0 -1
  9. package/lib/cjs/locale/fr-FR.js +0 -1
  10. package/lib/cjs/locale/id-ID.js +0 -1
  11. package/lib/cjs/locale/it-IT.js +0 -1
  12. package/lib/cjs/locale/ja-JP.js +0 -1
  13. package/lib/cjs/locale/ko-KR.js +0 -1
  14. package/lib/cjs/locale/pl-PL.js +0 -1
  15. package/lib/cjs/locale/pt-BR.js +0 -1
  16. package/lib/cjs/locale/ru-RU.js +0 -1
  17. package/lib/cjs/locale/sk-SK.js +0 -1
  18. package/lib/cjs/locale/vi-VN.js +0 -1
  19. package/lib/cjs/locale/zh-CN.js +0 -1
  20. package/lib/cjs/locale/zh-HK.js +0 -1
  21. package/lib/cjs/locale/zh-TW.js +0 -1
  22. package/lib/es/facade.js +25 -3
  23. package/lib/es/index.js +484 -78
  24. package/lib/facade.js +25 -3
  25. package/lib/index.js +484 -78
  26. package/lib/types/commands/mutations/set-table-filter.mutation.d.ts +3 -0
  27. package/lib/types/commands/utils/calculated-column.d.ts +20 -0
  28. package/lib/types/controllers/sheet-table-formula.controller.d.ts +4 -1
  29. package/lib/types/controllers/table-filter.controller.d.ts +4 -1
  30. package/lib/types/facade/f-enum.d.ts +5 -0
  31. package/lib/types/facade/f-workbook.d.ts +6 -6
  32. package/lib/types/facade/f-worksheet.d.ts +22 -3
  33. package/lib/types/index.d.ts +3 -2
  34. package/lib/types/model/filter-util/condition.d.ts +27 -0
  35. package/lib/types/model/filter-util/date-filter-util.d.ts +225 -0
  36. package/lib/types/model/filter-util/number-filter-util.d.ts +47 -0
  37. package/lib/types/model/filter-util/text-filter-util.d.ts +23 -0
  38. package/lib/types/model/filter-util/top-n.d.ts +29 -0
  39. package/lib/types/model/table-column.d.ts +39 -0
  40. package/lib/types/model/table-filter.d.ts +42 -0
  41. package/lib/types/model/table-manager.d.ts +97 -0
  42. package/lib/types/model/table.d.ts +96 -0
  43. package/lib/types/models/filter-util/record-filter.d.ts +24 -0
  44. package/lib/types/models/table-column.d.ts +11 -0
  45. package/lib/types/models/table-filter.d.ts +1 -0
  46. package/lib/types/models/table.d.ts +4 -0
  47. package/lib/types/types/enum.d.ts +2 -1
  48. package/lib/types/types/type.d.ts +55 -2
  49. package/lib/types/util.d.ts +2 -1
  50. package/lib/umd/facade.js +1 -1
  51. package/lib/umd/index.js +1 -1
  52. package/package.json +8 -8
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ar-SA.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "عمود",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ca-ES.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Columna",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/de-DE.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Spalte",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/en-US.ts
3
2
  /**
4
3
  * Copyright 2023-present DreamNum Co., Ltd.
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/es-ES.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Columna",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/fa-IR.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "ستون",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/fr-FR.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Colonne",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/id-ID.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Kolom",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/it-IT.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Colonna",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ja-JP.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "列",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ko-KR.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "열",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/pl-PL.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Kolumna",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/pt-BR.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Coluna",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ru-RU.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Столбец",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/sk-SK.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Stĺpec",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/vi-VN.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "Cột",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/zh-CN.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "列",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/zh-HK.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "列",
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/zh-TW.ts
3
2
  const locale = { "sheets-table": {
4
3
  columnPrefix: "列",
package/lib/es/facade.js CHANGED
@@ -1,5 +1,5 @@
1
- import { IUniverInstanceService, LocaleService, Rectangle, UniverInstanceType, cellToRange, customNameCharacterCheck } from "@univerjs/core";
2
- import { AddSheetTableCommand, AddTableThemeCommand, DeleteSheetTableCommand, SetSheetTableCommand, SetSheetTableFilterCommand, SheetTableService, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from "@univerjs/sheets-table";
1
+ import { IUniverInstanceService, Rectangle, UniverInstanceType, cellToRange, customNameCharacterCheck } from "@univerjs/core";
2
+ import { AddSheetTableCommand, AddTableThemeCommand, DeleteSheetTableCommand, SetSheetTableCommand, SetSheetTableFilterCommand, SheetTableService, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableManager, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from "@univerjs/sheets-table";
3
3
  import { FWorkbook, FWorksheet } from "@univerjs/sheets/facade";
4
4
  import { RangeThemeStyle } from "@univerjs/sheets";
5
5
  import { FEnum } from "@univerjs/core/facade";
@@ -64,11 +64,33 @@ FWorkbook.extend(FWorkbookSheetsTableMixin);
64
64
  //#endregion
65
65
  //#region src/facade/f-worksheet.ts
66
66
  var FWorksheetTableMixin = class extends FWorksheet {
67
+ setTableColumnFormula(tableId, columnId, formula) {
68
+ const unitId = this.getWorkbook().getUnitId();
69
+ const table = this._injector.get(TableManager).getTableById(unitId, tableId);
70
+ if (!table || table.getSubunitId() !== this.getSheetId()) return false;
71
+ return this._commandService.syncExecuteCommand(SetSheetTableCommand.id, {
72
+ unitId,
73
+ tableId,
74
+ calculatedColumn: {
75
+ columnId,
76
+ formula
77
+ }
78
+ });
79
+ }
80
+ setTableFilterButtons(tableId, config) {
81
+ const unitId = this.getWorkbook().getUnitId();
82
+ const table = this._injector.get(TableManager).getTableById(unitId, tableId);
83
+ if (!table || table.getSubunitId() !== this.getSheetId()) return false;
84
+ return this._commandService.syncExecuteCommand(SetSheetTableCommand.id, {
85
+ unitId,
86
+ tableId,
87
+ filterButtons: config
88
+ });
89
+ }
67
90
  addTable(tableName, rangeInfo, tableId, options) {
68
91
  const subUnitId = this.getSheetId();
69
92
  const workbook = this.getWorkbook();
70
93
  const unitId = workbook.getUnitId();
71
- this._injector.get(LocaleService);
72
94
  const sheetNameSet = /* @__PURE__ */ new Set();
73
95
  if (workbook) workbook.getSheets().forEach((sheet) => {
74
96
  sheetNameSet.add(sheet.getName());