@@ -21,10 +21,15 @@ export default class DeleteRowsDialog extends React.Component {
2121 }
2222
2323 valid ( ) {
24- if ( this . state . confirmation === this . props . className ) {
24+ const selectionLength = Object . keys ( this . props . selection ) . length ;
25+
26+ if ( this . props . selection [ '*' ] && this . state . confirmation . toLowerCase ( ) === 'delete all' ) {
27+ return true ;
28+ }
29+ if ( selectionLength >= 10 && this . state . confirmation . toLowerCase ( ) === 'delete selected' ) {
2530 return true ;
2631 }
27- if ( ! this . props . selection [ '*' ] && Object . keys ( this . props . selection ) . length < 10 ) {
32+ if ( ! this . props . selection [ '*' ] && selectionLength < 10 ) {
2833 return true ;
2934 }
3035 return false ;
@@ -33,17 +38,35 @@ export default class DeleteRowsDialog extends React.Component {
3338 render ( ) {
3439 let content = null ;
3540 let selectionLength = Object . keys ( this . props . selection ) . length ;
36- if ( this . props . selection [ '*' ] || selectionLength >= 10 ) {
41+
42+ if ( selectionLength >= 10 ) {
43+ content = (
44+ < Field
45+ label = {
46+ < Label
47+ text = 'Confirm this action'
48+ description = 'Enter "delete selected" word to continue.' />
49+ }
50+ input = {
51+ < TextInput
52+ placeholder = 'delete selected'
53+ value = { this . state . confirmation }
54+ onChange = { ( confirmation ) => this . setState ( { confirmation } ) } />
55+ } />
56+ ) ;
57+ }
58+
59+ if ( this . props . selection [ '*' ] ) {
3760 content = (
3861 < Field
3962 label = {
4063 < Label
4164 text = 'Confirm this action'
42- description = 'Enter the current class name to continue.' />
65+ description = 'Enter "delete all" to continue.' />
4366 }
4467 input = {
4568 < TextInput
46- placeholder = 'Current class name '
69+ placeholder = 'delete all '
4770 value = { this . state . confirmation }
4871 onChange = { ( confirmation ) => this . setState ( { confirmation } ) } />
4972 } />
0 commit comments