RCFilters: Create one single source of truth for item display
authorMoriel Schottlender <moriel@gmail.com>
Tue, 19 Dec 2017 02:25:34 +0000 (18:25 -0800)
committerMoriel Schottlender <moriel@gmail.com>
Fri, 22 Dec 2017 01:28:01 +0000 (17:28 -0800)
commit95667ea4e141b6dcd5b1c943ce12e03a09717d6f
treeae33de2968b43cb02b4cfffedeb43c03bce96a8d
parente1aabf2f24aef20adc72db8a750704cbb33236c6
RCFilters: Create one single source of truth for item display

Synchronize the search input, filter view and all view selection into
a single source of truth through the model.
- Stop using OO.ui.MenuSelectWidget's internal filtering logic, and
  use our own filtering logic in the model instead.
- Add a concept of 'search' to the model, that is synchronized with
  the current search term of the systme. The search dictates the view
  and the visible items in the filters.
  -- Whenever the search changes for whatever reason,
     the model automatically updates the visibility of all items and
     groups in the filter list.
  -- This means that after changing view or search, the widgets can
     always trust that they have the most updated visible item list
     to scroll to or select.
- Make the view model's findMatches
  as the ultimate source of truth as to what should be visible.
  The items are now **always** all included in the menu, but they
  change their visibility according to the logic in the findMatches.
  If there is a search term, the function will account for that and
  the selected view, so we can be sure that search results also
  change between changing views.

This allows us to simplify the operation of selecting a tag, where
we know that the order of operation is bound to switching the views,
that will also show us the relevant results. We can bind to the display
event and properly select -- and scroll to -- the item.

Bug: T182720
Bug: T178540
Change-Id: If575f348705d863b9d68d19761ded55a4d453550
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterGroup.js
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterItem.js
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FiltersViewModel.js
resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.ui.MenuSelectWidget.less
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterMenuHeaderWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterMenuSectionOptionWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterTagMultiselectWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.ItemMenuOptionWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.MenuSelectWidget.js