Skip to content

Commit

Permalink
fix(auto-complete): the display effect is abnormal when the option is…
Browse files Browse the repository at this point in the history
… empty
  • Loading branch information
betavs committed Jan 8, 2025
1 parent ae8156f commit 657bdce
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/_common
Submodule _common updated 46 files
+1 −1 docs/mobile/flutter_design/pull-down-refresh.md
+2 −0 js/common.ts
+3 −0 js/global-config/locale/ar_KW.ts
+3 −0 js/global-config/locale/en_US.ts
+3 −0 js/global-config/locale/it_IT.ts
+3 −0 js/global-config/locale/ja_JP.ts
+3 −0 js/global-config/locale/ko_KR.ts
+3 −0 js/global-config/locale/ru_RU.ts
+3 −0 js/global-config/locale/zh_CN.ts
+3 −0 js/global-config/locale/zh_TW.ts
+8 −4 js/input-number/large-number.ts
+4 −4 js/tree-v1/tree-node.ts
+4 −4 js/tree/tree-node.ts
+8 −10 package.json
+324 −0 style/mobile/components/color-picker/_index.less
+34 −0 style/mobile/components/color-picker/_var.less
+1 −0 style/mobile/components/input/v2/_index.less
+1 −0 style/mobile/components/input/v2/_var.less
+9 −0 style/web/components/auto-complete/_index.less
+2 −0 style/web/components/auto-complete/_var.less
+0 −40 test/script/jest.base.conf.js
+0 −34 test/script/jest.unit.conf.js
+1 −0 test/unit/date-picker/utils.test.js
+1 −0 test/unit/input-number/compareLargeNumber.test.js
+17 −0 test/unit/input-number/formatDecimal.test.js
+1 −0 test/unit/input-number/largeIntNumberAdd.test.js
+1 −0 test/unit/input-number/largeNumberAdd.test.js
+1 −0 test/unit/input-number/largeNumberSubtract.test.js
+1 −0 test/unit/input-number/largeNumberToFixed.test.js
+2 −1 test/unit/input-number/number.test.js
+1 −0 test/unit/time-picker/utils.test.js
+1 −0 test/unit/tree/activable.test.js
+1 −0 test/unit/tree/append.test.js
+1 −0 test/unit/tree/checkable.test.js
+1 −0 test/unit/tree/disabled.test.js
+1 −0 test/unit/tree/event.test.js
+1 −0 test/unit/tree/expand.test.js
+1 −0 test/unit/tree/filter.test.js
+1 −0 test/unit/tree/get-node.test.js
+1 −0 test/unit/tree/init.test.js
+1 −0 test/unit/tree/lazy.test.js
+1 −0 test/unit/tree/model.test.js
+1 −0 test/unit/upload/returnFileSize.test.js
+1 −0 test/unit/upload/utils.test.js
+1 −1 tsconfig.json
+13 −0 vitest.config.mts
2 changes: 1 addition & 1 deletion src/auto-complete/auto-complete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default defineComponent({
const topContent = renderTNodeJSX(this, 'panelTopContent');
const bottomContent = renderTNodeJSX(this, 'panelBottomContent');
const panelContent = topContent || this.options?.length || bottomContent ? (
<div class={`${this.classPrefix}-autocomplete__panel`}>
<div class={`${this.classPrefix}-auto-complete__panel`}>
{topContent}
{listContent}
{bottomContent}
Expand Down
7 changes: 5 additions & 2 deletions src/auto-complete/option-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import HighlightOption from './highlight-option';
import { CommonClassNameType } from '../hooks/useCommonClassName';
import { AutoCompleteOptionObj, TdAutoCompleteProps } from './type';
import log from '../_common/js/log';
import { usePrefixClass } from '../hooks/useConfig';
import { useConfig, usePrefixClass } from '../hooks/useConfig';
import { on, off } from '../utils/dom';

export default defineComponent({
Expand All @@ -28,6 +28,8 @@ export default defineComponent({
const active = ref('');
const classPrefix = usePrefixClass();

const { globalConfig } = useConfig('autoComplete');

const classes = computed(() => `${classPrefix.value}-select__list`);
const optionClasses = computed(() => [
`${classPrefix.value}-select-option`,
Expand Down Expand Up @@ -129,6 +131,7 @@ export default defineComponent({
});

return {
globalConfig,
classes,
classPrefix,
optionClasses,
Expand All @@ -141,7 +144,7 @@ export default defineComponent({
},

render() {
if (!this.tOptions.length) return null;
if (!this.tOptions.length) return <div class={`${this.classPrefix}-auto-complete__panel--empty`}>{this.globalConfig.empty}</div>;
return (
<ul class={this.classes}>
{this.tOptions.map((item) => {
Expand Down
12 changes: 12 additions & 0 deletions src/config-provider/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { ImageProps } from '../image';
import { TNode, SizeEnum, AttachNode } from '../common';

export interface GlobalConfigProvider {
/**
* 自动填充全局配置
*/
autoComplete?: AutoCompleteConfig;
/**
* 警告全局配置
*/
Expand Down Expand Up @@ -148,6 +152,14 @@ export interface GlobalConfigProvider {
upload?: UploadConfig;
}

export interface AutoCompleteConfig {
/**
* 语言配置,“暂无数据”描述文本
* @default ''
*/
empty?: string;
}

export interface InputConfig {
/**
* 是否开启自动填充功能
Expand Down

0 comments on commit 657bdce

Please sign in to comment.