/** * JavaScript code for the "Edit" section integration of the "Table Options". * * @package TablePress * @subpackage Views JavaScript * @author Tobias Bäthge * @since 3.0.0 */ /** * WordPress dependencies. */ import { CheckboxControl, FormTokenField, __experimentalHStack as HStack, // eslint-disable-line @wordpress/no-unsafe-wp-apis __experimentalNumberControl as NumberControl, // eslint-disable-line @wordpress/no-unsafe-wp-apis SelectControl, __experimentalVStack as VStack, // eslint-disable-line @wordpress/no-unsafe-wp-apis } from '@wordpress/components'; import { createInterpolateElement } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; /** * Internal dependencies. */ import { initializeReactComponentInPortal } from '../common/react-loader'; const Section = ( { tableOptions, updateTableOptions } ) => { return (
{ __( 'Table Header', 'tablepress' ) }:
{ __( 'Table Footer', 'tablepress' ) }:
{ __( 'Alternating Row Colors', 'tablepress' ) }: updateTableOptions( { alternating_row_colors } ) } />
{ __( 'Row Hover Highlighting', 'tablepress' ) }: updateTableOptions( { row_hover } ) } />
{ __( 'Print Table Name', 'tablepress' ) }: the table.', 'position (above or below)', 'tablepress' ), { select: ( updateTableOptions( { print_name_position } ) } options={ [ { label: __( 'above', 'tablepress' ), value: 'above' }, { label: __( 'below', 'tablepress' ), value: 'below' }, ] } /> ), }, ) } checked={ tableOptions.print_name } onChange={ ( print_name ) => updateTableOptions( { print_name } ) } />
{ __( 'Print Table Description', 'tablepress' ) }: the table.', 'position (above or below)', 'tablepress' ), { select: ( updateTableOptions( { print_description_position } ) } options={ [ { label: __( 'above', 'tablepress' ), value: 'above' }, { label: __( 'below', 'tablepress' ), value: 'below' }, ] } /> ), }, ) } checked={ tableOptions.print_description } onChange={ ( print_description ) => updateTableOptions( { print_description } ) } />
updateTableOptions( { extra_css_classes: extra_css_classes.join( ' ' ).trim().replace( /[^A-Za-z0-9 _:-]/g, '' ) } ) } value={ '' !== tableOptions.extra_css_classes ? tableOptions.extra_css_classes.split( ' ' ) : [] } tokenizeOnBlur={ true } tokenizeOnSpace={ true } __experimentalShowHowTo={ false } /> { createInterpolateElement( __( 'Additional CSS classes for styling purposes can be entered here.', 'tablepress' ) + ' ' + __( 'This is NOT the place to enter Custom CSS code!', 'tablepress' ), { a: , // eslint-disable-line jsx-a11y/anchor-has-content }, ) }
); }; initializeReactComponentInPortal( 'table-options', 'edit', Section, );