@gridsheet/preact-core 2.0.0-rc.2 → 2.0.0-rc.4

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.
@@ -1,8 +1,7 @@
1
- import { FC, KeyboardEvent } from 'react';
2
- import { CursorStateType, ModeType } from '../types';
1
+ import { FC } from 'react';
2
+ import { ModeType } from '../types';
3
3
  type Props = {
4
4
  mode: ModeType;
5
- handleKeyUp?: (e: KeyboardEvent<HTMLTextAreaElement>, points: CursorStateType) => void;
6
5
  };
7
6
  export declare const Editor: FC<Props>;
8
7
  export declare const editorStyle: (text: string) => JSX.Element;
@@ -1,9 +1,3 @@
1
1
  import { FC } from 'react';
2
- import { FeedbackType } from '../types';
3
- type Props = {
4
- onChange?: FeedbackType;
5
- onSelect?: FeedbackType;
6
- };
7
- export declare const Emitter: FC<Props>;
8
- export {};
2
+ export declare const Emitter: FC;
9
3
  //# sourceMappingURL=Emitter.d.ts.map
@@ -1,3 +1,5 @@
1
- import { Props } from '../types';
2
- export declare function GridSheet({ initialCells, sheetName, tableRef, storeRef, options, className, style, hub: initialHub, }: Props): JSX.Element;
1
+ import { Connector, Props } from '../types';
2
+ export declare const createConnector: () => import('react').RefObject<Connector | null>;
3
+ export declare const useConnector: () => import('react').MutableRefObject<Connector | null>;
4
+ export declare function GridSheet({ initialCells, sheetName, connector: initialConnector, options, className, style, hub: initialHub, }: Props): JSX.Element;
3
5
  //# sourceMappingURL=GridSheet.d.ts.map
@@ -4,9 +4,9 @@ import { Dispatcher } from '../store';
4
4
  export type PluginContextType = {
5
5
  provided: boolean;
6
6
  store?: StoreType;
7
- dispatch?: Dispatcher;
7
+ sync?: Dispatcher;
8
8
  setStore: (store: StoreType) => void;
9
- setDispatch: (dispatch: Dispatcher) => void;
9
+ setSync: (sync: Dispatcher) => void;
10
10
  };
11
11
  export declare const PluginContext: import('react').Context<PluginContextType>;
12
12
  export declare function useInitialPluginContext(): PluginContextType;
@@ -1,2 +1,2 @@
1
- export declare const Resizer: () => JSX.Element | null;
1
+ export declare const Resizer: () => JSX.Element;
2
2
  //# sourceMappingURL=Resizer.d.ts.map
@@ -1,9 +1,10 @@
1
1
  import { CSSProperties } from 'react';
2
2
  type Props = {
3
+ className?: string;
3
4
  style: CSSProperties;
4
5
  horizontal?: number;
5
6
  vertical?: number;
6
7
  };
7
- export declare function ScrollHandle({ style, horizontal, vertical }: Props): JSX.Element | null;
8
+ export declare function ScrollHandle({ style, horizontal, vertical, className }: Props): JSX.Element;
8
9
  export {};
9
10
  //# sourceMappingURL=ScrollHandle.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import { FC, MutableRefObject } from 'react';
2
- import { OptionsType, StoreRef } from '../types';
3
- type StoreInitializerProps = OptionsType & {
2
+ import { OptionsType, Connector } from '../types';
3
+ type StoreObserverProps = OptionsType & {
4
4
  sheetName?: string;
5
- storeRef?: MutableRefObject<StoreRef | null>;
5
+ connector?: MutableRefObject<Connector | null>;
6
6
  };
7
- export declare const createStoreRef: () => import('react').RefObject<StoreRef | null>;
8
- export declare const useStoreRef: () => MutableRefObject<StoreRef | null>;
9
- export declare const StoreObserver: FC<StoreInitializerProps>;
7
+ export declare const createConnector: () => import('react').RefObject<Connector | null>;
8
+ export declare const useConnector: () => MutableRefObject<Connector | null>;
9
+ export declare const StoreObserver: FC<StoreObserverProps>;
10
10
  export {};
11
11
  //# sourceMappingURL=StoreObserver.d.ts.map
@@ -1,9 +1,2 @@
1
- import { TableRef } from '../types';
2
- type Props = {
3
- tableRef: React.MutableRefObject<TableRef | null> | undefined;
4
- };
5
- export declare const createTableRef: () => import('react').RefObject<TableRef | null>;
6
- export declare const useTableRef: () => import('react').MutableRefObject<TableRef | null>;
7
- export declare const Tabular: ({ tableRef }: Props) => JSX.Element | null;
8
- export {};
1
+ export declare const Tabular: () => JSX.Element | null;
9
2
  //# sourceMappingURL=Tabular.d.ts.map
@@ -7,6 +7,7 @@ export type IdentifyProps = {
7
7
  table: Table;
8
8
  slideY?: number;
9
9
  slideX?: number;
10
+ operation?: 'move' | 'removeRows' | 'removeCols';
10
11
  dependency: string;
11
12
  idMap?: {
12
13
  [id: string]: string;
@@ -40,24 +41,24 @@ export declare class RefEntity extends Entity<string> {
40
41
  constructor(value: string);
41
42
  stringify(): string;
42
43
  evaluate({ table }: EvaluateProps): Table;
43
- identify({ table, dependency, slideY, slideX }: IdentifyProps): string;
44
+ identify(props: IdentifyProps): string;
44
45
  }
45
46
  export declare class RangeEntity extends Entity<string> {
46
47
  stringify(): string;
47
48
  evaluate({ table }: EvaluateProps): Table;
48
- identify({ table, dependency, slideY, slideX }: IdentifyProps): string;
49
+ identify(props: IdentifyProps): string;
49
50
  }
50
51
  export declare class IdEntity extends Entity<string> {
51
52
  private parse;
52
53
  evaluate({ table }: EvaluateProps): Table;
53
54
  display({ table, slideY, slideX }: DisplayProps): string;
54
- identify({ table, dependency, slideX, slideY }: IdentifyProps): string;
55
+ identify(props: IdentifyProps): string;
55
56
  }
56
57
  export declare class IdRangeEntity extends Entity<string> {
57
58
  private parse;
58
59
  evaluate({ table }: EvaluateProps): Table;
59
60
  display({ table, slideY, slideX }: DisplayProps): string;
60
- identify({ table, dependency, slideY, slideX }: IdentifyProps): string | undefined;
61
+ identify(props: IdentifyProps): string | undefined;
61
62
  }
62
63
  export declare class FunctionEntity {
63
64
  args: Expression[];
@@ -121,7 +122,7 @@ export declare function splitRef(ref: string): {
121
122
  sheetName: string | undefined;
122
123
  addresses: string[];
123
124
  };
124
- export declare const parseRef: (table: Table, ref: string) => {
125
+ export declare const parseRef: (ref: string, { table, operation, dependency }: IdentifyProps) => {
125
126
  table: Table;
126
127
  sheetId?: number;
127
128
  formula?: string;
@@ -8,8 +8,12 @@ export type EnsureNumberOptions = {
8
8
  alternative?: number;
9
9
  ignore?: boolean;
10
10
  };
11
+ export type EnsureBooleanOptions = {
12
+ alternative?: boolean;
13
+ ignore?: boolean;
14
+ };
11
15
  export declare const ensureNumber: (value: any, options?: EnsureNumberOptions) => number;
12
16
  export declare const ensureString: (value: any) => string;
13
- export declare const ensureBoolean: (value: any, alternative?: boolean) => boolean;
17
+ export declare const ensureBoolean: (value: any, options?: EnsureBooleanOptions) => boolean;
14
18
  export declare const check: (value: any, condition: string) => boolean;
15
19
  //# sourceMappingURL=__utils.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { Table } from '../lib/table';
2
- import { MatrixType, PointType, RefEvaluation } from '../types';
2
+ import { Id, MatrixType, PointType, RefEvaluation } from '../types';
3
3
  type SolveFormulaProps = {
4
4
  value: any;
5
5
  table: Table;
@@ -14,6 +14,13 @@ type SolveTableProps = {
14
14
  refEvaluation?: RefEvaluation;
15
15
  };
16
16
  export declare const solveTable: ({ table, raise }: SolveTableProps) => MatrixType;
17
- export declare const stripTable: (value: any, y?: number, x?: number, raise?: boolean) => any;
17
+ export type StripTableProps = {
18
+ value: any;
19
+ y?: number;
20
+ x?: number;
21
+ raise?: boolean;
22
+ history?: Set<Id>;
23
+ };
24
+ export declare const stripTable: ({ value, y, x, raise, history }: StripTableProps) => any;
18
25
  export {};
19
26
  //# sourceMappingURL=solver.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,16 +1,14 @@
1
- export { GridSheet } from './components/GridSheet';
2
- export { useTableRef, createTableRef } from './components/Tabular';
3
- export { useStoreRef, createStoreRef } from './components/StoreObserver';
1
+ export { GridSheet, createConnector, useConnector } from './components/GridSheet';
4
2
  export { Renderer } from './renderers/core';
5
3
  export type { RendererMixinType, RendererCallProps, RenderProps } from './renderers/core';
6
4
  export { Parser } from './parsers/core';
7
5
  export type { ParserMixinType } from './parsers/core';
8
- export { oa2aa, aa2oa, buildInitialCells, buildInitialCellsOrigin, zoneToArea, areaToZone, areaToRange, } from './lib/structs';
6
+ export { oa2aa, aa2oa, buildInitialCells, buildInitialCellsFromOrigin, zoneToArea, areaToZone, areaToRange, } from './lib/structs';
9
7
  export { TimeDelta } from './lib/time';
10
8
  export { x2c, c2x, y2r, r2y, p2a, a2p } from './lib/converters';
11
9
  export { updateTable } from './store/actions';
12
10
  export { PluginBase, useInitialPluginContext, usePluginContext } from './components/PluginBase';
13
- export type { MatrixType, CellType, FeedbackType, OptionsType, WriterType, CellsByAddressType, CellsByIdType, ModeType, HeadersType, HistoryType, StoreType, PointType, AreaType, ZoneType, Props, TableRef, } from './types';
11
+ export type { MatrixType, CellType, FeedbackType, OptionsType, WriterType, CellsByAddressType, CellsByIdType, ModeType, HeadersType, HistoryType, StoreType, PointType, AreaType, ZoneType, Props, Connector, EditorEvent, CursorStateType, } from './types';
14
12
  export type { HubType, WireProps, TransmitProps } from './lib/hub';
15
13
  export { Wire, useHub, createHub } from './lib/hub';
16
14
  export type { Dispatcher } from './store';
@@ -18,7 +16,7 @@ export { ThousandSeparatorRendererMixin } from './renderers/thousand_separator';
18
16
  export { CheckboxRendererMixin } from './renderers/checkbox';
19
17
  export { BaseFunction } from './formula/functions/__base';
20
18
  export { FormulaError } from './formula/evaluator';
21
- export { Table } from './lib/table';
19
+ export { Table, type UserTable } from './lib/table';
22
20
  export { Policy } from './policy/core';
23
21
  export type { PolicyType, PolicyOption, PolicyMixinType } from './policy/core';
24
22
  export * as operations from './lib/operation';
@@ -26,6 +24,9 @@ export { DEFAULT_HISTORY_LIMIT } from './constants';
26
24
  export { userActions } from './store/actions';
27
25
  export { clip } from './lib/clipboard';
28
26
  export { makeBorder } from './styles/utils';
27
+ export { syncers } from './store/dispatchers';
28
+ export { ensureString, ensureNumber, ensureBoolean } from './formula/functions/__utils';
29
+ export type { EnsureNumberOptions, EnsureBooleanOptions } from './formula/functions/__utils';
29
30
  //# sourceMappingURL=index.d.ts.map
30
31
  export { h, render } from "preact";
31
32
  export {