Skip to content

Commit 8694ce3

Browse files
committed
v. 3.0.11
1 parent f477aeb commit 8694ce3

File tree

82 files changed

+1811
-1196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1811
-1196
lines changed

.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ cypress
55
cypress.json
66
public
77
src
8+
core
9+
.vscode
810
tsconfig.*json
911
package.*json
1012
azure-pipelines-upgrade-rc-version.yml
13+
azure-pipelines-upgrade-version-and-publish.yml
1114
snapshots.js
1215
.gitignore

.vscode/settings.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"runOnSave.statusMessageTimeout": 3000,
3+
"runOnSave.commands": [
4+
{
5+
"match": ".*",
6+
"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",
7+
"runIn": "terminal",
8+
"runningStatusMessage": "Compiling ${fileBasename}",
9+
"finishStatusMessage": "${fileBasename} compiled"
10+
}
11+
]
12+
}

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019-2020 Silevis Software Sp. z o.o.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# ReactGrid
2+
3+
ReactGrid allows you to create custom data grids inside your ReactJS application while providing a spreadsheet-like
4+
look and feel.
5+
6+
Before run you need to have installed:
7+
- "react": "^16.13.1",
8+
- "react-dom": "^16.13.1"
9+
10+
# Installation
11+
112
## 1. Install ReactGrid from npm repository
213

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

1728
```tsx
18-
import "@silevis/reactgrid/dist/lib/assets/core.css";
29+
import "@silevis/reactgrid/lib/assets/core.css";
1930
```
2031

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

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

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

86-
## Docs
97+
# Docs
8798

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

90-
## Licensing
101+
# Licensing
91102

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

94105
(c) 2020 Silevis Software
95106

96-
## Author
107+
# Author
97108

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

cypress/integration/common/utils.js

+5-44
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/// <reference types="cypress" />
22

33
const Constants = require('./constants');
4-
const config = require('../../../src/testEnvConfig');
4+
const config = require('../../../src/test/testEnvConfig');
55

66
class Utils {
7+
78
visit() {
89
cy.visit('/');
910
}
@@ -62,11 +63,11 @@ class Utils {
6263
selectCell(clientX, clientY, customEventArgs) {
6364
const scrollableElement = this.getScrollableElement();
6465
if (customEventArgs !== undefined) {
65-
scrollableElement.trigger('pointerdown', clientX, clientY, customEventArgs);
66+
scrollableElement.trigger('pointerdown', clientX, clientY, { ...customEventArgs, pointerType: 'mouse' });
6667
} else {
67-
scrollableElement.trigger('pointerdown', clientX, clientY);
68+
scrollableElement.trigger('pointerdown', clientX, clientY, { pointerType: 'mouse' });
6869
}
69-
scrollableElement.trigger('pointerup', clientX, clientY, { force: true });
70+
scrollableElement.trigger('pointerup', clientX, clientY, { force: true, pointerType: 'mouse' });
7071
cy.wait(200);
7172
}
7273

@@ -127,21 +128,6 @@ class Utils {
127128
});
128129
}
129130

130-
swingCursor(startX, startY, direction, repeations) {
131-
const log = false;
132-
for (let i = 0; i < repeations; i++) {
133-
cy.wait(10, { log });
134-
const delta = i % 2;
135-
if (direction === 'horizontal') {
136-
this.getBody().trigger('pointermove', { clientX: startX + delta, clientY: startY, force: true, log });
137-
} else if (direction === 'vertical') {
138-
this.getBody().trigger('pointermove', { clientX: startX, clientY: startY + delta, force: true, log });
139-
} else {
140-
cy.log('Unknown cursor swing direction!')
141-
}
142-
}
143-
}
144-
145131
selectCellInEditMode(clientX, clientY) {
146132
this.selectCell(clientX, clientY)
147133
this.keyDown(Constants.keyCodes.Enter, { force: true });
@@ -153,31 +139,6 @@ class Utils {
153139
.substring(7);
154140
}
155141

156-
157-
moveCursorHorizontallyOnScrollable(startX, startY, distance, step = 5) {
158-
const endingPoint = startX + distance;
159-
const logEnabled = false;
160-
const rg = this.getScrollableElement();
161-
const body = this.getBody();
162-
rg.trigger('pointerdown', startX, startY);
163-
for (let x = startX; distance < 0 ? (x > endingPoint) : (x < endingPoint); x += distance > 0 ? step : -step) {
164-
body.trigger('pointermove', x, startY, { log: logEnabled, force: true });
165-
}
166-
body.trigger('pointerup', { clientX: endingPoint, clientY: startY, log: logEnabled, force: true });
167-
}
168-
169-
moveCursorVerticallyOnScrollable(startX, startY, distance, step = 5) {
170-
const endingPoint = startY + distance;
171-
const logEnabled = true;
172-
const rg = this.getScrollableElement();
173-
const body = this.getBody();
174-
rg.trigger('pointerdown', startX, startY);
175-
for (let x = startY; distance < 0 ? (x > endingPoint) : (x < endingPoint); x += distance > 0 ? step : -step) {
176-
body.trigger('pointermove', startX, x, { log: logEnabled, force: true });
177-
}
178-
body.trigger('pointerup', { clientX: startX, clientY: endingPoint, log: logEnabled, force: true });
179-
}
180-
181142
selectCellByTouch(clientX, clientY) {
182143
this.getReactGridContent().click(clientX, clientY, { clientX: clientX, clientY: clientY });
183144
}

cypress/integration/tests/standard/selection.spec.js cypress/integration/tests/standard/focus.spec.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
const Utils = require('../../common/utils');
44
const Constants = require('../../common/constants');
5-
const config = require('../../../../src/testEnvConfig');
5+
const config = require('../../../../src/test/testEnvConfig');
6+
7+
context('Focus', () => {
68

7-
context('Selection', () => {
89
beforeEach(() => {
910
Utils.visit();
1011
});
@@ -37,4 +38,5 @@ context('Selection', () => {
3738
Utils.assertElementLeftIsEqual(Utils.getCellFocus(), config.cellWidth * (config.columns - 1) - config.lineWidth);
3839
Utils.assertElementTopIsEqual(Utils.getCellFocus(), config.cellHeight * (config.rows - 1) - config.lineWidth);
3940
})
41+
4042
});

cypress/integration/tests/standard/hiddenFocus.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const Utils = require('../../common/utils');
44
const Constants = require('../../common/constants');
5-
const config = require('../../../../src/testEnvConfig');
5+
const config = require('../../../../src/test/testEnvConfig');
66

77
context('Hidden focus', () => {
88
beforeEach(() => {

cypress/integration/tests/standard/keyHandle.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// <reference types="Cypress" />
22
const Utils = require('../../common/utils');
33
const Constants = require('../../common/constants');
4-
const config = require('../../../../src/testEnvConfig');
4+
const config = require('../../../../src/test/testEnvConfig');
55

66
context('Keyboard', () => {
77
beforeEach(() => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// <reference types="Cypress" />
2+
const Utils = require('../../common/utils');
3+
const Constants = require('../../common/constants');
4+
const config = require('../../../../src/test/testEnvConfig');
5+
6+
context('Other', () => {
7+
beforeEach(() => {
8+
Utils.visit();
9+
});
10+
11+
it('should dont copy values between cells after change focus position', () => { // ✅
12+
13+
const x = Utils.getCellXCenter() + config.cellWidth;
14+
const y = Utils.getCellYCenter() + (config.cellHeight * 2);
15+
16+
Utils.getCell(2, 2).invoke('text').then(text => {
17+
18+
Utils.selectCellInEditMode(x, y);
19+
20+
Utils.selectCell(x + config.cellWidth, y);
21+
22+
Utils.getCell(2, 2).contains(text);
23+
24+
});
25+
26+
});
27+
28+
});

cypress/integration/tests/standard/scroll.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Utils = require('../../common/utils');
2-
const config = require('../../../../src/testEnvConfig');
2+
const config = require('../../../../src/test/testEnvConfig');
33
const Constants = require('../../common/constants');
44

55
context('Scroll', () => {

cypress/integration/tests/sticky/scroll.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Utils = require('../../common/utils');
2-
const config = require('../../../../src/testEnvConfig');
2+
const config = require('../../../../src/test/testEnvConfig');
33
const Constants = require('../../common/constants');
44

55
context('Scroll', () => {

0 commit comments

Comments
 (0)