@univerjs/sheets-numfmt 0.20.1 → 0.21.0-insiders.20260422-d7fcb4d
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/cjs/facade.js +64 -1
- package/lib/cjs/index.js +951 -1
- package/lib/es/facade.js +65 -1
- package/lib/es/index.js +913 -1
- package/lib/facade.js +65 -1
- package/lib/index.js +913 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
- package/LICENSE +0 -176
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
let
|
|
1
|
+
let _univerjs_sheets_numfmt = require("@univerjs/sheets-numfmt");
|
|
2
|
+
let _univerjs_sheets_facade = require("@univerjs/sheets/facade");
|
|
3
|
+
|
|
4
|
+
//#region src/facade/f-range.ts
|
|
5
|
+
var FRangeSheetsNumfmtMixin = class extends _univerjs_sheets_facade.FRange {
|
|
6
|
+
setNumberFormat(pattern) {
|
|
7
|
+
const values = [];
|
|
8
|
+
const { startColumn, startRow, endColumn, endRow } = this._range;
|
|
9
|
+
for (let row = startRow; row <= endRow; row++) for (let col = startColumn; col <= endColumn; col++) values.push({
|
|
10
|
+
row,
|
|
11
|
+
col,
|
|
12
|
+
pattern
|
|
13
|
+
});
|
|
14
|
+
this._commandService.syncExecuteCommand(_univerjs_sheets_numfmt.SetNumfmtCommand.id, {
|
|
15
|
+
unitId: this._workbook.getUnitId(),
|
|
16
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
17
|
+
values
|
|
18
|
+
});
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
setNumberFormats(patterns) {
|
|
22
|
+
const values = [];
|
|
23
|
+
const { startColumn, startRow, endColumn, endRow } = this._range;
|
|
24
|
+
for (let row = startRow; row <= endRow; row++) for (let col = startColumn; col <= endColumn; col++) {
|
|
25
|
+
var _patterns;
|
|
26
|
+
const pattern = (_patterns = patterns[row - startRow]) === null || _patterns === void 0 ? void 0 : _patterns[col - startColumn];
|
|
27
|
+
values.push({
|
|
28
|
+
row,
|
|
29
|
+
col,
|
|
30
|
+
pattern
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
this._commandService.syncExecuteCommand(_univerjs_sheets_numfmt.SetNumfmtCommand.id, {
|
|
34
|
+
unitId: this._workbook.getUnitId(),
|
|
35
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
36
|
+
values
|
|
37
|
+
});
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
getNumberFormat() {
|
|
41
|
+
var _style$numberFormat$p, _style$numberFormat;
|
|
42
|
+
const style = this.getCellStyle();
|
|
43
|
+
return (_style$numberFormat$p = style === null || style === void 0 || (_style$numberFormat = style.numberFormat) === null || _style$numberFormat === void 0 ? void 0 : _style$numberFormat.pattern) !== null && _style$numberFormat$p !== void 0 ? _style$numberFormat$p : "";
|
|
44
|
+
}
|
|
45
|
+
getNumberFormats() {
|
|
46
|
+
return this.getCellStyles().map((row) => row.map((cellStyle) => {
|
|
47
|
+
var _cellStyle$numberForm, _cellStyle$numberForm2;
|
|
48
|
+
return (_cellStyle$numberForm = cellStyle === null || cellStyle === void 0 || (_cellStyle$numberForm2 = cellStyle.numberFormat) === null || _cellStyle$numberForm2 === void 0 ? void 0 : _cellStyle$numberForm2.pattern) !== null && _cellStyle$numberForm !== void 0 ? _cellStyle$numberForm : "";
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
_univerjs_sheets_facade.FRange.extend(FRangeSheetsNumfmtMixin);
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/facade/f-workbook.ts
|
|
56
|
+
var FWorkbookSheetsNumfmtMixin = class extends _univerjs_sheets_facade.FWorkbook {
|
|
57
|
+
setNumfmtLocal(locale) {
|
|
58
|
+
this._injector.get(_univerjs_sheets_numfmt.SheetsNumfmtCellContentController).setNumfmtLocal(locale);
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
_univerjs_sheets_facade.FWorkbook.extend(FWorkbookSheetsNumfmtMixin);
|
|
63
|
+
|
|
64
|
+
//#endregion
|