@gridsheet/vue-core 0.1.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/README.md +97 -0
- package/dist/GridSheet.vue.d.ts +75 -0
- package/dist/hub.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +87 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @gridsheet/vue-core
|
|
2
|
+
|
|
3
|
+
Spreadsheet component for Vue 3
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @gridsheet/vue-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
This package requires the following peer dependency:
|
|
14
|
+
|
|
15
|
+
- `vue` ^3.3.0
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<template>
|
|
21
|
+
<main>
|
|
22
|
+
<h1>GridSheet Vue Example</h1>
|
|
23
|
+
<div class="grid-container">
|
|
24
|
+
<GridSheet
|
|
25
|
+
:hubReactive="hubReactive"
|
|
26
|
+
:initialCells="{
|
|
27
|
+
A1: { value: 'Hello' },
|
|
28
|
+
B1: { value: 'Vue', style: { backgroundColor: '#448888'} },
|
|
29
|
+
A2: { value: 123 },
|
|
30
|
+
B2: { value: 456 },
|
|
31
|
+
A3: { value: 789},
|
|
32
|
+
C10: { value: '=SUM(A2:B2)' },
|
|
33
|
+
}"
|
|
34
|
+
:options="{
|
|
35
|
+
mode: 'dark',
|
|
36
|
+
}"
|
|
37
|
+
sheetName="Sheet1"
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<GridSheet
|
|
41
|
+
:hubReactive="hubReactive"
|
|
42
|
+
:initialCells="{
|
|
43
|
+
C3: { value: '=SUM(Sheet1!A2:B3)' },
|
|
44
|
+
}"
|
|
45
|
+
:options="{}"
|
|
46
|
+
sheetName="Sheet2"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</main>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
import { GridSheet, useHubReactive } from '@gridsheet/vue-core';
|
|
54
|
+
const hubReactive = useHubReactive();
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Components
|
|
59
|
+
|
|
60
|
+
### GridSheet
|
|
61
|
+
|
|
62
|
+
The main spreadsheet component for Vue 3 applications.
|
|
63
|
+
|
|
64
|
+
**Props:**
|
|
65
|
+
- `hubReactive` - Reactive hub for data binding and state management
|
|
66
|
+
- `initialCells` - Initial cell data with values, styles, and formulas
|
|
67
|
+
- `options` - GridSheet options (e.g., mode: 'dark')
|
|
68
|
+
- `sheetName` - Name of the sheet
|
|
69
|
+
|
|
70
|
+
### useHubReactive
|
|
71
|
+
|
|
72
|
+
A Vue 3-specific composable for creating reactive hubs that can be used for data binding and state management.
|
|
73
|
+
|
|
74
|
+
## Exports
|
|
75
|
+
|
|
76
|
+
This package exports:
|
|
77
|
+
|
|
78
|
+
- All core GridSheet functionality from `@gridsheet/preact-core`
|
|
79
|
+
- `GridSheet` - Vue 3 component
|
|
80
|
+
- `useHubReactive` - Vue 3-specific reactive hub composable
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Start development server
|
|
86
|
+
pnpm dev
|
|
87
|
+
|
|
88
|
+
# Build the package
|
|
89
|
+
pnpm build
|
|
90
|
+
|
|
91
|
+
# Preview the build
|
|
92
|
+
pnpm preview
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Apache-2.0
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { HubReactiveType, CellsByAddressType, OptionsType, TableRef } from '@gridsheet/preact-core';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
interface RefObject<T> {
|
|
5
|
+
readonly current: T | null;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
8
|
+
initialCells: {
|
|
9
|
+
type: () => CellsByAddressType;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
sheetName: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
hubReactive: {
|
|
17
|
+
type: () => HubReactiveType | Ref<HubReactiveType>;
|
|
18
|
+
default: null;
|
|
19
|
+
};
|
|
20
|
+
tableRef: {
|
|
21
|
+
type: () => RefObject<TableRef | null>;
|
|
22
|
+
default: null;
|
|
23
|
+
};
|
|
24
|
+
options: {
|
|
25
|
+
type: () => OptionsType;
|
|
26
|
+
default: () => {};
|
|
27
|
+
};
|
|
28
|
+
className: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
style: {
|
|
33
|
+
type: any;
|
|
34
|
+
default: () => {};
|
|
35
|
+
};
|
|
36
|
+
}>, {
|
|
37
|
+
container: Ref<HTMLElement | null, HTMLElement | null>;
|
|
38
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
39
|
+
initialCells: {
|
|
40
|
+
type: () => CellsByAddressType;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
sheetName: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
default: string;
|
|
46
|
+
};
|
|
47
|
+
hubReactive: {
|
|
48
|
+
type: () => HubReactiveType | Ref<HubReactiveType>;
|
|
49
|
+
default: null;
|
|
50
|
+
};
|
|
51
|
+
tableRef: {
|
|
52
|
+
type: () => RefObject<TableRef | null>;
|
|
53
|
+
default: null;
|
|
54
|
+
};
|
|
55
|
+
options: {
|
|
56
|
+
type: () => OptionsType;
|
|
57
|
+
default: () => {};
|
|
58
|
+
};
|
|
59
|
+
className: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
style: {
|
|
64
|
+
type: any;
|
|
65
|
+
default: () => {};
|
|
66
|
+
};
|
|
67
|
+
}>> & Readonly<{}>, {
|
|
68
|
+
sheetName: string;
|
|
69
|
+
hubReactive: HubReactiveType | Ref<HubReactiveType, HubReactiveType>;
|
|
70
|
+
tableRef: RefObject<TableRef | null>;
|
|
71
|
+
options: OptionsType;
|
|
72
|
+
className: string;
|
|
73
|
+
style: any;
|
|
74
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
75
|
+
export default _default;
|
package/dist/hub.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useHubReactive(historyLimit?: number): import('vue').ShallowRef<import('@gridsheet/preact-core').HubReactiveType, import('@gridsheet/preact-core').HubReactiveType>;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { render as o, h as l, GridSheet as f, DEFAULT_HISTORY_LIMIT as s, createHubReactive as d } from "@gridsheet/preact-core";
|
|
2
|
+
export * from "@gridsheet/preact-core";
|
|
3
|
+
import { defineComponent as h, ref as v, onMounted as b, isRef as u, watch as i, onBeforeUnmount as p, createElementBlock as R, openBlock as m, shallowRef as _ } from "vue";
|
|
4
|
+
const y = h({
|
|
5
|
+
name: "GridSheet",
|
|
6
|
+
props: {
|
|
7
|
+
initialCells: {
|
|
8
|
+
type: Object,
|
|
9
|
+
required: !0
|
|
10
|
+
},
|
|
11
|
+
sheetName: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
hubReactive: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
tableRef: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: null
|
|
22
|
+
},
|
|
23
|
+
options: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: () => ({})
|
|
26
|
+
},
|
|
27
|
+
className: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default: () => ({})
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
setup(e) {
|
|
37
|
+
const n = v(null);
|
|
38
|
+
let t = null;
|
|
39
|
+
function a() {
|
|
40
|
+
return {
|
|
41
|
+
...e,
|
|
42
|
+
hubReactive: u(e.hubReactive) ? e.hubReactive.value : e.hubReactive
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function r() {
|
|
46
|
+
n.value && (t = n.value, o(
|
|
47
|
+
l(f, a()),
|
|
48
|
+
t
|
|
49
|
+
));
|
|
50
|
+
}
|
|
51
|
+
return b(() => {
|
|
52
|
+
r(), u(e.hubReactive) ? i(
|
|
53
|
+
() => e.hubReactive.value,
|
|
54
|
+
r,
|
|
55
|
+
{ deep: !1 }
|
|
56
|
+
) : i(
|
|
57
|
+
() => e.hubReactive,
|
|
58
|
+
r,
|
|
59
|
+
{ deep: !1 }
|
|
60
|
+
);
|
|
61
|
+
}), p(() => {
|
|
62
|
+
t && (t.innerHTML = "");
|
|
63
|
+
}), {
|
|
64
|
+
container: n
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}), O = (e, n) => {
|
|
68
|
+
const t = e.__vccOpts || e;
|
|
69
|
+
for (const [a, r] of n)
|
|
70
|
+
t[a] = r;
|
|
71
|
+
return t;
|
|
72
|
+
}, S = { ref: "container" };
|
|
73
|
+
function j(e, n, t, a, r, c) {
|
|
74
|
+
return m(), R("div", S, null, 512);
|
|
75
|
+
}
|
|
76
|
+
const x = /* @__PURE__ */ O(y, [["render", j]]);
|
|
77
|
+
function G(e = s) {
|
|
78
|
+
const n = d(e), t = _(n), { hub: a } = t.value;
|
|
79
|
+
function r(c) {
|
|
80
|
+
Object.assign(a, { ...c }), a.ready && requestAnimationFrame(() => t.value = { ...t.value });
|
|
81
|
+
}
|
|
82
|
+
return a.reflect = r, t;
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
x as GridSheet,
|
|
86
|
+
G as useHubReactive
|
|
87
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gridsheet/vue-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": ["dist"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "vite example",
|
|
10
|
+
"build": "vite build",
|
|
11
|
+
"preview": "vite preview"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"vue": "^3.3.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@gridsheet/preact-core": "^2.0.0-rc.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
21
|
+
"vue": "^3.4.21",
|
|
22
|
+
"vite": "^6.3.5",
|
|
23
|
+
"vite-plugin-dts": "^3.9.0"
|
|
24
|
+
}
|
|
25
|
+
}
|