Skip to content

Commit

Permalink
Merge branch 'master' into UIPQB-64
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
vashjs committed Nov 13, 2023
2 parents d15d5b1 + 87ed788 commit c9fb89d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## (in progress)
* [UIPQB-60](https://issues.folio.org/browse/UIPQB-60) 'In' and 'Not In' requests not properly formatted for [Users] "User ID"
* [UIPQB-56](https://issues.folio.org/browse/UIPQB-56) Prevent columns from being reset when query is changed
* [UIPQB-67](https://issues.folio.org/browse/UIPQB-67) Styles are defined globally for inputs with type "number"
* [UIPQB-64](https://issues.folio.org/browse/UIPQB-64) Query builder can’t edit single condition queries without AND wrapper

## [1.0.0](https://github.com/folio-org/ui-plugin-query-builder/tree/v1.0.0) (2023-10-12)
Expand Down
6 changes: 3 additions & 3 deletions src/QueryBuilder/QueryBuilder.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
align-items: center;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
input.NumberInput::-webkit-outer-spin-button,
input.NumberInput::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

/* Firefox */
input[type=number] {
input.NumberInput[type=number] {
-moz-appearance: textfield;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { OPERATORS } from '../../../../constants/operators';
import { SelectionContainer } from '../SelectionContainer/SelectionContainer';
import { ISO_FORMAT } from '../../helpers/timeUtils';

import css from '../../../QueryBuilder.css';

export const DataTypeInput = ({
availableValues,
onChange,
Expand All @@ -28,7 +30,7 @@ export const DataTypeInput = ({
const isEqualRelatedOperator = [OPERATORS.EQUAL, OPERATORS.NOT_EQUAL].includes(operator);
const hasSourceOrValues = source || availableValues;

const textControl = ({ testId, type = 'text' }) => {
const textControl = ({ testId, type = 'text', textClass }) => {
const onKeyDown = (event) => {
// prevent typing e, +, - in number type
if (type === 'number' && (event.keyCode === 69 || event.keyCode === 187 || event.keyCode === 189)) {
Expand All @@ -42,6 +44,7 @@ export const DataTypeInput = ({
onChange={(e) => onChange(e.target.value, index, COLUMN_KEYS.VALUE)}
onKeyDown={onKeyDown}
type={type}
className={textClass}
{...rest}
/>
);
Expand Down Expand Up @@ -114,7 +117,9 @@ export const DataTypeInput = ({
};

const numericTypeControls = () => {
return hasSourceOrValues ? selectControl({ testId: 'data-input-select-numeric' }) : textControl({ type: 'number' });
return hasSourceOrValues
? selectControl({ testId: 'data-input-select-numeric' })
: textControl({ type: 'number', textClass: css.NumberInput });
};

const booleanTypeControls = () => (
Expand Down

0 comments on commit c9fb89d

Please sign in to comment.