@sci-grid/vue 1.0.1 → 1.0.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.
- package/package.json +13 -2
- package/CHANGELOG.md +0 -8
- package/src/index.test.ts +0 -21
- package/src/index.ts +0 -49
- package/src/test-setup.ts +0 -9
- package/tsconfig.json +0 -10
- package/vite.config.ts +0 -25
package/package.json
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sci-grid/vue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
8
19
|
"peerDependencies": {
|
|
9
20
|
"vue": ">=3.0.0",
|
|
10
|
-
"@sci-grid/core": "1.0.
|
|
21
|
+
"@sci-grid/core": "1.0.4"
|
|
11
22
|
},
|
|
12
23
|
"devDependencies": {
|
|
13
24
|
"vue": "^3.5.0",
|
package/CHANGELOG.md
DELETED
package/src/index.test.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { render } from '@testing-library/vue';
|
|
3
|
-
import { SciGridVue } from './index.js';
|
|
4
|
-
|
|
5
|
-
describe('SciGrid Vue Adapter', () => {
|
|
6
|
-
const mockProvider = {
|
|
7
|
-
getRowCount: () => 10,
|
|
8
|
-
getColumnCount: () => 5,
|
|
9
|
-
getCellData: (r: number, c: number) => `Data ${r},${c}`,
|
|
10
|
-
getHeader: (c: number) => ({ name: `Col ${c}` })
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
it('should render successfully', () => {
|
|
14
|
-
const { container } = render(SciGridVue, {
|
|
15
|
-
props: {
|
|
16
|
-
provider: mockProvider
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
expect(container.querySelector('canvas')).toBeDefined();
|
|
20
|
-
});
|
|
21
|
-
});
|
package/src/index.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ref, onMounted, onUnmounted, watch, defineComponent, h, type PropType } from 'vue';
|
|
2
|
-
import { SciGrid } from '@sci-grid/core';
|
|
3
|
-
import type { GridConfig, IDataGridProvider } from '@sci-grid/core';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* SciGrid Vue 3 Adapter
|
|
7
|
-
* Premium data grid integration for Vue applications.
|
|
8
|
-
*/
|
|
9
|
-
export const SciGridVue = defineComponent({
|
|
10
|
-
name: 'SciGridVue',
|
|
11
|
-
props: {
|
|
12
|
-
provider: {
|
|
13
|
-
type: Object as PropType<IDataGridProvider>,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
config: {
|
|
17
|
-
type: Object as PropType<Partial<GridConfig>>,
|
|
18
|
-
default: () => ({})
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
setup(props: { provider: IDataGridProvider; config: Partial<GridConfig> }) {
|
|
22
|
-
const containerRef = ref<HTMLElement | null>(null);
|
|
23
|
-
let grid: SciGrid | null = null;
|
|
24
|
-
|
|
25
|
-
onMounted(() => {
|
|
26
|
-
if (containerRef.value) {
|
|
27
|
-
grid = new SciGrid(containerRef.value, props.provider, props.config);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
onUnmounted(() => {
|
|
32
|
-
grid?.destroy();
|
|
33
|
-
grid = null;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
watch(() => props.provider, (newProvider: IDataGridProvider) => {
|
|
37
|
-
grid?.updateProvider(newProvider);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
watch(() => props.config, (newConfig: Partial<GridConfig>) => {
|
|
41
|
-
grid?.updateConfig(newConfig);
|
|
42
|
-
}, { deep: true });
|
|
43
|
-
|
|
44
|
-
return () => h('div', {
|
|
45
|
-
ref: containerRef,
|
|
46
|
-
style: { width: '100%', height: '100%' }
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
package/src/test-setup.ts
DELETED
package/tsconfig.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import vue from '@vitejs/plugin-vue';
|
|
3
|
-
import dts from 'vite-plugin-dts';
|
|
4
|
-
import { resolve } from 'path';
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [vue(), dts()],
|
|
8
|
-
build: {
|
|
9
|
-
lib: {
|
|
10
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
11
|
-
name: 'SciGridVue',
|
|
12
|
-
fileName: 'index',
|
|
13
|
-
formats: ['es', 'cjs']
|
|
14
|
-
},
|
|
15
|
-
rollupOptions: {
|
|
16
|
-
external: ['vue', '@sci-grid/core'],
|
|
17
|
-
output: {
|
|
18
|
-
globals: {
|
|
19
|
-
vue: 'Vue',
|
|
20
|
-
'@sci-grid/core': 'SciGrid'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|