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.
@@ -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) + latterSpace;
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 './x14:sparklines';
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';
@@ -1,5 +1,5 @@
1
1
  import { CT_Color_Attributes } from '../CT_Color.js';
2
- import { X14Sparklines_Attributes } from './x14_sparklines.js';
2
+ import { X14Sparklines_Attributes } from './x14Sparklines.js';
3
3
 
4
4
  /**
5
5
  * 目前先简单实现,后面再改成自动解析
@@ -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 | Excel | UnSupport>;
16
+ export declare function createOfficeViewer(docFile: ArrayBuffer, renderOptions?: Partial<RenderOptions>, fileName?: string, parser?: PackageParser): Promise<Word | UnSupport | Excel>;
@@ -23,7 +23,7 @@ declare const languages: {
23
23
  count: string;
24
24
  sum: string;
25
25
  };
26
- zh_CN: Record<"autoFilter.sortAscending" | "autoFilter.sortDescending" | "checkBox.selectAll" | "checkBox.search" | "customFilter.equal" | "customFilter.notEqual" | "customFilter.greaterThan" | "customFilter.greaterThanOrEqual" | "customFilter.lessThan" | "customFilter.lessThanOrEqual" | "customFilter.beginsWith" | "customFilter.notBeginsWith" | "customFilter.endsWith" | "customFilter.notEndsWith" | "customFilter.contains" | "customFilter.notContains" | "customFilter.and" | "customFilter.or" | "average" | "count" | "sum", string>;
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): "desc" | "none" | "asc";
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) + latterSpace;
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: "drawing" | "corner" | "cell" | "row-header" | "col-header" | "row-grid" | "col-grid";
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: "drawing" | "corner" | "cell" | "row-header" | "col-header" | "row-grid" | "col-grid";
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 './x14:sparklines';
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 x14_sparklines = require('./x14_sparklines.js');
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: x14_sparklines.X14Sparklines_Attributes
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 | Uint8Array | Blob | null;
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 | Uint8Array | Blob | null;
20
+ getFileByType(filePath: string, type?: 'string' | 'blob' | 'uint8array'): string | Blob | Uint8Array | null;
21
21
  /**
22
22
  * 读取文本内容
23
23
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "office-viewer",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "office 文档在线预览",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -116,4 +116,4 @@
116
116
  "printBasicPrototype": false
117
117
  }
118
118
  }
119
- }
119
+ }