Skip to content

Commit 20f208a

Browse files
committed
*.d.ts
1 parent 4c60e61 commit 20f208a

28 files changed

+385
-8
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
88
## Install
99
```shell
10-
npm install ts-loader -S
11-
npm install spreadsheet -S
10+
npm install typescript --save-dev
11+
npm install awesome-typescript-loader --save-dev
12+
npm install xspreadsheet --save-dev
1213
```
1314

1415
## Quick Start
+50
Loading

dist/core/alphabet.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export declare function alphabet(index: number): string;
2+
export declare function alphabetIndex(key: string): number;

dist/core/cell.d.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export interface Cell {
2+
font?: string;
3+
format?: string;
4+
fontSize?: number;
5+
bold?: boolean;
6+
italic?: boolean;
7+
underline?: boolean;
8+
color?: string;
9+
backgroundColor?: string;
10+
align?: string;
11+
valign?: string;
12+
wordWrap?: boolean;
13+
visable?: boolean;
14+
rowspan?: number;
15+
colspan?: number;
16+
text?: string;
17+
merge?: [number, number];
18+
[key: string]: any;
19+
}
20+
export declare const defaultCell: Cell;
21+
export declare function getStyleFromCell(cell: Cell | null): {
22+
[key: string]: string;
23+
};

dist/core/font.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface Font {
2+
key: string;
3+
title: string;
4+
}
5+
export declare const fonts: Array<Font>;

dist/core/format.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface Format {
2+
key: string;
3+
title: string;
4+
label?: string;
5+
render(txt: string): string;
6+
}
7+
export declare const formatRenderHtml: (key: string | undefined, txt: string | undefined) => string;
8+
export declare const formats: Array<Format>;

dist/core/formula.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface Formula {
2+
key: string;
3+
title: string;
4+
render(ary: Array<number>): number;
5+
}
6+
export declare const formulaFilterKey: (v: string, filter: (formula: Formula, param: string) => string) => string;
7+
export declare const formulaRender: (v: string, renderCell: (rindex: number, cindex: number) => any) => string;
8+
export declare const formulaReplaceParam: (param: string, rowDiff: number, colDiff: number) => string;
9+
export declare const formulas: Array<Formula>;

dist/core/select.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export declare class Select {
2+
start: [number, number];
3+
stop: [number, number];
4+
canMerge: boolean;
5+
constructor(start: [number, number], stop: [number, number], canMerge: boolean);
6+
forEach(cb: (r: number, c: number, rindex: number, cindex: number, rowspan: number, colspan: number) => void): void;
7+
rowIndex(index: number): number;
8+
colIndex(index: number): number;
9+
rowLen(): number;
10+
colLen(): number;
11+
cellLen(): number;
12+
}

dist/local/base/colorPanel.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Element } from "./element";
2+
export declare class ColorPanel extends Element {
3+
constructor(click: (color: string) => void);
4+
}
5+
export declare function buildColorPanel(click: (color: string) => void): ColorPanel;

dist/local/base/dropdown.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Element } from "./element";
2+
export declare class Dropdown extends Element {
3+
content: Element;
4+
title: Element;
5+
constructor(title: string | Element, width: string, contentChildren: Element[]);
6+
documentHandler(e: any): false | undefined;
7+
toggleHandler(evt: Event): void;
8+
}
9+
export declare function buildDropdown(title: string | Element, width: string, contentChildren: Element[]): Dropdown;

dist/local/base/element.d.ts

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export declare class Element {
2+
tag: string;
3+
el: HTMLElement;
4+
_data: {
5+
[key: string]: any;
6+
};
7+
constructor(tag?: string);
8+
data(key: string, value?: any): any;
9+
on(eventName: string, handler: (evt: any) => any): Element;
10+
class(name: string): Element;
11+
attrs(map?: {
12+
[key: string]: string;
13+
}): Element;
14+
attr(attr: string, value?: any): any;
15+
removeAttr(attr: string): Element;
16+
offset(): any;
17+
clearStyle(): this;
18+
styles(map?: {
19+
[key: string]: string;
20+
}, isClear?: boolean): Element;
21+
style(key: string, value?: any): any;
22+
removeStyle(key: string): void;
23+
children(cs: Array<HTMLElement | string | Element>): Element;
24+
child(c: HTMLElement | string | Element): Element;
25+
html(html?: string): string | this;
26+
val(v?: string): any;
27+
clone(): any;
28+
isHide(): boolean;
29+
toggle(): void;
30+
disabled(): Element;
31+
able(): Element;
32+
active(flag?: boolean): Element;
33+
deactive(): Element;
34+
isActive(): boolean;
35+
addClass(cls: string): Element;
36+
removeClass(cls: string): this;
37+
hasClass(cls: string): boolean;
38+
show(isRemove?: boolean): Element;
39+
hide(): Element;
40+
}
41+
export declare function h(tag?: string): Element;

dist/local/base/icon.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Element } from "./element";
2+
export declare class Icon extends Element {
3+
img: Element;
4+
constructor(name: string);
5+
replace(name: string): void;
6+
}
7+
export declare function buildIcon(name: string): Icon;

dist/local/base/item.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Element } from "./element";
2+
import { Icon } from "./icon";
3+
export declare class Item extends Element {
4+
iconEl: Icon | null;
5+
static build(): Item;
6+
constructor();
7+
icon(name: string): this;
8+
replaceIcon(name: string): void;
9+
}
10+
export declare function buildItem(): Item;

dist/local/base/menu.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Element } from "./element";
2+
export declare class Menu extends Element {
3+
constructor(align?: string);
4+
}
5+
export declare function buildMenu(align?: string): Menu;

dist/local/editor.d.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Element } from "./base/element";
2+
import { Cell } from "../core/cell";
3+
export declare class Editor {
4+
defaultRowHeight: number;
5+
el: Element;
6+
target: HTMLElement | null;
7+
value: Cell | null;
8+
editor: Element;
9+
textarea: Element;
10+
textline: Element;
11+
change: (v: Cell) => void;
12+
constructor(defaultRowHeight: number);
13+
onChange(change: (v: Cell) => void): void;
14+
set(target: HTMLElement, value: Cell | null): void;
15+
setValue(value: Cell | null): string;
16+
setStyle(value: Cell | null): void;
17+
clear(): void;
18+
private inputChange(evt);
19+
reload(): void;
20+
}

dist/local/editorbar.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Element } from "./base/element";
2+
import { Cell } from "../core/cell";
3+
export declare class Editorbar {
4+
el: Element;
5+
value: Cell | null;
6+
textarea: Element;
7+
label: Element;
8+
change: (v: Cell) => void;
9+
constructor();
10+
set(title: string, value: Cell | null): void;
11+
setValue(value: Cell | null): void;
12+
input(evt: any): void;
13+
}

dist/local/event.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export declare function bind<T extends Event>(name: string, fn: (evt: T) => void, target?: any): void;
2+
export declare function unbind<T extends Event>(name: string, fn: (evt: T) => void, target?: any): void;
3+
export declare function mouseMoveUp<T extends Event>(movefunc: (evt: T) => void, upfunc: (evt: T) => void): void;

dist/local/index.d.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Spreadsheet, SpreadsheetOptions } from '../core/index';
2+
import '../style/index.less';
3+
import { Table } from './table';
4+
import { Toolbar } from './toolbar';
5+
import { Editorbar } from './editorbar';
6+
export interface Options {
7+
d?: SpreadsheetOptions;
8+
bodyHeight?: () => number;
9+
}
10+
export declare class LocalSpreadsheet {
11+
el: HTMLElement;
12+
ss: Spreadsheet;
13+
refs: {
14+
[key: string]: HTMLElement;
15+
};
16+
table: Table;
17+
toolbar: Toolbar;
18+
editorbar: Editorbar;
19+
constructor(el: HTMLElement, options?: Options);
20+
private render();
21+
private toolbarChange(k, v);
22+
private editorbarChange(v);
23+
private editorChange(v);
24+
private clickCell(rindex, cindex, v);
25+
}

dist/local/resizer.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Element } from "./base/element";
2+
export declare class Resizer {
3+
vertical: boolean;
4+
change: (index: number, distance: number) => void;
5+
el: Element;
6+
resizer: Element;
7+
resizerLine: Element;
8+
moving: boolean;
9+
index: number;
10+
constructor(vertical: boolean, change: (index: number, distance: number) => void);
11+
set(target: any, index: number): void;
12+
mousedown(evt: any): void;
13+
}

dist/local/selector.d.ts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Element } from "./base/element";
2+
import { Spreadsheet } from "../core/index";
3+
import { Table } from './table';
4+
export declare class Selector {
5+
ss: Spreadsheet;
6+
table: Table;
7+
topEl: Element;
8+
rightEl: Element;
9+
bottomEl: Element;
10+
leftEl: Element;
11+
areaEl: Element;
12+
cornerEl: Element;
13+
copyEl: Element;
14+
el: Element;
15+
_offset: {
16+
left: number;
17+
top: number;
18+
width: number;
19+
height: number;
20+
};
21+
startTarget: any;
22+
endTarget: any;
23+
change: () => void;
24+
changeCopy: (evt: any, arrow: 'bottom' | 'top' | 'left' | 'right', startRow: number, startCol: number, stopRow: number, stopCol: number) => void;
25+
constructor(ss: Spreadsheet, table: Table);
26+
mousedown(evt: any): void;
27+
private keydown(evt);
28+
private cornerMousedown(evt);
29+
reload(): void;
30+
private setOffset();
31+
private rowsHeight(minRow, maxRow, cb?);
32+
private colsWidth(minCol, maxCol, cb?);
33+
}
34+
export declare class DashedSelector {
35+
el: Element;
36+
constructor();
37+
set(selector: Selector): void;
38+
hide(): void;
39+
}

dist/local/toolbar.d.ts

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { Element } from "./base/element";
2+
import { Spreadsheet } from "../core/index";
3+
import { Cell } from '../core/cell';
4+
import { Dropdown } from './base/dropdown';
5+
export declare class Toolbar {
6+
ss: Spreadsheet;
7+
el: Element;
8+
defaultCell: Cell;
9+
target: Element | null;
10+
currentCell: Cell | null;
11+
elUndo: Element;
12+
elRedo: Element;
13+
elPaintformat: Element;
14+
elClearformat: Element;
15+
elFormat: Dropdown;
16+
elFont: Dropdown;
17+
elFontSize: Dropdown;
18+
elFontWeight: Element;
19+
elFontStyle: Element;
20+
elTextDecoration: Element;
21+
elColor: Dropdown;
22+
elBackgroundColor: Dropdown;
23+
elMerge: Element;
24+
elAlign: Dropdown;
25+
elValign: Dropdown;
26+
elWordWrap: Element;
27+
change: (key: keyof Cell, v: any) => void;
28+
redo: () => boolean;
29+
undo: () => boolean;
30+
constructor(ss: Spreadsheet);
31+
set(target: Element, cell: Cell | null): void;
32+
private setCell(cell);
33+
private setCellStyle();
34+
setRedoAble(flag: boolean): void;
35+
setUndoAble(flag: boolean): void;
36+
private buildSeparator();
37+
private buildAligns();
38+
private buildValigns();
39+
private buildWordWrap();
40+
private buildFontWeight();
41+
private buildFontStyle();
42+
private buildTextDecoration();
43+
private buildMerge();
44+
private buildColor();
45+
private buildBackgroundColor();
46+
private buildUndo();
47+
private buildRedo();
48+
private buildPaintformat();
49+
private buildClearformat();
50+
private buildFormats();
51+
private buildFonts();
52+
private buildFontSizes();
53+
}

dist/main.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { LocalSpreadsheet, Options } from './local/index';
2+
export default function spreadsheet(el: HTMLElement, options: Options): LocalSpreadsheet;
3+
declare global {
4+
interface Window {
5+
spreadsheet: any;
6+
}
7+
}

dist/xspreadsheet.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/xspreadsheet.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)