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

New component menu bulk actions #90

Open
trigoporres opened this issue Oct 15, 2024 · 0 comments
Open

New component menu bulk actions #90

trigoporres opened this issue Oct 15, 2024 · 0 comments
Labels
enhancement New feature or request genesys-ui-table

Comments

@trigoporres
Copy link
Contributor

What is the problem this feature will solve?

We do not have a special component for the bulk actions menu of the table. It must always be created in the column definition. This makes it possible for everyone to set up the menu in their own way.

What is the feature you are proposing to solve the problem?

We have to create a menu component with the corresponding styles that can be used directly in the bulkactions column. In this way:

     <Popover.Panel>
            <Panel.Header size="sm" title={'Bulk actions'}>
              <HFlex justifyContent="space-between">
                <Typography.Heading size="h5">
                  Bulk actions
                </Typography.Heading>
                <Typography.Caption colorScheme="weak">
                  {bulkSelection.length} selected
                </Typography.Caption>
              </HFlex>
            </Panel.Header>
            <Panel.Body removeSpace>
              <Box padding="cmp-xxs">
                <Menu>
                  <Menu.Item
                    onClick={() => {
                      setOpened(false);
                    }}
                  >
                    Dummy action
                  </Menu.Item>
                  <Menu.Item>Dummy action 2</Menu.Item>
                  <Popover
                    placement="right-start"
                    id={popoverId}
                  >
                    {({ toggle, ref, isOpened, setOpened }) => (
                      <Menu.Item
                        aria-controls={popoverId}
                        aria-haspopup="true"
                        aria-expanded={isOpened}
                        ref={ref}
                        onClick={() => {
                          setOpened(true);
                        }}
                        onMouseLeave={toggle}
                        onMouseOver={() => {
                          setOpened(true);
                        }}
                        expandable
                        state={
                          isOpened ? 'expanded' : undefined
                        }
                      >
                        Danger actions
                      </Menu.Item>
                    )}
                    <Popover.Panel>
                      <Menu>
                        <Menu.Item>Dummy action 1</Menu.Item>
                        <Menu.Item>Dummy action 2</Menu.Item>
                        <Menu.Item
                          onClick={() => {
                            setData((prev) =>
                              prev.filter(
                                (_, index) =>
                                  !bulkSelection.includes(
                                    index,
                                  ),
                              ),
                            );
                            clear();
                          }}
                        >
                          Remove row(s)
                        </Menu.Item>
                      </Menu>
                    </Popover.Panel>
                  </Popover>
                </Menu>
              </Box>
            </Panel.Body>
          </Popover.Panel>

What alternatives have you considered?

No response

@trigoporres trigoporres added enhancement New feature or request genesys-ui-table labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request genesys-ui-table
Projects
None yet
Development

No branches or pull requests

1 participant