angular Cell Cursor
Simple excel like spreadsheet development kit for angularJs.
- display table cell cursor like Excel.
- user can move cursor by mouse or keyboad ( ARROW ).
- range selection like Excel (mouse drag or shift+ARROW , ESC to deselect).
- user can copy range values to Excel (ctrl+C).
- user can paste range values from Excel (ctrl+V).
- user can edit cell value (ENTER,F2, or direct input for example a).
- user can drag to resize column or row.
- Easy to extend.
DEMO
http://team-lab.github.io/cell-cursor/example.html
directives
cell-cursor
cell-cursor="expression"
bind cell-cursor. export CellCursor object.
<!-- bind CellCursor to scope.x --> <!-- table need tablindex attribute for directive catch keydown events. --> <!-- cursor can move in tbody --> {{i.id}} {{i.name}} <!-- you can access CellCursor Object --> cursor=[{{x.selected.cursor.row}},{{x.selected.cursor.col}}]
cell-cursor-copy
cell-cursor-copy="expression"
When copy
called, then set data to clipboard.
<!-- if you use ng-model on `td`, getSelectedCellValues() get data by ngModelControll.$viewValue --> {{i.id}} <!-- if you use cell-options on `td`, getSelectedCellValues() get data by getter() --> {{i.name}}
cell-cursor-paste
cell-cursor-paste="expression"
When press ctrl+v
called, then get data from clipboard.
Expression scope has $data
it is clipboard data.
<!-- if you use ng-model on `td`, setSelectedCellValues() set data by ngModelControll.$setViewValue --> <!-- if td has readonly attributes, setSelectedCellValues dose not effect --> {{i.id}} <!-- if you use cell-options on `td`, setSelectedCellValues() set data by setter() --> {{i.name}} readonly({{readonly}})
cell-cursor-options
cell-cursor-options="expression"
set option object. set to cell( td or th ) element.
Order of getters/setter definitions is getter
|setter
> bind
> ngModel
> input
.
Event function signeture is function (event, option:(cell-cursor-options), cellCursorOptionsController, cellCursor, td:HTMLCellElement):boolean
.
event called now keydown
|keypress
|keydown
|compositionstart
|compositionupdate
|compositionend
|input
only.
{{i.name}}
cell-cursor-drag
cell-cursor-drag="expression"
expression indicate CellCursor
object.
{{i.name}}
cell-cursor-col-resize
drag resize handler. User can drag and resize to column width. ( in html, set style 'max-width' and 'width' to all cell elements. )
<!-- set handler as class name --> <!-- wrap content div that has 'overflow:hidden' if you need --> This name is 'A'. This name is 'B'. This name is 'C'.
cell-cursor-row-resize
drag resize handler. User can drag and resize to row height. ( in html, set style 'max-height' and 'height' to tr elements. )
<!-- set handler as class name --> A B C