hooks
4 years ago
images
4 years ago
BulkActionCheckbox.tsx
4 years ago
BulkActionSelect.module.scss
4 years ago
BulkActionSelect.tsx
4 years ago
Filters.tsx
4 years ago
FormSelect.module.scss
4 years ago
FormSelect.tsx
4 years ago
Input.module.scss
4 years ago
Input.tsx
4 years ago
ListTable.module.scss
4 years ago
ListTable.tsx
4 years ago
ListTablePage.module.scss
3 years ago
ListTableRows.module.scss
3 years ago
ListTableRows.tsx
4 years ago
Pagination.module.scss
4 years ago
Pagination.tsx
4 years ago
README.MD
4 years ago
RowAction.module.scss
4 years ago
RowAction.tsx
4 years ago
Select.module.scss
4 years ago
Select.tsx
4 years ago
TableCell.module.scss
4 years ago
TableCell.tsx
4 years ago
TestLabel.module.scss
4 years ago
TestLabel.tsx
4 years ago
TypeBadge.module.scss
4 years ago
TypeBadge.tsx
4 years ago
api.ts
4 years ago
index.tsx
4 years ago
BulkActionSelect.tsx
35 lines
| 1 | import pageStyles from "@givewp/components/ListTable/ListTablePage.module.scss"; |
| 2 | import styles from './BulkActionSelect.module.scss'; |
| 3 | import {__} from "@wordpress/i18n"; |
| 4 | import Select from "@givewp/components/ListTable/Select"; |
| 5 | import {useState} from "react"; |
| 6 | |
| 7 | let selected = ''; |
| 8 | |
| 9 | export const BulkActionSelect = ({bulkActions = null, showModal, data, parameters}) => { |
| 10 | const [selectedState, setSelectedState] = useState(selected); |
| 11 | if(!bulkActions){ |
| 12 | return null; |
| 13 | } |
| 14 | |
| 15 | const changeSelected = (event) => { |
| 16 | selected = event.target.value; |
| 17 | setSelectedState(event.target.value); |
| 18 | } |
| 19 | |
| 20 | return ( |
| 21 | <form id={styles.bulkActionsForm} onSubmit={showModal}> |
| 22 | <Select name='giveListTableBulkActions' value={selectedState} onChange={changeSelected}> |
| 23 | <option value=''>{__('Bulk Actions', 'give')}</option> |
| 24 | {bulkActions.map(action => { |
| 25 | if (typeof action?.isVisible == 'function' && !action.isVisible(data, parameters)) { |
| 26 | return null; |
| 27 | } |
| 28 | return <option key={action.value} value={action.value}>{action.label}</option>; |
| 29 | })} |
| 30 | </Select> |
| 31 | <button className={pageStyles.addFormButton}>{__('Apply', 'give')}</button> |
| 32 | </form> |
| 33 | ); |
| 34 | } |
| 35 |