Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comp:cascader): add disableData to dynamically disable options (#…
…1408) * feat(comp:cascader): add disableData to dynamically disable options * feat(comp:cascader): add separator prop
- Loading branch information
Showing
15 changed files
with
286 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: | ||
zh: 禁用状态 | ||
en: Disabled status | ||
order: 3 | ||
--- | ||
|
||
## zh | ||
|
||
可以设置 `disabled` 来禁用整个组件 | ||
|
||
也可以设置 `disableData` 来动态禁用某些选项,它的优先级低于 `dataSource` 的 `disabled` | ||
|
||
## en | ||
|
||
You can set `disabled` to disable the cascader component. | ||
|
||
You can also set `disableData` to dynamically disable some options, which have a lower priority than `disabled` of `dataSource`. |
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,130 @@ | ||
<template> | ||
<IxSpace vertical> | ||
<IxCascader v-model:value="valueRef" :dataSource="dataSource" disabled :fullPath="false" /> | ||
<IxCascader v-model:value="valueRef" :dataSource="dataSource" :disableData="disableData" :fullPath="false" /> | ||
</IxSpace> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed, ref } from 'vue' | ||
import { CascaderData } from '@idux/components/cascader' | ||
const valueRef = ref('button') | ||
const disableData = computed(() => (data: CascaderData) => valueRef.value === data.key) | ||
const dataSource: CascaderData[] = [ | ||
{ | ||
key: 'components', | ||
label: 'Components', | ||
children: [ | ||
{ | ||
key: 'general', | ||
label: 'General', | ||
children: [ | ||
{ | ||
key: 'button', | ||
label: 'Button', | ||
}, | ||
{ | ||
key: 'header', | ||
label: 'Header', | ||
}, | ||
{ | ||
key: 'icon', | ||
label: 'Icon', | ||
}, | ||
], | ||
}, | ||
{ | ||
key: 'layout', | ||
label: 'Layout', | ||
children: [ | ||
{ | ||
key: 'divider', | ||
label: 'Divider', | ||
}, | ||
{ | ||
key: 'grid', | ||
label: 'Grid', | ||
}, | ||
{ | ||
key: 'space', | ||
label: 'Space', | ||
}, | ||
], | ||
}, | ||
{ | ||
key: 'navigation', | ||
label: 'Navigation', | ||
children: [ | ||
{ | ||
key: 'breadcrumb', | ||
label: 'Breadcrumb', | ||
}, | ||
{ | ||
key: 'dropdown', | ||
label: 'Dropdown', | ||
}, | ||
{ | ||
key: 'menu', | ||
label: 'Menu', | ||
}, | ||
{ | ||
key: 'pagination', | ||
label: 'Pagination', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
key: 'pro', | ||
label: 'Pro', | ||
children: [ | ||
{ | ||
key: 'pro-layout', | ||
label: 'Layout', | ||
}, | ||
{ | ||
key: 'pro-table', | ||
label: 'Table', | ||
disabled: true, | ||
}, | ||
{ | ||
key: 'pro-transfer', | ||
label: 'Transfer', | ||
}, | ||
], | ||
}, | ||
{ | ||
key: 'cdk', | ||
label: 'CDK', | ||
disabled: true, | ||
children: [ | ||
{ | ||
key: 'a11y', | ||
label: 'Accessibility', | ||
}, | ||
{ | ||
key: 'breakpoint', | ||
label: 'Breakpoint', | ||
}, | ||
{ | ||
key: 'click-outside', | ||
label: 'ClickOutside', | ||
}, | ||
{ | ||
key: 'clipboard', | ||
label: 'Clipboard', | ||
}, | ||
{ | ||
key: 'forms', | ||
label: 'Forms', | ||
}, | ||
], | ||
}, | ||
] | ||
</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
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
Oops, something went wrong.