@gridsheet/preact-core 3.0.0-rc.11 → 3.0.0-rc.12
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/README.md +28 -34
- package/dist/{react-core/src/components → components}/FunctionGuide.d.ts +1 -1
- package/dist/{react-core/src/components → components}/useAutocomplete.d.ts +2 -2
- package/dist/index.d.ts +17 -3
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/{react-core/src/lib → lib}/clipboard.d.ts +3 -3
- package/dist/{react-core/src/lib → lib}/hooks.d.ts +1 -1
- package/dist/{react-core/src/lib → lib}/menu.d.ts +1 -1
- package/dist/policy/checkbox.d.ts +3 -0
- package/dist/spellbook.d.ts +6 -2
- package/dist/{react-core/src/store → store}/actions.d.ts +5 -6
- package/dist/{react-core/src/store → store}/helpers.d.ts +6 -6
- package/dist/{react-core/src/types.d.ts → types.d.ts} +2 -2
- package/package.json +3 -3
- package/dist/react-core/src/index.d.ts +0 -17
- package/dist/react-core/src/policy/checkbox.d.ts +0 -3
- package/dist/react-core/src/spellbook.d.ts +0 -6
- /package/dist/{react-core/src/components → components}/Cell.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/CellStateOverlay.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/ColumnMenu.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/ColumnMenuFilterSection.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/ColumnMenuLabelSection.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/ColumnMenuSortSection.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/ContextMenu.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/Editor.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/EditorOptions.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/Emitter.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/Fixed.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/FormulaBar.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/GridSheet.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/HeaderCellLeft.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/HeaderCellTop.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/MenuItem.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/PluginBase.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/Resizer.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/RowMenu.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/ScrollHandle.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/SearchBar.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/StoreObserver.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/Tabular.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/svg/AddIcon.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/svg/Base.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/svg/CloseIcon.d.ts +0 -0
- /package/dist/{react-core/src/components → components}/svg/SearchIcon.d.ts +0 -0
- /package/dist/{react-core/src/lib → lib}/events.d.ts +0 -0
- /package/dist/{react-core/src/lib → lib}/paste.d.ts +0 -0
- /package/dist/{react-core/src/lib → lib}/style.d.ts +0 -0
- /package/dist/{react-core/src/store → store}/applyers.d.ts +0 -0
- /package/dist/{react-core/src/store → store}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Spreadsheet component for Preact
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @gridsheet/preact-core
|
|
8
|
+
npm install @gridsheet/preact-core @gridsheet/functions
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
### Peer Dependencies
|
|
@@ -17,46 +17,40 @@ This package requires the following peer dependencies:
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
### Basic Preact Component
|
|
21
|
-
|
|
22
20
|
```tsx
|
|
23
21
|
import { GridSheet } from '@gridsheet/preact-core';
|
|
22
|
+
import { useSpellbook } from '@gridsheet/preact-core/spellbook'; // requires @gridsheet/functions
|
|
24
23
|
|
|
25
|
-
// Your Preact component
|
|
26
24
|
function App() {
|
|
25
|
+
const book = useSpellbook();
|
|
27
26
|
return (
|
|
28
|
-
|
|
27
|
+
<>
|
|
28
|
+
<GridSheet
|
|
29
|
+
book={book}
|
|
30
|
+
initialCells={{
|
|
31
|
+
A1: { value: 'Hello' },
|
|
32
|
+
B1: { value: 'Preact', style: { backgroundColor: '#448888' } },
|
|
33
|
+
A2: { value: 123 },
|
|
34
|
+
B2: { value: 456 },
|
|
35
|
+
A3: { value: 789 },
|
|
36
|
+
C6: { value: '=SUM(A2:B2)' },
|
|
37
|
+
}}
|
|
38
|
+
options={{
|
|
39
|
+
mode: 'dark',
|
|
40
|
+
}}
|
|
41
|
+
sheetName="Sheet1"
|
|
42
|
+
/>
|
|
43
|
+
<GridSheet
|
|
44
|
+
book={book}
|
|
45
|
+
initialCells={{
|
|
46
|
+
C3: { value: '=SUM(Sheet1!A2:B3)' },
|
|
47
|
+
}}
|
|
48
|
+
options={{}}
|
|
49
|
+
sheetName="Sheet2"
|
|
50
|
+
/>
|
|
51
|
+
</>
|
|
29
52
|
);
|
|
30
53
|
}
|
|
31
|
-
|
|
32
|
-
render(<App />, document.getElementById('app'));
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Vanilla JavaScript Integration
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
import { GridSheet, h, render } from '@gridsheet/preact-core';
|
|
39
|
-
|
|
40
|
-
// Create a container element
|
|
41
|
-
const container = document.getElementById('gridsheet');
|
|
42
|
-
|
|
43
|
-
// Render GridSheet directly
|
|
44
|
-
render(
|
|
45
|
-
h(GridSheet, {
|
|
46
|
-
initialCells: {
|
|
47
|
-
A1: { value: 'Hello' },
|
|
48
|
-
B1: { value: 'Vanilla JS', style: { backgroundColor: '#448888'} },
|
|
49
|
-
A2: { value: 123 },
|
|
50
|
-
B2: { value: 456 },
|
|
51
|
-
C10: { value: '=SUM(A2:B2)' },
|
|
52
|
-
},
|
|
53
|
-
options: {
|
|
54
|
-
mode: 'dark',
|
|
55
|
-
},
|
|
56
|
-
sheetName: 'Sheet1'
|
|
57
|
-
}),
|
|
58
|
-
container
|
|
59
|
-
);
|
|
60
54
|
```
|
|
61
55
|
|
|
62
56
|
## Exports
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FunctionHelp, AutocompleteOption } from '
|
|
2
|
+
import { FunctionHelp, AutocompleteOption } from '@gridsheet/core';
|
|
3
3
|
type OptionWithGuide = AutocompleteOption & {
|
|
4
4
|
isFunction?: boolean;
|
|
5
5
|
example?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FunctionMapping, AutocompleteOption } from '@gridsheet/core';
|
|
2
2
|
type UseAutocompleteProps = {
|
|
3
3
|
inputting: string;
|
|
4
4
|
selectionStart: number;
|
|
@@ -16,7 +16,7 @@ export declare const useAutocomplete: ({ inputting, selectionStart, optionsAll,
|
|
|
16
16
|
handleArrowUp: (e: React.KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
17
17
|
handleArrowDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
18
18
|
isFormula: boolean;
|
|
19
|
-
activeFunctionHelp:
|
|
19
|
+
activeFunctionHelp: any;
|
|
20
20
|
activeArgIndex: number;
|
|
21
21
|
};
|
|
22
22
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {}
|
|
3
|
-
|
|
1
|
+
export { oa2aa, aa2oa, buildInitialCells, buildInitialCellsFromOrigin, zoneToArea, areaToZone, areaToRange, matrixShape, addressesToAreas, addressesToCols, addressesToRows, Time, x2c, c2x, y2r, r2y, p2a, a2p, rh, ch, Registry, createBook, createRegistry, Sheet, toValueMatrix, toValueObject, toValueRows, toValueCols, toCellMatrix, toCellObject, toCellRows, toCellCols, BaseFunction, BaseFunctionAsync, Lexer, FormulaParser, RefEntity, ValueEntity, RangeEntity, FormulaError, ensureString, ensureNumber, ensureBoolean, ensureDate, check, eachMatrix, createBooleanMask, conditionArg, stripMatrix, Policy, ThousandSeparatorPolicyMixin, operations, DEFAULT_HISTORY_LIMIT, Pending, Spilling, } from '@gridsheet/core';
|
|
2
|
+
export type { CSSPropertiesLike, RefLike, MatrixType, CellType, System, Address, AsyncCache, FilterCondition, FilterConditionMethod, FilterConfig, FeedbackType, WriterType, CellsByAddressType, CellsByIdType, SystemsByIdType, ModeType, HeadersType, HistoryType, HistorySortRowsType, PointType, AreaType, ZoneType, EditorEvent, CursorStateType, BookType, BookProps, RegistryProps, TransmitProps, UserSheet, SheetLimits, ToValueMatrixProps, ToValueObjectProps, ToValueRowsProps, ToValueColsProps, ToCellMatrixProps, ToCellObjectProps, ToCellRowsProps, ToCellColsProps, FunctionProps, FunctionArgumentDefinition, FunctionCategory, FunctionMapping, EnsureNumberOptions, EnsureBooleanOptions, PolicyType, AutocompleteOption, PolicyMixinType, RenderProps, SerializeProps, SelectProps, SelectFallbackProps, SerializeForClipboardProps, } from '@gridsheet/core';
|
|
3
|
+
export { GridSheet, createSheetRef, useSheetRef, createStoreRef, useStoreRef } from './components/GridSheet';
|
|
4
|
+
export { updateSheet } from './store/actions';
|
|
5
|
+
export { PluginBase, useInitialPluginContext, usePluginContext } from './components/PluginBase';
|
|
6
|
+
export { MenuItem, MenuDivider } from './components/MenuItem';
|
|
7
|
+
export { useBook } from './lib/hooks';
|
|
8
|
+
export type { Dispatcher } from './store';
|
|
9
|
+
export { CheckboxPolicyMixin } from './policy/checkbox';
|
|
10
|
+
export type { Props, StoreType, SheetHandle, StoreHandle, OptionsType } from './types';
|
|
11
|
+
export { userActions } from './store/actions';
|
|
12
|
+
export { clip, sheet2csv } from './lib/clipboard';
|
|
13
|
+
export { applyers } from './store/applyers';
|
|
14
|
+
export { makeBorder } from './lib/style';
|
|
15
|
+
export type { MenuContext, MenuItemBase, MenuComponentItem, ContextMenuItemDescriptor, RowMenuItemDescriptor, ColMenuItemDescriptor, MenuDividerItem, ContextMenuSectionProps, RowMenuSectionProps, ColMenuSectionProps, } from './lib/menu';
|
|
16
|
+
export { defaultContextMenuDescriptors, defaultRowMenuDescriptors, defaultColMenuDescriptors, registerMenuComponent, } from './lib/menu';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
4
18
|
export { h, render } from "preact";
|
|
5
19
|
export {
|
|
6
20
|
useState,
|
package/dist/index.js
CHANGED
|
@@ -1265,6 +1265,7 @@ const Editor = ({ mode }) => {
|
|
|
1265
1265
|
return;
|
|
1266
1266
|
}
|
|
1267
1267
|
dispatch(setInputting(e.currentTarget.value));
|
|
1268
|
+
setSelectionStart(e.currentTarget.selectionStart);
|
|
1268
1269
|
setSelected(0);
|
|
1269
1270
|
},
|
|
1270
1271
|
[cell]
|
|
@@ -4432,6 +4433,7 @@ const FormulaBar = ({ ready }) => {
|
|
|
4432
4433
|
const largeInput = largeEditorRef.current;
|
|
4433
4434
|
const handleInput = useCallback((e) => {
|
|
4434
4435
|
dispatch(setInputting(e.currentTarget.value));
|
|
4436
|
+
setSelectionStart(e.currentTarget.selectionStart);
|
|
4435
4437
|
}, []);
|
|
4436
4438
|
const handleSelect = useCallback((e) => {
|
|
4437
4439
|
setSelectionStart(e.currentTarget.selectionStart);
|