best-unit 1.2.4 → 1.2.5
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/best-unit.cjs +13 -13
- package/dist/best-unit.js +320 -308
- package/package.json +1 -1
- package/src/components/common/select/theme.tsx +23 -2
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Theme } from "@/types";
|
|
1
|
+
import { Theme, type ThemeConfig } from "@/types";
|
|
2
2
|
import { getInitParams } from "@/utils/business";
|
|
3
3
|
|
|
4
4
|
export const selectThemes = {
|
|
@@ -78,6 +78,27 @@ export const selectThemes = {
|
|
|
78
78
|
|
|
79
79
|
export function getSelectTheme() {
|
|
80
80
|
const theme = getInitParams<Theme>("theme");
|
|
81
|
+
const themeConfig = getInitParams<ThemeConfig>("themeConfig");
|
|
81
82
|
const whiteTheme = theme === Theme.WHITE;
|
|
82
|
-
|
|
83
|
+
const baseTheme = whiteTheme ? selectThemes.white : selectThemes.dark;
|
|
84
|
+
|
|
85
|
+
// 如果初始化时传入了主题配置,则覆盖默认配置
|
|
86
|
+
if (themeConfig) {
|
|
87
|
+
const config = whiteTheme ? themeConfig.white : themeConfig.dark;
|
|
88
|
+
if (config?.color) {
|
|
89
|
+
return {
|
|
90
|
+
...baseTheme,
|
|
91
|
+
option: (active: boolean, optDisabled: boolean, hovered: boolean) => ({
|
|
92
|
+
...baseTheme.option(active, optDisabled, hovered),
|
|
93
|
+
color: optDisabled
|
|
94
|
+
? baseTheme.option(active, optDisabled, hovered).color
|
|
95
|
+
: active
|
|
96
|
+
? config.color
|
|
97
|
+
: baseTheme.option(active, optDisabled, hovered).color,
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return baseTheme;
|
|
83
104
|
}
|