@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 CHANGED
@@ -1417,9 +1417,9 @@ tableRef.value?.refresh()
1417
1417
 
1418
1418
  | Method | Parameters | Description |
1419
1419
  |--------|------------|-------------|
1420
- | `refresh()` | None | Resets page to 1 and refetches data |
1421
- | `fetchData(params)` | `params: Object` | Fetch data with specific custom parameters |
1422
- | `clearCache()` | None | Clears the client-side response cache |
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kikiloaw/simple-table",
3
- "version": "1.1.8",
3
+ "version": "1.1.11",
4
4
  "description": "A lightweight, dependency-light DataTable component for Vue 3 with Tailwind CSS",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -194,8 +194,13 @@ function getCacheKey(): string {
194
194
  })
195
195
  }
196
196
 
197
- function clearCache() {
198
- responseCache.value.clear()
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