@gridsheet/preact-core 2.0.0-rc.0
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/dist/components/Cell.d.ts +9 -0
- package/dist/components/ContextMenu.d.ts +20 -0
- package/dist/components/Editor.d.ts +10 -0
- package/dist/components/Emitter.d.ts +9 -0
- package/dist/components/Fixed.d.ts +10 -0
- package/dist/components/FormulaBar.d.ts +2 -0
- package/dist/components/GridSheet.d.ts +3 -0
- package/dist/components/HeaderCellLeft.d.ts +7 -0
- package/dist/components/HeaderCellTop.d.ts +7 -0
- package/dist/components/PluginBase.d.ts +21 -0
- package/dist/components/Resizer.d.ts +2 -0
- package/dist/components/ScrollHandle.d.ts +9 -0
- package/dist/components/SearchBar.d.ts +2 -0
- package/dist/components/StoreObserver.d.ts +8 -0
- package/dist/components/Tabular.d.ts +8 -0
- package/dist/components/hooks.d.ts +10 -0
- package/dist/components/svg/AddIcon.d.ts +3 -0
- package/dist/components/svg/Base.d.ts +12 -0
- package/dist/components/svg/CloseIcon.d.ts +3 -0
- package/dist/components/svg/SearchIcon.d.ts +3 -0
- package/dist/constants.d.ts +21 -0
- package/dist/formula/evaluator.d.ts +120 -0
- package/dist/formula/functions/__base.d.ts +26 -0
- package/dist/formula/functions/__utils.d.ts +12 -0
- package/dist/formula/functions/abs.d.ts +12 -0
- package/dist/formula/functions/acos.d.ts +12 -0
- package/dist/formula/functions/add.d.ts +13 -0
- package/dist/formula/functions/and.d.ts +19 -0
- package/dist/formula/functions/asin.d.ts +12 -0
- package/dist/formula/functions/atan.d.ts +12 -0
- package/dist/formula/functions/atan2.d.ts +12 -0
- package/dist/formula/functions/average.d.ts +19 -0
- package/dist/formula/functions/col.d.ts +13 -0
- package/dist/formula/functions/concat.d.ts +12 -0
- package/dist/formula/functions/concatenate.d.ts +19 -0
- package/dist/formula/functions/cos.d.ts +12 -0
- package/dist/formula/functions/count.d.ts +19 -0
- package/dist/formula/functions/counta.d.ts +19 -0
- package/dist/formula/functions/countif.d.ts +13 -0
- package/dist/formula/functions/divide.d.ts +12 -0
- package/dist/formula/functions/eq.d.ts +12 -0
- package/dist/formula/functions/exp.d.ts +12 -0
- package/dist/formula/functions/gt.d.ts +12 -0
- package/dist/formula/functions/gte.d.ts +12 -0
- package/dist/formula/functions/hlookup.d.ts +18 -0
- package/dist/formula/functions/if.d.ts +17 -0
- package/dist/formula/functions/iferror.d.ts +20 -0
- package/dist/formula/functions/len.d.ts +12 -0
- package/dist/formula/functions/lenb.d.ts +12 -0
- package/dist/formula/functions/ln.d.ts +12 -0
- package/dist/formula/functions/log.d.ts +12 -0
- package/dist/formula/functions/log10.d.ts +12 -0
- package/dist/formula/functions/lt.d.ts +12 -0
- package/dist/formula/functions/lte.d.ts +12 -0
- package/dist/formula/functions/max.d.ts +19 -0
- package/dist/formula/functions/min.d.ts +19 -0
- package/dist/formula/functions/minus.d.ts +13 -0
- package/dist/formula/functions/mod.d.ts +12 -0
- package/dist/formula/functions/multiply.d.ts +12 -0
- package/dist/formula/functions/ne.d.ts +12 -0
- package/dist/formula/functions/not.d.ts +12 -0
- package/dist/formula/functions/now.d.ts +9 -0
- package/dist/formula/functions/or.d.ts +19 -0
- package/dist/formula/functions/pi.d.ts +9 -0
- package/dist/formula/functions/power.d.ts +12 -0
- package/dist/formula/functions/product.d.ts +19 -0
- package/dist/formula/functions/radians.d.ts +12 -0
- package/dist/formula/functions/rand.d.ts +9 -0
- package/dist/formula/functions/round.d.ts +17 -0
- package/dist/formula/functions/rounddown.d.ts +17 -0
- package/dist/formula/functions/roundup.d.ts +17 -0
- package/dist/formula/functions/row.d.ts +13 -0
- package/dist/formula/functions/sin.d.ts +12 -0
- package/dist/formula/functions/sqrt.d.ts +12 -0
- package/dist/formula/functions/sum.d.ts +19 -0
- package/dist/formula/functions/sumif.d.ts +18 -0
- package/dist/formula/functions/tan.d.ts +12 -0
- package/dist/formula/functions/uminus.d.ts +12 -0
- package/dist/formula/functions/vlookup.d.ts +18 -0
- package/dist/formula/mapping.d.ts +3 -0
- package/dist/formula/solver.d.ts +16 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +7166 -0
- package/dist/lib/autofill.d.ts +17 -0
- package/dist/lib/clipboard.d.ts +3 -0
- package/dist/lib/converters.d.ts +10 -0
- package/dist/lib/events.d.ts +6 -0
- package/dist/lib/hub.d.ts +39 -0
- package/dist/lib/input.d.ts +15 -0
- package/dist/lib/operation.d.ts +27 -0
- package/dist/lib/palette.d.ts +2 -0
- package/dist/lib/paste.d.ts +4 -0
- package/dist/lib/sheet.d.ts +3 -0
- package/dist/lib/structs.d.ts +64 -0
- package/dist/lib/table.d.ts +388 -0
- package/dist/lib/time.d.ts +24 -0
- package/dist/lib/virtualization.d.ts +22 -0
- package/dist/parsers/core.d.ts +36 -0
- package/dist/policy/core.d.ts +47 -0
- package/dist/renderers/checkbox.d.ts +5 -0
- package/dist/renderers/core.d.ts +62 -0
- package/dist/renderers/thousand_separator.d.ts +4 -0
- package/dist/store/actions.d.ts +194 -0
- package/dist/store/dispatchers.d.ts +13 -0
- package/dist/store/helpers.d.ts +31 -0
- package/dist/store/index.d.ts +10 -0
- package/dist/styles/embedder.d.ts +2 -0
- package/dist/styles/minified.d.ts +3 -0
- package/dist/types.d.ts +310 -0
- package/dist/utils.d.ts +2 -0
- package/exports.ts +35 -0
- package/index.ts +3 -0
- package/package.json +28 -0
- package/tsconfig.json +25 -0
- package/vite.config.js +37 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AreaType, PointType, StoreType } from '../types';
|
|
2
|
+
import { Table } from './table';
|
|
3
|
+
import { CSSProperties } from 'react';
|
|
4
|
+
export declare class Autofill {
|
|
5
|
+
private readonly src;
|
|
6
|
+
private readonly dst;
|
|
7
|
+
private readonly direction;
|
|
8
|
+
private readonly table;
|
|
9
|
+
constructor(store: StoreType, draggingTo: PointType);
|
|
10
|
+
get applied(): Table;
|
|
11
|
+
get wholeArea(): AreaType;
|
|
12
|
+
getCellStyle(target: PointType): CSSProperties;
|
|
13
|
+
private getDestinationArea;
|
|
14
|
+
private suggestDirection;
|
|
15
|
+
private getChangePatterns;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=autofill.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Address, ExtraPointType } from '../types';
|
|
2
|
+
export declare const x2c: (x: number) => string;
|
|
3
|
+
export declare const c2x: (col: string, absolute?: boolean) => number;
|
|
4
|
+
export declare const y2r: (y: number) => string;
|
|
5
|
+
export declare const r2y: (row: number | string, absolute?: boolean) => number;
|
|
6
|
+
export declare const p2a: ({ y, x, absX, absY }: ExtraPointType) => string;
|
|
7
|
+
export declare const a2p: (address: Address) => ExtraPointType;
|
|
8
|
+
export declare const grantAddressAbsolute: (address: Address, absCol: boolean, absRow: boolean) => string | undefined;
|
|
9
|
+
export declare const stripAddressAbsolute: (address: Address) => string;
|
|
10
|
+
//# sourceMappingURL=converters.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isTouching: (e: React.TouchEvent | React.MouseEvent) => boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Safely call preventDefault to avoid errors on touch events
|
|
4
|
+
*/
|
|
5
|
+
export declare const safePreventDefault: (e: React.MouseEvent | React.TouchEvent) => void;
|
|
6
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { HistoryType, RefPaletteType, SheetIdsByName, ContextsBySheetId, ZoneType, HubPatchType, CellsByIdType, Id } from '../types';
|
|
2
|
+
export type HubProps = {
|
|
3
|
+
historyLimit?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare class Hub {
|
|
6
|
+
sheetHead: number;
|
|
7
|
+
cellHead: number;
|
|
8
|
+
data: CellsByIdType;
|
|
9
|
+
sheetIdsByName: SheetIdsByName;
|
|
10
|
+
contextsBySheetId: ContextsBySheetId;
|
|
11
|
+
choosingSheetId: number;
|
|
12
|
+
choosingAddress: string;
|
|
13
|
+
editingSheetId: number;
|
|
14
|
+
editingAddress: string;
|
|
15
|
+
paletteBySheetName: {
|
|
16
|
+
[sheetName: string]: RefPaletteType;
|
|
17
|
+
};
|
|
18
|
+
lastFocused: HTMLTextAreaElement | null;
|
|
19
|
+
solvedCaches: Map<Id, any>;
|
|
20
|
+
copyingSheetId: number;
|
|
21
|
+
copyingZone: ZoneType;
|
|
22
|
+
cutting: boolean;
|
|
23
|
+
histories: HistoryType[];
|
|
24
|
+
historyIndex: number;
|
|
25
|
+
historyLimit: number;
|
|
26
|
+
lastHistory?: HistoryType;
|
|
27
|
+
currentHistory?: HistoryType;
|
|
28
|
+
ready: boolean;
|
|
29
|
+
reflect: (newHub?: HubPatchType) => void;
|
|
30
|
+
identifyFormula(): void;
|
|
31
|
+
constructor({ historyLimit }?: HubProps);
|
|
32
|
+
}
|
|
33
|
+
export declare const createHub: (historyLimit?: number) => Hub;
|
|
34
|
+
export type HubReactiveType = {
|
|
35
|
+
hub: Hub;
|
|
36
|
+
};
|
|
37
|
+
export declare const createHubReactive: (historyLimit?: number) => HubReactiveType;
|
|
38
|
+
export declare const useHubReactive: (historyLimit?: number) => HubReactiveType;
|
|
39
|
+
//# sourceMappingURL=hub.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PointType } from '../types';
|
|
2
|
+
import { Table } from './table';
|
|
3
|
+
export declare const insertTextAtCursor: (input: HTMLTextAreaElement, text: string) => void;
|
|
4
|
+
type InsertRefProps = {
|
|
5
|
+
input: HTMLTextAreaElement | null;
|
|
6
|
+
ref: string;
|
|
7
|
+
dryRun?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const insertRef: ({ input, ref, dryRun }: InsertRefProps) => boolean;
|
|
10
|
+
export declare const isRefInsertable: (input: HTMLTextAreaElement | null) => boolean;
|
|
11
|
+
export declare const expandInput: (input: HTMLTextAreaElement | null) => void;
|
|
12
|
+
export declare const resetInput: (input: HTMLTextAreaElement | null, table: Table, point: PointType) => void;
|
|
13
|
+
export declare const isFocus: (input: HTMLTextAreaElement | null) => boolean;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OperationType as operations } from '../types';
|
|
2
|
+
export declare const RemoveRows: operations;
|
|
3
|
+
export declare const RemoveCols: operations;
|
|
4
|
+
export declare const InsertRowsAbove: operations;
|
|
5
|
+
export declare const InsertRowsBelow: operations;
|
|
6
|
+
export declare const InsertColsLeft: operations;
|
|
7
|
+
export declare const InsertColsRight: operations;
|
|
8
|
+
export declare const MoveFrom: operations;
|
|
9
|
+
export declare const MoveTo: operations;
|
|
10
|
+
export declare const Write: operations;
|
|
11
|
+
export declare const Style: operations;
|
|
12
|
+
export declare const Copy: operations;
|
|
13
|
+
export declare const Resize: operations;
|
|
14
|
+
export declare const SetRenderer: operations;
|
|
15
|
+
export declare const SetParser: operations;
|
|
16
|
+
export declare const SetPolicy: operations;
|
|
17
|
+
export declare const NoOperation: operations;
|
|
18
|
+
export declare const Move: operations;
|
|
19
|
+
export declare const Update: operations;
|
|
20
|
+
export declare const InsertRows: operations;
|
|
21
|
+
export declare const InsertCols: operations;
|
|
22
|
+
export declare const Add: operations;
|
|
23
|
+
export declare const Delete: operations;
|
|
24
|
+
export declare const ReadOnly: operations;
|
|
25
|
+
export declare const hasOperation: (operation: operations | undefined, flag: operations) => boolean;
|
|
26
|
+
export declare const debugOperations: (prevention: operations | undefined) => string[];
|
|
27
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { MatrixType, AreaType, ZoneType, RangeType, PointType, Y, X, CellsByAddressType, ShapeType, MatricesByAddress, CellType, Address } from '../types';
|
|
2
|
+
export declare const slideArea: (area: AreaType, y: Y, x: X) => AreaType;
|
|
3
|
+
export declare const superposeArea: (srcArea: AreaType, dstArea: AreaType) => ShapeType;
|
|
4
|
+
export declare const concatAreas: (area1: AreaType, area2: AreaType) => AreaType;
|
|
5
|
+
export declare const zoneToArea: (zone: ZoneType) => AreaType;
|
|
6
|
+
export declare const areaToZone: (area: AreaType) => ZoneType;
|
|
7
|
+
export declare const areaToRange: (area: AreaType) => string;
|
|
8
|
+
export declare const between: (range: RangeType, index: number) => boolean;
|
|
9
|
+
export declare const among: (area: AreaType, point: PointType) => boolean;
|
|
10
|
+
type ShapeExtension = {
|
|
11
|
+
base?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const zoneShape: ({ base, ...zone }: ZoneType & ShapeExtension) => ShapeType;
|
|
14
|
+
export declare const areaShape: ({ base, ...area }: AreaType & ShapeExtension) => ShapeType;
|
|
15
|
+
export declare const matrixShape: ({ base, matrix }: {
|
|
16
|
+
matrix: MatrixType;
|
|
17
|
+
} & ShapeExtension) => ShapeType;
|
|
18
|
+
export declare const makeSequence: (start: number, stop: number, step?: number) => number[];
|
|
19
|
+
export declare const oa2aa: (oa: {
|
|
20
|
+
[s: string]: any;
|
|
21
|
+
}[], fields: string[]) => MatrixType;
|
|
22
|
+
export declare const aa2oa: (aa: MatrixType, fields: string[]) => {
|
|
23
|
+
[s: string]: any;
|
|
24
|
+
}[];
|
|
25
|
+
export declare const putMatrix: <T = any>(dst: T[][], src: T[][], dstArea: AreaType, filter?: (srcValue: T, dstValue: T) => boolean) => MatricesByAddress<T>;
|
|
26
|
+
export declare const createMatrix: <T = any>(numRows: number, numCols: number, fill?: T) => T[][];
|
|
27
|
+
export declare const cropMatrix: <T = any>(matrix: T[][], area: AreaType) => T[][];
|
|
28
|
+
export declare const buildInitialCellsOrigin: ({ cells, ensured, matrix, flattenAs, }: {
|
|
29
|
+
cells?: CellsByAddressType;
|
|
30
|
+
ensured?: {
|
|
31
|
+
numRows?: number;
|
|
32
|
+
numCols?: number;
|
|
33
|
+
};
|
|
34
|
+
flattenAs?: keyof CellType;
|
|
35
|
+
matrix?: MatrixType;
|
|
36
|
+
}) => CellsByAddressType;
|
|
37
|
+
export declare const buildInitialCells: ({ cells, ensured, matrices, flattenAs, }?: {
|
|
38
|
+
cells?: CellsByAddressType;
|
|
39
|
+
ensured?: {
|
|
40
|
+
numRows?: number;
|
|
41
|
+
numCols?: number;
|
|
42
|
+
};
|
|
43
|
+
flattenAs?: keyof CellType;
|
|
44
|
+
matrices?: MatricesByAddress<any>;
|
|
45
|
+
}) => CellsByAddressType;
|
|
46
|
+
export declare const upsert: <T>({ cells, matrices, flattenAs, }: {
|
|
47
|
+
cells?: CellsByAddressType;
|
|
48
|
+
flattenAs?: keyof CellType;
|
|
49
|
+
matrices?: MatricesByAddress<T>;
|
|
50
|
+
}) => CellsByAddressType;
|
|
51
|
+
export declare const getMaxSizesFromCells: (cells?: CellsByAddressType) => {
|
|
52
|
+
numRows: number;
|
|
53
|
+
numCols: number;
|
|
54
|
+
};
|
|
55
|
+
export declare const range: (start: number, end: number) => number[];
|
|
56
|
+
export declare const complementSelectingArea: (selectingArea: AreaType, choosing: PointType) => AreaType;
|
|
57
|
+
export declare const isSameArea: (area1: AreaType, area2: AreaType) => boolean;
|
|
58
|
+
export declare const expandRange: (range: string) => Address[];
|
|
59
|
+
export declare const restrictZone: (zone: ZoneType) => ZoneType;
|
|
60
|
+
export type BinarySearchPredicate = (mid: number) => boolean;
|
|
61
|
+
export declare const binarySearch: (low: number, high: number, predicate: BinarySearchPredicate, lessThan: boolean) => number;
|
|
62
|
+
export declare const moveKey: (obj: any, keyFrom: string, keyTo: string) => void;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=structs.d.ts.map
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { RendererCallProps } from '../renderers/core';
|
|
2
|
+
import { Id, AreaType, CellsByIdType, CellsByAddressType, PointType, Address, CellFilter, Labelers, MatrixType, CellType, Parsers, Renderers, HistoryType, StorePatchType, ShapeType, OperatorType, OperationType, Policies, RawCellType, ExtraPointType, StoreType } from '../types';
|
|
3
|
+
import { FunctionMapping } from '../formula/functions/__base';
|
|
4
|
+
import { Hub } from './hub';
|
|
5
|
+
import { PolicyType } from '../policy/core';
|
|
6
|
+
type Props = {
|
|
7
|
+
parsers?: Parsers;
|
|
8
|
+
renderers?: Renderers;
|
|
9
|
+
labelers?: Labelers;
|
|
10
|
+
policies?: Policies;
|
|
11
|
+
historyLimit?: number;
|
|
12
|
+
minNumRows?: number;
|
|
13
|
+
maxNumRows?: number;
|
|
14
|
+
minNumCols?: number;
|
|
15
|
+
maxNumCols?: number;
|
|
16
|
+
headerHeight?: number;
|
|
17
|
+
headerWidth?: number;
|
|
18
|
+
functions?: FunctionMapping;
|
|
19
|
+
sheetName?: string;
|
|
20
|
+
hub?: Hub;
|
|
21
|
+
};
|
|
22
|
+
type GetProps = {
|
|
23
|
+
evaluates?: boolean | null;
|
|
24
|
+
raise?: boolean;
|
|
25
|
+
filter?: CellFilter;
|
|
26
|
+
};
|
|
27
|
+
type MoveProps = {
|
|
28
|
+
srcTable?: UserTable;
|
|
29
|
+
src: AreaType;
|
|
30
|
+
dst: AreaType;
|
|
31
|
+
operator?: OperatorType;
|
|
32
|
+
undoReflection?: StorePatchType;
|
|
33
|
+
redoReflection?: StorePatchType;
|
|
34
|
+
historicize?: boolean;
|
|
35
|
+
};
|
|
36
|
+
type GetFieldProps = GetProps & {
|
|
37
|
+
key?: keyof CellType;
|
|
38
|
+
};
|
|
39
|
+
type GetPropsWithArea = GetProps & {
|
|
40
|
+
area?: AreaType;
|
|
41
|
+
};
|
|
42
|
+
type GetFieldPropsWithArea = GetFieldProps & {
|
|
43
|
+
area?: AreaType;
|
|
44
|
+
};
|
|
45
|
+
export interface UserTable {
|
|
46
|
+
changedAt: Date;
|
|
47
|
+
lastChangedAt?: Date;
|
|
48
|
+
top: number;
|
|
49
|
+
left: number;
|
|
50
|
+
bottom: number;
|
|
51
|
+
right: number;
|
|
52
|
+
minNumRows: number;
|
|
53
|
+
maxNumRows: number;
|
|
54
|
+
minNumCols: number;
|
|
55
|
+
maxNumCols: number;
|
|
56
|
+
totalWidth: number;
|
|
57
|
+
totalHeight: number;
|
|
58
|
+
headerWidth: number;
|
|
59
|
+
headerHeight: number;
|
|
60
|
+
currentHistory?: HistoryType;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the raw table object, which is used for internal operations.
|
|
63
|
+
* This is not intended for public use and may change in future versions.
|
|
64
|
+
*/
|
|
65
|
+
__raw__: Table;
|
|
66
|
+
getRectSize(area: AreaType): ShapeType;
|
|
67
|
+
getAddressById(id: Id, slideY: number, slideX: number): string | undefined;
|
|
68
|
+
getAddressesByIds(ids: CellsByIdType): CellsByAddressType;
|
|
69
|
+
getPointById(id: Id): PointType;
|
|
70
|
+
getByPoint(point: PointType): CellType | undefined;
|
|
71
|
+
getId(point: PointType): Id;
|
|
72
|
+
getById(id: Id): CellType | undefined;
|
|
73
|
+
getNumRows(base?: number): number;
|
|
74
|
+
getNumCols(base?: number): number;
|
|
75
|
+
getFieldMatrix(args?: GetFieldPropsWithArea): any[][];
|
|
76
|
+
getFieldObject(args?: GetFieldProps): CellsByAddressType;
|
|
77
|
+
getFieldRows(args?: GetFieldProps): CellsByAddressType[];
|
|
78
|
+
getFieldCols(args?: GetFieldProps): CellsByAddressType[];
|
|
79
|
+
getMatrix(args?: GetPropsWithArea): (CellType | null)[][];
|
|
80
|
+
getObject(args?: GetProps): CellsByAddressType;
|
|
81
|
+
getRows(args?: GetProps): CellsByAddressType[];
|
|
82
|
+
getCols(args?: GetProps): CellsByAddressType[];
|
|
83
|
+
getTableBySheetName(sheetName: string): UserTable;
|
|
84
|
+
getSheetId(): number;
|
|
85
|
+
getHistories(): HistoryType[];
|
|
86
|
+
move(args: MoveProps): UserTable;
|
|
87
|
+
copy(args: MoveProps & {
|
|
88
|
+
onlyValue?: boolean;
|
|
89
|
+
}): UserTable;
|
|
90
|
+
update(args: {
|
|
91
|
+
diff: CellsByAddressType;
|
|
92
|
+
partial?: boolean;
|
|
93
|
+
updateChangedAt?: boolean;
|
|
94
|
+
reflection?: StorePatchType;
|
|
95
|
+
}): UserTable;
|
|
96
|
+
writeMatrix(args: {
|
|
97
|
+
point: PointType;
|
|
98
|
+
matrix: MatrixType<string>;
|
|
99
|
+
updateChangedAt?: boolean;
|
|
100
|
+
reflection?: StorePatchType;
|
|
101
|
+
}): UserTable;
|
|
102
|
+
write(args: {
|
|
103
|
+
point: PointType;
|
|
104
|
+
value: string;
|
|
105
|
+
updateChangedAt?: boolean;
|
|
106
|
+
reflection?: StorePatchType;
|
|
107
|
+
}): UserTable;
|
|
108
|
+
insertRowsAndUpdate(args: {
|
|
109
|
+
y: number;
|
|
110
|
+
numRows: number;
|
|
111
|
+
baseY: number;
|
|
112
|
+
diff: CellsByAddressType;
|
|
113
|
+
partial?: boolean;
|
|
114
|
+
updateChangedAt?: boolean;
|
|
115
|
+
reflection?: StorePatchType;
|
|
116
|
+
}): UserTable;
|
|
117
|
+
insertRows(args: {
|
|
118
|
+
y: number;
|
|
119
|
+
numRows: number;
|
|
120
|
+
baseY: number;
|
|
121
|
+
reflection?: StorePatchType;
|
|
122
|
+
}): UserTable;
|
|
123
|
+
removeRows(args: {
|
|
124
|
+
y: number;
|
|
125
|
+
numRows: number;
|
|
126
|
+
reflection?: StorePatchType;
|
|
127
|
+
}): UserTable;
|
|
128
|
+
insertColsAndUpdate(args: {
|
|
129
|
+
x: number;
|
|
130
|
+
numCols: number;
|
|
131
|
+
baseX: number;
|
|
132
|
+
diff: CellsByAddressType;
|
|
133
|
+
partial?: boolean;
|
|
134
|
+
updateChangedAt?: boolean;
|
|
135
|
+
reflection?: StorePatchType;
|
|
136
|
+
}): UserTable;
|
|
137
|
+
insertCols(args: {
|
|
138
|
+
x: number;
|
|
139
|
+
numCols: number;
|
|
140
|
+
baseX: number;
|
|
141
|
+
reflection?: StorePatchType;
|
|
142
|
+
}): UserTable;
|
|
143
|
+
removeCols(args: {
|
|
144
|
+
x: number;
|
|
145
|
+
numCols: number;
|
|
146
|
+
reflection?: StorePatchType;
|
|
147
|
+
}): UserTable;
|
|
148
|
+
undo(): {
|
|
149
|
+
history: HistoryType | null;
|
|
150
|
+
newTable: UserTable;
|
|
151
|
+
};
|
|
152
|
+
redo(): {
|
|
153
|
+
history: HistoryType | null;
|
|
154
|
+
newTable: UserTable;
|
|
155
|
+
};
|
|
156
|
+
getHistories(): HistoryType[];
|
|
157
|
+
getHistoryIndex(): number;
|
|
158
|
+
getHistorySize(): number;
|
|
159
|
+
stringify(props: {
|
|
160
|
+
point: PointType;
|
|
161
|
+
cell?: CellType;
|
|
162
|
+
evaluates?: boolean;
|
|
163
|
+
}): string;
|
|
164
|
+
}
|
|
165
|
+
export declare class Table implements UserTable {
|
|
166
|
+
changedAt: Date;
|
|
167
|
+
lastChangedAt?: Date;
|
|
168
|
+
minNumRows: number;
|
|
169
|
+
maxNumRows: number;
|
|
170
|
+
minNumCols: number;
|
|
171
|
+
maxNumCols: number;
|
|
172
|
+
totalWidth: number;
|
|
173
|
+
totalHeight: number;
|
|
174
|
+
headerWidth: number;
|
|
175
|
+
headerHeight: number;
|
|
176
|
+
sheetId: number;
|
|
177
|
+
sheetName: string;
|
|
178
|
+
prevSheetName: string;
|
|
179
|
+
status: 0 | 1 | 2;
|
|
180
|
+
hub: Hub;
|
|
181
|
+
idsToBeAbsoluted: Id[];
|
|
182
|
+
private version;
|
|
183
|
+
private idMatrix;
|
|
184
|
+
private area;
|
|
185
|
+
private parsers;
|
|
186
|
+
private renderers;
|
|
187
|
+
private labelers;
|
|
188
|
+
private policies;
|
|
189
|
+
private functions;
|
|
190
|
+
private addressCaches;
|
|
191
|
+
constructor({ parsers, renderers, labelers, policies, minNumRows, maxNumRows, minNumCols, maxNumCols, headerWidth, headerHeight, functions, sheetName, hub, }: Props);
|
|
192
|
+
get isInitialized(): boolean;
|
|
193
|
+
identifyFormula(): void;
|
|
194
|
+
getSheetId(): number;
|
|
195
|
+
getTableBySheetName(sheetName: string): Table;
|
|
196
|
+
getTableBySheetId(sheetId: number): Table;
|
|
197
|
+
initialize(cells: CellsByAddressType): void;
|
|
198
|
+
incrementVersion(): void;
|
|
199
|
+
private generateId;
|
|
200
|
+
getRectSize({ top, left, bottom, right }: AreaType): {
|
|
201
|
+
width: number;
|
|
202
|
+
height: number;
|
|
203
|
+
};
|
|
204
|
+
private setTotalSize;
|
|
205
|
+
clone(keepAddressCache?: boolean): Table;
|
|
206
|
+
getPointById(id: Id, slideY?: number, slideX?: number): PointType & {
|
|
207
|
+
absCol: boolean;
|
|
208
|
+
absRow: boolean;
|
|
209
|
+
};
|
|
210
|
+
getAddressById(id: Id, slideY?: number, slideX?: number): string | undefined;
|
|
211
|
+
getAddressesByIds(ids: CellsByIdType): CellsByAddressType;
|
|
212
|
+
clearAddressCaches(): void;
|
|
213
|
+
getId(point: PointType): string;
|
|
214
|
+
getIdFormula(point: ExtraPointType): {
|
|
215
|
+
id: Id | null;
|
|
216
|
+
formula: string | null;
|
|
217
|
+
};
|
|
218
|
+
getByPoint(point: PointType): CellType<any, any> | undefined;
|
|
219
|
+
getById(id: Id): CellType<any, any> | undefined;
|
|
220
|
+
getPathById(id: Id): string;
|
|
221
|
+
getByPath(path: string): CellType<any, any>;
|
|
222
|
+
getNumRows(base?: number): number;
|
|
223
|
+
getNumCols(base?: number): number;
|
|
224
|
+
get top(): number;
|
|
225
|
+
get left(): number;
|
|
226
|
+
get bottom(): number;
|
|
227
|
+
get right(): number;
|
|
228
|
+
getFullRef(ref: Address): string;
|
|
229
|
+
getFieldMatrix({ area, key, evaluates, raise, filter, }?: GetFieldPropsWithArea): any[][];
|
|
230
|
+
getFieldObject({ key, evaluates, raise, filter }?: GetFieldProps): CellsByAddressType;
|
|
231
|
+
getFieldRows({ key, evaluates, raise, filter }?: GetFieldProps): CellsByAddressType[];
|
|
232
|
+
getFieldCols({ key, evaluates, raise, filter }?: GetFieldProps): CellsByAddressType[];
|
|
233
|
+
getMatrix({ area, evaluates, raise, filter, }?: GetPropsWithArea): (CellType | null)[][];
|
|
234
|
+
getObject({ evaluates, raise, filter }?: GetProps): CellsByAddressType;
|
|
235
|
+
getRows({ evaluates, raise, filter }?: GetProps): CellsByAddressType[];
|
|
236
|
+
getCols({ evaluates, raise, filter }?: GetProps): CellsByAddressType[];
|
|
237
|
+
private pushHistory;
|
|
238
|
+
private cleanObsolete;
|
|
239
|
+
private cleanStrayed;
|
|
240
|
+
private getNewIdMatrix;
|
|
241
|
+
private getIdMatrixFromArea;
|
|
242
|
+
private setChangedAt;
|
|
243
|
+
private copyCellLayout;
|
|
244
|
+
move({ srcTable, src, dst, historicize, operator, undoReflection, redoReflection, }: MoveProps): Table;
|
|
245
|
+
copy({ srcTable, src, dst, onlyValue, operator, undoReflection, redoReflection, }: MoveProps & {
|
|
246
|
+
onlyValue?: boolean;
|
|
247
|
+
}): Table;
|
|
248
|
+
getPolicyByPoint(point: PointType): PolicyType;
|
|
249
|
+
private _update;
|
|
250
|
+
update({ diff, partial, updateChangedAt, historicize, operator, operation: op, undoReflection, redoReflection, }: {
|
|
251
|
+
diff: CellsByAddressType;
|
|
252
|
+
partial?: boolean;
|
|
253
|
+
updateChangedAt?: boolean;
|
|
254
|
+
historicize?: boolean;
|
|
255
|
+
operator?: OperatorType;
|
|
256
|
+
operation?: OperationType;
|
|
257
|
+
undoReflection?: StorePatchType;
|
|
258
|
+
redoReflection?: StorePatchType;
|
|
259
|
+
}): Table;
|
|
260
|
+
writeRawCellMatrix({ point, matrix, updateChangedAt, historicize, onlyValue, operator, undoReflection, redoReflection, }: {
|
|
261
|
+
point: PointType;
|
|
262
|
+
matrix: MatrixType<RawCellType>;
|
|
263
|
+
updateChangedAt?: boolean;
|
|
264
|
+
historicize?: boolean;
|
|
265
|
+
onlyValue?: boolean;
|
|
266
|
+
operator?: OperatorType;
|
|
267
|
+
undoReflection?: StorePatchType;
|
|
268
|
+
redoReflection?: StorePatchType;
|
|
269
|
+
}): Table;
|
|
270
|
+
writeMatrix(props: {
|
|
271
|
+
point: PointType;
|
|
272
|
+
matrix: MatrixType<string>;
|
|
273
|
+
updateChangedAt?: boolean;
|
|
274
|
+
historicize?: boolean;
|
|
275
|
+
operator?: OperatorType;
|
|
276
|
+
undoReflection?: StorePatchType;
|
|
277
|
+
redoReflection?: StorePatchType;
|
|
278
|
+
}): Table;
|
|
279
|
+
write(props: {
|
|
280
|
+
point: PointType;
|
|
281
|
+
value: string;
|
|
282
|
+
updateChangedAt?: boolean;
|
|
283
|
+
historicize?: boolean;
|
|
284
|
+
operator?: OperatorType;
|
|
285
|
+
undoReflection?: StorePatchType;
|
|
286
|
+
redoReflection?: StorePatchType;
|
|
287
|
+
}): Table;
|
|
288
|
+
insertRowsAndUpdate({ y, numRows, baseY, diff, partial, updateChangedAt, operator, undoReflection, redoReflection, }: {
|
|
289
|
+
y: number;
|
|
290
|
+
numRows: number;
|
|
291
|
+
baseY: number;
|
|
292
|
+
diff: CellsByAddressType;
|
|
293
|
+
partial?: boolean;
|
|
294
|
+
updateChangedAt?: boolean;
|
|
295
|
+
operator?: OperatorType;
|
|
296
|
+
undoReflection?: StorePatchType;
|
|
297
|
+
redoReflection?: StorePatchType;
|
|
298
|
+
}): Table;
|
|
299
|
+
insertRows({ y, numRows, baseY, undoReflection, redoReflection, }: {
|
|
300
|
+
y: number;
|
|
301
|
+
numRows: number;
|
|
302
|
+
baseY: number;
|
|
303
|
+
operator?: OperatorType;
|
|
304
|
+
undoReflection?: StorePatchType;
|
|
305
|
+
redoReflection?: StorePatchType;
|
|
306
|
+
}): Table;
|
|
307
|
+
removeRows({ y, numRows, operator, undoReflection, redoReflection, }: {
|
|
308
|
+
y: number;
|
|
309
|
+
numRows: number;
|
|
310
|
+
operator?: OperatorType;
|
|
311
|
+
undoReflection?: StorePatchType;
|
|
312
|
+
redoReflection?: StorePatchType;
|
|
313
|
+
}): Table;
|
|
314
|
+
insertColsAndUpdate({ x, numCols, baseX, diff, partial, updateChangedAt, undoReflection, redoReflection, }: {
|
|
315
|
+
x: number;
|
|
316
|
+
numCols: number;
|
|
317
|
+
baseX: number;
|
|
318
|
+
diff: CellsByAddressType;
|
|
319
|
+
partial?: boolean;
|
|
320
|
+
updateChangedAt?: boolean;
|
|
321
|
+
undoReflection?: StorePatchType;
|
|
322
|
+
redoReflection?: StorePatchType;
|
|
323
|
+
}): Table;
|
|
324
|
+
insertCols({ x, numCols, baseX, undoReflection, redoReflection, }: {
|
|
325
|
+
x: number;
|
|
326
|
+
numCols: number;
|
|
327
|
+
baseX: number;
|
|
328
|
+
undoReflection?: StorePatchType;
|
|
329
|
+
redoReflection?: StorePatchType;
|
|
330
|
+
}): Table;
|
|
331
|
+
removeCols({ x, numCols, operator, undoReflection, redoReflection, }: {
|
|
332
|
+
x: number;
|
|
333
|
+
numCols: number;
|
|
334
|
+
operator?: OperatorType;
|
|
335
|
+
undoReflection?: StorePatchType;
|
|
336
|
+
redoReflection?: StorePatchType;
|
|
337
|
+
}): Table;
|
|
338
|
+
getHistories(): HistoryType[];
|
|
339
|
+
getHistoryIndex(): number;
|
|
340
|
+
getHistorySize(): number;
|
|
341
|
+
getHistoryLimit(): number;
|
|
342
|
+
setFunctions(additionalFunctions: FunctionMapping): void;
|
|
343
|
+
getArea(): AreaType;
|
|
344
|
+
parse(point: PointType, value: string): CellType;
|
|
345
|
+
render(props: RendererCallProps): any;
|
|
346
|
+
stringify({ point, cell, evaluates }: {
|
|
347
|
+
point: PointType;
|
|
348
|
+
cell?: CellType;
|
|
349
|
+
evaluates?: boolean;
|
|
350
|
+
}): string;
|
|
351
|
+
trim(area: AreaType): Table;
|
|
352
|
+
private applyDiff;
|
|
353
|
+
undo(): {
|
|
354
|
+
history: null;
|
|
355
|
+
newTable: Table;
|
|
356
|
+
callback?: undefined;
|
|
357
|
+
} | {
|
|
358
|
+
history: HistoryType;
|
|
359
|
+
newTable: Table;
|
|
360
|
+
callback: ({ table: { hub } }: StoreType) => void;
|
|
361
|
+
};
|
|
362
|
+
redo(): {
|
|
363
|
+
history: null;
|
|
364
|
+
newTable: Table;
|
|
365
|
+
callback?: undefined;
|
|
366
|
+
} | {
|
|
367
|
+
history: HistoryType;
|
|
368
|
+
newTable: Table;
|
|
369
|
+
callback: ({ table: { hub } }: StoreType) => void;
|
|
370
|
+
};
|
|
371
|
+
getFunction(name: string): typeof import('../formula/functions/__base').BaseFunction;
|
|
372
|
+
getLabel(key: string, n: number): string;
|
|
373
|
+
getBase(): this;
|
|
374
|
+
getSolvedCache(point: PointType): any;
|
|
375
|
+
setSolvedCache(point: PointType, value: any): void;
|
|
376
|
+
clearSolvedCaches(): void;
|
|
377
|
+
sheetPrefix(omit?: boolean): string;
|
|
378
|
+
rangeToArea(range: string): {
|
|
379
|
+
top: number;
|
|
380
|
+
left: number;
|
|
381
|
+
bottom: number;
|
|
382
|
+
right: number;
|
|
383
|
+
};
|
|
384
|
+
updatePolicies(policies: Policies | undefined): void;
|
|
385
|
+
get __raw__(): Table;
|
|
386
|
+
}
|
|
387
|
+
export {};
|
|
388
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const defaultTimeDeltaFormat = "HH:mm:ss";
|
|
2
|
+
export declare const BASE_DATE: Date;
|
|
3
|
+
type Diff = [number, number, number, number, number, number, number];
|
|
4
|
+
export declare class TimeDelta {
|
|
5
|
+
gsType: string;
|
|
6
|
+
protected diff: Diff;
|
|
7
|
+
private date1;
|
|
8
|
+
private date2;
|
|
9
|
+
format: string;
|
|
10
|
+
constructor(date1: Date, date2: Date, format?: string);
|
|
11
|
+
add(date: Date): Date;
|
|
12
|
+
sub(date: Date): Date;
|
|
13
|
+
stringify(format?: string): string;
|
|
14
|
+
toJSON(): string;
|
|
15
|
+
toString(): string;
|
|
16
|
+
static create(hours?: number, minutes?: number, seconds?: number, milliseconds?: number): TimeDelta;
|
|
17
|
+
static is(obj: any): boolean;
|
|
18
|
+
static ensure(obj: any): TimeDelta;
|
|
19
|
+
static fromObject(obj: any): TimeDelta;
|
|
20
|
+
static parse(value: string, format?: string, strict?: boolean): TimeDelta | undefined;
|
|
21
|
+
}
|
|
22
|
+
export declare const safeQueueMicrotask: typeof queueMicrotask;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Table } from './table';
|
|
2
|
+
import { AreaType, PointType, Virtualization } from '../types';
|
|
3
|
+
export declare const getCellRectPositions: (table: Table, { y, x }: PointType) => {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
right: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const getScreenRect: (e: HTMLDivElement) => {
|
|
12
|
+
top: number;
|
|
13
|
+
left: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
right: number;
|
|
16
|
+
height: number;
|
|
17
|
+
width: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const virtualize: (table: Table, e: HTMLDivElement | null) => Virtualization | null;
|
|
20
|
+
export declare const smartScroll: (table: Table, e: HTMLDivElement | null, targetPoint: PointType, behavior?: ScrollBehavior) => void;
|
|
21
|
+
export declare const getAreaInTabular: (tabularElement: HTMLDivElement) => AreaType;
|
|
22
|
+
//# sourceMappingURL=virtualization.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CellType } from '../types';
|
|
2
|
+
import { TimeDelta } from '../lib/time';
|
|
3
|
+
type Condition = (value: string) => boolean;
|
|
4
|
+
type Stringify = (value: string) => any;
|
|
5
|
+
type Props = {
|
|
6
|
+
condition?: Condition;
|
|
7
|
+
complement?: Stringify;
|
|
8
|
+
mixins?: ParserMixinType[];
|
|
9
|
+
};
|
|
10
|
+
export interface ParserMixinType {
|
|
11
|
+
functions?: ((value: string, cell?: CellType) => any)[];
|
|
12
|
+
callback?(parsed: any, cell?: CellType): CellType;
|
|
13
|
+
parse?(value: string, cell: CellType): any;
|
|
14
|
+
bool?(value: string, cell?: CellType): boolean | undefined;
|
|
15
|
+
number?(value: string, cell?: CellType): number | undefined;
|
|
16
|
+
timedelta?(value: string, cell?: CellType): TimeDelta | undefined;
|
|
17
|
+
date?(value: string, cell?: CellType): Date | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare class Parser implements ParserMixinType {
|
|
20
|
+
functions: ((value: string, cell?: CellType) => any)[];
|
|
21
|
+
private condition?;
|
|
22
|
+
private complement?;
|
|
23
|
+
constructor(props?: Props);
|
|
24
|
+
private applyMixins;
|
|
25
|
+
call(value: string, cell: CellType): CellType;
|
|
26
|
+
callback(parsed: any, cell?: CellType): CellType;
|
|
27
|
+
parse(value: string, cell?: CellType): any;
|
|
28
|
+
bool(value: string, cell?: CellType): boolean | undefined;
|
|
29
|
+
number(value: string, cell?: CellType): number | undefined;
|
|
30
|
+
timedelta(value: string, cell?: CellType): TimeDelta | undefined;
|
|
31
|
+
date(value: string, cell?: CellType): Date | undefined;
|
|
32
|
+
}
|
|
33
|
+
export type ParserType = Parser;
|
|
34
|
+
export declare const defaultParser: Parser;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=core.d.ts.map
|