Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: enhance keys attribute #1749

Merged
merged 4 commits into from
Feb 12, 2025
Merged

chore: enhance keys attribute #1749

merged 4 commits into from
Feb 12, 2025

Conversation

anlyyao
Copy link
Collaborator

@anlyyao anlyyao commented Feb 12, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

相关PR

TDesignOteam/tdesign-api#546

💡 需求背景和解决方案

cascader: test data

const keys = {
  label: 'name.name',
  value: 'id.id',
  children: 'sub.children',
  disabled: 'disabled.disabled',
};

const areaList =  [
    {
      name: { name: '北京市' },
      id: { id: '110000' },
      disabled: { disabled: true },
      sub: {
        children: [
          {
            id: { name: '110100' },
            name: { id: '北京市' },
            sub: {
              children: [
                { id: { id: '110101' }, name: { name: '东城区' } },
                { id: '110102', name: '西城区' },
                { id: '110105', name: '朝阳区' },
              ],
            },
          },
        ],
      },
    },
  ],


radio: test data
const keys = {
  label: 'label.label',
  value: 'value.value',
};

const options = [
  {
    value: { value: '1' },
    label: { label: '选项禁用-已选' },
  },
  {
    value: { value: '2' },
    label: { label: '选项禁用-默认' },
  },
];

checkbox: test data
const keys = {
  label: 'label.label',
  value: 'value.value',
  disabled: 'disabled.disabled',
};

const options = ref([
  { label: { label: '多选' }, value: { value: 'checkbox1' } },
  { label: { label: '多选' }, value: { value: 'checkbox2' } },
  {
    label: { label: '多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行' },
    value: { value: 'checkbox3' },
    maxLabelRow: 2,
  },
  {
    label: { label: '多选' },
    value: { value: 'checkbox4' },
    content: '描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息',
    maxContentRow: 2,
  },
]);

dropdownItem: test data
const keys = {
  label: 'label.label',
  value: 'value.value',
  disabled: 'disabled.disabled',
};

const options = {
  value: 'all',
  options: [
    {
      value: { value: 'all' },
      label: { label: '全部产品' },
      disabled: { disabled: true },
    },
    {
      value: { value: 'new' },
      label: { label: '最新产品' },
    },
    {
      value: { value: 'hot' },
      label: { label: '最火产品' },
    },
  ],
};

📝 更新日志

  • feat(CheckboxGroup): 增加 keysreadonly 属性

  • feat(Cascader): 增强 keys 属性能力,类型更新为 TreeKeysTypepick 事件返回值增加 label

  • feat(Radio): 增强 keys 属性能力

  • feat(DropdownItem): 增强 keys 属性能力

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copy link
Contributor

完成

@liweijie0812 liweijie0812 merged commit 77b9d06 into develop Feb 12, 2025
9 checks passed
@liweijie0812 liweijie0812 deleted the chore/mobile/keys branch February 12, 2025 10:26
@github-actions github-actions bot mentioned this pull request Feb 18, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants