Browse Source

Merge branch 'main' into alova

alova
Jin Mao 6 months ago
committed by GitHub
parent
commit
382918b8f0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      packages/@core/ui-kit/shadcn-ui/src/ui/dialog/DialogContent.vue
  2. 6
      packages/@core/ui-kit/shadcn-ui/src/ui/sheet/SheetContent.vue
  3. 35
      packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue
  4. 6
      packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue

11
packages/@core/ui-kit/shadcn-ui/src/ui/dialog/DialogContent.vue

@ -8,12 +8,7 @@ import { computed, ref } from 'vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { X } from 'lucide-vue-next'; import { X } from 'lucide-vue-next';
import { import { DialogClose, DialogContent, useForwardPropsEmits } from 'radix-vue';
DialogClose,
DialogContent,
DialogPortal,
useForwardPropsEmits,
} from 'radix-vue';
import DialogOverlay from './DialogOverlay.vue'; import DialogOverlay from './DialogOverlay.vue';
@ -87,7 +82,7 @@ defineExpose({
</script> </script>
<template> <template>
<DialogPortal :to="appendTo"> <Teleport defer :to="appendTo">
<Transition name="fade"> <Transition name="fade">
<DialogOverlay <DialogOverlay
v-if="open && modal" v-if="open && modal"
@ -132,5 +127,5 @@ defineExpose({
<X class="h-4 w-4" /> <X class="h-4 w-4" />
</DialogClose> </DialogClose>
</DialogContent> </DialogContent>
</DialogPortal> </Teleport>
</template> </template>

6
packages/@core/ui-kit/shadcn-ui/src/ui/sheet/SheetContent.vue

@ -7,7 +7,7 @@ import { computed, ref } from 'vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { DialogContent, DialogPortal, useForwardPropsEmits } from 'radix-vue'; import { DialogContent, useForwardPropsEmits } from 'radix-vue';
import { sheetVariants } from './sheet'; import { sheetVariants } from './sheet';
import SheetOverlay from './SheetOverlay.vue'; import SheetOverlay from './SheetOverlay.vue';
@ -73,7 +73,7 @@ function onAnimationEnd(event: AnimationEvent) {
</script> </script>
<template> <template>
<DialogPortal :to="appendTo"> <Teleport defer :to="appendTo">
<Transition name="fade"> <Transition name="fade">
<SheetOverlay <SheetOverlay
v-if="open && modal" v-if="open && modal"
@ -103,5 +103,5 @@ function onAnimationEnd(event: AnimationEvent) {
<Cross2Icon class="h-5 w-" /> <Cross2Icon class="h-5 w-" />
</DialogClose> --> </DialogClose> -->
</DialogContent> </DialogContent>
</DialogPortal> </Teleport>
</template> </template>

35
packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue

@ -103,10 +103,15 @@ function updateTreeValue() {
treeValue.value = undefined; treeValue.value = undefined;
} else { } else {
if (Array.isArray(val)) { if (Array.isArray(val)) {
const filteredValues = val.filter((v) => { let filteredValues = val.filter((v) => {
const item = getItemByValue(v); const item = getItemByValue(v);
return item && !get(item, props.disabledField); return item && !get(item, props.disabledField);
}); });
if (!props.checkStrictly && props.autoCheckParent) {
filteredValues = processParentSelection(filteredValues);
}
treeValue.value = filteredValues.map((v) => getItemByValue(v)); treeValue.value = filteredValues.map((v) => getItemByValue(v));
if (filteredValues.length !== val.length) { 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>>) { function updateModelValue(val: Arrayable<Recordable<any>>) {
if (Array.isArray(val)) { if (Array.isArray(val)) {
const filteredVal = val.filter((v) => !get(v, props.disabledField)); const filteredVal = val.filter((v) => !get(v, props.disabledField));

6
packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue

@ -104,7 +104,7 @@ function selectColor() {
watch( watch(
() => [modelValue.value, props.isDark] as [BuiltinThemeType, boolean], () => [modelValue.value, props.isDark] as [BuiltinThemeType, boolean],
([themeType, isDark]) => { ([themeType, isDark], [_, isDarkPrev]) => {
const theme = builtinThemePresets.value.find( const theme = builtinThemePresets.value.find(
(item) => item.type === themeType, (item) => item.type === themeType,
); );
@ -113,7 +113,9 @@ watch(
? theme.darkPrimaryColor || theme.primaryColor ? theme.darkPrimaryColor || theme.primaryColor
: theme.primaryColor; : theme.primaryColor;
themeColorPrimary.value = primaryColor || theme.color; if (!(theme.type === 'custom' && isDark !== isDarkPrev)) {
themeColorPrimary.value = primaryColor || theme.color;
}
} }
}, },
); );

Loading…
Cancel
Save