Skip to content

Commit

Permalink
v. 3.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
patryk0493 committed May 11, 2020
1 parent f477aeb commit 8694ce3
Show file tree
Hide file tree
Showing 82 changed files with 1,811 additions and 1,196 deletions.
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ cypress
cypress.json
public
src
core
.vscode
tsconfig.*json
package.*json
azure-pipelines-upgrade-rc-version.yml
azure-pipelines-upgrade-version-and-publish.yml
snapshots.js
.gitignore
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"runOnSave.statusMessageTimeout": 3000,
"runOnSave.commands": [
{
"match": ".*",
"command": "npm run pre-deploy && rm -rf ../dist && cp -r dist .. && rm -rf ../ReactGrid-Pro/node_modules/@silevis && cd ../ReactGrid-Pro && npm i ./../dist --force --save-dev && npm i react react-dom --no-save && npm run copy:mit:tests && cd ../ReactGrid-MIT",
"runIn": "terminal",
"runningStatusMessage": "Compiling ${fileBasename}",
"finishStatusMessage": "${fileBasename} compiled"
}
]
}
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2019-2020 Silevis Software Sp. z o.o.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# ReactGrid

ReactGrid allows you to create custom data grids inside your ReactJS application while providing a spreadsheet-like
look and feel.

Before run you need to have installed:
- "react": "^16.13.1",
- "react-dom": "^16.13.1"

# Installation

## 1. Install ReactGrid from npm repository

```shell
Expand All @@ -15,7 +26,7 @@ import { ReactGrid } from "@silevis/reactgrid";
Import file from `node_modules` directory. This file is necessary to correctly displaying.

```tsx
import "@silevis/reactgrid/dist/lib/assets/core.css";
import "@silevis/reactgrid/lib/assets/core.css";
```

## 4. Create a cell matrix
Expand All @@ -28,7 +39,7 @@ Both of them must be valid ReactGrid objects: `Columns` `Rows`.
import React, { useState } from "react";
import ReactDOM from "react-dom";
import { ReactGrid } from "@silevis/reactgrid";
import "@silevis/reactgrid/dist/lib/assets/core.css";
import "@silevis/reactgrid/lib/assets/core.css";

function App() {
const [state, setState] = useState(() => ({
Expand Down Expand Up @@ -83,17 +94,17 @@ ReactDOM.render(<App />, rootElement);

Open example on [codesandbox.io](https://codesandbox.io/s/reactgrid-getting-started-0754c)

## Docs
# Docs

Browse docs: [click](http://reactgrid.com/)

## Licensing
# Licensing

ReactGrid is distributed under [MIT](link) license.

(c) 2020 Silevis Software

## Author
# Author

[Silevis Software](https://www.silevis.com/)

Expand Down
49 changes: 5 additions & 44 deletions cypress/integration/common/utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/// <reference types="cypress" />

const Constants = require('./constants');
const config = require('../../../src/testEnvConfig');
const config = require('../../../src/test/testEnvConfig');

class Utils {

visit() {
cy.visit('/');
}
Expand Down Expand Up @@ -62,11 +63,11 @@ class Utils {
selectCell(clientX, clientY, customEventArgs) {
const scrollableElement = this.getScrollableElement();
if (customEventArgs !== undefined) {
scrollableElement.trigger('pointerdown', clientX, clientY, customEventArgs);
scrollableElement.trigger('pointerdown', clientX, clientY, { ...customEventArgs, pointerType: 'mouse' });
} else {
scrollableElement.trigger('pointerdown', clientX, clientY);
scrollableElement.trigger('pointerdown', clientX, clientY, { pointerType: 'mouse' });
}
scrollableElement.trigger('pointerup', clientX, clientY, { force: true });
scrollableElement.trigger('pointerup', clientX, clientY, { force: true, pointerType: 'mouse' });
cy.wait(200);
}

Expand Down Expand Up @@ -127,21 +128,6 @@ class Utils {
});
}

swingCursor(startX, startY, direction, repeations) {
const log = false;
for (let i = 0; i < repeations; i++) {
cy.wait(10, { log });
const delta = i % 2;
if (direction === 'horizontal') {
this.getBody().trigger('pointermove', { clientX: startX + delta, clientY: startY, force: true, log });
} else if (direction === 'vertical') {
this.getBody().trigger('pointermove', { clientX: startX, clientY: startY + delta, force: true, log });
} else {
cy.log('Unknown cursor swing direction!')
}
}
}

selectCellInEditMode(clientX, clientY) {
this.selectCell(clientX, clientY)
this.keyDown(Constants.keyCodes.Enter, { force: true });
Expand All @@ -153,31 +139,6 @@ class Utils {
.substring(7);
}


moveCursorHorizontallyOnScrollable(startX, startY, distance, step = 5) {
const endingPoint = startX + distance;
const logEnabled = false;
const rg = this.getScrollableElement();
const body = this.getBody();
rg.trigger('pointerdown', startX, startY);
for (let x = startX; distance < 0 ? (x > endingPoint) : (x < endingPoint); x += distance > 0 ? step : -step) {
body.trigger('pointermove', x, startY, { log: logEnabled, force: true });
}
body.trigger('pointerup', { clientX: endingPoint, clientY: startY, log: logEnabled, force: true });
}

moveCursorVerticallyOnScrollable(startX, startY, distance, step = 5) {
const endingPoint = startY + distance;
const logEnabled = true;
const rg = this.getScrollableElement();
const body = this.getBody();
rg.trigger('pointerdown', startX, startY);
for (let x = startY; distance < 0 ? (x > endingPoint) : (x < endingPoint); x += distance > 0 ? step : -step) {
body.trigger('pointermove', startX, x, { log: logEnabled, force: true });
}
body.trigger('pointerup', { clientX: startX, clientY: endingPoint, log: logEnabled, force: true });
}

selectCellByTouch(clientX, clientY) {
this.getReactGridContent().click(clientX, clientY, { clientX: clientX, clientY: clientY });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

const Utils = require('../../common/utils');
const Constants = require('../../common/constants');
const config = require('../../../../src/testEnvConfig');
const config = require('../../../../src/test/testEnvConfig');

context('Focus', () => {

context('Selection', () => {
beforeEach(() => {
Utils.visit();
});
Expand Down Expand Up @@ -37,4 +38,5 @@ context('Selection', () => {
Utils.assertElementLeftIsEqual(Utils.getCellFocus(), config.cellWidth * (config.columns - 1) - config.lineWidth);
Utils.assertElementTopIsEqual(Utils.getCellFocus(), config.cellHeight * (config.rows - 1) - config.lineWidth);
})

});
2 changes: 1 addition & 1 deletion cypress/integration/tests/standard/hiddenFocus.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const Utils = require('../../common/utils');
const Constants = require('../../common/constants');
const config = require('../../../../src/testEnvConfig');
const config = require('../../../../src/test/testEnvConfig');

context('Hidden focus', () => {
beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/tests/standard/keyHandle.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// <reference types="Cypress" />
const Utils = require('../../common/utils');
const Constants = require('../../common/constants');
const config = require('../../../../src/testEnvConfig');
const config = require('../../../../src/test/testEnvConfig');

context('Keyboard', () => {
beforeEach(() => {
Expand Down
28 changes: 28 additions & 0 deletions cypress/integration/tests/standard/other.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference types="Cypress" />
const Utils = require('../../common/utils');
const Constants = require('../../common/constants');
const config = require('../../../../src/test/testEnvConfig');

context('Other', () => {
beforeEach(() => {
Utils.visit();
});

it('should dont copy values between cells after change focus position', () => { // ✅

const x = Utils.getCellXCenter() + config.cellWidth;
const y = Utils.getCellYCenter() + (config.cellHeight * 2);

Utils.getCell(2, 2).invoke('text').then(text => {

Utils.selectCellInEditMode(x, y);

Utils.selectCell(x + config.cellWidth, y);

Utils.getCell(2, 2).contains(text);

});

});

});
2 changes: 1 addition & 1 deletion cypress/integration/tests/standard/scroll.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Utils = require('../../common/utils');
const config = require('../../../../src/testEnvConfig');
const config = require('../../../../src/test/testEnvConfig');
const Constants = require('../../common/constants');

context('Scroll', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/tests/sticky/scroll.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Utils = require('../../common/utils');
const config = require('../../../../src/testEnvConfig');
const config = require('../../../../src/test/testEnvConfig');
const Constants = require('../../common/constants');

context('Scroll', () => {
Expand Down
Loading

0 comments on commit 8694ce3

Please sign in to comment.