ketekny-ui-kit 1.0.142 → 1.0.143
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/package.json
CHANGED
|
@@ -158,6 +158,7 @@ export default {
|
|
|
158
158
|
const favorites = []
|
|
159
159
|
const collect = (items) => {
|
|
160
160
|
for (const item of items) {
|
|
161
|
+
if (item?.isDivider) continue
|
|
161
162
|
if (item?.children?.length) {
|
|
162
163
|
collect(item.children)
|
|
163
164
|
continue
|
|
@@ -329,7 +330,7 @@ export default {
|
|
|
329
330
|
(routeFullPath && itemPath === routeFullPath) ||
|
|
330
331
|
(routePath && normalizedItemPath === routePath)
|
|
331
332
|
|
|
332
|
-
if (matchesPath) {
|
|
333
|
+
if (matchesPath && item.selectable !== false) {
|
|
333
334
|
return {
|
|
334
335
|
id: item.id,
|
|
335
336
|
parentIds,
|
|
@@ -350,8 +351,9 @@ export default {
|
|
|
350
351
|
return
|
|
351
352
|
}
|
|
352
353
|
|
|
353
|
-
if (!this.activeId
|
|
354
|
-
|
|
354
|
+
if (!this.activeId) {
|
|
355
|
+
const firstSelectableItem = this.mainMenu.find((item) => !item.isDivider && item.selectable !== false)
|
|
356
|
+
if (firstSelectableItem?.id) this.activeId = firstSelectableItem.id
|
|
355
357
|
}
|
|
356
358
|
},
|
|
357
359
|
toggleCollapsed() {
|
|
@@ -375,6 +377,7 @@ export default {
|
|
|
375
377
|
this.openIds = new Set([...this.openIds, id])
|
|
376
378
|
},
|
|
377
379
|
select(itemOrId) {
|
|
380
|
+
if (typeof itemOrId !== 'string' && (itemOrId?.isDivider || itemOrId?.selectable === false)) return
|
|
378
381
|
const id = typeof itemOrId === 'string' ? itemOrId : itemOrId?.id
|
|
379
382
|
if (!id) return
|
|
380
383
|
this.activeId = id
|
|
@@ -399,7 +402,8 @@ export default {
|
|
|
399
402
|
filterTree(nodes, q) {
|
|
400
403
|
const result = []
|
|
401
404
|
for (const node of nodes) {
|
|
402
|
-
|
|
405
|
+
if (node.isDivider) continue
|
|
406
|
+
const matches = String(node.label ?? '').toLowerCase().includes(q)
|
|
403
407
|
const matchedChildren = node.children ? this.filterTree(node.children, q) : []
|
|
404
408
|
if (matches) result.push(node)
|
|
405
409
|
else if (matchedChildren.length) result.push({ ...node, children: matchedChildren })
|
|
@@ -30,6 +30,9 @@ export default {
|
|
|
30
30
|
hasChildren() {
|
|
31
31
|
return Array.isArray(this.item.children) && this.item.children.length > 0
|
|
32
32
|
},
|
|
33
|
+
isDivider() {
|
|
34
|
+
return this.item.isDivider === true
|
|
35
|
+
},
|
|
33
36
|
isOpen() {
|
|
34
37
|
return this.openIds.has(this.item.id)
|
|
35
38
|
},
|
|
@@ -41,7 +44,7 @@ export default {
|
|
|
41
44
|
return this.hasChildren && this.containsActive(this.item)
|
|
42
45
|
},
|
|
43
46
|
isActiveLeaf() {
|
|
44
|
-
return !this.hasChildren && this.item.id === this.activeId
|
|
47
|
+
return !this.hasChildren && this.item.selectable !== false && this.item.id === this.activeId
|
|
45
48
|
},
|
|
46
49
|
isActive() {
|
|
47
50
|
return this.isActiveLeaf || this.isActiveTrail
|
|
@@ -82,7 +85,7 @@ export default {
|
|
|
82
85
|
},
|
|
83
86
|
methods: {
|
|
84
87
|
containsActive(node) {
|
|
85
|
-
if (node.id === this.activeId) return true
|
|
88
|
+
if (node.selectable !== false && node.id === this.activeId) return true
|
|
86
89
|
if (!node.children) return false
|
|
87
90
|
return node.children.some((child) => this.containsActive(child))
|
|
88
91
|
},
|
|
@@ -125,7 +128,18 @@ export default {
|
|
|
125
128
|
</script>
|
|
126
129
|
|
|
127
130
|
<template>
|
|
128
|
-
<li
|
|
131
|
+
<li v-if="isDivider" role="separator" :aria-label="item.label || undefined" class="py-2">
|
|
132
|
+
<div v-if="isCollapsedTop" class="mx-2 border-t border-[var(--sidebar-border)]" />
|
|
133
|
+
<div v-else class="flex items-center gap-2 px-3">
|
|
134
|
+
<span class="h-px flex-1 bg-[var(--sidebar-border)]" />
|
|
135
|
+
<span v-if="item.label" class="shrink-0 text-xs font-medium uppercase tracking-wider text-[var(--sidebar-text-muted)]">
|
|
136
|
+
{{ item.label }}
|
|
137
|
+
</span>
|
|
138
|
+
<span v-if="item.label" class="h-px flex-1 bg-[var(--sidebar-border)]" />
|
|
139
|
+
</div>
|
|
140
|
+
</li>
|
|
141
|
+
|
|
142
|
+
<li v-else :class="isCollapsedTop ? 'group/fly relative' : ''">
|
|
129
143
|
<button
|
|
130
144
|
type="button"
|
|
131
145
|
:style="isCollapsedTop ? undefined : indentStyle"
|