diff --git a/package.json b/package.json index 8e3b852b30..4840abc0c9 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "start": "cd examples/demo-app && (path-exists node_modules || npm i) && npm run start-local", "start:custom-layer": "(cd examples/custom-layer && (path-exists node_modules || npm i) && npm run start-local)", "start:open-modal": "(cd examples/open-modal && (path-exists node_modules || npm i) && npm run start-local)", - "build": "rm -fr dist && uber-licence && babel src --out-dir dist --plugins=transform-es2015-modules-commonjs --source-maps inline", + "build": "uber-licence && babel src --out-dir dist --plugins=transform-es2015-modules-commonjs --source-maps inline", "lint": "eslint src examples/**/src website/src", "check-licence": "uber-licence --dry", "add-licence": "uber-licence", diff --git a/src/components/bottom-widget.js b/src/components/bottom-widget.js index 7cffc8b8fd..f2d3ba788f 100644 --- a/src/components/bottom-widget.js +++ b/src/components/bottom-widget.js @@ -69,6 +69,7 @@ export default function BottomWidgetFactory(TimeWidget) { width={Math.min(MaxWidth, enlargedFilterWidth)} isAnyFilterAnimating={isAnyFilterAnimating} enlargedIdx={enlargedFilterIdx} + filters={filters} filter={filters[enlargedFilterIdx]} /> ); diff --git a/src/components/common/time-range-slider.js b/src/components/common/time-range-slider.js index c09bb0d2cc..1cd36f7bc7 100644 --- a/src/components/common/time-range-slider.js +++ b/src/components/common/time-range-slider.js @@ -65,7 +65,7 @@ export default class TimeRangeSlider extends Component { width: 288 }; this._animation = null; - this._sliderThrottle = throttle(this.props.onChange, 20); + this._sliderThrottle = throttle((value) => this.props.onChange(value), 20); } componentDidUpdate() { diff --git a/src/components/filters/time-widget.js b/src/components/filters/time-widget.js index 76fa8effef..342d9d7b5e 100644 --- a/src/components/filters/time-widget.js +++ b/src/components/filters/time-widget.js @@ -27,6 +27,7 @@ import {SelectTextBold, IconRoundSmall, CenterFlexbox} from 'components/common/s import TimeRangeFilter from 'components/filters/time-range-filter'; import {Close, Clock, LineChart} from 'components/common/icons'; import {TIME_ANIMATION_SPEED} from 'utils/filter-utils'; +import ItemSelector from 'components/common/item-selector/item-selector'; const innerPdSide = 32; const WidgetContainer = styled.div` @@ -118,6 +119,7 @@ export class TimeWidget extends Component { const { enlargedIdx, enlargeFilter, + filters, filter, isAnyFilterAnimating, setFilter, @@ -135,7 +137,16 @@ export class TimeWidget extends Component { - {filter.name} + filter.name)} + multiSelect={false} + searchable={false} + onChange={(name)=>{ + if (name !== filter.name) + enlargeFilter(filters.findIndex(f=>f.name === name)); + }} + /> @@ -164,7 +175,12 @@ export class TimeWidget extends Component { setFilter(enlargedIdx, 'value', value)} + setFilter={value => { + for (let i = 0; i < filters.length; ++i){ + if (filters[i].fieldType === 'timestamp') { + setFilter(i, 'value', value); + } + } } } isAnyFilterAnimating={isAnyFilterAnimating} updateAnimationSpeed={(speed) => updateAnimationSpeed(enlargedIdx, speed)} toggleAnimation={() => toggleAnimation(enlargedIdx)} diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.js index 271387e20a..aaa841bc15 100644 --- a/src/reducers/vis-state-updaters.js +++ b/src/reducers/vis-state-updaters.js @@ -305,6 +305,11 @@ export function setFilterUpdater(state, action) { freeze: true, fieldIdx }; + const enlargedFilterIdx = state.filters.findIndex(f => f.enlarged); + if (enlargedFilterIdx > -1 && enlargedFilterIdx !== idx) { + // there should be only one enlarged filter + newFilter.enlarged = false; + } newState = { ...state,