@kikiloaw/simple-table 1.1.8 → 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 +3 -3
- package/package.json +1 -1
- package/src/SimpleTable.vue +10 -3
package/README.md
CHANGED
|
@@ -1417,9 +1417,9 @@ tableRef.value?.refresh()
|
|
|
1417
1417
|
|
|
1418
1418
|
| Method | Parameters | Description |
|
|
1419
1419
|
|--------|------------|-------------|
|
|
1420
|
-
| `refresh()` | None | Resets
|
|
1421
|
-
| `fetchData(params)` | `params
|
|
1422
|
-
| `clearCache()` |
|
|
1420
|
+
| `refresh()` | None | **Resets to Page 1** and refetches data. Use for "Reset" actions. |
|
|
1421
|
+
| `fetchData(params)` | `params?: Object` | Refetches **current page** (if no params). Pass params to override (e.g. `{ page: 1 }`). |
|
|
1422
|
+
| `clearCache(scope)` | `scope?: 'all' \| 'current'` | Clears cache. Default `'all'` clears everything. Pass `'current'` to clear only active page state. |
|
|
1423
1423
|
|
|
1424
1424
|
---
|
|
1425
1425
|
|
package/package.json
CHANGED
package/src/SimpleTable.vue
CHANGED
|
@@ -194,8 +194,13 @@ function getCacheKey(): string {
|
|
|
194
194
|
})
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
function clearCache() {
|
|
198
|
-
|
|
197
|
+
function clearCache(scope: 'all' | 'current' = 'all') {
|
|
198
|
+
if (scope === 'current') {
|
|
199
|
+
const key = getCacheKey()
|
|
200
|
+
responseCache.value.delete(key)
|
|
201
|
+
} else {
|
|
202
|
+
responseCache.value.clear()
|
|
203
|
+
}
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
// Internal data state to handle both props updates and ajax updates
|
|
@@ -336,8 +341,10 @@ const paginationMeta = computed(() => {
|
|
|
336
341
|
})
|
|
337
342
|
|
|
338
343
|
// -- Computed: Page Numbers for Pagination --
|
|
344
|
+
const { width } = useWindowSize()
|
|
345
|
+
|
|
339
346
|
const pageNumbers = computed(() => {
|
|
340
|
-
const { width } = useWindowSize()
|
|
347
|
+
// const { width } = useWindowSize() // MOVED OUTSIDE
|
|
341
348
|
const isMobile = width.value < 640
|
|
342
349
|
const isExtraSmall = width.value < 550
|
|
343
350
|
|