-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pro): add proTagSelect component
- Loading branch information
Showing
56 changed files
with
2,598 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/pro/tag-select/__tests__/__snapshots__/proTagSelect.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`ProTagSelect > render work 1`] = ` | ||
"<div class=\\"ix-trigger ix-trigger-md ix-trigger-paddingless ix-selector ix-selector-md ix-selector-allow-input ix-selector-multiple ix-pro-tag-select ix-control-trigger ix-pro-tag-select\\" tabindex=\\"-1\\"> | ||
<!----> | ||
<div class=\\"ix-selector-content\\"> | ||
<div class=\\"ix-selector-placeholder\\"> | ||
<!----> | ||
</div> | ||
<div class=\\"ix-overflow ix-selector-overflow \\"> | ||
<!----> | ||
<div class=\\"ix-overflow-item ix-overflow-suffix\\"> | ||
<div class=\\"ix-selector-input\\"><input class=\\"ix-selector-input-inner\\" style=\\"opacity: 0; width: 0px;\\" readonly=\\"\\"><span class=\\"ix-selector-input-mirror\\" aria-hidden=\\"true\\"></span></div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class=\\"ix-trigger-suffix\\"><i class=\\"ix-icon ix-icon-down\\" style=\\"transform: rotate(0deg);\\" role=\\"img\\" aria-label=\\"down\\"></i></div> | ||
<!----> | ||
</div>" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { MountingOptions, mount } from '@vue/test-utils' | ||
|
||
import { renderWork } from '@tests' | ||
|
||
import ProTagSelect from '../src/ProTagSelect' | ||
import { ProTagSelectProps } from '../src/types' | ||
|
||
describe.skip('ProTagSelect', () => { | ||
const ProTagSelectMount = (options?: MountingOptions<Partial<ProTagSelectProps>>) => | ||
mount(ProTagSelect, { ...(options as MountingOptions<ProTagSelectProps>) }) | ||
|
||
renderWork<ProTagSelectProps>(ProTagSelect, { | ||
props: {}, | ||
}) | ||
|
||
test('xxx work', async () => { | ||
const wrapper = ProTagSelectMount({ props: { xxx: 'Xxx' } }) | ||
|
||
expect(wrapper.classes()).toContain('ix-Xxx') | ||
|
||
await wrapper.setProps({ xxx: 'Yyy' }) | ||
|
||
expect(wrapper.classes()).toContain('ix-Yyy') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 0 | ||
title: | ||
zh: 基本使用 | ||
en: Basic usage | ||
--- | ||
|
||
## zh | ||
|
||
最简单的用法。 | ||
|
||
## en | ||
|
||
The simplest usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<template> | ||
<IxProTagSelect | ||
v-model:value="selectedValue" | ||
placeholder="请选择标签" | ||
:dataSource="tagSelectData" | ||
:onTagDataRemove="handleTagDataRemove" | ||
:onTagDataAdd="handleTagDataAdd" | ||
:onTagDataChange="handleTagDataChange" | ||
style="width: 336px" | ||
> | ||
<template #removeConfirmTitle="{ label }"> 确定删除“{{ label }}”标签吗? </template> | ||
<template #removeConfirmContent> 操作说明 </template> | ||
</IxProTagSelect> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { TagSelectData } from '@idux/pro/tag-select' | ||
const selectedValue = ref<string[]>([]) | ||
const tagSelectData = ref<TagSelectData[]>([ | ||
{ | ||
key: 'emphasis', | ||
label: '重点关注', | ||
color: 'yellow', | ||
}, | ||
{ | ||
key: 'alarm', | ||
label: '告警标签', | ||
color: 'blue', | ||
}, | ||
{ | ||
key: 'track', | ||
label: '持续追踪', | ||
color: 'blue', | ||
}, | ||
{ | ||
key: 'care-and-track', | ||
label: '持续关注并追踪', | ||
color: 'green', | ||
}, | ||
{ | ||
key: 'keeps-alarm', | ||
label: '持续告警', | ||
color: 'red', | ||
}, | ||
]) | ||
const handleTagDataRemove = (data: TagSelectData) => { | ||
tagSelectData.value = tagSelectData.value.filter(d => d.key !== data.key) | ||
} | ||
const handleTagDataAdd = (data: TagSelectData) => { | ||
tagSelectData.value.push(data) | ||
} | ||
const handleTagDataChange = (data: TagSelectData) => { | ||
const index = tagSelectData.value.findIndex(d => d.key === data.key) | ||
if (index < 0) { | ||
return | ||
} | ||
tagSelectData.value.splice(index, 1, data) | ||
} | ||
</script> | ||
|
||
<style scoped lang="less"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 1 | ||
title: | ||
zh: 选择前确认 | ||
en: Confirm before select | ||
--- | ||
|
||
## zh | ||
|
||
选择前通过浮层确认选项的创建。 | ||
|
||
## en | ||
|
||
Confirm via an popper before select. |
Oops, something went wrong.