office-viewer 0.3.5 → 0.3.6
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/common/autoParse.js +7 -1
- package/esm/excel/edit/ui/CellEditor.d.ts +1 -0
- package/esm/excel/edit/ui/CellEditor.js +18 -5
- package/esm/excel/io/excel/util/Range.d.ts +1 -1
- package/esm/excel/render/autoFilter/AutoFilterIconUI.d.ts +2 -0
- package/esm/excel/render/autoFilter/AutoFilterIconUI.js +5 -1
- package/esm/excel/render/autoFilter/filterColumn/CustomFiltersUI.js +9 -3
- package/esm/excel/render/cell/drawCells.js +1 -1
- package/esm/excel/render/cell/frozen/drawFrozen.d.ts +1 -1
- package/esm/excel/render/cell/frozen/getFrozenLeftViewPointRange.d.ts +1 -1
- package/esm/excel/render/cell/frozen/getFrozenTopLeftViewPointRange.d.ts +1 -1
- package/esm/excel/render/cell/frozen/getFrozenTopViewPointRange.d.ts +1 -1
- package/esm/excel/render/dnd/DragState.d.ts +1 -1
- package/esm/excel/render/drawing/drawDrawing.d.ts +1 -1
- package/esm/excel/render/drawing/findPositionInViewRange.d.ts +1 -1
- package/esm/excel/render/drawing/getRectFromAnchorPoint.d.ts +1 -1
- package/esm/excel/render/formulaBar/FormulaBar.js +7 -3
- package/esm/excel/render/grid/drawGridLines.d.ts +1 -1
- package/esm/excel/render/header/drawRowColHeaders.d.ts +1 -1
- package/esm/excel/render/header/drawRowColHeaders.js +3 -0
- package/esm/excel/render/selection/SheetSelection.d.ts +1 -1
- package/esm/excel/render/selection/binarySearchSize.d.ts +1 -1
- package/esm/excel/render/selection/findCell.d.ts +1 -1
- package/esm/excel/render/selection/findInViewRange.d.ts +1 -1
- package/esm/excel/render/selection/findInViewRangeX.d.ts +1 -1
- package/esm/excel/render/selection/findInViewRangeY.d.ts +1 -1
- package/esm/excel/render/selection/getCellPosition.d.ts +1 -1
- package/esm/excel/render/selection/getRangePosition.d.ts +1 -1
- package/esm/excel/render/selection/hitTest.d.ts +1 -1
- package/esm/excel/render/selection/hitTestInRange.d.ts +1 -1
- package/esm/excel/render/sparkline/drawSparkline.d.ts +1 -1
- package/esm/excel/render/ui/CheckBoxList.js +6 -2
- package/esm/excel/render/ui/Input.d.ts +9 -1
- package/esm/excel/render/ui/Input.js +15 -11
- package/esm/excel/types/worksheet/CellData.js +10 -0
- package/esm/util/__tests__/replaceVar.test.d.ts +1 -1
- package/esm/util/__tests__/xmlToNode.test.d.ts +1 -0
- package/esm/util/onClickOutside.d.ts +2 -2
- package/esm/util/onClickOutside.js +4 -1
- package/esm/util/onClickOutsideOnce.d.ts +4 -0
- package/esm/util/onClickOutsideOnce.js +14 -0
- package/esm/util/xmlToNode.d.ts +5 -0
- package/lib/common/autoParse.js +7 -1
- package/lib/createOfficeViewer.d.ts +1 -1
- package/lib/excel/edit/ui/CellEditor.d.ts +1 -0
- package/lib/excel/edit/ui/CellEditor.js +18 -5
- package/lib/excel/io/excel/util/Range.d.ts +1 -1
- package/lib/excel/render/autoFilter/AutoFilterIconUI.d.ts +2 -0
- package/lib/excel/render/autoFilter/AutoFilterIconUI.js +5 -1
- package/lib/excel/render/autoFilter/filterColumn/CustomFiltersUI.js +9 -3
- package/lib/excel/render/autoFilter/sortState/getColumnSortOrder.d.ts +1 -1
- package/lib/excel/render/cell/drawCells.js +1 -1
- package/lib/excel/render/cell/frozen/drawFrozen.d.ts +1 -1
- package/lib/excel/render/cell/frozen/getFrozenLeftViewPointRange.d.ts +1 -1
- package/lib/excel/render/cell/frozen/getFrozenTopLeftViewPointRange.d.ts +1 -1
- package/lib/excel/render/cell/frozen/getFrozenTopViewPointRange.d.ts +1 -1
- package/lib/excel/render/dnd/DragState.d.ts +1 -1
- package/lib/excel/render/dnd/mousedownColHeader.d.ts +1 -1
- package/lib/excel/render/dnd/mousedownRowHeader.d.ts +1 -1
- package/lib/excel/render/drawing/drawDrawing.d.ts +1 -1
- package/lib/excel/render/drawing/findPositionInViewRange.d.ts +1 -1
- package/lib/excel/render/drawing/getRectFromAnchorPoint.d.ts +1 -1
- package/lib/excel/render/formulaBar/FormulaBar.js +7 -3
- package/lib/excel/render/grid/drawGridLines.d.ts +1 -1
- package/lib/excel/render/header/drawRowColHeaders.d.ts +1 -1
- package/lib/excel/render/header/drawRowColHeaders.js +3 -0
- package/lib/excel/render/selection/SheetSelection.d.ts +1 -1
- package/lib/excel/render/selection/binarySearchSize.d.ts +1 -1
- package/lib/excel/render/selection/findCell.d.ts +1 -1
- package/lib/excel/render/selection/findInViewRange.d.ts +1 -1
- package/lib/excel/render/selection/findInViewRangeX.d.ts +1 -1
- package/lib/excel/render/selection/findInViewRangeY.d.ts +1 -1
- package/lib/excel/render/selection/getCellPosition.d.ts +1 -1
- package/lib/excel/render/selection/getRangePosition.d.ts +1 -1
- package/lib/excel/render/selection/hitTest.d.ts +1 -1
- package/lib/excel/render/selection/hitTestInRange.d.ts +1 -1
- package/lib/excel/render/sparkline/drawSparkline.d.ts +1 -1
- package/lib/excel/render/ui/CheckBoxList.js +6 -2
- package/lib/excel/render/ui/Input.d.ts +9 -1
- package/lib/excel/render/ui/Input.js +15 -11
- package/lib/excel/types/worksheet/CellData.js +10 -0
- package/lib/util/__tests__/replaceVar.test.d.ts +1 -1
- package/lib/util/__tests__/xmlToNode.test.d.ts +1 -0
- package/lib/util/onClickOutside.d.ts +2 -2
- package/lib/util/onClickOutside.js +4 -1
- package/lib/util/onClickOutsideOnce.d.ts +4 -0
- package/lib/util/onClickOutsideOnce.js +18 -0
- package/lib/util/xmlToNode.d.ts +5 -0
- package/package.json +4 -2
- package/esm/util/runWorker.d.ts +0 -6
- package/lib/util/runWorker.d.ts +0 -6
|
@@ -19,6 +19,7 @@ export declare class AutoFilterIconUI {
|
|
|
19
19
|
rangeRef: RangeRef;
|
|
20
20
|
colIndex: number;
|
|
21
21
|
autoFilter: CT_AutoFilter;
|
|
22
|
+
removeClickOutsideEvent: () => void;
|
|
22
23
|
constructor(sheet: Sheet, dataContainer: HTMLElement, autoFilter: CT_AutoFilter, rangeRef: RangeRef, colIndex: number, fid: string, headerRowCount?: number);
|
|
23
24
|
/**
|
|
24
25
|
* 更新过滤图标
|
|
@@ -30,4 +31,5 @@ export declare class AutoFilterIconUI {
|
|
|
30
31
|
showMenu(): void;
|
|
31
32
|
hideMenu(): void;
|
|
32
33
|
hide(): void;
|
|
34
|
+
destroy(): void;
|
|
33
35
|
}
|
|
@@ -33,7 +33,7 @@ var AutoFilterIconUI = /** @class */ (function () {
|
|
|
33
33
|
this.filterIcon = filterIcon;
|
|
34
34
|
this.filterMenu = new AutoFilterMenuUI.AutoFilterMenuUI(this, filterIconContainer, sheet, autoFilter, rangeRef, colIndex, headerRowCount);
|
|
35
35
|
filterIcon.addEventListener('click', this.handleClick.bind(this));
|
|
36
|
-
onClickOutside.onClickOutside(filterIconContainer, function () {
|
|
36
|
+
this.removeClickOutsideEvent = onClickOutside.onClickOutside(filterIconContainer, function () {
|
|
37
37
|
_this.hideMenu();
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -83,6 +83,10 @@ var AutoFilterIconUI = /** @class */ (function () {
|
|
|
83
83
|
AutoFilterIconUI.prototype.hide = function () {
|
|
84
84
|
this.filterIconContainer.style.display = 'none';
|
|
85
85
|
};
|
|
86
|
+
AutoFilterIconUI.prototype.destroy = function () {
|
|
87
|
+
this.filterIconContainer.remove();
|
|
88
|
+
this.removeClickOutsideEvent();
|
|
89
|
+
};
|
|
86
90
|
return AutoFilterIconUI;
|
|
87
91
|
}());
|
|
88
92
|
|
|
@@ -120,9 +120,15 @@ var CustomFiltersUI = /** @class */ (function () {
|
|
|
120
120
|
var select = new Select.Select(customFilterItemInput, this.operatorOptions, toOperatorUI.toOperatorUI(operator, value), function () {
|
|
121
121
|
_this.syncCustomFilters();
|
|
122
122
|
});
|
|
123
|
-
var input = new Input.Input(
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
var input = new Input.Input({
|
|
124
|
+
container: customFilterItemInput,
|
|
125
|
+
value: value,
|
|
126
|
+
onChange: function () {
|
|
127
|
+
_this.syncCustomFilters();
|
|
128
|
+
},
|
|
129
|
+
style: 'normal',
|
|
130
|
+
options: this.texts
|
|
131
|
+
});
|
|
126
132
|
this.customFilterItems.push({ input: input, select: select });
|
|
127
133
|
};
|
|
128
134
|
/**
|
|
@@ -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): "desc" | "none" | "asc";
|
|
@@ -20,7 +20,7 @@ function drawCells(excelRender, currentSheet, excelRenderOptions, canvas, displa
|
|
|
20
20
|
}
|
|
21
21
|
var cellInfo = currentSheet.getCellInfo(row, col);
|
|
22
22
|
if (cellInfo) {
|
|
23
|
-
cellInfoMap.set("".concat(row, ",").concat(col), tslib.__assign(tslib.__assign({}, cellInfo), { width: width, height: height }));
|
|
23
|
+
cellInfoMap.set("".concat(row, ",").concat(col), tslib.__assign(tslib.__assign({}, JSON.parse(JSON.stringify(cellInfo))), { width: width, height: height }));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ExcelRenderOptions } from '../../../sheet/ExcelRenderOptions';
|
|
2
2
|
import { Sheet } from '../../../sheet/Sheet';
|
|
3
3
|
import { SheetCanvas } from '../../SheetCanvas';
|
|
4
|
-
import { ViewRange } from 'src/excel/sheet/ViewRange';
|
|
5
4
|
import { IDataProvider } from '../../../types/IDataProvider';
|
|
6
5
|
import { LinkPosition } from '../LinkPosition';
|
|
7
6
|
import { ExcelRender } from '../../ExcelRender';
|
|
7
|
+
import { ViewRange } from '../../../sheet/ViewRange';
|
|
8
8
|
export type FrozenViewRange = {
|
|
9
9
|
topViewRange: ViewRange | null;
|
|
10
10
|
leftViewRange: ViewRange | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Workbook } from '../../Workbook';
|
|
2
|
-
import { Region } from '
|
|
2
|
+
import { Region } from '../../sheet/ViewRange';
|
|
3
3
|
import { SheetSelection } from '../selection/SheetSelection';
|
|
4
4
|
import { HitTestResult } from '../selection/hitTest';
|
|
5
5
|
export interface DragState {
|
|
@@ -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: "drawing" | "corner" | "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: "
|
|
13
|
+
selectType: "drawing" | "corner" | "cell" | "row-header" | "col-header" | "row-grid" | "col-grid";
|
|
14
14
|
activeCell: RangeRef;
|
|
15
15
|
sheetIndex: number;
|
|
16
16
|
cellRanges: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Sheet } from '../../sheet/Sheet';
|
|
2
2
|
import { SheetCanvas } from '../SheetCanvas';
|
|
3
|
-
import { ViewRange } from 'src/excel/sheet/ViewRange';
|
|
4
3
|
import { ExcelRender } from '../ExcelRender';
|
|
4
|
+
import { ViewRange } from '../../sheet/ViewRange';
|
|
5
5
|
/**
|
|
6
6
|
* 绘制 sheet 里的图片及文本框
|
|
7
7
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CT_Marker } from '../../../openxml/ExcelTypes';
|
|
2
2
|
import { Sheet } from '../../sheet/Sheet';
|
|
3
|
-
import { ViewRange } from '
|
|
3
|
+
import { ViewRange } from '../../sheet/ViewRange';
|
|
4
4
|
export declare function getRectFromOneAnchorPoint(currentSheet: Sheet, cell: CT_Marker, viewRange: ViewRange): {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -39,9 +39,13 @@ var FormulaBar = /** @class */ (function () {
|
|
|
39
39
|
parent: this.dom
|
|
40
40
|
});
|
|
41
41
|
this.textBox = textBox;
|
|
42
|
-
var textInput = new Input.Input(
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
var textInput = new Input.Input({
|
|
43
|
+
container: textBox,
|
|
44
|
+
onChange: function (value) {
|
|
45
|
+
_this.changeCellValue(value);
|
|
46
|
+
},
|
|
47
|
+
style: 'borderLess'
|
|
48
|
+
});
|
|
45
49
|
this.textInput = textInput;
|
|
46
50
|
};
|
|
47
51
|
FormulaBar.prototype.getActiveCell = function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridLineOptions } from '../../sheet/ExcelRenderOptions';
|
|
2
2
|
import { Sheet } from '../../sheet/Sheet';
|
|
3
|
-
import { ViewRange } from '
|
|
3
|
+
import { ViewRange } from '../../sheet/ViewRange';
|
|
4
4
|
import { SheetCanvas, Line } from '../SheetCanvas';
|
|
5
5
|
/**
|
|
6
6
|
* 生成网格线
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcelRenderOptions } from '../../sheet/ExcelRenderOptions';
|
|
2
2
|
import { Sheet } from '../../sheet/Sheet';
|
|
3
|
-
import { ViewRange } from '
|
|
3
|
+
import { ViewRange } from '../../sheet/ViewRange';
|
|
4
4
|
import { FontSize } from '../../types/FontSize';
|
|
5
5
|
import { FontStyle } from '../../types/FontStyle';
|
|
6
6
|
import { SheetCanvas } from '../SheetCanvas';
|
|
@@ -11,6 +11,9 @@ var genFontStr = require('../cell/genFontStr.js');
|
|
|
11
11
|
*/
|
|
12
12
|
function drawRowColHeaders(currentSheet, viewRange, sheetCanvas, renderOptions, defaultFontSize, defaultFontStyle) {
|
|
13
13
|
var e_1, _a, e_2, _b;
|
|
14
|
+
if (currentSheet.showRowColHeaders() === false) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
14
17
|
var rows = viewRange.rows, startRowOffset = viewRange.startRowOffset, height = viewRange.height, width = viewRange.width, cols = viewRange.cols, startColOffset = viewRange.startColOffset;
|
|
15
18
|
var _c = currentSheet.getRowColSize(), rowHeaderWidth = _c.rowHeaderWidth, colHeaderHeight = _c.colHeaderHeight;
|
|
16
19
|
var gridLineColor = renderOptions.gridLineColor, rowColHeadersBgColor = renderOptions.rowColHeadersBackgroundColor, hiddenRowColHeadersLineColor = renderOptions.hiddenRowColHeadersLineColor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Region, ViewRange } from 'src/excel/sheet/ViewRange';
|
|
2
1
|
import { RangeRef } from '../../types/RangeRef';
|
|
3
2
|
import { FrozenViewRange } from '../cell/frozen/drawFrozen';
|
|
4
3
|
import { Position } from './Position';
|
|
5
4
|
import { IAbsoluteAnchor, IOneCellAnchor, ITwoCellAnchor } from '../../types/IDrawing';
|
|
5
|
+
import { Region, ViewRange } from '../../sheet/ViewRange';
|
|
6
6
|
export type HitTestCommon = Position & RangeRef;
|
|
7
7
|
/**
|
|
8
8
|
* 点击到表头的最左上角
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* 绘制 sparkline
|
|
3
3
|
*/
|
|
4
4
|
import { Sheet } from '../../sheet/Sheet';
|
|
5
|
-
import { ViewRange } from 'src/excel/sheet/ViewRange';
|
|
6
5
|
import { SheetCanvas } from '../SheetCanvas';
|
|
6
|
+
import { ViewRange } from '../../sheet/ViewRange';
|
|
7
7
|
export declare function drawSparkline(currentSheet: Sheet, viewRange: ViewRange, canvas: SheetCanvas): void;
|
|
@@ -21,8 +21,12 @@ var CheckBoxList = /** @class */ (function () {
|
|
|
21
21
|
className: 'excel-checkbox-list-wrapper',
|
|
22
22
|
parent: container
|
|
23
23
|
});
|
|
24
|
-
var searchInput = new Input.Input(
|
|
25
|
-
|
|
24
|
+
var searchInput = new Input.Input({
|
|
25
|
+
container: wrapper,
|
|
26
|
+
placeholder: searchPlaceholder,
|
|
27
|
+
onChange: function (text) {
|
|
28
|
+
_this.handleSearch(text);
|
|
29
|
+
}
|
|
26
30
|
});
|
|
27
31
|
this.searchInput = searchInput;
|
|
28
32
|
var listContainer = H.H('div', {
|
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare class Input {
|
|
5
5
|
input: HTMLInputElement;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(args: {
|
|
7
|
+
container: HTMLElement;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
onEnter?: (value: string) => void;
|
|
12
|
+
style?: 'normal' | 'borderLess';
|
|
13
|
+
options?: string[];
|
|
14
|
+
});
|
|
7
15
|
getElement(): HTMLInputElement;
|
|
8
16
|
getValue(): string;
|
|
9
17
|
setValue(text: string): void;
|
|
@@ -7,26 +7,30 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
*/
|
|
8
8
|
var inputId = 0;
|
|
9
9
|
var Input = /** @class */ (function () {
|
|
10
|
-
function Input(
|
|
11
|
-
if (style === void 0) { style = 'normal'; }
|
|
12
|
-
if (options === void 0) { options = []; }
|
|
10
|
+
function Input(args) {
|
|
13
11
|
var _this = this;
|
|
14
12
|
this.input = document.createElement('input');
|
|
15
|
-
this.input.value = value;
|
|
16
|
-
this.input.placeholder = placeholder;
|
|
17
|
-
container.appendChild(this.input);
|
|
13
|
+
this.input.value = args.value || '';
|
|
14
|
+
this.input.placeholder = args.placeholder || '';
|
|
15
|
+
args.container.appendChild(this.input);
|
|
18
16
|
this.input.className = 'excel-input';
|
|
19
|
-
if (style === 'borderLess') {
|
|
17
|
+
if (args.style === 'borderLess') {
|
|
20
18
|
this.input.classList.add('excel-input-border-less');
|
|
21
19
|
}
|
|
22
20
|
this.input.oninput = function () {
|
|
23
|
-
onChange(_this.input.value);
|
|
21
|
+
args.onChange(_this.input.value);
|
|
24
22
|
};
|
|
25
|
-
|
|
23
|
+
this.input.onkeydown = function (e) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (e.key === 'Enter') {
|
|
26
|
+
(_a = args.onEnter) === null || _a === void 0 ? void 0 : _a.call(args, _this.input.value);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
if (args.options && args.options.length) {
|
|
26
30
|
var datalist_1 = document.createElement('datalist');
|
|
27
31
|
datalist_1.id = "".concat(inputId++, "-list");
|
|
28
|
-
container.appendChild(datalist_1);
|
|
29
|
-
options.forEach(function (option) {
|
|
32
|
+
args.container.appendChild(datalist_1);
|
|
33
|
+
args.options.forEach(function (option) {
|
|
30
34
|
var optionElement = document.createElement('option');
|
|
31
35
|
optionElement.value = option;
|
|
32
36
|
datalist_1.appendChild(optionElement);
|
|
@@ -33,6 +33,16 @@ function updateValue(value, cellData) {
|
|
|
33
33
|
if (typeof cellData === 'string') {
|
|
34
34
|
return value;
|
|
35
35
|
}
|
|
36
|
+
if ('type' in cellData && cellData.type === 'blank') {
|
|
37
|
+
if (cellData.s !== undefined) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'style',
|
|
40
|
+
value: value,
|
|
41
|
+
s: cellData.s
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
36
46
|
if ('value' in cellData) {
|
|
37
47
|
return tslib.__assign(tslib.__assign({}, cellData), { value: value });
|
|
38
48
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Word from '../../
|
|
1
|
+
import { Word } from '../../index';
|
|
2
2
|
export declare function createWord(fileName: string, data: any): Word;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* 点击元素外部时触发回调,用于一直存在的对象,需要手动调用删除监听器
|
|
7
7
|
*/
|
|
8
8
|
function onClickOutside(element, onClickOutside) {
|
|
9
9
|
var outsideClickListener = function (event) {
|
|
@@ -12,6 +12,9 @@ function onClickOutside(element, onClickOutside) {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
document.addEventListener('mousedown', outsideClickListener);
|
|
15
|
+
return function () {
|
|
16
|
+
document.removeEventListener('mousedown', outsideClickListener);
|
|
17
|
+
};
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
exports.onClickOutside = onClickOutside;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 点击元素外部时触发回调,只触发一次,用于临时对象
|
|
7
|
+
*/
|
|
8
|
+
function onClickOutsideOnce(element, onClickOutside) {
|
|
9
|
+
var outsideClickListener = function (event) {
|
|
10
|
+
if (event.target instanceof Node && !element.contains(event.target)) {
|
|
11
|
+
onClickOutside();
|
|
12
|
+
document.removeEventListener('mousedown', outsideClickListener);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
document.addEventListener('mousedown', outsideClickListener);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.onClickOutsideOnce = onClickOutsideOnce;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "office-viewer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "office 文档在线预览",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"genPresetIcons": "cd tools && ts-node --transpileOnly genPresetIcons.ts",
|
|
28
28
|
"genIcons": "ts-node --transpileOnly tools/genIcons.ts",
|
|
29
29
|
"emptyExcel": "ts-node --transpileOnly tools/convertFileToBase64.ts src/excel/io/csv/empty.xlsx src/excel/io/csv/emptyXLSX.ts",
|
|
30
|
-
"genExampleFileList": "ts-node --transpileOnly tools/genExampleFileList.ts"
|
|
30
|
+
"genExampleFileList": "ts-node --transpileOnly tools/genExampleFileList.ts",
|
|
31
|
+
"typecheck": "tsc --noEmit"
|
|
31
32
|
},
|
|
32
33
|
"exports": {
|
|
33
34
|
".": {
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"tslib": "^2.3.1"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
68
|
+
"@happy-dom/global-registrator": "^14.2.0",
|
|
67
69
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
68
70
|
"@rollup/plugin-json": "^4.1.0",
|
|
69
71
|
"@rollup/plugin-node-resolve": "^14.1.0",
|
package/esm/util/runWorker.d.ts
DELETED