@univerjs/sheets-table 0.10.0-nightly.202507310307 → 0.10.1-nightly.202508020912

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/facade.js CHANGED
@@ -1,29 +1,36 @@
1
- import { SheetTableService as o, AddSheetTableCommand as u, DeleteSheetTableCommand as T, SetSheetTableFilterCommand as d, SetSheetTableCommand as c, AddTableThemeCommand as C, TableColumnFilterTypeEnum as f, TableConditionTypeEnum as v, TableNumberCompareTypeEnum as k, TableStringCompareTypeEnum as p, TableDateCompareTypeEnum as _ } from "@univerjs/sheets-table";
2
- import { FWorkbook as h, FWorksheet as g } from "@univerjs/sheets/facade";
3
- import { cellToRange as x, Rectangle as y } from "@univerjs/core";
4
- import { RangeThemeStyle as F } from "@univerjs/sheets";
5
- import { FEnum as I } from "@univerjs/core/facade";
6
- class W extends h {
1
+ import { LocaleService as h, IUniverInstanceService as y, UniverInstanceType as x, customNameCharacterCheck as g, ILogService as u, cellToRange as F, Rectangle as N } from "@univerjs/core";
2
+ import { SheetTableService as l, AddSheetTableCommand as k, DeleteSheetTableCommand as C, SetSheetTableFilterCommand as T, SetSheetTableCommand as f, AddTableThemeCommand as U, TableColumnFilterTypeEnum as W, TableConditionTypeEnum as j, TableNumberCompareTypeEnum as w, TableStringCompareTypeEnum as L, TableDateCompareTypeEnum as R } from "@univerjs/sheets-table";
3
+ import { FWorkbook as _, FWorksheet as p } from "@univerjs/sheets/facade";
4
+ import { RangeThemeStyle as P } from "@univerjs/sheets";
5
+ import { FEnum as E } from "@univerjs/core/facade";
6
+ class V extends _ {
7
7
  getTableInfo(e) {
8
8
  const t = this.getId();
9
- return this._injector.get(o).getTableInfo(t, e);
9
+ return this._injector.get(l).getTableInfo(t, e);
10
10
  }
11
11
  getTableList() {
12
12
  const e = this.getId();
13
- return this._injector.get(o).getTableList(e);
14
- }
15
- async addTable(e, t, n, i, r) {
16
- var b;
17
- const s = this._injector.get(o), a = {
13
+ return this._injector.get(l).getTableList(e);
14
+ }
15
+ async addTable(e, t, n, i, a) {
16
+ var v;
17
+ const o = this._injector.get(l), r = this._injector.get(h), c = this._injector.get(y).getCurrentUnitOfType(x.UNIVER_SHEET), b = /* @__PURE__ */ new Set();
18
+ if (c && c.getSheets().forEach((m) => {
19
+ b.add(m.getName());
20
+ }), !g(t, b)) {
21
+ this._injector.get(u).warn(r.t("sheets-table.tableNameError"));
22
+ return;
23
+ }
24
+ const d = {
18
25
  unitId: this.getId(),
19
26
  name: t,
20
27
  subUnitId: e,
21
28
  range: n,
22
- options: r,
29
+ options: a,
23
30
  id: i
24
31
  };
25
- if (await this._commandService.executeCommand(u.id, a))
26
- return (b = s.getTableList(this.getId()).find((S) => S.name === t)) == null ? void 0 : b.id;
32
+ if (await this._commandService.executeCommand(k.id, d))
33
+ return (v = o.getTableList(this.getId()).find((m) => m.name === t)) == null ? void 0 : v.id;
27
34
  }
28
35
  async removeTable(e) {
29
36
  var i;
@@ -35,7 +42,7 @@ class W extends h {
35
42
  subUnitId: t,
36
43
  tableId: e
37
44
  };
38
- return this._commandService.executeCommand(T.id, n);
45
+ return this._commandService.executeCommand(C.id, n);
39
46
  }
40
47
  getTableInfoByName(e) {
41
48
  return this.getTableList().find((n) => n.name === e);
@@ -47,21 +54,26 @@ class W extends h {
47
54
  column: t,
48
55
  tableFilter: n
49
56
  };
50
- return this._commandService.executeCommand(d.id, i);
57
+ return this._commandService.executeCommand(T.id, i);
51
58
  }
52
59
  }
53
- h.extend(W);
54
- class E extends g {
60
+ _.extend(V);
61
+ class D extends p {
55
62
  addTable(e, t, n, i) {
56
- const r = this.getSheetId(), a = {
57
- unitId: this.getWorkbook().getUnitId(),
58
- subUnitId: r,
63
+ const a = this.getSheetId(), o = this.getWorkbook(), r = o.getUnitId(), s = this._injector.get(h), c = /* @__PURE__ */ new Set();
64
+ if (o && o.getSheets().forEach((d) => {
65
+ c.add(d.getName());
66
+ }), !g(e, c))
67
+ return this._injector.get(u).warn(s.t("sheets-table.tableNameError")), !1;
68
+ const I = {
69
+ unitId: r,
70
+ subUnitId: a,
59
71
  name: e,
60
72
  range: t,
61
73
  id: n,
62
74
  options: i
63
75
  };
64
- return this._commandService.executeCommand(u.id, a);
76
+ return this._commandService.executeCommand(k.id, I);
65
77
  }
66
78
  setTableFilter(e, t, n) {
67
79
  const i = {
@@ -70,7 +82,7 @@ class E extends g {
70
82
  column: t,
71
83
  tableFilter: n
72
84
  };
73
- return this._commandService.executeCommand(d.id, i);
85
+ return this._commandService.executeCommand(T.id, i);
74
86
  }
75
87
  removeTable(e) {
76
88
  const t = {
@@ -78,7 +90,7 @@ class E extends g {
78
90
  subUnitId: this.getSheetId(),
79
91
  tableId: e
80
92
  };
81
- return this._commandService.executeCommand(T.id, t);
93
+ return this._commandService.executeCommand(C.id, t);
82
94
  }
83
95
  setTableRange(e, t) {
84
96
  const n = {
@@ -88,19 +100,24 @@ class E extends g {
88
100
  newRange: t
89
101
  }
90
102
  };
91
- return this._commandService.executeCommand(c.id, n);
103
+ return this._commandService.executeCommand(f.id, n);
92
104
  }
93
105
  setTableName(e, t) {
94
- const n = {
106
+ const n = this.getWorkbook(), i = this._injector.get(h), a = /* @__PURE__ */ new Set();
107
+ if (n && n.getSheets().forEach((s) => {
108
+ a.add(s.getName());
109
+ }), !g(t, a))
110
+ return this._injector.get(u).warn(i.t("sheets-table.tableNameError")), !1;
111
+ const r = {
95
112
  unitId: this.getWorkbook().getUnitId(),
96
113
  tableId: e,
97
114
  name: t
98
115
  };
99
- return this._commandService.executeCommand(c.id, n);
116
+ return this._commandService.executeCommand(f.id, r);
100
117
  }
101
118
  getSubTableInfos() {
102
119
  const e = this._fWorkbook.getId();
103
- return this._injector.get(o).getTableList(e).filter((n) => n.subUnitId === this.getSheetId());
120
+ return this._injector.get(l).getTableList(e).filter((n) => n.subUnitId === this.getSheetId());
104
121
  }
105
122
  resetFilter(e, t) {
106
123
  const n = {
@@ -109,40 +126,40 @@ class E extends g {
109
126
  column: t,
110
127
  tableFilter: void 0
111
128
  };
112
- return this._commandService.executeCommand(d.id, n);
129
+ return this._commandService.executeCommand(T.id, n);
113
130
  }
114
131
  getTableByCell(e, t) {
115
- const n = this._fWorkbook.getId(), r = this._injector.get(o).getTableList(n).filter((a) => a.subUnitId === this.getSheetId()), s = x(e, t);
116
- return r.find((a) => {
117
- const l = a.range;
118
- return y.intersects(l, s);
132
+ const n = this._fWorkbook.getId(), a = this._injector.get(l).getTableList(n).filter((r) => r.subUnitId === this.getSheetId()), o = F(e, t);
133
+ return a.find((r) => {
134
+ const s = r.range;
135
+ return N.intersects(s, o);
119
136
  });
120
137
  }
121
138
  addTableTheme(e, t) {
122
- const n = new F("table-style");
123
- return n.fromJson(t), this._commandService.executeCommand(C.id, {
139
+ const n = new P("table-style");
140
+ return n.fromJson(t), this._commandService.executeCommand(U.id, {
124
141
  unitId: this._fWorkbook.getId(),
125
142
  tableId: e,
126
143
  themeStyle: n
127
144
  });
128
145
  }
129
146
  }
130
- g.extend(E);
131
- class U extends I {
147
+ p.extend(D);
148
+ class A extends E {
132
149
  get TableColumnFilterTypeEnum() {
133
- return f;
150
+ return W;
134
151
  }
135
152
  get TableConditionTypeEnum() {
136
- return v;
153
+ return j;
137
154
  }
138
155
  get TableNumberCompareTypeEnum() {
139
- return k;
156
+ return w;
140
157
  }
141
158
  get TableStringCompareTypeEnum() {
142
- return p;
159
+ return L;
143
160
  }
144
161
  get TableDateCompareTypeEnum() {
145
- return _;
162
+ return R;
146
163
  }
147
164
  }
148
- I.extend(U);
165
+ E.extend(A);