@gridsheet/vue-core
v3.0.5
Published
Spreadsheet component for Vue 3
Downloads
895
Maintainers
Readme
@gridsheet/vue-core
Spreadsheet component for Vue 3
Installation
npm install @gridsheet/vue-core @gridsheet/functionsPeer Dependencies
This package requires the following peer dependency:
vue^3.3.0
Usage
<template>
<main>
<GridSheet
:book="book"
:initialCells="{
A1: { value: 'Hello' },
B1: { value: 'Vue', style: { backgroundColor: '#448888'} },
A2: { value: 123 },
B2: { value: 456 },
A3: { value: 789},
C6: { value: '=SUM(A2:B2)' },
}"
:options="{
mode: 'dark',
}"
sheetName="Sheet1"
/>
<GridSheet
:book="book"
:initialCells="{
C3: { value: '=SUM(Sheet1!A2:B3)' },
}"
:options="{}"
sheetName="Sheet2"
/>
</main>
</template>
<script setup>
import { GridSheet } from '@gridsheet/vue-core';
import { useSpellbook } from '@gridsheet/vue-core/spellbook'; // requires @gridsheet/functions
const book = useSpellbook();
</script>Components
GridSheet
The main spreadsheet component for Vue 3 applications.
Props:
book- Book object for cross-sheet data binding and state managementinitialCells- Initial cell data with values, styles, and formulasoptions- GridSheet options (e.g., mode: 'dark')sheetName- Name of the sheetsheetRef- Ref object to access sheet handlestoreRef- Ref object to access store handleclassName- CSS class namestyle- Inline styles
useSpellbook
Creates a reactive book with all extended functions (@gridsheet/functions) pre-loaded. Returns a shallowRef<BookType>.
import { useSpellbook } from '@gridsheet/vue-core/spellbook'; // requires @gridsheet/functions
const book = useSpellbook({ /* RegistryProps */ });useBook
Same as useSpellbook but without extended functions.
import { useBook } from '@gridsheet/vue-core';
const book = useBook({ /* RegistryProps */ });Exports
This package exports:
- All core GridSheet functionality from
@gridsheet/preact-core GridSheet- Vue 3 componentuseBook- Vue 3-specific reactive book composable@gridsheet/vue-core/spellbook-useSpellbook,createSpellbook
Docs
Development
# Start development server
pnpm dev
# Build the package
pnpm buildLicense
Apache-2.0
