Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: CRUD 的 filterTogglable 支持配置文案和图标 Close: #7089 #7181

Merged
merged 8 commits into from
Jun 16, 2023

Conversation

2betop
Copy link
Collaborator

@2betop 2betop commented Jun 15, 2023

What

🤖 Generated by Copilot at 5881ca2

This pull request improves the usability and customization of the CRUD component's filter toggle feature. It adds documentation and code examples for the filterTogglable property in docs/zh-CN/components/crud.md. It also adds support for custom labels and icons for the filter toggle button in packages/amis/src/renderers/CRUD.tsx.

🤖 Generated by Copilot at 5881ca2

Unleash the power of the filter
filterTogglable is the key
Customize the button with labels and icons
CRUD renderer will set you free

Why

Close: #7089

How

🤖 Generated by Copilot at 5881ca2

  • Add and update the documentation of the filterTogglable property of the CRUD component, showing how to customize the label, icon, and active state of the filter toggle button (link, link)
  • Import the generateIcon function from amis-core and the isPlainObject function from lodash in the CRUD renderer, which are used to render and check the custom icon and label properties (link, link)
  • Update the type definition of the filterTogglable property of the CRUD component, changing it from boolean to boolean | {label?: string; icon?: string; activeLabel?: string; activeIcon?: string;} (link)
  • Fix a typo in the CRUD renderer, changing store.filterTogggable to store.filterTogglable (link)
  • Add the filterTogglable property to the props destructuring in the renderFilterToggler method of the CRUD renderer, and assign the custom label and icon properties to a local variable, with fallbacks to the default values (link)
  • Add a logic to the renderFilterToggler method of the CRUD renderer, which checks if the filterTogglable property is an object or a boolean, and handles the active state of the filter toggle button by switching the icon and label properties accordingly (link)
  • Modify the JSX of the filter toggle button in the renderFilterToggler method of the CRUD renderer, using the generateIcon function to render the custom icon if provided, or the default icon if not explicitly set to false, and rendering the custom label if provided, or the default label otherwise (link)

@github-actions github-actions bot added the feat label Jun 15, 2023
@github-actions
Copy link

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

@hsm-lv hsm-lv merged commit c07951b into baidu:master Jun 16, 2023
5 checks passed
@2betop 2betop deleted the feat-crud-filter-togglable branch July 4, 2023 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crud中筛选按钮 ps:切换显示查询表单的功能按钮
3 participants