office-viewer 0.3.4 → 0.3.5

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.
@@ -89,14 +89,14 @@ function shapeToSVG(shape, avLst, shapePr, width, height, wpsStyle) {
89
89
  pathEl.setAttribute('stroke-width', outline.width);
90
90
  }
91
91
  if (outline.style === 'none') {
92
- pathEl.setAttribute('stroke', 'transparent');
92
+ pathEl.setAttribute('stroke', 'none');
93
93
  }
94
94
  }
95
95
  else if (wpsStyle && wpsStyle.lineColor) {
96
96
  pathEl.setAttribute('stroke', wpsStyle.lineColor);
97
97
  }
98
98
  else {
99
- pathEl.setAttribute('stroke', 'transparent');
99
+ pathEl.setAttribute('stroke', 'none');
100
100
  }
101
101
  var fillColor = pathEl.getAttribute('fill');
102
102
  if (fillColor && fillColor !== 'none') {
@@ -124,16 +124,16 @@ function shapeToSVG(shape, avLst, shapePr, width, height, wpsStyle) {
124
124
  }
125
125
  }
126
126
  if (path.fill === 'none') {
127
- pathEl.setAttribute('fill', 'transparent');
127
+ pathEl.setAttribute('fill', 'none');
128
128
  }
129
129
  if (path.stroke === false) {
130
- pathEl.setAttribute('stroke', 'transparent');
130
+ pathEl.setAttribute('stroke', 'none');
131
131
  if (!path.fill) {
132
- pathEl.setAttribute('fill', 'transparent');
132
+ pathEl.setAttribute('fill', 'none');
133
133
  }
134
134
  }
135
135
  if (shapePr.noFill) {
136
- pathEl.setAttribute('fill', 'transparent');
136
+ pathEl.setAttribute('fill', 'none');
137
137
  }
138
138
  svg.appendChild(pathEl);
139
139
  }
@@ -39,7 +39,7 @@ function checkString(buffer, string, options) {
39
39
  return check(buffer, stringToBytes(string), options);
40
40
  }
41
41
  function fileTypeFromArrayBuffer(arrayBuffer) {
42
- return fileTypeFromBuffer(new Uint8Array(arrayBuffer));
42
+ return fileTypeFromBuffer(new Uint8Array(arrayBuffer.slice(0, 20)));
43
43
  }
44
44
  function fileTypeFromBuffer(buffer) {
45
45
  if (check(buffer, [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])) {
@@ -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<Excel | Word | UnSupport>;
16
+ export declare function createOfficeViewer(docFile: ArrayBuffer, renderOptions?: Partial<RenderOptions>, fileName?: string, parser?: PackageParser): Promise<Word | UnSupport | Excel>;
@@ -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): "asc" | "desc" | "none";
6
+ export declare function getColumnSortOrder(colIndex: number, rangeRef: RangeRef, sortState?: CT_SortState): "none" | "desc" | "asc";
@@ -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: "cell" | "corner" | "drawing" | "row-header" | "col-header" | "row-grid" | "col-grid";
13
+ selectType: "corner" | "drawing" | "cell" | "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: "cell" | "corner" | "drawing" | "row-header" | "col-header" | "row-grid" | "col-grid";
13
+ selectType: "corner" | "drawing" | "cell" | "row-header" | "col-header" | "row-grid" | "col-grid";
14
14
  activeCell: RangeRef;
15
15
  sheetIndex: number;
16
16
  cellRanges: {
@@ -93,14 +93,14 @@ function shapeToSVG(shape, avLst, shapePr, width, height, wpsStyle) {
93
93
  pathEl.setAttribute('stroke-width', outline.width);
94
94
  }
95
95
  if (outline.style === 'none') {
96
- pathEl.setAttribute('stroke', 'transparent');
96
+ pathEl.setAttribute('stroke', 'none');
97
97
  }
98
98
  }
99
99
  else if (wpsStyle && wpsStyle.lineColor) {
100
100
  pathEl.setAttribute('stroke', wpsStyle.lineColor);
101
101
  }
102
102
  else {
103
- pathEl.setAttribute('stroke', 'transparent');
103
+ pathEl.setAttribute('stroke', 'none');
104
104
  }
105
105
  var fillColor = pathEl.getAttribute('fill');
106
106
  if (fillColor && fillColor !== 'none') {
@@ -128,16 +128,16 @@ function shapeToSVG(shape, avLst, shapePr, width, height, wpsStyle) {
128
128
  }
129
129
  }
130
130
  if (path.fill === 'none') {
131
- pathEl.setAttribute('fill', 'transparent');
131
+ pathEl.setAttribute('fill', 'none');
132
132
  }
133
133
  if (path.stroke === false) {
134
- pathEl.setAttribute('stroke', 'transparent');
134
+ pathEl.setAttribute('stroke', 'none');
135
135
  if (!path.fill) {
136
- pathEl.setAttribute('fill', 'transparent');
136
+ pathEl.setAttribute('fill', 'none');
137
137
  }
138
138
  }
139
139
  if (shapePr.noFill) {
140
- pathEl.setAttribute('fill', 'transparent');
140
+ pathEl.setAttribute('fill', 'none');
141
141
  }
142
142
  svg.appendChild(pathEl);
143
143
  }
@@ -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 | Blob | Uint8Array | null;
22
+ getFileByType(filePath: string, type: 'string' | 'blob'): string | Uint8Array | Blob | 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 | Blob | Uint8Array | null;
20
+ getFileByType(filePath: string, type?: 'string' | 'blob' | 'uint8array'): string | Uint8Array | Blob | null;
21
21
  /**
22
22
  * 读取文本内容
23
23
  */
@@ -43,7 +43,7 @@ function checkString(buffer, string, options) {
43
43
  return check(buffer, stringToBytes(string), options);
44
44
  }
45
45
  function fileTypeFromArrayBuffer(arrayBuffer) {
46
- return fileTypeFromBuffer(new Uint8Array(arrayBuffer));
46
+ return fileTypeFromBuffer(new Uint8Array(arrayBuffer.slice(0, 20)));
47
47
  }
48
48
  function fileTypeFromBuffer(buffer) {
49
49
  if (check(buffer, [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "office-viewer",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "office 文档在线预览",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -70,16 +70,11 @@
70
70
  "@rollup/plugin-typescript": "^8.3.4",
71
71
  "@swc/jest": "^0.2.34",
72
72
  "@testing-library/jest-dom": "^5.17.0",
73
- "@types/big.js": "^6.2.2",
74
73
  "@types/jest": "^28.1.0",
75
74
  "@types/prettier": "^2.7.3",
76
- "@types/react": "^18.0.24",
77
- "@types/react-dom": "^18.0.8",
78
75
  "amis-formula": "^2.7.2",
79
76
  "jest": "^29.0.3",
80
77
  "jest-environment-jsdom": "^29.0.3",
81
- "react": "^18.2.0",
82
- "react-dom": "^18.2.0",
83
78
  "rollup": "^2.60.2",
84
79
  "rollup-plugin-terser": "^7.0.2",
85
80
  "sass": "^1.69.7",
@@ -119,4 +114,4 @@
119
114
  "printBasicPrototype": false
120
115
  }
121
116
  }
122
- }
117
+ }