@univerjs/sheets-numfmt 0.17.0 → 0.18.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/facade.js CHANGED
@@ -1,47 +1 @@
1
- import { SetNumfmtCommand as i, SheetsNumfmtCellContentController as C } from "@univerjs/sheets-numfmt";
2
- import { FRange as d, FWorkbook as h } from "@univerjs/sheets/facade";
3
- class g extends d {
4
- setNumberFormat(o) {
5
- const t = [], { startColumn: e, startRow: s, endColumn: r, endRow: u } = this._range;
6
- for (let m = s; m <= u; m++)
7
- for (let n = e; n <= r; n++)
8
- t.push({ row: m, col: n, pattern: o });
9
- return this._commandService.syncExecuteCommand(i.id, {
10
- unitId: this._workbook.getUnitId(),
11
- subUnitId: this._worksheet.getSheetId(),
12
- values: t
13
- }), this;
14
- }
15
- setNumberFormats(o) {
16
- var m;
17
- const t = [], { startColumn: e, startRow: s, endColumn: r, endRow: u } = this._range;
18
- for (let n = s; n <= u; n++)
19
- for (let a = e; a <= r; a++) {
20
- const c = (m = o[n - s]) == null ? void 0 : m[a - e];
21
- t.push({ row: n, col: a, pattern: c });
22
- }
23
- return this._commandService.syncExecuteCommand(i.id, {
24
- unitId: this._workbook.getUnitId(),
25
- subUnitId: this._worksheet.getSheetId(),
26
- values: t
27
- }), this;
28
- }
29
- getNumberFormat() {
30
- var t, e;
31
- const o = this.getCellStyle();
32
- return (e = (t = o == null ? void 0 : o.numberFormat) == null ? void 0 : t.pattern) != null ? e : "";
33
- }
34
- getNumberFormats() {
35
- return this.getCellStyles().map((t) => t.map((e) => {
36
- var s, r;
37
- return (r = (s = e == null ? void 0 : e.numberFormat) == null ? void 0 : s.pattern) != null ? r : "";
38
- }));
39
- }
40
- }
41
- d.extend(g);
42
- class b extends h {
43
- setNumfmtLocal(o) {
44
- return this._injector.get(C).setNumfmtLocal(o), this;
45
- }
46
- }
47
- h.extend(b);
1
+ import{SetNumfmtCommand as e,SheetsNumfmtCellContentController as t}from"@univerjs/sheets-numfmt";import{FRange as n,FWorkbook as r}from"@univerjs/sheets/facade";var i=class extends n{setNumberFormat(t){let n=[],{startColumn:r,startRow:i,endColumn:a,endRow:o}=this._range;for(let e=i;e<=o;e++)for(let i=r;i<=a;i++)n.push({row:e,col:i,pattern:t});return this._commandService.syncExecuteCommand(e.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),values:n}),this}setNumberFormats(t){let n=[],{startColumn:r,startRow:i,endColumn:a,endRow:o}=this._range;for(let e=i;e<=o;e++)for(let o=r;o<=a;o++){var s;let a=(s=t[e-i])==null?void 0:s[o-r];n.push({row:e,col:o,pattern:a})}return this._commandService.syncExecuteCommand(e.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),values:n}),this}getNumberFormat(){var e,t;let n=this.getCellStyle();return(e=n==null||(t=n.numberFormat)==null?void 0:t.pattern)==null?``:e}getNumberFormats(){return this.getCellStyles().map(e=>e.map(e=>{var t,n;return(t=e==null||(n=e.numberFormat)==null?void 0:n.pattern)==null?``:t}))}};n.extend(i);var a=class extends r{setNumfmtLocal(e){return this._injector.get(t).setNumfmtLocal(e),this}};r.extend(a);export{};