|
@@ -28,6 +28,7 @@ |
|
@@ -28,6 +28,7 @@ |
28
|
import { useGetComponentConfig } from '../packages/hook/useGetComponetConfig';
|
28
|
import { useGetComponentConfig } from '../packages/hook/useGetComponetConfig';
|
29
|
import { MessageAlert } from './components/MessageAlert';
|
29
|
import { MessageAlert } from './components/MessageAlert';
|
30
|
import { createSelectWidgetKeysContext, createSelectWidgetModeContext } from './useContext';
|
30
|
import { createSelectWidgetKeysContext, createSelectWidgetModeContext } from './useContext';
|
|
|
31
|
+ import { useGetCategoryByComponentKey } from '../packages/hook/useGetCategoryByComponentKey';
|
31
|
|
32
|
|
32
|
const props = defineProps<{
|
33
|
const props = defineProps<{
|
33
|
layout: Layout[];
|
34
|
layout: Layout[];
|
|
@@ -119,10 +120,16 @@ |
|
@@ -119,10 +120,16 @@ |
119
|
*/
|
120
|
*/
|
120
|
watch(
|
121
|
watch(
|
121
|
() => selectWidgetKeys.value.componentKey,
|
122
|
() => selectWidgetKeys.value.componentKey,
|
122
|
- (value) => {
|
123
|
+ (value, oldValue) => {
|
123
|
if (value) {
|
124
|
if (value) {
|
|
|
125
|
+ const oldCategory = useGetCategoryByComponentKey(oldValue);
|
|
|
126
|
+ const category = useGetCategoryByComponentKey(value);
|
|
|
127
|
+ const needReset =
|
|
|
128
|
+ [oldCategory, category].some((item) => item === PackagesCategoryEnum.CONTROL) &&
|
|
|
129
|
+ oldCategory !== category;
|
124
|
dataSource.value = unref(dataSource).map((item) => ({
|
130
|
dataSource.value = unref(dataSource).map((item) => ({
|
125
|
...item,
|
131
|
...item,
|
|
|
132
|
+ ...(needReset ? { attribute: null } : {}),
|
126
|
componentInfo: { ...unref(getComponentConfig).persetOption, ...item.componentInfo },
|
133
|
componentInfo: { ...unref(getComponentConfig).persetOption, ...item.componentInfo },
|
127
|
}));
|
134
|
}));
|
128
|
if ((window as any).requestIdleCallback as unknown as boolean) {
|
135
|
if ((window as any).requestIdleCallback as unknown as boolean) {
|