@coffic/cosy-ui 0.3.45 → 0.3.48
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.
@@ -166,6 +166,12 @@ export interface Props {
|
|
166
166
|
*/
|
167
167
|
sidebarItems: SidebarSection[];
|
168
168
|
|
169
|
+
/**
|
170
|
+
* 是否显示侧边栏
|
171
|
+
* @default true
|
172
|
+
*/
|
173
|
+
showSidebar?: boolean;
|
174
|
+
|
169
175
|
/**
|
170
176
|
* 是否显示目录
|
171
177
|
* @default true
|
@@ -371,6 +377,7 @@ const {
|
|
371
377
|
logo = DefaultLogo,
|
372
378
|
logoHref = '/',
|
373
379
|
sidebarItems,
|
380
|
+
showSidebar = true,
|
374
381
|
showTableOfContents = true,
|
375
382
|
showHeader = true,
|
376
383
|
showFooter = true,
|
@@ -447,9 +454,10 @@ const sidebarTopClass = sidebarTopClasses[headerHeight];
|
|
447
454
|
currentLocale={currentLocale}
|
448
455
|
sticky={true}
|
449
456
|
basePath={basePath}
|
450
|
-
showSidebarToggle={true}
|
457
|
+
showSidebarToggle={showSidebar && true}
|
451
458
|
defaultSidebarOpen={defaultSidebarOpen}
|
452
459
|
height={headerHeight}
|
460
|
+
transition:persist
|
453
461
|
/>
|
454
462
|
)
|
455
463
|
}
|
@@ -457,14 +465,18 @@ const sidebarTopClass = sidebarTopClasses[headerHeight];
|
|
457
465
|
<div class="cosy:flex cosy:lg:flex-row cosy:flex-col cosy:flex-1">
|
458
466
|
<div class="cosy:flex cosy:flex-row cosy:flex-1 cosy:pb-0 cosy:min-h-screen">
|
459
467
|
<!-- 侧边栏容器 -->
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
+
{
|
469
|
+
showSidebar && (
|
470
|
+
<div class={`${sidebarTopClass} cosy:z-10 cosy:sticky cosy:bg-base-100 cosy:h-screen`}>
|
471
|
+
<Sidebar
|
472
|
+
sidebarItems={sidebarItems}
|
473
|
+
currentPath={currentPath}
|
474
|
+
debug={false}
|
475
|
+
class="cosy:lg:border-r cosy:border-b cosy:border-base-300 cosy:lg:border-b-0 cosy:lg:w-64 cosy:lg:shrink-0"
|
476
|
+
/>
|
477
|
+
</div>
|
478
|
+
)
|
479
|
+
}
|
468
480
|
|
469
481
|
<!-- 主内容区域 -->
|
470
482
|
<Main class="cosy:lg:py-8 cosy:py-4 cosy:w-full">
|
@@ -229,7 +229,7 @@ const spacerHeightClass = spacerHeightClasses[initialHeight];
|
|
229
229
|
? 'cosy:btn-sm'
|
230
230
|
: '',
|
231
231
|
]}>
|
232
|
-
<Image src={logo} alt="logo" class={logoSizeClass} />
|
232
|
+
<Image transition="none" src={logo} alt="logo" class={logoSizeClass} />
|
233
233
|
</Link>
|
234
234
|
</div>
|
235
235
|
|
package/dist/utils/path.ts
CHANGED
@@ -5,11 +5,8 @@
|
|
5
5
|
* @returns 是否匹配
|
6
6
|
*/
|
7
7
|
export function isPathMatch(currentPath: string, targetPath: string): boolean {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
|
14
|
-
return currentPath === targetPath || currentPath.endsWith(targetPath) || ("/" + currentPath).endsWith(targetPath);
|
8
|
+
return currentPath === targetPath ||
|
9
|
+
currentPath.endsWith(targetPath) ||
|
10
|
+
currentPath + "/" === targetPath ||
|
11
|
+
("/" + currentPath).endsWith(targetPath);
|
15
12
|
}
|