mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2025-12-30 01:32:26 +00:00
Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev
This commit is contained in:
@@ -82,7 +82,7 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport :to="appendTo">
|
||||
<Teleport defer :to="appendTo">
|
||||
<Transition name="fade">
|
||||
<DialogOverlay
|
||||
v-if="open && modal"
|
||||
|
||||
@@ -73,7 +73,7 @@ function onAnimationEnd(event: AnimationEvent) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport :to="appendTo">
|
||||
<Teleport defer :to="appendTo">
|
||||
<Transition name="fade">
|
||||
<SheetOverlay
|
||||
v-if="open && modal"
|
||||
|
||||
@@ -103,10 +103,15 @@ function updateTreeValue() {
|
||||
treeValue.value = undefined;
|
||||
} else {
|
||||
if (Array.isArray(val)) {
|
||||
const filteredValues = val.filter((v) => {
|
||||
let filteredValues = val.filter((v) => {
|
||||
const item = getItemByValue(v);
|
||||
return item && !get(item, props.disabledField);
|
||||
});
|
||||
|
||||
if (!props.checkStrictly && props.autoCheckParent) {
|
||||
filteredValues = processParentSelection(filteredValues);
|
||||
}
|
||||
|
||||
treeValue.value = filteredValues.map((v) => getItemByValue(v));
|
||||
|
||||
if (filteredValues.length !== val.length) {
|
||||
@@ -123,7 +128,35 @@ function updateTreeValue() {
|
||||
}
|
||||
}
|
||||
}
|
||||
function processParentSelection(
|
||||
selectedValues: Array<number | string>,
|
||||
): Array<number | string> {
|
||||
if (props.checkStrictly) return selectedValues;
|
||||
|
||||
const result = [...selectedValues];
|
||||
|
||||
for (let i = result.length - 1; i >= 0; i--) {
|
||||
const currentValue = result[i];
|
||||
if (currentValue === undefined) continue;
|
||||
const currentItem = getItemByValue(currentValue);
|
||||
|
||||
if (!currentItem) continue;
|
||||
|
||||
const children = get(currentItem, props.childrenField);
|
||||
if (Array.isArray(children) && children.length > 0) {
|
||||
const hasSelectedChildren = children.some((child) => {
|
||||
const childValue = get(child, props.valueField);
|
||||
return result.includes(childValue);
|
||||
});
|
||||
|
||||
if (!hasSelectedChildren) {
|
||||
result.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
function updateModelValue(val: Arrayable<Recordable<any>>) {
|
||||
if (Array.isArray(val)) {
|
||||
const filteredVal = val.filter((v) => !get(v, props.disabledField));
|
||||
|
||||
@@ -104,7 +104,7 @@ function selectColor() {
|
||||
|
||||
watch(
|
||||
() => [modelValue.value, props.isDark] as [BuiltinThemeType, boolean],
|
||||
([themeType, isDark]) => {
|
||||
([themeType, isDark], [_, isDarkPrev]) => {
|
||||
const theme = builtinThemePresets.value.find(
|
||||
(item) => item.type === themeType,
|
||||
);
|
||||
@@ -113,7 +113,9 @@ watch(
|
||||
? theme.darkPrimaryColor || theme.primaryColor
|
||||
: theme.primaryColor;
|
||||
|
||||
themeColorPrimary.value = primaryColor || theme.color;
|
||||
if (!(theme.type === 'custom' && isDark !== isDarkPrev)) {
|
||||
themeColorPrimary.value = primaryColor || theme.color;
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user