swimos / swim-toolkit-js Goto Github PK
View Code? Open in Web Editor NEWUser interface frameworks for advanced real-time applications.
Home Page: https://swimos.org
User interface frameworks for advanced real-time applications.
Home Page: https://swimos.org
A TreeView
displays a hierarchical table with disclosable rows containing column-aligned cells. Each row in a TreeView
is represented by a LeafView
. And each LeafView
contains a CellView
corresponding to each column defined for the row.
A TreeView
is responsible for positioning rows, maintaining column alignment guides, and delegating row activation, selection, and other control logic to a TreeViewController
. A LeafView
is responsible for laying out its cells, interpreting user interaction, and maintaining, displaying, and animating highlight, selection, focus, disclosure, and depth state.
A LeafView
can be activated, selected, and disclosed. On desktop, a LeafView
is both selected and activated with a single click. On mobile, a LeafView
is activated with a tap, and selected with a long press. Multiple leaf views may be concurrently selected with either a shift-click or a long press. A LeafView
is disclosed by activating a DisclosureCellView
embedded within the row. Swiping left or right on a LeafView
reveals an optional AccessoryView
hidden beneath either end of the row. Accessory views can be used to provide row-specific actions, such as removing a row.
CellView
is the abstract base class for all tree view cells. Each CellView
is anchored to a left and right column alignment guide inherited from its view scope. A CellView
can span columns by anchoring itself to non-adjacent column alignment guides.
AccessoryView
is the abstract base class for views that hide beneath either end of a LeafView
, and can be revealed with a left or right swipe on the LeafView
itself. Multiple accessory views can be attached to either end of a LeafView
, facilitating small menus of actions.
Tree Stems (not visible)
| | | |
+----------------------------+
| Tree View |
| +------------------------+ |
| | | |
| | Leaf | |
| | View | |
| | | |
+-----------|-+------------------------+-|-----------+
| | | +------+------+------+ | | |
| Accessory | | | Cell | Cell | Cell | | | Accessory |
| View | | | View | View | View | | | View |
| | | +------+------+------+ | | |
+-----------|-+------------------------+-|-----------+
| | +------+-------------+ | |
| | | Cell | Cell | | |
| | | View | View | | |
| | +------+-------------+ | |
| +------------------------+ |
| | | |
| | Leaf | |
| | View | |
| | | |
| +------------------------+ |
+----------------------------+
CellView
specializations will include IconCellView
, TextCellView
, and DisclosureCellView
, with additional specialized cells implemented by other UX libraries. The primary implementation of AccessoryView
will be ButtonAccessoryView
.
Tree views are implemented by a family of coordinated views, namely TreeView
, LeafView
, CellView
, and AccessoryView
.
TreeView
has three primary responsibilities: propagating configuration parameters to leaf views via the view scope, procedurally positioning leaf views in the DOM, and coordinating with the TreeViewController
.
TreeView
should inject a treeStems
item into the view scope containing the named alignment guides to which cell views will align themselves.
@ViewScope(Object)
treeStems: ViewScope<this, TreeStems>;
TreeView
should inherit edgeInsets
from its environment, aligning its leftmost column vein to the left inset, and aligning its rightmost column vein to the right inset.
@ViewScope(Object, {inherit: true})
edgeInsets: ViewScope<this, ViewEdgeInsets>;
TreeView
should also add a treeTransition
item to the view scope, which is used to tween leaf view positions when rearranging rows.
@ViewScope(Object, {
init(): Transition<any> {
return Transition.duration(250, Ease.cubicOut);
},
})
treeTransition: ViewScope<this, Transition<any>>;
TreeView
should be positioned relative
, with auto
overflow and -webkit-overflow-scrolling: touch
so that it scrolls internally with momentum. On insertion, child leaf views should be positioned absolute
.
TreeView
procedurally positions its child leaf views. Procedural positioning is employed for two reasons: to facilitate animated changes in leaf position due to insertion, removal, reordering, expanding, collapsing, and dragging; and to support optimizing long lists by dynamically pruning leaf views from the DOM when not scrolled into view.
Iterate over all child leafs, setting the top
style property of each leaf to the running height of the tree view, and then incrementing the running height by the leaf height. The top
of the first leaf must be shifted by the height of any pruned leaves. Implementation of leaf pruning may be tackled at a later date.
Implement the tree module iteratively, with progressively more detailed passes over the family of views.
Sketch out the basic view classes and associated types.
tree
directory to @swim/navigation/main
.tree/index.ts
file to contain all tree directory exports.@swim/navigation
's main index.ts
file (export * from "./tree";
).tree/TreeView.ts
; export an empty TreeView
class that extends HtmlView
.type TreeStems = {readonly [key: string]: number};
declaration to tree/TreeView.ts
.tree/TreeViewObserver.ts
; export an empty TreeViewObserver
interface that extends HtmlViewObserver
.tree/TreeViewController.ts
; export an empty TreeViewController
class that extends HtmlViewController
.TreeStems
, TreeView
, TreeViewObserver
, and TreeViewController
from tree/index.ts
.tree/LeafView
; export an empty LeafView
class that extends HtmlView
.tree/LeafViewObserver
; export an empty LeafViewObserver
interface that extends HtmlViewObserver
.tree/LeafViewController
; export an empty LeafViewController
class that extends HtmlViewController
.LeafView
, LeafViewObserver
, and LeafViewController
from tree/index.ts
.tree/CellView
; export an empty CellView
abstract class that extends HtmlView
.tree/CellViewObserver
; export an empty CellViewObserver
interface that extends HtmlViewObserver
.tree/CellViewController
; export an empty CellViewController
class that extends HtmlViewController
.CellView
, CellViewObserver
, and CellViewController
from tree/index.ts
.tree/AccessoryView
; export an empty CellView
abstract class that extends HtmlView
.AccessoryView
from tree/index.ts
.Fill in essential view properties.
treeStems
view scope property.edgeInsets
view scope property.treeTransition
view scope property.treeStems
view scope property.depthColor
view animator.highlightColor
view animator._depth: number
field._highlighted: boolean
field._selected: boolean
field._focussed: boolean
field._expanded: boolean
field._gesture: PositionGesture<LeafView>
field._leftVein: string
field._rightVein: string
field.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.