This repository has been archived by the owner on Nov 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 168
[WIP] Cell Editing #444
Open
mbektas
wants to merge
36
commits into
phosphorjs:master
Choose a base branch
from
mbektas:celleditor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[WIP] Cell Editing #444
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks @mbektasbbg! I just wanted to comment and say this looks awesome at first glance. I'll give it a more in-depth review with comments in the the immediate future :) |
I also sat down with Mehmet and we discussed some code style things as well as tested and found some behavior bugs in Firefox/Safari, which he took notes on. Mehmet also mentioned he views this as an initial WIP implementation, and he has some design questions and wants to consider the implementation and design as definitely open for discussion. |
And I'll add, @mbektasbbg, that I'm also really excited about this! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @sccolbert (cc. @jasongrout, @blink1073, @afshin, @ellisonbg, @SylvainCorlay) I have been working on adding editing capabilities to DataGrid and trying to have a flexible design so that it is possibly something that can be merged to upstream and useful for everyone. It is still a work in progress and I would appreciate any feedback.
In a short summary, it adds a new DataModel (MutableDataModel), ICellEditorController interface with a concrete implementation and ICellEditor interface with several editor implementations and ICellInputValidator interface with concrete implementations for some types. I also added cursor movement using Tab & Enter keys within body or confined to selections when there are any.
Editing is possible if data model is of type MutableDataModel and there is a selection model. It is triggered using double click or typing. Editing can also be triggered programmatically, optionally with a custom editor and validator. Editor type to use is inferred from metadata if the metadata follows the schema defined in https://frictionlessdata.io/specs/table-schema/, otherwise if cell data is a primitive type TextCellEditor is used.
Cell editors to used can be set/overridden based on cell data type or metadata key-value pair match.
DataGrid example is modified to present most of the editing features including a custom cell editor.
Some Documentation to help with PR
Cursor movement
Deleting Cell values (setting to null) using Delete key
MutableDataModel which defines new method setData
Cell Editor
TextCellEditor
{type: 'string'}
NumberCellEditor
{type: 'number'}
IntegerCellEditor
{type: 'integer'}
BooleanCellEditor
{type: 'boolean'}
DateCellEditor
{type: 'date'}
OptionCellEditor
{type: any, constraint: {enum: [list of options]}}
DynamicOptionCellEditor
{type: any, constraint: {enum: 'dynamic'}}
. This is not a standard schema format, I extended it.Editor Controller
Validators
TextInputValidator
NumberInputValidator
IntegerInputValidator