office-viewer 0.3.6 → 0.3.8
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/esm/excel/render/cell/drawMultiLineText.js +1 -4
- package/esm/excel/types/X14Sparkline/X14SparklineGroup.d.ts +1 -1
- package/esm/excel/types/X14Sparkline/X14SparklineGroup.js +1 -1
- package/lib/createOfficeViewer.d.ts +1 -1
- package/lib/excel/lang/lang.d.ts +1 -1
- package/lib/excel/render/autoFilter/sortState/getColumnSortOrder.d.ts +1 -1
- package/lib/excel/render/cell/drawMultiLineText.js +1 -4
- package/lib/excel/render/dnd/mousedownColHeader.d.ts +1 -1
- package/lib/excel/render/dnd/mousedownRowHeader.d.ts +1 -1
- package/lib/excel/types/X14Sparkline/X14SparklineGroup.d.ts +1 -1
- package/lib/excel/types/X14Sparkline/X14SparklineGroup.js +2 -2
- package/lib/package/XMLPackageParser.d.ts +1 -1
- package/lib/package/ZipPackageParser.d.ts +1 -1
- package/package.json +2 -2
- /package/esm/excel/types/X14Sparkline/{x14:sparklines.d.ts → x14Sparklines.d.ts} +0 -0
- /package/esm/excel/types/X14Sparkline/{x14_sparklines.js → x14Sparklines.js} +0 -0
- /package/lib/excel/types/X14Sparkline/{x14:sparklines.d.ts → x14Sparklines.d.ts} +0 -0
- /package/lib/excel/types/X14Sparkline/{x14_sparklines.js → x14Sparklines.js} +0 -0
|
@@ -9,7 +9,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
9
9
|
// 这样才能让不同字体大小的文字垂直对齐
|
|
10
10
|
ctx.textBaseline = 'alphabetic';
|
|
11
11
|
var defaultFontHeight = dataProvider.getDefaultFontSize().height;
|
|
12
|
-
var latterSpace = defaultFontHeight * 0.1;
|
|
13
12
|
var textPositions = [];
|
|
14
13
|
var totalLineHeight = lines.reduce(function (acc, line) {
|
|
15
14
|
return acc + (line.maxHeight || defaultFontHeight);
|
|
@@ -36,8 +35,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
36
35
|
var totalLineWidth = tokens.reduce(function (acc, token) {
|
|
37
36
|
return acc + (token.w || 0);
|
|
38
37
|
}, 0);
|
|
39
|
-
// 加上字母间距
|
|
40
|
-
totalLineWidth += latterSpace * (tokens.length - 1);
|
|
41
38
|
if (horizontal === 'center') {
|
|
42
39
|
currentX = x + (width - totalLineWidth) / 2;
|
|
43
40
|
}
|
|
@@ -67,7 +64,7 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
67
64
|
height: fontHeight
|
|
68
65
|
});
|
|
69
66
|
// 这里其实不大可能为零
|
|
70
|
-
currentX = currentX + (token.w || 0)
|
|
67
|
+
currentX = currentX + (token.w || 0);
|
|
71
68
|
}
|
|
72
69
|
}
|
|
73
70
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Attributes } from '../../../openxml/Attributes';
|
|
5
5
|
import { CT_Color } from '../CT_Color';
|
|
6
|
-
import { X14Sparklines } from './
|
|
6
|
+
import { X14Sparklines } from './x14Sparklines';
|
|
7
7
|
export type ST_SparklineAxisMinMax = 'individual' | 'groupMax' | 'group';
|
|
8
8
|
export type X14SparklineGroup = {
|
|
9
9
|
'displayEmptyCellsAs'?: 'gap' | 'zero' | 'span';
|
|
@@ -13,4 +13,4 @@ import { PackageParser } from './package/PackageParser';
|
|
|
13
13
|
* @param parser 文件解析器,支持 zip 和 xml 两种,也可以扩展
|
|
14
14
|
* @returns OfficeViewer 实例
|
|
15
15
|
*/
|
|
16
|
-
export declare function createOfficeViewer(docFile: ArrayBuffer, renderOptions?: Partial<RenderOptions>, fileName?: string, parser?: PackageParser): Promise<Word |
|
|
16
|
+
export declare function createOfficeViewer(docFile: ArrayBuffer, renderOptions?: Partial<RenderOptions>, fileName?: string, parser?: PackageParser): Promise<Word | UnSupport | Excel>;
|
package/lib/excel/lang/lang.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const languages: {
|
|
|
23
23
|
count: string;
|
|
24
24
|
sum: string;
|
|
25
25
|
};
|
|
26
|
-
zh_CN: Record<"
|
|
26
|
+
zh_CN: Record<"count" | "sum" | "average" | "customFilter.equal" | "customFilter.notEqual" | "customFilter.beginsWith" | "customFilter.notBeginsWith" | "customFilter.endsWith" | "customFilter.notEndsWith" | "customFilter.contains" | "customFilter.notContains" | "customFilter.greaterThan" | "customFilter.greaterThanOrEqual" | "customFilter.lessThan" | "customFilter.lessThanOrEqual" | "autoFilter.sortAscending" | "autoFilter.sortDescending" | "checkBox.selectAll" | "checkBox.search" | "customFilter.and" | "customFilter.or", string>;
|
|
27
27
|
};
|
|
28
28
|
export type Language = keyof typeof languages;
|
|
29
29
|
export declare function getTranslate(language: string): (key: EnKeys) => string;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { CT_SortState } from '../../../../openxml/ExcelTypes';
|
|
5
5
|
import { RangeRef } from '../../../types/RangeRef';
|
|
6
|
-
export declare function getColumnSortOrder(colIndex: number, rangeRef: RangeRef, sortState?: CT_SortState): "
|
|
6
|
+
export declare function getColumnSortOrder(colIndex: number, rangeRef: RangeRef, sortState?: CT_SortState): "none" | "desc" | "asc";
|
|
@@ -13,7 +13,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
13
13
|
// 这样才能让不同字体大小的文字垂直对齐
|
|
14
14
|
ctx.textBaseline = 'alphabetic';
|
|
15
15
|
var defaultFontHeight = dataProvider.getDefaultFontSize().height;
|
|
16
|
-
var latterSpace = defaultFontHeight * 0.1;
|
|
17
16
|
var textPositions = [];
|
|
18
17
|
var totalLineHeight = lines.reduce(function (acc, line) {
|
|
19
18
|
return acc + (line.maxHeight || defaultFontHeight);
|
|
@@ -40,8 +39,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
40
39
|
var totalLineWidth = tokens.reduce(function (acc, token) {
|
|
41
40
|
return acc + (token.w || 0);
|
|
42
41
|
}, 0);
|
|
43
|
-
// 加上字母间距
|
|
44
|
-
totalLineWidth += latterSpace * (tokens.length - 1);
|
|
45
42
|
if (horizontal === 'center') {
|
|
46
43
|
currentX = x + (width - totalLineWidth) / 2;
|
|
47
44
|
}
|
|
@@ -71,7 +68,7 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
71
68
|
height: fontHeight
|
|
72
69
|
});
|
|
73
70
|
// 这里其实不大可能为零
|
|
74
|
-
currentX = currentX + (token.w || 0)
|
|
71
|
+
currentX = currentX + (token.w || 0);
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
74
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -10,7 +10,7 @@ import { HitTestResult } from '../selection/hitTest';
|
|
|
10
10
|
export declare function mousedownColHeader(workbook: Workbook, hitTestResult: HitTestResult): {
|
|
11
11
|
user: string;
|
|
12
12
|
region: import("../../sheet/ViewRange").Region;
|
|
13
|
-
selectType: "
|
|
13
|
+
selectType: "cell" | "corner" | "drawing" | "row-header" | "col-header" | "row-grid" | "col-grid";
|
|
14
14
|
activeCell: RangeRef;
|
|
15
15
|
sheetIndex: number;
|
|
16
16
|
cellRanges: {
|
|
@@ -10,7 +10,7 @@ import { HitTestResult } from '../selection/hitTest';
|
|
|
10
10
|
export declare function mousedownRowHeader(workbook: Workbook, hitTestResult: HitTestResult): {
|
|
11
11
|
user: string;
|
|
12
12
|
region: import("../../sheet/ViewRange").Region;
|
|
13
|
-
selectType: "
|
|
13
|
+
selectType: "cell" | "corner" | "drawing" | "row-header" | "col-header" | "row-grid" | "col-grid";
|
|
14
14
|
activeCell: RangeRef;
|
|
15
15
|
sheetIndex: number;
|
|
16
16
|
cellRanges: {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Attributes } from '../../../openxml/Attributes';
|
|
5
5
|
import { CT_Color } from '../CT_Color';
|
|
6
|
-
import { X14Sparklines } from './
|
|
6
|
+
import { X14Sparklines } from './x14Sparklines';
|
|
7
7
|
export type ST_SparklineAxisMinMax = 'individual' | 'groupMax' | 'group';
|
|
8
8
|
export type X14SparklineGroup = {
|
|
9
9
|
'displayEmptyCellsAs'?: 'gap' | 'zero' | 'span';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var CT_Color = require('../CT_Color.js');
|
|
6
|
-
var
|
|
6
|
+
var x14Sparklines = require('./x14Sparklines.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 目前先简单实现,后面再改成自动解析
|
|
@@ -105,7 +105,7 @@ var X14SparklineGroup_Attributes = {
|
|
|
105
105
|
},
|
|
106
106
|
'x14:sparklines': {
|
|
107
107
|
type: 'child',
|
|
108
|
-
childAttributes:
|
|
108
|
+
childAttributes: x14Sparklines.X14Sparklines_Attributes
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
|
|
@@ -19,7 +19,7 @@ export default class XMLPackageParser implements PackageParser {
|
|
|
19
19
|
/**
|
|
20
20
|
* 在 xml 下基本不用这个
|
|
21
21
|
*/
|
|
22
|
-
getFileByType(filePath: string, type: 'string' | 'blob'): string |
|
|
22
|
+
getFileByType(filePath: string, type: 'string' | 'blob'): string | Blob | Uint8Array | null;
|
|
23
23
|
/**
|
|
24
24
|
* 读取文本内容
|
|
25
25
|
*/
|
|
@@ -17,7 +17,7 @@ export default class ZipPackageParser implements PackageParser {
|
|
|
17
17
|
/**
|
|
18
18
|
* 根据类型读取文件
|
|
19
19
|
*/
|
|
20
|
-
getFileByType(filePath: string, type?: 'string' | 'blob' | 'uint8array'): string |
|
|
20
|
+
getFileByType(filePath: string, type?: 'string' | 'blob' | 'uint8array'): string | Blob | Uint8Array | null;
|
|
21
21
|
/**
|
|
22
22
|
* 读取文本内容
|
|
23
23
|
*/
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|