Giter Site home page Giter Site logo

hyh888 / grid-chen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from decatur/gridchen

0.0 1.0 0.0 658 KB

Very lightweight and fast editable web grid with strict MS-Excel adherence to user experience. Very modern (web components, es6 modules) with no dependencies.

License: MIT License

JavaScript 85.54% HTML 13.63% CSS 0.83%

grid-chen's Introduction

About

Very lightweight and fast editable web grid with strict MS-Excel adherence to user experience. Very modern (web components, es6 modules) with no dependencies.

If you need to edit mixed hierarchical and grid data, please visit sister project https://decatur.github.io/form-chen.

Demos

See https://decatur.github.io/grid-chen

Usage

<!DOCTYPE html>
<body>
<grid-chen></grid-chen>
</body>
<script type="module">
    import "./webwebcomponent.js"
    import {createView} from "./grid-chen/matrixview.js"

    const schema = {
        title: 'Array of Row Arrays',
        type: 'array',
        items: {
            type: 'array',
            items: [
                {title: 'SomeDate', type: 'string', format:'full-date'},
                {title: 'SomeNumber', type: 'number'}
            ]
        }
    };
    const rows = [['2019-01-01', 1], ['2020-01-01', 2], ['2021-01-01', 3]];
    document.querySelector('grid-chen').resetFromView(createView(schema, rows));
</script>

Issues

  • onselectionchanged fires too often
  • Paste must select pasted region (pasted region differs from selection if selection cannot be tiled by source); easy
  • Type violation of cell value must align left; easy

TODOs

  • Do not use JSON Patch replace for a remove operation!
  • TransactionManager: Do not add properties cell to patch array.
  • Handle clipboard not permitted errors
  • Improve encapsulation of JavaScript API
  • Show 1 empty row at end (Slider issue)
  • Avoid refreshing complete viewport on cell change
  • Handling of Infinity and NaN (#NV in de-de)

Alternatives

Expected Behaviour

We try to mimic MS-Excel as close as possible.

Keyboard Shortcuts

See also Keyboard shortcuts in Excel

Key Action
Ctrl+Z Undo last transaction
Ctrl+Y Redo, reverse last undo
Arrows Move active cell up/down/left/right (not in edit mode)
Tab Move active cell right (non-rolling)
Enter Move active cell down (non-rolling)
Shift+Enter Move active cell up (non-rolling)
Shift+Tab Move active cell left (non-rolling)
SHIFT+Arrows Select a range of cells
Ctrl+Space Select entire column
Shift+Space Select entire row
Shift+MouseClick Expand selection
Ctrl+MouseClick Multi-select cells
Ctrl+'-' Delete selected row
Ctrl+'+' Insert row before selection
Alt + Enter In edit mode, insert newline
Page Down Move one page down
Page Up Move one page up
Ctrl+A Select all grid cells (same as Ctrl+A in an Excel List Object)
Ctrl+A Ctrl+A Select the entire grid including header (same as Ctrl+A Ctrl+A in an Excel List Object)
ESC Cancel edit or input mode
Delete Remove selected cells contents
Ctrl+C Copy selected cells to clipboard
Ctrl+V Paste clipboard into selected cells
Ctrl+X Cut
F2 Enter edit mode; In input or edit mode, toggle between input and edit.
Alt+F1 Open a modal chart of the selection.
Backspace In input or edit mode, deletes one character to the left
Delete In input or edit mode, deletes one character to the right
End In input or edit mode, move to the end of the text
Home In input or edit mode, move to the beginning of the text

Light / Dark Mode

grid-chen has a light and dark mode. The desired mode is sniffed through the background color intensity of the body element. There are currently no other explicit CSS hooks, such as CSS custom properties.

โš  Some dark reader (for example Dark Reader) extensions may show inferior results when converting light to dark mode than grid-chen's native dark mode.

Undo & Redo

tm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.