@aspire-ui/element-component-pro 1.0.23 → 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/package.json
CHANGED
|
@@ -17,7 +17,7 @@ function deepMerge(target: Record<string, unknown>, source?: Record<string, unkn
|
|
|
17
17
|
const targetValue = target[key]
|
|
18
18
|
const sourceValue = source[key]
|
|
19
19
|
|
|
20
|
-
if (isPlainObject(sourceValue)) {
|
|
20
|
+
if (isPlainObject(sourceValue) || key !== 'components') {
|
|
21
21
|
if (!isPlainObject(targetValue)) {
|
|
22
22
|
target[key] = { ...(sourceValue as Record<string, unknown>) }
|
|
23
23
|
} else {
|
|
@@ -60,11 +60,12 @@ export interface UseComponentSettingReturn {
|
|
|
60
60
|
* 合并优先级:组件默认值 < 全局配置 < 组件 props
|
|
61
61
|
*/
|
|
62
62
|
export function useComponentSetting(): UseComponentSettingReturn {
|
|
63
|
+
/** 返回浅拷贝(仅外层解包),内部保持对 reactive 存储的直接引用,保证响应式追踪 */
|
|
63
64
|
const getSetting = <T extends Record<string, unknown> = Record<string, unknown>>(componentName?: string): T => {
|
|
64
65
|
if (componentName === undefined) {
|
|
65
|
-
return
|
|
66
|
+
return { ...componentSettings } as T
|
|
66
67
|
}
|
|
67
|
-
return
|
|
68
|
+
return { ...(componentSettings[componentName] ?? {}) } as T
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
const setSetting = (componentName: string, config: Record<string, unknown>): void => {
|