Skip to content

New <perspective-viewer>#1488

Merged
texodus merged 3 commits intomasterfrom
perspective-viewer-II-son-of-perspective-viewer
Aug 31, 2021
Merged

New <perspective-viewer>#1488
texodus merged 3 commits intomasterfrom
perspective-viewer-II-son-of-perspective-viewer

Conversation

@texodus
Copy link
Member

@texodus texodus commented Jul 25, 2021

This PR rewrites the @finos/perspective-viewer packages entirely, replacing it with previously internal @finos/perspective-vieux package, which has been renamed to the former. This is mostly a drop-in replacement, but some APIs have been cleaned up in the process:

  • The HTML Attribute API for <perspective-viewer> has been mostly deprecated. Some attributes which are inert but read by plugins currently remain: editable, selectable and name. For all other attributes, use restore() instead, which

    • Can set multiple fields without causing multiple renders.
    • Appropriately choose defaults when e.g. both plugin and columns are set, without overwriting columns with the plugin's defaults.
    • Can be await-ed, when you need to perform an action after a field's effects have rendered.
  • Semantics for restore() have also been updated slightly. A field can be explicitly ignored by omitting the field entirely from the restore object, and explicitly set to default by setting it to undefined. As a result, calling view.restore({}) has no effect now (all fields are omitted/ignored), where-as previous versions this call was equivalent to reset().

     // Set `plugin`
    await viewer.restore({plugin: "Treemap"});
    
     // Set `plugin` to default
    await viewer.restore({plugin: undefined});
    
     // Do nothing
    await viewer.restore({});
  • New MessagePack based serialization options for save() and restore().

    > await viewer.save("json")
    {"row_pivots": [],"column_pivots": [],"columns": ["Row ID","Order ID", ... }
    > await viewer.save("string")
    "l5CQ3AAVplJvdyBJRKhPcmRlci .. ."
    > await viewer.save("arraybuffer")
    [151, 144, 144, 220, 0, 21, 166, 82,  ]
  • save() and restore() now support the settings flag to set User Settings visibility. Fixes toggleConfig() via attribute and part of save() (for perspective-viewer) #879

  • Test suite has been rewritten. Screenshots are no longer hashed, these tests now compare DOM fragments from the rendered page instead, only generating a screenshot when the test fails. As a result, docker is no longer needed for JS tests and has been removed, and test suite runs substantially faster on OSX.

New UX features:

  • In-place editing of expression columns, as well as expression delete button.

    smart_editing

  • Drag/drop dragimage is now centered in the top/left (previously it was anchored to dragstart click position), and is clipped to the column name and type badge only.

  • Drag/drop columns in the header (Group By, Sort, etc) can now accept drop columns in any position instead of just the end of the list.

    dragndrop

  • Filter auto-complete now shows all completions from the dataset (instead of just the top 10), has an :empty style, and initializes in a pre-filtered state correctly.

    dilter

  • Numeric filters now use <input type="number">, Date filters use <input type="date">. DateTime filters additionally use <input type="time">

    Screen Shot 2021-08-31 at 5 46 46 PM

@texodus texodus force-pushed the perspective-viewer-II-son-of-perspective-viewer branch 9 times, most recently from 0b6b2ba to 5aae70d Compare July 28, 2021 20:14
@texodus texodus force-pushed the perspective-viewer-II-son-of-perspective-viewer branch 2 times, most recently from 5eca4a8 to fcbefb0 Compare August 10, 2021 01:41
@texodus texodus mentioned this pull request Aug 12, 2021
@texodus texodus force-pushed the perspective-viewer-II-son-of-perspective-viewer branch 13 times, most recently from 75ce153 to 96f424a Compare August 19, 2021 21:34
@texodus texodus force-pushed the perspective-viewer-II-son-of-perspective-viewer branch 4 times, most recently from 101af7e to 1efc1a3 Compare August 21, 2021 15:11
@texodus texodus force-pushed the perspective-viewer-II-son-of-perspective-viewer branch 10 times, most recently from 13d06ad to 747bdf5 Compare August 30, 2021 18:05
@texodus texodus marked this pull request as ready for review August 30, 2021 20:13
@texodus texodus force-pushed the perspective-viewer-II-son-of-perspective-viewer branch from 747bdf5 to fe14b70 Compare August 31, 2021 19:34
@texodus texodus merged commit 7cddd9e into master Aug 31, 2021
@texodus texodus deleted the perspective-viewer-II-son-of-perspective-viewer branch August 31, 2021 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

toggleConfig() via attribute and part of save() (for perspective-viewer)

1 participant