Skip to content

Commit 737d1aa

Browse files
authored
revert: feat: forward and back buttons for organize column search (#1640)
This reverts commit 75cf184. Auto-merge was to eager, I only approved for functionality not code reviewed.
1 parent 75cf184 commit 737d1aa

7 files changed

Lines changed: 13 additions & 303 deletions

File tree

packages/components/src/SearchInput.scss

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,4 @@
5555
border-radius: 1rem;
5656
background-color: rgba($white, 0.25);
5757
}
58-
59-
.search-change-selection {
60-
position: absolute;
61-
right: $spacer-1;
62-
top: 15%;
63-
bottom: 15%;
64-
height: 70%;
65-
}
66-
67-
.search-change-button {
68-
background: none;
69-
border: none;
70-
padding: 1px 2px;
71-
}
72-
73-
.search-change-text {
74-
background-color: rgba($white, 0.2);
75-
border-radius: 10px;
76-
padding: 1px 5px;
77-
}
78-
79-
.match_count {
80-
background-color: rgba($white, 0.2);
81-
border-radius: 10px;
82-
padding: 1px 5px;
83-
margin: 0 5px;
84-
}
8558
}

packages/components/src/SearchInput.tsx

Lines changed: 7 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import React, { PureComponent } from 'react';
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3-
import { vsArrowLeft, vsArrowRight, vsSearch } from '@deephaven/icons';
3+
import { vsSearch } from '@deephaven/icons';
44
import classNames from 'classnames';
5-
import Button from './Button';
65
import './SearchInput.scss';
76

8-
interface QueryParams {
9-
queriedColumnIndex: number | undefined;
10-
changeQueriedColumnIndex: (direction: 'forward' | 'back') => void;
11-
}
127
interface SearchInputProps {
138
value: string;
149
placeholder: string;
@@ -20,7 +15,6 @@ interface SearchInputProps {
2015
matchCount: number;
2116
id: string;
2217
'data-testid'?: string;
23-
queryParams?: QueryParams;
2418
}
2519

2620
class SearchInput extends PureComponent<SearchInputProps> {
@@ -33,40 +27,19 @@ class SearchInput extends PureComponent<SearchInputProps> {
3327
},
3428
id: '',
3529
'data-testid': undefined,
36-
queryParams: undefined,
3730
};
3831

3932
constructor(props: SearchInputProps) {
4033
super(props);
4134
this.inputField = React.createRef();
42-
this.searchChangeSelection = React.createRef();
43-
}
44-
45-
componentDidMount(): void {
46-
this.setInputPaddingRight();
4735
}
4836

49-
componentDidUpdate(): void {
50-
this.setInputPaddingRight();
51-
}
37+
inputField: React.RefObject<HTMLInputElement>;
5238

5339
focus(): void {
5440
this.inputField.current?.focus();
5541
}
5642

57-
inputField: React.RefObject<HTMLInputElement>;
58-
59-
searchChangeSelection: React.RefObject<HTMLDivElement>;
60-
61-
setInputPaddingRight(): void {
62-
const inputField = this.inputField.current;
63-
const searchChangeSelection = this.searchChangeSelection.current;
64-
if (inputField && searchChangeSelection) {
65-
const paddingRight = searchChangeSelection.getBoundingClientRect().width;
66-
inputField.style.paddingRight = `${paddingRight}px`;
67-
}
68-
}
69-
7043
render(): JSX.Element {
7144
const {
7245
value,
@@ -79,47 +52,7 @@ class SearchInput extends PureComponent<SearchInputProps> {
7952
id,
8053
onKeyDown,
8154
'data-testid': dataTestId,
82-
queryParams,
8355
} = this.props;
84-
85-
let matchCountSection;
86-
87-
if (queryParams && matchCount > 1) {
88-
matchCountSection = (
89-
<>
90-
<Button
91-
kind="ghost"
92-
className="search-change-button"
93-
type="button"
94-
onClick={() => {
95-
queryParams.changeQueriedColumnIndex('back');
96-
}}
97-
icon={vsArrowLeft}
98-
tooltip="Next match"
99-
/>
100-
<span className="search-change-text">
101-
{queryParams.queriedColumnIndex !== undefined &&
102-
`${queryParams.queriedColumnIndex + 1} of `}
103-
{matchCount}
104-
</span>
105-
<Button
106-
kind="ghost"
107-
className="search-change-button"
108-
type="button"
109-
onClick={() => {
110-
queryParams.changeQueriedColumnIndex('forward');
111-
}}
112-
icon={vsArrowRight}
113-
tooltip="Next match"
114-
/>
115-
</>
116-
);
117-
} else {
118-
matchCountSection = matchCount > 0 && (
119-
<span className="match_count">{matchCount}</span>
120-
);
121-
}
122-
12356
return (
12457
<div className={classNames('search-group', className)}>
12558
<input
@@ -135,19 +68,12 @@ class SearchInput extends PureComponent<SearchInputProps> {
13568
id={id}
13669
data-testid={dataTestId}
13770
/>
138-
139-
{matchCount != null ? (
140-
<div
141-
className="search-change-selection"
142-
ref={this.searchChangeSelection}
143-
>
144-
{matchCountSection}
145-
</div>
146-
) : (
147-
<span className="search-icon">
148-
<FontAwesomeIcon icon={vsSearch} />
149-
</span>
71+
{matchCount != null && (
72+
<span className="search-match">{matchCount}</span>
15073
)}
74+
<span className="search-icon">
75+
<FontAwesomeIcon icon={vsSearch} />
76+
</span>
15177
</div>
15278
);
15379
}

packages/iris-grid/src/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.test.tsx

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,31 +1184,3 @@ test('On drag start/end', () => {
11841184
expect(mockGroupHandler).toBeCalledWith([]);
11851185
expect(mockMoveHandler).toBeCalledWith([{ from: 0, to: 1 }]);
11861186
});
1187-
1188-
test('changeSelectedColumn moves queried column index and loops', () => {
1189-
const builder = React.createRef<VisibilityOrderingBuilder>();
1190-
render(<Builder builderRef={builder} />);
1191-
1192-
builder.current?.searchColumns('TestColumn');
1193-
expect(builder.current?.state.selectedColumns.size).toEqual(10);
1194-
1195-
builder.current?.changeSelectedColumn('forward');
1196-
expect(builder.current?.state.queriedColumnIndex).toEqual(9);
1197-
1198-
builder.current?.changeSelectedColumn('forward');
1199-
expect(builder.current?.state.queriedColumnIndex).toEqual(0);
1200-
});
1201-
1202-
test('adjustQueriedIndex sets queriedColumnRange to prevIndex = 9 and nextIndex = 0', () => {
1203-
const builder = React.createRef<VisibilityOrderingBuilder>();
1204-
render(<Builder builderRef={builder} />);
1205-
1206-
builder.current?.searchColumns('TestColumn');
1207-
1208-
builder.current?.adjustQueriedIndex('Test');
1209-
1210-
expect(builder.current?.state.queriedColumnRange).toEqual({
1211-
prevIndex: 9,
1212-
nextIndex: 0,
1213-
});
1214-
});

0 commit comments

Comments
 (0)