@revolist/svelte-datagrid 4.21.11 → 4.22.1
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 +68 -4
- package/dist/lib/components/RevoGrid.d.ts +1 -0
- package/dist/lib/editor.adapter.d.ts +26 -0
- package/dist/lib/editor.d.ts +8 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/reactive-props.svelte.d.ts +5 -0
- package/dist/lib/renderer.d.ts +22 -0
- package/dist/lib/revogrid.d.ts +2 -0
- package/dist/lib/svelte/index.d.ts +2 -0
- package/dist/svelte-datagrid.js +390 -253
- package/dist/svelte-datagrid.umd.cjs +439 -282
- package/lib/editor.adapter.ts +79 -0
- package/lib/editor.ts +18 -0
- package/lib/index.ts +9 -1
- package/lib/reactive-props.svelte.ts +22 -0
- package/lib/renderer.ts +117 -0
- package/package.json +9 -9
- package/dist/index.d.ts +0 -7
package/README.md
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
<img src="https://badgen.net/bundlephobia/tree-shaking/@revolist/revogrid" alt="Tree shaking"/>
|
|
12
12
|
<img src="https://img.shields.io/bundlephobia/min/@revolist/revogrid" alt="Bundle size"/>
|
|
13
13
|
<img src="https://sonarcloud.io/api/project_badges/measure?project=revolist_revogrid&metric=alert_status" alt="Sonar Quality Gate"/>
|
|
14
|
+
<a href="https://github.com/revolist/revogrid/actions/workflows/unit.yml">
|
|
15
|
+
<img src="https://github.com/revolist/revogrid/actions/workflows/unit.yml/badge.svg" alt="Workflow status badge" loading="lazy" height="20">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/revolist/revogrid/actions/workflows/e2e.yml">
|
|
18
|
+
<img src="https://github.com/revolist/revogrid/actions/workflows/e2e.yml/badge.svg" alt="Workflow status badge" loading="lazy" height="20">
|
|
19
|
+
</a>
|
|
14
20
|
</p>
|
|
15
21
|
|
|
16
22
|
|
|
@@ -18,6 +24,9 @@
|
|
|
18
24
|
<p align="center">
|
|
19
25
|
Support Millions of cells and thousands of columns easy and efficiently for fast data rendering. Easy to use.
|
|
20
26
|
</p>
|
|
27
|
+
<p align="center">
|
|
28
|
+
Used by some of the largest companies in Europe and the United States.
|
|
29
|
+
</p>
|
|
21
30
|
|
|
22
31
|
<p align="center">
|
|
23
32
|
<a href="https://rv-grid.com/demo/">Demo and API</a> •
|
|
@@ -39,6 +48,8 @@ Support Millions of cells and thousands of columns easy and efficiently for fast
|
|
|
39
48
|
|
|
40
49
|
- **[Accessibility](https://rv-grid.com/guide/wcag)**: Follows WAI-ARIA best practices.
|
|
41
50
|
|
|
51
|
+
- **[RTL Support](https://rv-grid.com/guide/rtl)**: Comprehensive Right-to-Left language support for Arabic, Hebrew, Persian, and other RTL languages. Features automatic column reordering, proper text alignment, and layout adjustments for RTL interfaces.
|
|
52
|
+
|
|
42
53
|
- **[Keyboard Support](https://rv-grid.com/guide/defs#Keyboard)**:
|
|
43
54
|
- Excel-like focus for efficient navigation and editing.
|
|
44
55
|
- Seamless copy/paste from Excel, Google Sheets, or any other sheet format.
|
|
@@ -116,6 +127,8 @@ Support Millions of cells and thousands of columns easy and efficiently for fast
|
|
|
116
127
|
- Nested grids: Build a grid inside a grid, showcasing advanced editing options and user interactions for a more dynamic data presentation.
|
|
117
128
|
- Context Menu: Build context menus for any grid element - from cells to headers. Cut, copy, paste, add rows, modify columns, and more. Fully customizable with your own actions and behaviors.
|
|
118
129
|
|
|
130
|
+
- **[AI Agents and MCP](https://rv-grid.com/guide/mcp)**: Connect Codex, Cursor, Claude Code, and VS Code to version-aware RevoGrid docs, examples, migrations, feature availability, and typed API context.
|
|
131
|
+
|
|
119
132
|
|
|
120
133
|
> ⚠️ **Note**: Repository Notice: This repo is read-only. Create new issues at the [revogrid repo](https://github.com/revolist/revogrid)
|
|
121
134
|
|
|
@@ -143,18 +156,32 @@ yarn add @revolist/svelte-datagrid;
|
|
|
143
156
|
```svelte
|
|
144
157
|
// App.svelte
|
|
145
158
|
<script lang="ts">
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
import {
|
|
160
|
+
Editor,
|
|
161
|
+
RevoGrid,
|
|
162
|
+
Template,
|
|
163
|
+
type ColumnRegular,
|
|
164
|
+
type Editors,
|
|
165
|
+
} from '@revolist/svelte-datagrid';
|
|
166
|
+
import OperationCell from './OperationCell.svelte';
|
|
167
|
+
import OperationEditor from './OperationEditor.svelte';
|
|
168
|
+
|
|
169
|
+
const OPERATION_EDITOR = 'operation';
|
|
170
|
+
|
|
171
|
+
const source = [
|
|
148
172
|
{
|
|
149
173
|
name: '1',
|
|
150
174
|
details: 'Item 1',
|
|
175
|
+
operation: 'Edit',
|
|
151
176
|
},
|
|
152
177
|
{
|
|
153
178
|
name: '2',
|
|
154
179
|
details: 'Item 2',
|
|
180
|
+
operation: 'Edit',
|
|
155
181
|
},
|
|
156
182
|
];
|
|
157
|
-
|
|
183
|
+
|
|
184
|
+
const columns: ColumnRegular[] = [
|
|
158
185
|
{
|
|
159
186
|
prop: 'name',
|
|
160
187
|
name: 'First',
|
|
@@ -166,14 +193,28 @@ yarn add @revolist/svelte-datagrid;
|
|
|
166
193
|
prop: 'details',
|
|
167
194
|
name: 'Second',
|
|
168
195
|
},
|
|
196
|
+
{
|
|
197
|
+
prop: 'operation',
|
|
198
|
+
name: 'Operation',
|
|
199
|
+
cellTemplate: Template(OperationCell),
|
|
200
|
+
editor: OPERATION_EDITOR,
|
|
201
|
+
},
|
|
169
202
|
];
|
|
203
|
+
|
|
204
|
+
const editors: Editors = {
|
|
205
|
+
[OPERATION_EDITOR]: Editor(OperationEditor),
|
|
206
|
+
};
|
|
170
207
|
</script>
|
|
171
208
|
|
|
172
209
|
<main>
|
|
173
|
-
|
|
210
|
+
<RevoGrid {source} {columns} {editors}></RevoGrid>
|
|
174
211
|
</main>
|
|
175
212
|
```
|
|
176
213
|
|
|
214
|
+
`Template(Component)` is the explicit Svelte component bridge for `cellTemplate`.
|
|
215
|
+
Native RevoGrid templates like `cellTemplate(h, props)` still work unchanged.
|
|
216
|
+
Use `Editor(Component)` to register Svelte components as custom editors.
|
|
217
|
+
|
|
177
218
|
|
|
178
219
|
[Example and guide](https://rv-grid.com/guide/svelte/)
|
|
179
220
|
|
|
@@ -249,6 +290,29 @@ If you or your company would like to support the ongoing development of RevoGrid
|
|
|
249
290
|
Thank you for supporting RevoGrid! 🙏
|
|
250
291
|
|
|
251
292
|
|
|
293
|
+
## Testing
|
|
294
|
+
|
|
295
|
+
[](https://github.com/revolist/revogrid/actions/workflows/ci-unit.yml)
|
|
296
|
+
[](https://github.com/revolist/revogrid/actions/workflows/ci-e2e.yml)
|
|
297
|
+
|
|
298
|
+
RevoGrid is thoroughly tested to ensure reliability and stability.
|
|
299
|
+
|
|
300
|
+
| Suite | Command | Scope |
|
|
301
|
+
|---|---|---|
|
|
302
|
+
| Unit | `npm run test` | Services, utilities, pure logic |
|
|
303
|
+
| E2E (Playwright) | `npm run test:e2e` | Real browser rendering & interaction |
|
|
304
|
+
|
|
305
|
+
### E2E Tests
|
|
306
|
+
|
|
307
|
+
End-to-end tests use [@stencil/playwright](https://www.npmjs.com/package/@stencil/playwright) to run `<revo-grid>` in a real Chromium browser. The dev server starts automatically when you run:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
npm run test:e2e
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Test files live in `e2e/` and share helpers from `e2e/helpers.ts`:
|
|
314
|
+
|
|
315
|
+
|
|
252
316
|
## Contributing
|
|
253
317
|
|
|
254
318
|
By getting involved, you'll have the opportunity to enhance your skills, gain valuable experience, and make a significant impact on an innovative project. Your contribution, no matter how big or small, is valuable.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RevoGrid($$anchor: any, $$props: any): any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ColumnDataSchemaModel, EditCell, EditorBase, HyperFunc, VNode } from '@revolist/revogrid';
|
|
2
|
+
import { Component } from 'svelte';
|
|
3
|
+
import { SvelteElement } from './renderer';
|
|
4
|
+
export type EditorType = Partial<EditCell> & {
|
|
5
|
+
column: ColumnDataSchemaModel;
|
|
6
|
+
save: (value: any, preventFocus?: boolean) => void;
|
|
7
|
+
close: (focusNext?: boolean) => void;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
export declare class SvelteEditorAdapter implements EditorBase {
|
|
11
|
+
private EditorComponent;
|
|
12
|
+
column: ColumnDataSchemaModel;
|
|
13
|
+
private save;
|
|
14
|
+
private close;
|
|
15
|
+
element: SvelteElement | null;
|
|
16
|
+
editCell?: EditCell;
|
|
17
|
+
private renderedComponent;
|
|
18
|
+
constructor(EditorComponent: Component<EditorType>, column: ColumnDataSchemaModel, save: (value: any, preventFocus?: boolean) => void, close: (focusNext?: boolean) => void);
|
|
19
|
+
beforeUpdate(): void;
|
|
20
|
+
beforeDisconnect(): void;
|
|
21
|
+
beforeAutoSave(value?: any): any;
|
|
22
|
+
componentDidRender(): void;
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
getValue(): any;
|
|
25
|
+
render(h: HyperFunc<VNode>): VNode;
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorCtr } from '@revolist/revogrid';
|
|
2
|
+
import { Component } from 'svelte';
|
|
3
|
+
import { EditorType } from './editor.adapter';
|
|
4
|
+
export { SvelteEditorAdapter, type EditorType } from './editor.adapter';
|
|
5
|
+
/**
|
|
6
|
+
* Create an editor constructor from a Svelte component.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Editor: (EditorComponent: Component<EditorType>) => EditorCtr;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type * from '@revolist/revogrid';
|
|
2
|
+
export * from '@revolist/revogrid/loader';
|
|
3
|
+
export * from './revogrid';
|
|
4
|
+
export { Template, SvelteTemplateConstructor, type RenderedComponent, type SvelteCellProps, type SvelteElement, } from './renderer';
|
|
5
|
+
export { Editor, type EditorType, SvelteEditorAdapter } from './editor';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CellTemplateProp, ColumnDataSchemaModel, ColumnTemplateProp, HyperFunc, VNode } from '@revolist/revogrid';
|
|
2
|
+
import { Component } from 'svelte';
|
|
3
|
+
import { ReactiveProps } from './reactive-props.svelte';
|
|
4
|
+
export type SvelteCellProps = CellTemplateProp & {
|
|
5
|
+
addition?: any;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export interface SvelteElement extends HTMLElement {
|
|
9
|
+
_svelteTemplate?: RenderedComponent<any>;
|
|
10
|
+
}
|
|
11
|
+
export interface RenderedComponent<T extends Record<string, any>> {
|
|
12
|
+
component: Component<T>;
|
|
13
|
+
instance: Record<string, any>;
|
|
14
|
+
props: ReactiveProps<T>;
|
|
15
|
+
update: (newProps: T) => void;
|
|
16
|
+
destroy: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function SvelteTemplateConstructor<T extends Record<string, any>>(el: SvelteElement | null, SvelteComponent: Component<T>, initialProps: T, lastEl?: RenderedComponent<T> | null, context?: Map<any, any> | undefined): RenderedComponent<T> | null;
|
|
19
|
+
/**
|
|
20
|
+
* Render a Svelte component in a RevoGrid column cell template.
|
|
21
|
+
*/
|
|
22
|
+
export declare const Template: <TProps extends Record<string, any> = SvelteCellProps>(SvelteComponent: Component<TProps>, customProps?: Partial<TProps>) => (h: HyperFunc<VNode>, p: ColumnDataSchemaModel | ColumnTemplateProp | CellTemplateProp, addition?: any) => VNode;
|