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: add custom dropdown menu item filter in edit mode #8

Merged
merged 3 commits into from
Aug 8, 2022

Conversation

goshander
Copy link
Member

implement new feature for filtering menu item in edit mode by custom visible handler

type MenuItem = {
  visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items
};

also fix dropdown menu item handler with ConfigItem as callback params

@goshander goshander requested a review from jhoncool August 3, 2022 13:42

```js
import {DashKit} from '@yandex-cloud/dashkit';

DashKit.setSettings({
gridLayout: {margin: [8, 8]},
isMobile: true,
// menu: [] as Array<MenuItem>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just an example, if we really pass an empty array, we will get an empty menu

const itemHandler = item.handler;

const itemAction =
itemHandler && typeof itemHandler === 'function'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not need part with itemHandler &&.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Collaborator

@jhoncool jhoncool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!

@goshander goshander merged commit 5c2824a into main Aug 8, 2022
@goshander goshander deleted the edit-menu-item-filter branch August 8, 2022 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants