@jackbo_vip/admin-kit 1.0.22 → 1.0.24
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/bem.scss +34 -0
- package/dist/constants.scss +5 -0
- package/dist/index.d.ts +722 -0
- package/package.json +3 -1
package/dist/bem.scss
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@forward './constants';
|
|
2
|
+
|
|
3
|
+
@mixin b($block) {
|
|
4
|
+
$B: $namespace + '-' + $block !global;
|
|
5
|
+
|
|
6
|
+
.#{$B} {
|
|
7
|
+
@content;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@mixin e($name) {
|
|
12
|
+
@at-root {
|
|
13
|
+
&#{$element-separator}#{$name} {
|
|
14
|
+
@content;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@mixin m($name) {
|
|
20
|
+
@at-root {
|
|
21
|
+
&#{$modifier-separator}#{$name} {
|
|
22
|
+
@content;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// block__element.is-active {}
|
|
28
|
+
@mixin is($state, $prefix: $state-prefix) {
|
|
29
|
+
@at-root {
|
|
30
|
+
&.#{$prefix}-#{$state} {
|
|
31
|
+
@content;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -546,6 +546,728 @@ export { SCROLL_FIXED_CLASS, useForwardPriorityValues, useIsMobile, useLayoutCon
|
|
|
546
546
|
export type { UseNamespaceReturn };
|
|
547
547
|
|
|
548
548
|
|
|
549
|
+
// ==========================================
|
|
550
|
+
// From @admin-kit/preferences
|
|
551
|
+
// ==========================================
|
|
552
|
+
export const {
|
|
553
|
+
getPreferences,
|
|
554
|
+
updatePreferences,
|
|
555
|
+
resetPreferences,
|
|
556
|
+
clearCache,
|
|
557
|
+
initPreferences,
|
|
558
|
+
} = preferencesManager;
|
|
559
|
+
|
|
560
|
+
export const preferences: Preferences = getPreferences();
|
|
561
|
+
|
|
562
|
+
export { preferencesManager };
|
|
563
|
+
|
|
564
|
+
interface BuiltinThemePreset {
|
|
565
|
+
color: string;
|
|
566
|
+
darkPrimaryColor?: string;
|
|
567
|
+
primaryColor?: string;
|
|
568
|
+
type: BuiltinThemeType;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const BUILT_IN_THEME_PRESETS: BuiltinThemePreset[] = [
|
|
572
|
+
{
|
|
573
|
+
color: 'hsl(212 100% 45%)',
|
|
574
|
+
type: 'default',
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
color: 'hsl(245 82% 67%)',
|
|
578
|
+
type: 'violet',
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
color: 'hsl(347 77% 60%)',
|
|
582
|
+
type: 'pink',
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
color: 'hsl(42 84% 61%)',
|
|
586
|
+
type: 'yellow',
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
color: 'hsl(231 98% 65%)',
|
|
590
|
+
type: 'sky-blue',
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
color: 'hsl(161 90% 43%)',
|
|
594
|
+
type: 'green',
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
color: 'hsl(240 5% 26%)',
|
|
598
|
+
darkPrimaryColor: 'hsl(0 0% 98%)',
|
|
599
|
+
primaryColor: 'hsl(240 5.9% 10%)',
|
|
600
|
+
type: 'zinc',
|
|
601
|
+
},
|
|
602
|
+
|
|
603
|
+
{
|
|
604
|
+
color: 'hsl(181 84% 32%)',
|
|
605
|
+
type: 'deep-green',
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
{
|
|
609
|
+
color: 'hsl(211 91% 39%)',
|
|
610
|
+
type: 'deep-blue',
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
color: 'hsl(18 89% 40%)',
|
|
614
|
+
type: 'orange',
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
color: 'hsl(0 75% 42%)',
|
|
618
|
+
type: 'rose',
|
|
619
|
+
},
|
|
620
|
+
|
|
621
|
+
{
|
|
622
|
+
color: 'hsl(0 0% 25%)',
|
|
623
|
+
darkPrimaryColor: 'hsl(0 0% 98%)',
|
|
624
|
+
primaryColor: 'hsl(240 5.9% 10%)',
|
|
625
|
+
type: 'neutral',
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
color: 'hsl(215 25% 27%)',
|
|
629
|
+
darkPrimaryColor: 'hsl(0 0% 98%)',
|
|
630
|
+
primaryColor: 'hsl(240 5.9% 10%)',
|
|
631
|
+
type: 'slate',
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
color: 'hsl(217 19% 27%)',
|
|
635
|
+
darkPrimaryColor: 'hsl(0 0% 98%)',
|
|
636
|
+
primaryColor: 'hsl(240 5.9% 10%)',
|
|
637
|
+
type: 'gray',
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
color: '',
|
|
641
|
+
type: 'custom',
|
|
642
|
+
},
|
|
643
|
+
];
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* 时区选项
|
|
647
|
+
*/
|
|
648
|
+
const DEFAULT_TIME_ZONE_OPTIONS: TimezoneOption[] = [
|
|
649
|
+
{
|
|
650
|
+
offset: -5,
|
|
651
|
+
timezone: 'America/New_York',
|
|
652
|
+
label: 'America/New_York(GMT-5)',
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
offset: 0,
|
|
656
|
+
timezone: 'Europe/London',
|
|
657
|
+
label: 'Europe/London(GMT0)',
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
offset: 8,
|
|
661
|
+
timezone: 'Asia/Shanghai',
|
|
662
|
+
label: 'Asia/Shanghai(GMT+8)',
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
offset: 9,
|
|
666
|
+
timezone: 'Asia/Tokyo',
|
|
667
|
+
label: 'Asia/Tokyo(GMT+9)',
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
offset: 9,
|
|
671
|
+
timezone: 'Asia/Seoul',
|
|
672
|
+
label: 'Asia/Seoul(GMT+9)',
|
|
673
|
+
},
|
|
674
|
+
];
|
|
675
|
+
|
|
676
|
+
export const COLOR_PRESETS = [...BUILT_IN_THEME_PRESETS].slice(0, 7);
|
|
677
|
+
|
|
678
|
+
export { BUILT_IN_THEME_PRESETS, DEFAULT_TIME_ZONE_OPTIONS };
|
|
679
|
+
|
|
680
|
+
export type { BuiltinThemePreset };
|
|
681
|
+
AccessModeType,
|
|
682
|
+
AuthPageLayoutType,
|
|
683
|
+
BreadcrumbStyleType,
|
|
684
|
+
BuiltinThemeType,
|
|
685
|
+
ContentCompactType,
|
|
686
|
+
DeepPartial,
|
|
687
|
+
LayoutHeaderMenuAlignType,
|
|
688
|
+
LayoutHeaderModeType,
|
|
689
|
+
LayoutType,
|
|
690
|
+
LoginExpiredModeType,
|
|
691
|
+
NavigationStyleType,
|
|
692
|
+
PageTransitionType,
|
|
693
|
+
PreferencesButtonPositionType,
|
|
694
|
+
TabsStyleType,
|
|
695
|
+
ThemeModeType,
|
|
696
|
+
} from '@admin-kit/typings';
|
|
697
|
+
|
|
698
|
+
type SupportedLanguagesType = 'en-US' | 'zh-CN';
|
|
699
|
+
|
|
700
|
+
interface AppPreferences {
|
|
701
|
+
/** 权限模式 */
|
|
702
|
+
accessMode: AccessModeType;
|
|
703
|
+
/** 登录注册页面布局 */
|
|
704
|
+
authPageLayout: AuthPageLayoutType;
|
|
705
|
+
/** 检查更新轮询时间 */
|
|
706
|
+
checkUpdatesInterval: number;
|
|
707
|
+
/** 是否开启灰色模式 */
|
|
708
|
+
colorGrayMode: boolean;
|
|
709
|
+
/** 是否开启色弱模式 */
|
|
710
|
+
colorWeakMode: boolean;
|
|
711
|
+
/** 是否开启紧凑模式 */
|
|
712
|
+
compact: boolean;
|
|
713
|
+
/** 是否开启内容紧凑模式 */
|
|
714
|
+
contentCompact: ContentCompactType;
|
|
715
|
+
/** 内容紧凑宽度 */
|
|
716
|
+
contentCompactWidth: number;
|
|
717
|
+
/** 内容内边距 */
|
|
718
|
+
contentPadding: number;
|
|
719
|
+
/** 内容底部内边距 */
|
|
720
|
+
contentPaddingBottom: number;
|
|
721
|
+
/** 内容左侧内边距 */
|
|
722
|
+
contentPaddingLeft: number;
|
|
723
|
+
/** 内容右侧内边距 */
|
|
724
|
+
contentPaddingRight: number;
|
|
725
|
+
/** 内容顶部内边距 */
|
|
726
|
+
contentPaddingTop: number;
|
|
727
|
+
// /** 应用默认头像 */
|
|
728
|
+
defaultAvatar: string;
|
|
729
|
+
/** 默认首页地址 */
|
|
730
|
+
defaultHomePath: string;
|
|
731
|
+
// /** 开启动态标题 */
|
|
732
|
+
dynamicTitle: boolean;
|
|
733
|
+
/** 是否开启检查更新 */
|
|
734
|
+
enableCheckUpdates: boolean;
|
|
735
|
+
/** 是否显示偏好设置 */
|
|
736
|
+
enablePreferences: boolean;
|
|
737
|
+
/**
|
|
738
|
+
* @zh_CN 是否开启refreshToken
|
|
739
|
+
*/
|
|
740
|
+
enableRefreshToken: boolean;
|
|
741
|
+
/**
|
|
742
|
+
* @zh_CN 是否开启首选项导航栏吸顶效果
|
|
743
|
+
*/
|
|
744
|
+
enableStickyPreferencesNavigationBar: boolean;
|
|
745
|
+
/** 是否移动端 */
|
|
746
|
+
isMobile: boolean;
|
|
747
|
+
/** 布局方式 */
|
|
748
|
+
layout: LayoutType;
|
|
749
|
+
/** 支持的语言 */
|
|
750
|
+
locale: SupportedLanguagesType;
|
|
751
|
+
/** 登录过期模式 */
|
|
752
|
+
loginExpiredMode: LoginExpiredModeType;
|
|
753
|
+
/** 应用名 */
|
|
754
|
+
name: string;
|
|
755
|
+
/** 偏好设置按钮位置 */
|
|
756
|
+
preferencesButtonPosition: PreferencesButtonPositionType;
|
|
757
|
+
/**
|
|
758
|
+
* @zh_CN 是否开启水印
|
|
759
|
+
*/
|
|
760
|
+
watermark: boolean;
|
|
761
|
+
/**
|
|
762
|
+
* @zh_CN 水印文案
|
|
763
|
+
*/
|
|
764
|
+
watermarkContent: string;
|
|
765
|
+
/** z-index */
|
|
766
|
+
zIndex: number;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
interface BreadcrumbPreferences {
|
|
770
|
+
/** 面包屑是否启用 */
|
|
771
|
+
enable: boolean;
|
|
772
|
+
/** 面包屑是否只有一个时隐藏 */
|
|
773
|
+
hideOnlyOne: boolean;
|
|
774
|
+
/** 面包屑首页图标是否可见 */
|
|
775
|
+
showHome: boolean;
|
|
776
|
+
/** 面包屑图标是否可见 */
|
|
777
|
+
showIcon: boolean;
|
|
778
|
+
/** 面包屑风格 */
|
|
779
|
+
styleType: BreadcrumbStyleType;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
interface CopyrightPreferences {
|
|
783
|
+
/** 版权公司名 */
|
|
784
|
+
companyName: string;
|
|
785
|
+
/** 版权公司名链接 */
|
|
786
|
+
companySiteLink: string;
|
|
787
|
+
/** 版权日期 */
|
|
788
|
+
date: string;
|
|
789
|
+
/** 版权是否可见 */
|
|
790
|
+
enable: boolean;
|
|
791
|
+
/** 备案号 */
|
|
792
|
+
icp: string;
|
|
793
|
+
/** 备案号链接 */
|
|
794
|
+
icpLink: string;
|
|
795
|
+
/** 设置面板是否显示*/
|
|
796
|
+
settingShow?: boolean;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
interface FooterPreferences {
|
|
800
|
+
/** 底栏是否可见 */
|
|
801
|
+
enable: boolean;
|
|
802
|
+
/** 底栏是否固定 */
|
|
803
|
+
fixed: boolean;
|
|
804
|
+
/** 底栏高度 */
|
|
805
|
+
height: number;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
interface HeaderPreferences {
|
|
809
|
+
/** 顶栏是否启用 */
|
|
810
|
+
enable: boolean;
|
|
811
|
+
/** 顶栏高度 */
|
|
812
|
+
height: number;
|
|
813
|
+
/** 顶栏是否隐藏,css-隐藏 */
|
|
814
|
+
hidden: boolean;
|
|
815
|
+
/** 顶栏菜单位置 */
|
|
816
|
+
menuAlign: LayoutHeaderMenuAlignType;
|
|
817
|
+
/** header显示模式 */
|
|
818
|
+
mode: LayoutHeaderModeType;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
interface LogoPreferences {
|
|
822
|
+
/** logo是否可见 */
|
|
823
|
+
enable: boolean;
|
|
824
|
+
/** logo图片适应方式 */
|
|
825
|
+
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
826
|
+
/** logo地址 */
|
|
827
|
+
source: string;
|
|
828
|
+
/** 暗色主题logo地址 (可选,若不设置则使用 source) */
|
|
829
|
+
sourceDark?: string;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
interface NavigationPreferences {
|
|
833
|
+
/** 导航菜单手风琴模式 */
|
|
834
|
+
accordion: boolean;
|
|
835
|
+
/** 导航菜单是否切割,只在 layout=mixed-nav 生效 */
|
|
836
|
+
split: boolean;
|
|
837
|
+
/** 导航菜单风格 */
|
|
838
|
+
styleType: NavigationStyleType;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
interface SidebarPreferences {
|
|
842
|
+
/** 点击目录时自动激活子菜单 */
|
|
843
|
+
autoActivateChild: boolean;
|
|
844
|
+
/** 侧边栏是否折叠 */
|
|
845
|
+
collapsed: boolean;
|
|
846
|
+
/** 侧边栏折叠按钮是否可见 */
|
|
847
|
+
collapsedButton: boolean;
|
|
848
|
+
/** 侧边栏折叠时,是否显示title */
|
|
849
|
+
collapsedShowTitle: boolean;
|
|
850
|
+
/** 侧边栏折叠宽度 */
|
|
851
|
+
collapseWidth: number;
|
|
852
|
+
/** 侧边栏是否可见 */
|
|
853
|
+
enable: boolean;
|
|
854
|
+
/** 菜单自动展开状态 */
|
|
855
|
+
expandOnHover: boolean;
|
|
856
|
+
/** 侧边栏扩展区域是否折叠 */
|
|
857
|
+
extraCollapse: boolean;
|
|
858
|
+
/** 侧边栏扩展区域折叠宽度 */
|
|
859
|
+
extraCollapsedWidth: number;
|
|
860
|
+
/** 侧边栏固定按钮是否可见 */
|
|
861
|
+
fixedButton: boolean;
|
|
862
|
+
/** 侧边栏是否隐藏 - css */
|
|
863
|
+
hidden: boolean;
|
|
864
|
+
/** 混合侧边栏宽度 */
|
|
865
|
+
mixedWidth: number;
|
|
866
|
+
/** 侧边栏宽度 */
|
|
867
|
+
width: number;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
interface ShortcutKeyPreferences {
|
|
871
|
+
/** 是否启用快捷键-全局 */
|
|
872
|
+
enable: boolean;
|
|
873
|
+
/** 是否启用全局锁屏快捷键 */
|
|
874
|
+
globalLockScreen: boolean;
|
|
875
|
+
/** 是否启用全局注销快捷键 */
|
|
876
|
+
globalLogout: boolean;
|
|
877
|
+
/** 是否启用全局偏好设置快捷键 */
|
|
878
|
+
globalPreferences: boolean;
|
|
879
|
+
/** 是否启用全局搜索快捷键 */
|
|
880
|
+
globalSearch: boolean;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
interface TabbarPreferences {
|
|
884
|
+
/** 是否开启多标签页拖拽 */
|
|
885
|
+
draggable: boolean;
|
|
886
|
+
/** 是否开启多标签页 */
|
|
887
|
+
enable: boolean;
|
|
888
|
+
/** 标签页高度 */
|
|
889
|
+
height: number;
|
|
890
|
+
/** 开启标签页缓存功能 */
|
|
891
|
+
keepAlive: boolean;
|
|
892
|
+
/** 限制最大数量 */
|
|
893
|
+
maxCount: number;
|
|
894
|
+
/** 是否点击中键时关闭标签 */
|
|
895
|
+
middleClickToClose: boolean;
|
|
896
|
+
/** 是否持久化标签 */
|
|
897
|
+
persist: boolean;
|
|
898
|
+
/** 是否开启多标签页图标 */
|
|
899
|
+
showIcon: boolean;
|
|
900
|
+
/** 显示最大化按钮 */
|
|
901
|
+
showMaximize: boolean;
|
|
902
|
+
/** 显示更多按钮 */
|
|
903
|
+
showMore: boolean;
|
|
904
|
+
/** 标签页风格 */
|
|
905
|
+
styleType: TabsStyleType;
|
|
906
|
+
/** 是否开启鼠标滚轮响应 */
|
|
907
|
+
wheelable: boolean;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
interface ThemePreferences {
|
|
911
|
+
/** 内置主题名 */
|
|
912
|
+
builtinType: BuiltinThemeType;
|
|
913
|
+
/** 错误色 */
|
|
914
|
+
colorDestructive: string;
|
|
915
|
+
/** 主题色 */
|
|
916
|
+
colorPrimary: string;
|
|
917
|
+
/** 成功色 */
|
|
918
|
+
colorSuccess: string;
|
|
919
|
+
/** 警告色 */
|
|
920
|
+
colorWarning: string;
|
|
921
|
+
/** 字体大小(单位:px) */
|
|
922
|
+
fontSize: number;
|
|
923
|
+
/** 当前主题 */
|
|
924
|
+
mode: ThemeModeType;
|
|
925
|
+
/** 圆角 */
|
|
926
|
+
radius: string;
|
|
927
|
+
/** 是否开启半深色header(只在theme='light'时生效) */
|
|
928
|
+
semiDarkHeader: boolean;
|
|
929
|
+
/** 是否开启半深色菜单(只在theme='light'时生效) */
|
|
930
|
+
semiDarkSidebar: boolean;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
interface TransitionPreferences {
|
|
934
|
+
/** 页面切换动画是否启用 */
|
|
935
|
+
enable: boolean;
|
|
936
|
+
// /** 是否开启页面加载loading */
|
|
937
|
+
loading: boolean;
|
|
938
|
+
/** 页面切换动画 */
|
|
939
|
+
name: PageTransitionType | string;
|
|
940
|
+
/** 是否开启页面加载进度动画 */
|
|
941
|
+
progress: boolean;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
interface WidgetPreferences {
|
|
945
|
+
/** 是否启用全屏部件 */
|
|
946
|
+
fullscreen: boolean;
|
|
947
|
+
/** 是否启用全局搜索部件 */
|
|
948
|
+
globalSearch: boolean;
|
|
949
|
+
/** 是否启用语言切换部件 */
|
|
950
|
+
languageToggle: boolean;
|
|
951
|
+
/** 是否开启锁屏功能 */
|
|
952
|
+
lockScreen: boolean;
|
|
953
|
+
/** 是否显示通知部件 */
|
|
954
|
+
notification: boolean;
|
|
955
|
+
/** 显示刷新按钮 */
|
|
956
|
+
refresh: boolean;
|
|
957
|
+
/** 是否显示侧边栏显示/隐藏部件 */
|
|
958
|
+
sidebarToggle: boolean;
|
|
959
|
+
/** 是否显示主题切换部件 */
|
|
960
|
+
themeToggle: boolean;
|
|
961
|
+
/** 是否显示时区部件 */
|
|
962
|
+
timezone: boolean;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
interface Preferences {
|
|
966
|
+
/** 全局配置 */
|
|
967
|
+
app: AppPreferences;
|
|
968
|
+
/** 顶栏配置 */
|
|
969
|
+
breadcrumb: BreadcrumbPreferences;
|
|
970
|
+
/** 版权配置 */
|
|
971
|
+
copyright: CopyrightPreferences;
|
|
972
|
+
/** 底栏配置 */
|
|
973
|
+
footer: FooterPreferences;
|
|
974
|
+
/** 面包屑配置 */
|
|
975
|
+
header: HeaderPreferences;
|
|
976
|
+
/** logo配置 */
|
|
977
|
+
logo: LogoPreferences;
|
|
978
|
+
/** 导航配置 */
|
|
979
|
+
navigation: NavigationPreferences;
|
|
980
|
+
/** 快捷键配置 */
|
|
981
|
+
shortcutKeys: ShortcutKeyPreferences;
|
|
982
|
+
/** 侧边栏配置 */
|
|
983
|
+
sidebar: SidebarPreferences;
|
|
984
|
+
/** 标签页配置 */
|
|
985
|
+
tabbar: TabbarPreferences;
|
|
986
|
+
/** 主题配置 */
|
|
987
|
+
theme: ThemePreferences;
|
|
988
|
+
/** 动画配置 */
|
|
989
|
+
transition: TransitionPreferences;
|
|
990
|
+
/** 功能配置 */
|
|
991
|
+
widget: WidgetPreferences;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
type PreferencesKeys = keyof Preferences;
|
|
995
|
+
|
|
996
|
+
interface InitialOptions {
|
|
997
|
+
namespace: string;
|
|
998
|
+
overrides?: DeepPartial<Preferences>;
|
|
999
|
+
}
|
|
1000
|
+
export type {
|
|
1001
|
+
AppPreferences,
|
|
1002
|
+
BreadcrumbPreferences,
|
|
1003
|
+
FooterPreferences,
|
|
1004
|
+
HeaderPreferences,
|
|
1005
|
+
InitialOptions,
|
|
1006
|
+
LogoPreferences,
|
|
1007
|
+
NavigationPreferences,
|
|
1008
|
+
Preferences,
|
|
1009
|
+
PreferencesKeys,
|
|
1010
|
+
ShortcutKeyPreferences,
|
|
1011
|
+
SidebarPreferences,
|
|
1012
|
+
SupportedLanguagesType,
|
|
1013
|
+
TabbarPreferences,
|
|
1014
|
+
ThemePreferences,
|
|
1015
|
+
TransitionPreferences,
|
|
1016
|
+
WidgetPreferences,
|
|
1017
|
+
};
|
|
1018
|
+
import { computed } from 'vue';
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
function usePreferences() {
|
|
1023
|
+
const preferences = preferencesManager.getPreferences();
|
|
1024
|
+
const initialPreferences = preferencesManager.getInitialPreferences();
|
|
1025
|
+
/**
|
|
1026
|
+
* @zh_CN 计算偏好设置的变化
|
|
1027
|
+
*/
|
|
1028
|
+
const diffPreference = computed(() => {
|
|
1029
|
+
return diff(initialPreferences, preferences);
|
|
1030
|
+
});
|
|
1031
|
+
|
|
1032
|
+
const appPreferences = computed(() => preferences.app);
|
|
1033
|
+
|
|
1034
|
+
const shortcutKeysPreferences = computed(() => preferences.shortcutKeys);
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* @zh_CN 判断是否为暗黑模式
|
|
1038
|
+
* @param preferences - 当前偏好设置对象,它的主题值将被用来判断是否为暗黑模式。
|
|
1039
|
+
* @returns 如果主题为暗黑模式,返回 true,否则返回 false。
|
|
1040
|
+
*/
|
|
1041
|
+
const isDark = computed(() => {
|
|
1042
|
+
return isDarkTheme(preferences.theme.mode);
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
const locale = computed(() => {
|
|
1046
|
+
return preferences.app.locale;
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
const isMobile = computed(() => {
|
|
1050
|
+
return appPreferences.value.isMobile;
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
const theme = computed(() => {
|
|
1054
|
+
return isDark.value ? 'dark' : 'light';
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* @zh_CN 布局方式
|
|
1059
|
+
*/
|
|
1060
|
+
const layout = computed(() =>
|
|
1061
|
+
isMobile.value ? 'sidebar-nav' : appPreferences.value.layout,
|
|
1062
|
+
);
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* @zh_CN 是否显示顶栏
|
|
1066
|
+
*/
|
|
1067
|
+
const isShowHeaderNav = computed(() => {
|
|
1068
|
+
return preferences.header.enable;
|
|
1069
|
+
});
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* @zh_CN 是否全屏显示content,不需要侧边、底部、顶部、tab区域
|
|
1073
|
+
*/
|
|
1074
|
+
const isFullContent = computed(
|
|
1075
|
+
() => appPreferences.value.layout === 'full-content',
|
|
1076
|
+
);
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* @zh_CN 是否侧边导航模式
|
|
1080
|
+
*/
|
|
1081
|
+
const isSideNav = computed(
|
|
1082
|
+
() => appPreferences.value.layout === 'sidebar-nav',
|
|
1083
|
+
);
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* @zh_CN 是否侧边混合模式
|
|
1087
|
+
*/
|
|
1088
|
+
const isSideMixedNav = computed(
|
|
1089
|
+
() => appPreferences.value.layout === 'sidebar-mixed-nav',
|
|
1090
|
+
);
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* @zh_CN 是否为头部导航模式
|
|
1094
|
+
*/
|
|
1095
|
+
const isHeaderNav = computed(
|
|
1096
|
+
() => appPreferences.value.layout === 'header-nav',
|
|
1097
|
+
);
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* @zh_CN 是否为头部混合导航模式
|
|
1101
|
+
*/
|
|
1102
|
+
const isHeaderMixedNav = computed(
|
|
1103
|
+
() => appPreferences.value.layout === 'header-mixed-nav',
|
|
1104
|
+
);
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* @zh_CN 是否为顶部通栏+侧边导航模式
|
|
1108
|
+
*/
|
|
1109
|
+
const isHeaderSidebarNav = computed(
|
|
1110
|
+
() => appPreferences.value.layout === 'header-sidebar-nav',
|
|
1111
|
+
);
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* @zh_CN 是否为混合导航模式
|
|
1115
|
+
*/
|
|
1116
|
+
const isMixedNav = computed(
|
|
1117
|
+
() => appPreferences.value.layout === 'mixed-nav',
|
|
1118
|
+
);
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* @zh_CN 是否包含侧边导航模式
|
|
1122
|
+
*/
|
|
1123
|
+
const isSideMode = computed(() => {
|
|
1124
|
+
return (
|
|
1125
|
+
isMixedNav.value ||
|
|
1126
|
+
isSideMixedNav.value ||
|
|
1127
|
+
isSideNav.value ||
|
|
1128
|
+
isHeaderMixedNav.value ||
|
|
1129
|
+
isHeaderSidebarNav.value
|
|
1130
|
+
);
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
const sidebarCollapsed = computed(() => {
|
|
1134
|
+
return preferences.sidebar.collapsed;
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* @zh_CN 是否开启keep-alive
|
|
1139
|
+
* 在tabs可见以及开启keep-alive的情况下才开启
|
|
1140
|
+
*/
|
|
1141
|
+
const keepAlive = computed(
|
|
1142
|
+
() => preferences.tabbar.enable && preferences.tabbar.keepAlive,
|
|
1143
|
+
);
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* @zh_CN 登录注册页面布局是否为左侧
|
|
1147
|
+
*/
|
|
1148
|
+
const authPanelLeft = computed(() => {
|
|
1149
|
+
return appPreferences.value.authPageLayout === 'panel-left';
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* @zh_CN 登录注册页面布局是否为左侧
|
|
1154
|
+
*/
|
|
1155
|
+
const authPanelRight = computed(() => {
|
|
1156
|
+
return appPreferences.value.authPageLayout === 'panel-right';
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* @zh_CN 登录注册页面布局是否为中间
|
|
1161
|
+
*/
|
|
1162
|
+
const authPanelCenter = computed(() => {
|
|
1163
|
+
return appPreferences.value.authPageLayout === 'panel-center';
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* @zh_CN 内容是否已经最大化
|
|
1168
|
+
* 排除 full-content模式
|
|
1169
|
+
*/
|
|
1170
|
+
const contentIsMaximize = computed(() => {
|
|
1171
|
+
const headerIsHidden = preferences.header.hidden;
|
|
1172
|
+
const sidebarIsHidden = preferences.sidebar.hidden;
|
|
1173
|
+
return headerIsHidden && sidebarIsHidden && !isFullContent.value;
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* @zh_CN 是否启用全局搜索快捷键
|
|
1178
|
+
*/
|
|
1179
|
+
const globalSearchShortcutKey = computed(() => {
|
|
1180
|
+
const { enable, globalSearch } = shortcutKeysPreferences.value;
|
|
1181
|
+
return enable && globalSearch;
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* @zh_CN 是否启用全局注销快捷键
|
|
1186
|
+
*/
|
|
1187
|
+
const globalLogoutShortcutKey = computed(() => {
|
|
1188
|
+
const { enable, globalLogout } = shortcutKeysPreferences.value;
|
|
1189
|
+
return enable && globalLogout;
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
const globalLockScreenShortcutKey = computed(() => {
|
|
1193
|
+
const { enable, globalLockScreen } = shortcutKeysPreferences.value;
|
|
1194
|
+
return enable && globalLockScreen;
|
|
1195
|
+
});
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* @zh_CN 偏好设置按钮位置
|
|
1199
|
+
*/
|
|
1200
|
+
const preferencesButtonPosition = computed(() => {
|
|
1201
|
+
const { enablePreferences, preferencesButtonPosition } = preferences.app;
|
|
1202
|
+
|
|
1203
|
+
// 如果没有启用偏好设置按钮
|
|
1204
|
+
if (!enablePreferences) {
|
|
1205
|
+
return {
|
|
1206
|
+
fixed: false,
|
|
1207
|
+
header: false,
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
const { header, sidebar } = preferences;
|
|
1212
|
+
const headerHidden = header.hidden;
|
|
1213
|
+
const sidebarHidden = sidebar.hidden;
|
|
1214
|
+
|
|
1215
|
+
const contentIsMaximize = headerHidden && sidebarHidden;
|
|
1216
|
+
|
|
1217
|
+
const isHeaderPosition = preferencesButtonPosition === 'header';
|
|
1218
|
+
|
|
1219
|
+
// 如果设置了固定位置
|
|
1220
|
+
if (preferencesButtonPosition !== 'auto') {
|
|
1221
|
+
return {
|
|
1222
|
+
fixed: preferencesButtonPosition === 'fixed',
|
|
1223
|
+
header: isHeaderPosition,
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
// 如果是全屏模式或者没有固定在顶部,
|
|
1228
|
+
const fixed =
|
|
1229
|
+
contentIsMaximize ||
|
|
1230
|
+
isFullContent.value ||
|
|
1231
|
+
isMobile.value ||
|
|
1232
|
+
!isShowHeaderNav.value;
|
|
1233
|
+
|
|
1234
|
+
return {
|
|
1235
|
+
fixed,
|
|
1236
|
+
header: !fixed,
|
|
1237
|
+
};
|
|
1238
|
+
});
|
|
1239
|
+
|
|
1240
|
+
return {
|
|
1241
|
+
authPanelCenter,
|
|
1242
|
+
authPanelLeft,
|
|
1243
|
+
authPanelRight,
|
|
1244
|
+
contentIsMaximize,
|
|
1245
|
+
diffPreference,
|
|
1246
|
+
globalLockScreenShortcutKey,
|
|
1247
|
+
globalLogoutShortcutKey,
|
|
1248
|
+
globalSearchShortcutKey,
|
|
1249
|
+
isDark,
|
|
1250
|
+
isFullContent,
|
|
1251
|
+
isHeaderMixedNav,
|
|
1252
|
+
isHeaderNav,
|
|
1253
|
+
isHeaderSidebarNav,
|
|
1254
|
+
isMixedNav,
|
|
1255
|
+
isMobile,
|
|
1256
|
+
isSideMixedNav,
|
|
1257
|
+
isSideMode,
|
|
1258
|
+
isSideNav,
|
|
1259
|
+
keepAlive,
|
|
1260
|
+
layout,
|
|
1261
|
+
locale,
|
|
1262
|
+
preferencesButtonPosition,
|
|
1263
|
+
sidebarCollapsed,
|
|
1264
|
+
theme,
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
export { usePreferences };
|
|
1269
|
+
|
|
1270
|
+
|
|
549
1271
|
// ==========================================
|
|
550
1272
|
// From @admin-kit/form-ui
|
|
551
1273
|
// ==========================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackbo_vip/admin-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "A comprehensive Vue 3 admin UI component library with TypeScript support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"import": "./dist/design.mjs",
|
|
17
17
|
"require": "./dist/design.cjs"
|
|
18
18
|
},
|
|
19
|
+
"./design/bem": "./dist/bem.scss",
|
|
20
|
+
"./design/constants": "./dist/constants.scss",
|
|
19
21
|
"./icons": {
|
|
20
22
|
"types": "./dist/icons.d.ts",
|
|
21
23
|
"import": "./dist/icons.mjs",
|