Skip to content

Commit

Permalink
fix(vue-legacy): can not filter option which has tooltip, close #954
Browse files Browse the repository at this point in the history
  • Loading branch information
Javey committed Jan 23, 2024
1 parent a2230ba commit 1f74698
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 54 deletions.
8 changes: 7 additions & 1 deletion components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ export class Dropdown<
}
}

const [trigger, menu] = children as DropdownChildren;
let [trigger, menu] = children as DropdownChildren;
/**
* In vue-legacy, if the menu is TooltipContent, the menu will be InUsed when update,
* so we clone it here, #954
*/
menu = directClone(menu);

const props = this.initEventCallbacks();
let {className, value, container} = this.get();
const { k } = this.config;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"highlight.js": "^10.4.1",
"history": "^5.0.0",
"html-webpack-plugin": "5.3.1",
"intact-react": "^3.0.24",
"intact-react": "^3.0.25",
"istanbul-instrumenter-loader": "^3.0.0",
"js-yaml": "^4.1.0",
"karma": "^6.3.2",
Expand Down
45 changes: 45 additions & 0 deletions packages/kpc-vue/__tests__/components/select.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import Vue from 'vue';
import {mount, unmount, dispatchEvent, getElement, wait} from '@/test/utils';
import {Select, Option, Tooltip, Dropdown, DropdownMenu, Card} from '../../';

describe('Select', () => {
it('should filter Option which wrapped by Tooltip', async () => {
const container = document.createElement('div');
document.body.appendChild(container);
const vue = new Vue({
el: container,
template: `
<Card>
<Select searchable ref="select">
<Option value="Monday">
<Tooltip content="星期一">星期一</Tooltip>
</Option>
<Option value="Tuesday">
<Tooltip content="星期二">星期二</Tooltip>
</Option>
</Select>
</Card>
`,
components: {
Select, Option, Tooltip, Dropdown, DropdownMenu, Card,
},
});

const select = vue.$refs.select as Select;
select.set('show', true);
await wait();

const dropdown = getElement('.k-select-menu')!;
select.input.onInput('s');
await wait();
expect(dropdown.querySelector('.k-select-body').textContent.trim()).to.eql('星期二');


select.input.onInput('');
await wait();
expect(dropdown.querySelector('.k-select-body').textContent.trim()).to.eql('星期一 星期二');

vue.$destroy();
document.body.removeChild(vue.$el);
});
});
63 changes: 11 additions & 52 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1162,16 +1162,16 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@king-design/react@^3.1.3":
version "3.1.3"
resolved "https://registry.npmjs.org/@king-design/react/-/react-3.1.3.tgz#c93b8f726eca841a513e31e3d6e99f52641d116e"
integrity sha512-Q4IADGNiBD0uYJo+IgjTE4JdRi1lkqHp6tfXuc2mOHLoFvAKrFCmJEmvO/LyiOsI9QXCD0eij6B1W1y1tPOfhQ==
"@king-design/react@^3.1.4-beta.0":
version "3.1.4-beta.0"
resolved "https://registry.npmmirror.com/@king-design/react/-/react-3.1.4-beta.0.tgz#a763dad469d9a4e28eaae9dbf1bda105d9684df9"
integrity sha512-mBWN73ciAlOmapjC3As3D8RcrvmEKnBq68P/t9ZIs0c+e9EugnIFtKbtEM4JChOrKURqjIuA9C3iXrSJ4dLDyA==
dependencies:
"@babel/runtime-corejs3" "^7.16.0"
"@emotion/css" "^11.5.0"
dayjs "^1.10.7"
enquire.js "^2.1.6"
intact-react "3.0.24"
intact-react "3.0.25"
monaco-editor "^0.26.1"
mxgraphx "^4.0.7"
resize-observer-polyfill "^1.5.1"
Expand Down Expand Up @@ -7408,36 +7408,20 @@ inquirer@^7.3.3:
strip-ansi "^6.0.0"
through "^2.3.6"

[email protected].24, intact-react@^3.0.24:
version "3.0.24"
resolved "https://registry.npmjs.org/intact-react/-/intact-react-3.0.24.tgz#1cae74bd8a38dedd1afda91451730e834fef2f82"
integrity sha512-XVmF60+l0K1TqgMcPXhETvlbvkXpmg8kRRedweV1azSYOTAm9+HL5UR8U6bYfCYA4Utv4G5QDSe7fNI10p1eUg==
[email protected].25, intact-react@^3.0.25:
version "3.0.25"
resolved "https://registry.npmmirror.com/intact-react/-/intact-react-3.0.25.tgz#f7de2e8ff9f3cafa6dd5dd16c035c95e08157775"
integrity sha512-ZPPQh9nkQ4+7BcXkQDIRhXlC8NYfyPHEXTJiKt9pef0ZdP8IVSFK7/tGOXCstdbbAJNEsf/bKv6QRkAbqZRNtg==
dependencies:
intact "^3.0.24"
intact-shared "^3.0.24"
intact "^3.0.25"
intact-shared "^3.0.25"
tslib "^2.3.1"

intact-shared@^3.0.24:
version "3.0.24"
resolved "https://registry.npmjs.org/intact-shared/-/intact-shared-3.0.24.tgz#b9be3c19091f0f6523579aed2670013a92e6182a"
integrity sha512-evhisxClh2A5Lp8aCrvaJNuycUlGy5b7YP4U7KYa9/U5cUZLdJQ39MlhYXX5+xIZFEo4ixz4Oy80Olto2riqFg==

intact-shared@^3.0.25:
version "3.0.25"
resolved "https://registry.npmjs.org/intact-shared/-/intact-shared-3.0.25.tgz#6b12d456eae887bc769ed42aa9f17a25f6722404"
integrity sha512-kZdNSNuFti4Ag9fr37IV0qETY5HNHrACPZt/co1mbfWghCXm/aydsrdUDNj0xv2wP2jjaIMm5XCHy5ryvCYxew==

intact@^3.0.24:
version "3.0.24"
resolved "https://registry.npmjs.org/intact/-/intact-3.0.24.tgz#09659c7f12e3ff9526404b7f40451b5e79e873d4"
integrity sha512-XnmMw53cag+PGebWW+na/FHTW8N3j5mvewODiBrce+c5pxns2Yuu4i5OdGPWAyHVAJPRK3Uksr4V8U2ElEggaw==
dependencies:
intact-shared "^3.0.24"
misstime "^3.0.24"
tslib "^2.2.0"
vdt "^3.0.24"
vdt-compiler "^3.0.24"

intact@^3.0.25:
version "3.0.25"
resolved "https://registry.npmjs.org/intact/-/intact-3.0.25.tgz#f6f5fc9ab7bdbbe1d8fdef9d8c1753ea54d45cb9"
Expand Down Expand Up @@ -9222,13 +9206,6 @@ minizlib@^2.0.0, minizlib@^2.1.1:
minipass "^3.0.0"
yallist "^4.0.0"

misstime@^3.0.24:
version "3.0.24"
resolved "https://registry.npmjs.org/misstime/-/misstime-3.0.24.tgz#3fde6195fe9c984630c4bcd9ed13c0aad96f9a88"
integrity sha512-LS87YBdBZ2Nivvt62h9W/6YBMQ2fjhz+shWqvfycT69ZRH3yRkDeBexiuL9BuDD026wBlqJT8ug47vWe/RuQkg==
dependencies:
intact-shared "^3.0.24"

misstime@^3.0.25:
version "3.0.25"
resolved "https://registry.npmjs.org/misstime/-/misstime-3.0.25.tgz#0cde275a6347b60c4c491990ccc9ff400767ef1c"
Expand Down Expand Up @@ -13446,15 +13423,6 @@ vary@^1, vary@~1.1.2:
resolved "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==

vdt-compiler@^3.0.24:
version "3.0.24"
resolved "https://registry.npmjs.org/vdt-compiler/-/vdt-compiler-3.0.24.tgz#80b015094c8b624d22f618529eba5ff79d26c942"
integrity sha512-MrJ4EwctSbP3lihHOj+4qLkmKRR7ZWJBPpJ1KkDYLSQkYWhFp+1Bdb8yMBKo1coq+5cMuq71tUKosSNCbIusEQ==
dependencies:
intact-shared "^3.0.24"
misstime "^3.0.24"
tslib "^2.2.0"

vdt-compiler@^3.0.25:
version "3.0.25"
resolved "https://registry.npmjs.org/vdt-compiler/-/vdt-compiler-3.0.25.tgz#79825015de4f042a5d8d5d0fc947db685555492c"
Expand All @@ -13473,15 +13441,6 @@ vdt-loader@^3.0.0-beta.1:
schema-utils "^3.0.0"
source-map "^0.7.3"

vdt@^3.0.24:
version "3.0.24"
resolved "https://registry.npmjs.org/vdt/-/vdt-3.0.24.tgz#ddbef5b4a60b496c57dcb6a74c0e316a0291068a"
integrity sha512-LUQJYjaE9XAvKOPfO5GRvh+1OI1yRYAX4oDVb40guzjJo+vqoJ/Q07X4uD3iIKqbkR/BHmUq5OmPwSmIaoC5sg==
dependencies:
intact-shared "^3.0.24"
misstime "^3.0.24"
tslib "^2.2.0"

vdt@^3.0.25:
version "3.0.25"
resolved "https://registry.npmjs.org/vdt/-/vdt-3.0.25.tgz#1f3a4f8e6db6c453eaa4ceabb985780c684ff8cb"
Expand Down

0 comments on commit 1f74698

Please sign in to comment.