snap-records 1.1.9 → 1.1.11
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 +24 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,22 +47,30 @@ It supports server-side pagination, sorting, filtering, caching, multiple render
|
|
|
47
47
|
|
|
48
48
|
To quickly set up SnapRecords:
|
|
49
49
|
|
|
50
|
-
1. Install
|
|
50
|
+
1. **Install via NPM**:
|
|
51
51
|
```bash
|
|
52
|
-
npm install
|
|
52
|
+
npm install snap-records
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. **Include Styles**:
|
|
56
|
+
If using a bundler (Vite, Webpack, etc.):
|
|
57
|
+
```typescript
|
|
58
|
+
import 'snap-records/dist/snap-records.css';
|
|
53
59
|
```
|
|
54
|
-
|
|
60
|
+
Or via HTML:
|
|
55
61
|
```html
|
|
56
|
-
<link rel="stylesheet" href="/
|
|
62
|
+
<link rel="stylesheet" href="/node_modules/snap-records/dist/snap-records.css" />
|
|
57
63
|
```
|
|
58
|
-
|
|
64
|
+
|
|
65
|
+
3. **Create a container**:
|
|
59
66
|
```html
|
|
60
67
|
<div id="table-container"></div>
|
|
61
68
|
```
|
|
62
|
-
|
|
69
|
+
|
|
70
|
+
4. **Initialize SnapRecords**:
|
|
63
71
|
|
|
64
72
|
```typescript
|
|
65
|
-
import { SnapRecords, RowsPerPage } from '
|
|
73
|
+
import { SnapRecords, RowsPerPage } from 'snap-records';
|
|
66
74
|
|
|
67
75
|
new SnapRecords('table-container', {
|
|
68
76
|
url: 'https://api.example.com/data',
|
|
@@ -74,6 +82,12 @@ To quickly set up SnapRecords:
|
|
|
74
82
|
|
|
75
83
|
## Installation
|
|
76
84
|
|
|
85
|
+
### NPM (Recommended)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm install snap-records
|
|
89
|
+
```
|
|
90
|
+
|
|
77
91
|
### Prerequisites
|
|
78
92
|
|
|
79
93
|
- Node.js (version 20 or higher)
|
|
@@ -141,7 +155,7 @@ npm install dexie immer lru-cache
|
|
|
141
155
|
A minimal setup with a table displaying user data:
|
|
142
156
|
|
|
143
157
|
```typescript
|
|
144
|
-
import { SnapRecords, RowsPerPage } from '
|
|
158
|
+
import { SnapRecords, RowsPerPage } from 'snap-records';
|
|
145
159
|
|
|
146
160
|
const snapRecords = new SnapRecords('table-container', {
|
|
147
161
|
url: '/api/users',
|
|
@@ -156,7 +170,7 @@ const snapRecords = new SnapRecords('table-container', {
|
|
|
156
170
|
Enabling row selection, custom formatting, and disabling sorting on a column:
|
|
157
171
|
|
|
158
172
|
```typescript
|
|
159
|
-
import { SnapRecords, RenderType, RowsPerPage } from '
|
|
173
|
+
import { SnapRecords, RenderType, RowsPerPage } from 'snap-records';
|
|
160
174
|
|
|
161
175
|
const snapRecords = new SnapRecords('table-container', {
|
|
162
176
|
url: '/api/users',
|
|
@@ -179,7 +193,7 @@ console.log(api.getSelectedRows());
|
|
|
179
193
|
Using all available options:
|
|
180
194
|
|
|
181
195
|
```typescript
|
|
182
|
-
import { SnapRecords, RenderType, RowsPerPage } from '
|
|
196
|
+
import { SnapRecords, RenderType, RowsPerPage } from 'snap-records';
|
|
183
197
|
|
|
184
198
|
const snapRecords = new SnapRecords('table-container', {
|
|
185
199
|
url: 'https://api.example.com/data',
|