@katlux/toolkit 0.1.1-alpha.136 → 0.1.1-alpha.138
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/dist/module.json +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTree/KTree.logic.js +3 -1
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +93 -2
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +91 -2
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +1 -0
- package/dist/skills/katlux-components/components/KGantt.md +10 -1
- package/dist/skills/katlux-config/SKILL.md +7 -7
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
}>> & Readonly<{}>, {
|
|
28
28
|
disabled: boolean;
|
|
29
29
|
text: string;
|
|
30
|
-
position: "
|
|
30
|
+
position: "left" | "right" | "top" | "bottom";
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
33
33
|
export default _default;
|
|
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
}>> & Readonly<{}>, {
|
|
28
28
|
disabled: boolean;
|
|
29
29
|
text: string;
|
|
30
|
-
position: "
|
|
30
|
+
position: "left" | "right" | "top" | "bottom";
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
33
33
|
export default _default;
|
|
@@ -106,7 +106,9 @@ export function useKTreeLogic(props, emit) {
|
|
|
106
106
|
if (typeof props.dataProvider.updatePageData === "function") {
|
|
107
107
|
props.dataProvider.updatePageData();
|
|
108
108
|
}
|
|
109
|
-
if (typeof props.dataProvider.
|
|
109
|
+
if (props.dataProvider.isEncryptionEnabled && typeof props.dataProvider.loadPageData === "function") {
|
|
110
|
+
props.dataProvider.loadPageData();
|
|
111
|
+
} else if (typeof props.dataProvider.notify === "function") {
|
|
110
112
|
props.dataProvider.notify();
|
|
111
113
|
}
|
|
112
114
|
}
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
48
|
<script setup lang="ts">
|
|
49
|
-
import { computed } from 'vue'
|
|
49
|
+
import { computed, watch, shallowRef } from 'vue'
|
|
50
50
|
import { ADataProvider } from '@katlux/providers'
|
|
51
51
|
import type { IKDatatableAction } from '@katlux/providers'
|
|
52
52
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
@@ -95,6 +95,8 @@ const selectAll = computed({
|
|
|
95
95
|
set: (val) => emit('update:selectAll', val)
|
|
96
96
|
})
|
|
97
97
|
|
|
98
|
+
const rowIdKey = computed(() => (props.dataProvider as any)?.idKey || 'id')
|
|
99
|
+
|
|
98
100
|
const { pageData, virtualRows, loading: dpLoading, initialLoad: dpInitialLoad } = useDataProvider(props.dataProvider)
|
|
99
101
|
const pageRows = computed(() => pageData.value || [])
|
|
100
102
|
|
|
@@ -144,9 +146,98 @@ const {
|
|
|
144
146
|
}
|
|
145
147
|
})
|
|
146
148
|
|
|
149
|
+
const deliveredRowsCache = shallowRef<Map<any, any>>(new Map())
|
|
150
|
+
const requestedPages = new Set<number>()
|
|
151
|
+
|
|
152
|
+
// Track delivered page rows in persistent cache so previously loaded pages stay decrypted
|
|
153
|
+
watch(pageRows, (rows) => {
|
|
154
|
+
if (Array.isArray(rows) && rows.length > 0) {
|
|
155
|
+
const idKey = rowIdKey.value
|
|
156
|
+
const nextCache = new Map(deliveredRowsCache.value)
|
|
157
|
+
for (const r of rows) {
|
|
158
|
+
const id = (r as any)?.[idKey] ?? (r as any)?.id
|
|
159
|
+
if (id !== undefined && id !== null) {
|
|
160
|
+
nextCache.set(id, r)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
deliveredRowsCache.value = nextCache
|
|
164
|
+
}
|
|
165
|
+
}, { immediate: true, deep: true })
|
|
166
|
+
|
|
167
|
+
// Reset cache on filter or sort updates
|
|
168
|
+
watch([() => (props.dataProvider as any)?.filter, () => (props.dataProvider as any)?.sortList], () => {
|
|
169
|
+
deliveredRowsCache.value = new Map()
|
|
170
|
+
requestedPages.clear()
|
|
171
|
+
const curPage = (props.dataProvider as any)?.currentPage || 1
|
|
172
|
+
requestedPages.add(curPage)
|
|
173
|
+
}, { deep: true })
|
|
174
|
+
|
|
175
|
+
let isFetchingPage = false
|
|
176
|
+
const pageQueue: number[] = []
|
|
177
|
+
|
|
178
|
+
const processPageQueue = async () => {
|
|
179
|
+
if (isFetchingPage || pageQueue.length === 0) return
|
|
180
|
+
const nextPage = pageQueue.shift()!
|
|
181
|
+
const dp = props.dataProvider as any
|
|
182
|
+
if (dp && typeof dp.setCurrentPage === 'function') {
|
|
183
|
+
isFetchingPage = true
|
|
184
|
+
try {
|
|
185
|
+
dp.setCurrentPage(nextPage)
|
|
186
|
+
if (typeof dp.loadPageData === 'function') {
|
|
187
|
+
const res = dp.loadPageData()
|
|
188
|
+
if (res instanceof Promise) await res
|
|
189
|
+
}
|
|
190
|
+
} finally {
|
|
191
|
+
isFetchingPage = false
|
|
192
|
+
if (pageQueue.length > 0) {
|
|
193
|
+
processPageQueue()
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const queuePage = (page: number) => {
|
|
200
|
+
if (!requestedPages.has(page)) {
|
|
201
|
+
requestedPages.add(page)
|
|
202
|
+
pageQueue.push(page)
|
|
203
|
+
processPageQueue()
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const ensureVisiblePagesLoaded = () => {
|
|
208
|
+
if (!props.virtualScroll) return
|
|
209
|
+
const ps = (props.dataProvider as any)?.pageSize ?? 10
|
|
210
|
+
if (!ps || ps <= 0) return
|
|
211
|
+
|
|
212
|
+
const start = startIndex.value
|
|
213
|
+
const end = endIndex.value
|
|
214
|
+
const startPage = Math.floor(start / ps) + 1
|
|
215
|
+
const endPage = Math.floor(Math.max(0, end - 1) / ps) + 1
|
|
216
|
+
|
|
217
|
+
for (let p = startPage; p <= endPage; p++) {
|
|
218
|
+
queuePage(p)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
watch([startIndex, endIndex], () => {
|
|
223
|
+
ensureVisiblePagesLoaded()
|
|
224
|
+
}, { immediate: true })
|
|
225
|
+
|
|
147
226
|
const displayRows = computed(() => {
|
|
148
227
|
if (props.virtualScroll) {
|
|
149
|
-
|
|
228
|
+
const items = visibleItems.value
|
|
229
|
+
const cache = deliveredRowsCache.value
|
|
230
|
+
if (cache.size > 0) {
|
|
231
|
+
const idKey = rowIdKey.value
|
|
232
|
+
return items.map(item => {
|
|
233
|
+
const id = (item as any)?.[idKey] ?? (item as any)?.id
|
|
234
|
+
if (id !== undefined && id !== null && cache.has(id)) {
|
|
235
|
+
return cache.get(id)
|
|
236
|
+
}
|
|
237
|
+
return item
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
return items
|
|
150
241
|
}
|
|
151
242
|
return pageRows.value
|
|
152
243
|
})
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
</template>
|
|
90
90
|
|
|
91
91
|
<script setup lang="ts">
|
|
92
|
-
import { ref, computed, isRef } from 'vue'
|
|
92
|
+
import { ref, computed, isRef, watch, shallowRef } from 'vue'
|
|
93
93
|
import { ADataProvider } from '@katlux/providers'
|
|
94
94
|
import type { IKDatatableAction } from '@katlux/providers'
|
|
95
95
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
@@ -391,9 +391,98 @@ const {
|
|
|
391
391
|
}
|
|
392
392
|
})
|
|
393
393
|
|
|
394
|
+
const deliveredRowsCache = shallowRef<Map<any, any>>(new Map())
|
|
395
|
+
const requestedPages = new Set<number>()
|
|
396
|
+
|
|
397
|
+
// Track delivered page rows in persistent cache so previously loaded pages stay decrypted
|
|
398
|
+
watch(pageRows, (rows) => {
|
|
399
|
+
if (Array.isArray(rows) && rows.length > 0) {
|
|
400
|
+
const idKey = rowIdKey.value
|
|
401
|
+
const nextCache = new Map(deliveredRowsCache.value)
|
|
402
|
+
for (const r of rows) {
|
|
403
|
+
const id = (r as any)?.[idKey] ?? (r as any)?.id
|
|
404
|
+
if (id !== undefined && id !== null) {
|
|
405
|
+
nextCache.set(id, r)
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
deliveredRowsCache.value = nextCache
|
|
409
|
+
}
|
|
410
|
+
}, { immediate: true, deep: true })
|
|
411
|
+
|
|
412
|
+
// Reset cache on filter or sort updates
|
|
413
|
+
watch([dpFilter, () => (props.dataProvider as any)?.sortList], () => {
|
|
414
|
+
deliveredRowsCache.value = new Map()
|
|
415
|
+
requestedPages.clear()
|
|
416
|
+
const curPage = (props.dataProvider as any)?.currentPage || 1
|
|
417
|
+
requestedPages.add(curPage)
|
|
418
|
+
}, { deep: true })
|
|
419
|
+
|
|
420
|
+
let isFetchingPage = false
|
|
421
|
+
const pageQueue: number[] = []
|
|
422
|
+
|
|
423
|
+
const processPageQueue = async () => {
|
|
424
|
+
if (isFetchingPage || pageQueue.length === 0) return
|
|
425
|
+
const nextPage = pageQueue.shift()!
|
|
426
|
+
const dp = props.dataProvider as any
|
|
427
|
+
if (dp && typeof dp.setCurrentPage === 'function') {
|
|
428
|
+
isFetchingPage = true
|
|
429
|
+
try {
|
|
430
|
+
dp.setCurrentPage(nextPage)
|
|
431
|
+
if (typeof dp.loadPageData === 'function') {
|
|
432
|
+
const res = dp.loadPageData()
|
|
433
|
+
if (res instanceof Promise) await res
|
|
434
|
+
}
|
|
435
|
+
} finally {
|
|
436
|
+
isFetchingPage = false
|
|
437
|
+
if (pageQueue.length > 0) {
|
|
438
|
+
processPageQueue()
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const queuePage = (page: number) => {
|
|
445
|
+
if (!requestedPages.has(page)) {
|
|
446
|
+
requestedPages.add(page)
|
|
447
|
+
pageQueue.push(page)
|
|
448
|
+
processPageQueue()
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const ensureVisiblePagesLoaded = () => {
|
|
453
|
+
if (!props.virtualScroll) return
|
|
454
|
+
const ps = effectivePageSize.value
|
|
455
|
+
if (!ps || ps <= 0) return
|
|
456
|
+
|
|
457
|
+
const start = startIndex.value
|
|
458
|
+
const end = endIndex.value
|
|
459
|
+
const startPage = Math.floor(start / ps) + 1
|
|
460
|
+
const endPage = Math.floor(Math.max(0, end - 1) / ps) + 1
|
|
461
|
+
|
|
462
|
+
for (let p = startPage; p <= endPage; p++) {
|
|
463
|
+
queuePage(p)
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
watch([startIndex, endIndex], () => {
|
|
468
|
+
ensureVisiblePagesLoaded()
|
|
469
|
+
}, { immediate: true })
|
|
470
|
+
|
|
394
471
|
const displayRows = computed(() => {
|
|
395
472
|
if (props.virtualScroll) {
|
|
396
|
-
|
|
473
|
+
const items = visibleItems.value
|
|
474
|
+
const cache = deliveredRowsCache.value
|
|
475
|
+
if (cache.size > 0) {
|
|
476
|
+
const idKey = rowIdKey.value
|
|
477
|
+
return items.map(item => {
|
|
478
|
+
const id = (item as any)?.[idKey] ?? (item as any)?.id
|
|
479
|
+
if (id !== undefined && id !== null && cache.has(id)) {
|
|
480
|
+
return cache.get(id)
|
|
481
|
+
}
|
|
482
|
+
return item
|
|
483
|
+
})
|
|
484
|
+
}
|
|
485
|
+
return items
|
|
397
486
|
}
|
|
398
487
|
return pageRows.value
|
|
399
488
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
| Prop | Type | Default | Description |
|
|
4
4
|
| --- | --- | --- | --- |
|
|
5
5
|
| `dataProvider` | `ADataProvider` | **Required** | Resource data source |
|
|
6
|
-
| `columns` | `ITreeViewColumn[]`| **Required** | Left-side resource columns |
|
|
6
|
+
| `columns` | `ITreeViewColumn[]`| **Required** | Left-side resource columns (specify `width` like `'260px'` to maintain a fixed, stable column width across timeline zoom operations) |
|
|
7
7
|
| `treeColumnIndex` | `number` | `0` | Column index displaying the hierarchical tree expander |
|
|
8
8
|
| `startDate` | `Date \| string` | Now - 15d | Timeline start date (date mode) |
|
|
9
9
|
| `endDate` | `Date \| string` | Now + 45d | Timeline end date (date mode) |
|
|
@@ -27,6 +27,14 @@
|
|
|
27
27
|
| `viewportHeight` | `number` | `500` | Height in px of the scrollable viewport |
|
|
28
28
|
| `buffer` | `number` | `5` | Number of off-screen buffer rows rendered above/below |
|
|
29
29
|
|
|
30
|
+
- **Slots**:
|
|
31
|
+
| Slot | Description |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `#task` | Custom template for timeline task bars (Props: `task`, `resource`) |
|
|
34
|
+
| `#timeline-header` | Custom template for the timeline ruler/header |
|
|
35
|
+
| `#cell-[fieldName]` | Custom cell renderer for resource columns (e.g. `#cell-resource`) |
|
|
36
|
+
| `#header-[fieldName]` | Custom header renderer for resource columns |
|
|
37
|
+
|
|
30
38
|
- **Events**:
|
|
31
39
|
| Event | Payload | Description |
|
|
32
40
|
| --- | --- | --- |
|
|
@@ -55,6 +63,7 @@ KModal(v-model="isModalOpen" :title="activeTask?.title || 'Task Details'")
|
|
|
55
63
|
p(v-if="activeTask") Resource: \#{{ activeRow?.name }}
|
|
56
64
|
```
|
|
57
65
|
```typescript
|
|
66
|
+
const columns = [{ field: 'resource', header: 'Resource', width: '260px' }]
|
|
58
67
|
const isModalOpen = ref(false)
|
|
59
68
|
const isContextMenuOpen = ref(false)
|
|
60
69
|
const menuPos = ref({ x: 0, y: 0 })
|
|
@@ -104,13 +104,13 @@ export default defineAppConfig({
|
|
|
104
104
|
|
|
105
105
|
| Package Name | Current Version | Description | Installation Command |
|
|
106
106
|
| --- | --- | --- | --- |
|
|
107
|
-
| `@katlux/toolkit` | `0.1.1-alpha.
|
|
108
|
-
| `@katlux/providers` | `0.1.1-alpha.
|
|
109
|
-
| `@katlux/preset-modern` | `0.1.1-alpha.
|
|
110
|
-
| `@katlux/preset-dark` | `0.1.1-alpha.
|
|
111
|
-
| `@katlux/block-charts` | `0.1.1-alpha.
|
|
112
|
-
| `@katlux/block-ecommerce` | `0.1.1-alpha.
|
|
113
|
-
| `@katlux/mcp` | `0.1.0-alpha.
|
|
107
|
+
| `@katlux/toolkit` | `0.1.1-alpha.137` | Core Nuxt module, UI toolkit, presets, and components | `npm install @katlux/toolkit@alpha` |
|
|
108
|
+
| `@katlux/providers` | `0.1.1-alpha.124` | Core data providers, client caching, and state structures | `npm install @katlux/providers@alpha` |
|
|
109
|
+
| `@katlux/preset-modern` | `0.1.1-alpha.112` | Modern design preset and styling variables | `npm install @katlux/preset-modern@alpha` |
|
|
110
|
+
| `@katlux/preset-dark` | `0.1.1-alpha.43` | Sleek Dark Mode design preset | `npm install @katlux/preset-dark@alpha` |
|
|
111
|
+
| `@katlux/block-charts` | `0.1.1-alpha.112` | Pre-built charting block components | `npm install @katlux/block-charts@alpha` |
|
|
112
|
+
| `@katlux/block-ecommerce` | `0.1.1-alpha.112` | Pre-built eCommerce block components | `npm install @katlux/block-ecommerce@alpha` |
|
|
113
|
+
| `@katlux/mcp` | `0.1.0-alpha.16` | Model Context Protocol server for AI assistant integration | `npm install @katlux/mcp@alpha` |
|
|
114
114
|
|
|
115
115
|
> [!NOTE]
|
|
116
116
|
> Katlux packages are currently published under the `@alpha` tag on NPM. Always append `@alpha` or the specific version tag when adding dependencies.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katlux/toolkit",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.138",
|
|
4
4
|
"description": "Core UI toolkit and utilities for the Katlux ecosystem",
|
|
5
5
|
"author": "Katlux",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"**/*.sass"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@katlux/providers": "^0.1.1-alpha.
|
|
57
|
+
"@katlux/providers": "^0.1.1-alpha.125",
|
|
58
58
|
"@nuxt/kit": "^3.12.0",
|
|
59
59
|
"@nuxtjs/i18n": "^10.4.0",
|
|
60
60
|
"pug": "^3.0.0",
|