Skip to content

Commit

Permalink
fix(FilterBar): support new web-components controls, fix layout and l…
Browse files Browse the repository at this point in the history
…abels (#661)
  • Loading branch information
Lukas742 authored Aug 19, 2020
1 parent e3b1117 commit d0969b5
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions packages/main/src/components/FilterBar/FilterBar.jss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const styles = {
background: ThemingParameters.sapObjectHeader_Background,
boxShadow: ThemingParameters.sapContent_HeaderShadow
},
filterItemExpand: {
'--_ui5_input_width': '100%'
},
filterBarHeader: {
alignItems: 'center',
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const styles = {
flexDirection: 'column',
maxWidth: '960px',
width: '80vw',
maxHeight: '70vh'
maxHeight: '70vh',
'--_ui5_input_width': '100%'
},
header: {
width: '100%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ exports[`FilterBar Render without crashing - default props 1`] = `

exports[`FilterBar Render without crashing - w/ filter dialog 1`] = `
<div
class="FilterBar-outerContainer-0"
class="FilterBar-outerContainer-0 FilterBar-filterItemExpand-0"
>
<div
class="Toolbar-outerContainer-0 Toolbar-clear-0 FilterBar-filterBarHeader-0"
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/components/FilterBar/demo.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const renderDefaultStory = (props) => {
filterBarExpanded={props.filterBarExpanded}
loading={props.loading}
considerGroupName={props.considerGroupName}
filterContainerWidth={props.auto}
filterContainerWidth={props.filterContainerWidth}
activeFiltersCount={props.activeFiltersCount}
showClearOnFB={props.showClearOnFB}
showRestoreOnFB={props.showRestoreOnFB}
Expand Down Expand Up @@ -116,7 +116,7 @@ export default {
useToolbar: true,
filterBarExpanded: true,
considerGroupName: false,
filterContainerWidth: '13rem',
filterContainerWidth: '13.125rem',
activeFiltersCount: 0,
showClearOnFB: false,
showRestoreOnFB: false,
Expand Down
3 changes: 3 additions & 0 deletions packages/main/src/components/FilterBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ const FilterBar: FC<FilterBarPropTypes> = forwardRef((props: FilterBarPropTypes,
if (className) {
cssClasses.put(className);
}
if (filterContainerWidth) {
cssClasses.put(classes.filterItemExpand);
}

useEffect(() => {
prevSearchInputPropsValueRef.current = search?.props?.value;
Expand Down
4 changes: 3 additions & 1 deletion packages/main/src/components/FilterBar/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ export const filterValue = (ref, child) => {
let filterItemProps = {};
if (
tagName === 'UI5-INPUT' ||
tagName === 'UI5-DATEPICKER' ||
tagName === 'UI5-DATE-PICKER' ||
tagName === 'UI5-DATETIME-PICKER' ||
tagName === 'UI5-DATERANGE-PICKER' ||
tagName === 'UI5-TIME-PICKER' ||
tagName === 'UI5-DURATION-PICKER'
) {
filterItemProps = { value: ref.value };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const styles = {
filterItem: {
width: '13rem',
width: 'var(--_ui5_input_width)',
marginRight: '1rem',
marginBottom: '1rem'
},
Expand Down
3 changes: 2 additions & 1 deletion packages/main/src/components/FilterGroupItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ FilterGroupItem.defaultProps = {
groupName: 'default',
visible: true,
visibleInFilterBar: true,
required: false
required: false,
label: ''
};

0 comments on commit d0969b5

Please sign in to comment.