arco-design-vue icon indicating copy to clipboard operation
arco-design-vue copied to clipboard

feat(table): RowSelection add disabled function for issues #1450

Open liect opened this issue 3 years ago • 0 comments

Types of changes

  • [x] New feature
  • [ ] Bug fix
  • [x] Enhancement
  • [ ] Component style change
  • [ ] Typescript definition change
  • [ ] Documentation change
  • [ ] Coding style change
  • [ ] Refactoring
  • [ ] Test cases
  • [ ] Continuous integration
  • [x] Breaking change
  • [ ] Others

Background and context

行选择器的disabled和data耦合太重,通过在RowSelection中增加disabled配置实现更灵活的disabled 微信截图_20220729162838

Solution

How is the change tested?

<template>
  <a-space direction="vertical" size="large" fill>
    <div>
      <span>OnlyCurrent: </span>
      <a-switch v-model="rowSelection.onlyCurrent" />
    </div>
    <a-table row-key="name" :columns="columns" :data="data" :row-selection="rowSelection"
             v-model:selectedKeys="selectedKeys" :pagination="pagination" />
  </a-space>
</template>

<script>
import { reactive, ref } from 'vue';

export default {
  setup() {
    const selectedKeys = ref(['1', '2']);

    const rowSelection = reactive({
      type: 'checkbox',
      showCheckedAll: true,
      onlyCurrent: false,
      disabled: (data)=> data.name === 'Kevin Sandra'
    });
   // ......
  return {
      rowSelection,
      columns,
      data,
      selectedKeys,
      pagination
    }
  },
}
</script>

Changelog

Component Changelog(CN) Changelog(EN) Related issues
Table 增强行选择器的disabled Enhanced Disabled for the row selector #1450

Checklist:

  • [x] Test suite passes (npm run test)
  • [x] Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
  • [x] Changes are submitted to the appropriate branch (e.g. features should be submitted to feature branch and others should be submitted to main branch)

Other information

liect avatar Jul 27 '22 02:07 liect