Skip to content

Commit 7e98c1a

Browse files
committed
!25 merge dev into main
!24 merge xingyan/fix-tree into dev Created-by: xingyan Commit-by: GreatZP;xingyan Merged-by: GreatZP Description: fix(Tree): 优化性能 fix: 更新版本号 !22 merge xingyan/fix-tree into dev fix: 更新pnpm-lock文件 feat: Dropdown&Select&CategorySearch支持append-to-body ... See merge request: DevCloudFE/vue-devui!25
2 parents 373a7a7 + 4615813 commit 7e98c1a

File tree

25 files changed

+7394
-8169
lines changed

25 files changed

+7394
-8169
lines changed

packages/devui-vue/devui/category-search/src/category-search-types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export interface TextConfig {
111111
filterTitle?: string;
112112
labelConnector?: string;
113113
noCategoriesAvailable?: string;
114+
tagMenuEmpty?: string;
114115
}
115116
export interface ExtendConfig {
116117
show?: boolean;
@@ -189,6 +190,7 @@ export const categorySearchProps = {
189190
filterTitle: '',
190191
labelConnector: '|',
191192
noCategoriesAvailable: '',
193+
tagMenuEmpty: ''
192194
}),
193195
},
194196
extendConfig: {
@@ -198,6 +200,10 @@ export const categorySearchProps = {
198200
type: String as PropType<StyleType>,
199201
default: 'default',
200202
},
203+
appendToBody: {
204+
type: Boolean,
205+
default: true
206+
}
201207
};
202208
export type CategorySearchProps = ExtractPropTypes<typeof categorySearchProps>;
203209

@@ -208,6 +214,7 @@ export interface CategorySearchInjection {
208214
innerTextConfig: Ref<TextConfig>;
209215
tagMaxWidth: Ref<number | undefined> | undefined;
210216
inputReadOnly: Ref<boolean>;
217+
appendToBody: Ref<boolean>;
211218
placeholder: Ref<string>;
212219
innerSearchKey: Ref<string>;
213220
innerSelectedTags: Ref<ICategorySearchTagItem[]>;

packages/devui-vue/devui/category-search/src/components/category-search-input.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default defineComponent({
2626
currentSearchCategory,
2727
ComponentMap,
2828
currentSelectTag,
29+
appendToBody,
2930
onCategoryItemClick,
3031
searchKeyChangeEvent,
3132
searchInputValue,
@@ -77,6 +78,7 @@ export default defineComponent({
7778
align='start'
7879
position={['bottom-start', 'top-start', 'bottom-end', 'top-end']}
7980
close-scope={checkType(currentSelectTag.value)}
81+
append-to-body={appendToBody.value}
8082
onToggle={onToggle}>
8183
{{
8284
default: () => (

packages/devui-vue/devui/category-search/src/components/category-search-save.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default defineComponent({
1010
props: extendIconProps,
1111
setup(props: ExtendIconProps) {
1212
const { disabled } = toRefs(props);
13-
const { innerTextConfig, filterNameRules, createFilterFn } = inject(categorySearchInjectionKey) as CategorySearchInjection;
13+
const { innerTextConfig, filterNameRules, appendToBody, createFilterFn } = inject(categorySearchInjectionKey) as CategorySearchInjection;
1414
const { isVisible, formRef, formData, inputRef, onConfirm, onToggle } = useCategorySearchSave(createFilterFn);
1515

1616
return () => (
@@ -22,6 +22,7 @@ export default defineComponent({
2222
position={['bottom-start', 'top-start', 'bottom-end', 'top-end']}
2323
close-scope='blank'
2424
class='dp-save-panel'
25+
append-to-body={appendToBody.value}
2526
onToggle={onToggle}>
2627
{{
2728
default: () => <SaveIcon textConfig={innerTextConfig.value} onClick={() => (isVisible.value = !isVisible.value)} />,

packages/devui-vue/devui/category-search/src/components/category-search-tag-dropdown.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineComponent({
99
props: categorySearchDropdownProps,
1010
setup(props: CategorySearchDropdownProps) {
1111
const { item, isJoinLabelType } = toRefs(props);
12-
const { rootCtx, ComponentMap, onSearchKeyTagClick, addTagContext, removeTagContext } = inject(
12+
const { rootCtx, ComponentMap, appendToBody, onSearchKeyTagClick, addTagContext, removeTagContext } = inject(
1313
categorySearchInjectionKey
1414
) as CategorySearchInjection;
1515
const isVisible = ref(false);
@@ -50,6 +50,7 @@ export default defineComponent({
5050
position={['bottom-start', 'top-start', 'bottom-end', 'top-end']}
5151
class="dp-category-search-dropdown dp-dropdown-menu-fix"
5252
close-scope={checkType(item.value)}
53+
append-to-body={appendToBody.value}
5354
onToggle={onToggle}>
5455
{{
5556
default: () => (

packages/devui-vue/devui/category-search/src/components/checkbox-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default defineComponent({
1111
emits: ['close'],
1212
setup(props: TypeMenuProps, ctx: SetupContext) {
1313
const { tag } = toRefs(props);
14-
const { chooseItems } = inject(categorySearchInjectionKey) as CategorySearchInjection;
14+
const { chooseItems, innerTextConfig } = inject(categorySearchInjectionKey) as CategorySearchInjection;
1515
const onConfirmClick = () => {
1616
chooseItems(tag.value);
1717
ctx.emit('close');
@@ -36,7 +36,7 @@ export default defineComponent({
3636
</div>
3737
</>
3838
) : (
39-
<div class='dp-no-data-tip'>暂无数据</div>
39+
<div class='dp-no-data-tip'>{ innerTextConfig.value.tagMenuEmpty || '暂无数据' }</div>
4040
);
4141
},
4242
});

packages/devui-vue/devui/category-search/src/components/label-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default defineComponent({
1111
emits: ['close'],
1212
setup(props: TypeMenuProps, ctx: SetupContext) {
1313
const { tag } = toRefs(props);
14-
const { chooseItems } = inject(categorySearchInjectionKey) as CategorySearchInjection;
14+
const { chooseItems, innerTextConfig } = inject(categorySearchInjectionKey) as CategorySearchInjection;
1515
const onConfirmClick = () => {
1616
chooseItems(tag.value);
1717
ctx.emit('close');
@@ -56,7 +56,7 @@ export default defineComponent({
5656
</div>
5757
</>
5858
) : (
59-
<div class='dp-no-data-tip'>暂无数据</div>
59+
<div class='dp-no-data-tip'>{ innerTextConfig.value.tagMenuEmpty || '暂无数据' }</div>
6060
);
6161
},
6262
});

packages/devui-vue/devui/category-search/src/components/radio-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default defineComponent({
77
props: typeMenuProps,
88
setup(props: TypeMenuProps) {
99
const { tag } = toRefs(props);
10-
const { chooseItem } = inject(categorySearchInjectionKey) as CategorySearchInjection;
10+
const { chooseItem, innerTextConfig } = inject(categorySearchInjectionKey) as CategorySearchInjection;
1111
const key = computed(() => tag.value.filterKey || 'label');
1212

1313
return () =>
@@ -23,7 +23,7 @@ export default defineComponent({
2323
))}
2424
</ul>
2525
) : (
26-
<div class='dp-no-data-tip'>暂无数据</div>
26+
<div class='dp-no-data-tip'>{ innerTextConfig.value.tagMenuEmpty || '暂无数据' }</div>
2727
);
2828
},
2929
});

packages/devui-vue/devui/category-search/src/composables/use-category-search.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export function useCategorySearch(props: CategorySearchProps, ctx: SetupContext)
3838
showSearchCategory,
3939
filterNameRules,
4040
extendConfig,
41+
appendToBody
4142
} = toRefs(props);
4243
const innerCategory: Ref<ICategorySearchTagItem[]> = ref([]);
4344
const innerSelectedTags: Ref<ICategorySearchTagItem[]> = ref([]);
@@ -368,6 +369,7 @@ export function useCategorySearch(props: CategorySearchProps, ctx: SetupContext)
368369
innerTextConfig,
369370
tagMaxWidth,
370371
inputReadOnly,
372+
appendToBody,
371373
placeholder,
372374
innerSearchKey,
373375
innerSelectedTags,

packages/devui-vue/devui/dropdown/src/dropdown-types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export const dropdownProps = {
6363
type: [String, Object] as PropType<TeleportProps['to']>,
6464
default: 'body',
6565
},
66+
appendToBody: {
67+
type: Boolean,
68+
default: true
69+
}
6670
};
6771

6872
export type DropdownProps = ExtractPropTypes<typeof dropdownProps>;

packages/devui-vue/devui/dropdown/src/dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default defineComponent({
5151
return () => (
5252
<>
5353
<PopperTrigger>{slots.default?.()}</PopperTrigger>
54-
<Teleport to={teleport.value}>
54+
<Teleport to={teleport.value} disabled={!props.appendToBody}>
5555
<Transition name={showAnimation.value ? ns.m(`fade-${currentPosition.value}`) : ''}>
5656
<FlexibleOverlay
5757
v-model={overlayModelValue.value}

0 commit comments

Comments
 (0)