FLUID-6612: Create "selectionToFlags" transform to parallel arrayToSetMembership

Metadata

Source
FLUID-6612
Type
Improvement
Priority
Major
Status
Open
Resolution
N/A
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2021-04-19T10:42:17.885-0400
Updated
2021-04-19T10:42:17.885-0400
Versions
N/A
Fixed Versions
N/A
Component
  1. Model Transformation System

Description

As part of the work in dealing with panel visibility in https://github.com/inclusive-design/covid-data-monitor/pull/10/files repeated uses appeared of structures like

{
     "citiesList": false,
     "resultsPage": false,
     "filterPanel": true,
     "hospitalPanel": false
 }

These clearly represent a "single selection" idiom that should be mappable via a single field

visiblePanel: "citiesList"

etc. and a transform like the existing fluid.transforms.arrayToSetMembership - however this transform will only accept an array (representing multiple selection) and not a single value.

We should add a further transform pair, e.g. fluid.transforms.selectionToFlags to handle this case, and perhaps consider renaming/aliasing arrayToSetMembership as arrayToFlags or so.

These transforms will be crucial for the new "in-model" data binding idiom, paralleling the various kinds of UISelect that used to do this in the view layer in "old RSF" - https://github.com/rsf/rsf/blob/master/rsf-core/core/src/uk/org/ponder/rsf/components/UISelect.java