-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support checking all blocks in material add block panel (#923)
物料插件-区块分组-添加区块,区块列表没有全选功能 改动点: 1. 给区块列表添加全选功能 2. 抽取了一个 SelectAll 组件到 common 包
- Loading branch information
Showing
8 changed files
with
122 additions
and
10 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,42 @@ | ||
<template> | ||
<tiny-checkbox class="block-select-all" :indeterminate="isIndeterminate" v-model="selectedAll"> | ||
{{ hiddenLabel ? '' : '全选' }} | ||
</tiny-checkbox> | ||
</template> | ||
|
||
<script setup> | ||
import { Checkbox as TinyCheckbox } from '@opentiny/vue' | ||
import { computed, defineEmits, defineProps } from 'vue' | ||
const props = defineProps({ | ||
allItems: { | ||
type: Array, | ||
default: () => [] | ||
}, | ||
selected: { | ||
type: Array, | ||
default: () => [] | ||
}, | ||
hiddenLabel: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}) | ||
const emit = defineEmits(['selectAll']) | ||
const selectedAll = computed({ | ||
get() { | ||
return props.allItems.length > 0 && props.allItems.length === props.selected.length | ||
}, | ||
set(value) { | ||
if (value) { | ||
emit('selectAll', props.allItems) | ||
} else { | ||
emit('selectAll', null) | ||
} | ||
} | ||
}) | ||
const isIndeterminate = computed(() => props.selected.length > 0 && props.selected.length !== props.allItems.length) | ||
</script> |
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