Skip to content

Commit

Permalink
Merge branch 'master' into feature/entire-selection
Browse files Browse the repository at this point in the history
  • Loading branch information
iddan committed Apr 2, 2022
2 parents f5e056a + b75a98c commit 131f2be
Show file tree
Hide file tree
Showing 12 changed files with 3,135 additions and 2,085 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x
- name: Cache node modules
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: "12.x"
node-version: "14.x"
- name: Test Build
run: |
yarn install --frozen-lockfile;
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: "12.x"
node-version: "14.x"
- uses: webfactory/ssh-agent@v0.5.0
with:
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-spreadsheet",
"version": "0.6.1",
"version": "0.6.2",
"description": "Simple, customizable yet performant spreadsheet for React",
"author": "Iddan Aaronsohn <mail@aniddan.com> (https://aniddan.com)",
"keywords": [
Expand Down Expand Up @@ -41,6 +41,7 @@
"use-context-selector": "^1.3.7"
},
"devDependencies": {
"jest-transform-css": "^3.0.0",
"@babel/core": "^7.16.5",
"@storybook/addon-actions": "^6.4.9",
"@storybook/addon-essentials": "^6.4.9",
Expand Down Expand Up @@ -94,12 +95,12 @@
"testPathIgnorePatterns": [
"dist"
],
"moduleNameMapper": {
"\\.css$": "<rootDir>/src/__mocks__/style-mock.ts"
},
"setupFilesAfterEnv": [
"<rootDir>/src/jest-setup.ts"
]
],
"transform": {
"^.+\\.css$": "jest-transform-css"
}
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
Expand Down
3 changes: 0 additions & 3 deletions src/__mocks__/style-mock.ts

This file was deleted.

25 changes: 24 additions & 1 deletion src/matrix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,32 @@ describe("Matrix.toArray()", () => {
...EXAMPLE_MATRIX[1],
...EXAMPLE_MATRIX[2],
];
test("Flattens matrix values to an array", () => {
test("Flattens square matrix values to an array", () => {
expect(Matrix.toArray(EXAMPLE_MATRIX)).toEqual(flattedMatrix);
});
test("Flattens horizontal matrix values to an array", () => {
expect(
Matrix.toArray([
[1, 2, 3],
[4, 5, 6],
])
).toEqual([1, 2, 3, 4, 5, 6]);
});
test("Flattens vertical matrix values to an array", () => {
expect(
Matrix.toArray([
[1, 2],
[3, 4],
[5, 6],
])
).toEqual([1, 2, 3, 4, 5, 6]);
});
test("Flattens column matrix values to an array", () => {
expect(Matrix.toArray([[1], [2], [3]])).toEqual([1, 2, 3]);
});
test("Flattens row matrix values to an array", () => {
expect(Matrix.toArray([[1, 2, 3]])).toEqual([1, 2, 3]);
});
test("Transforms matrix values and collects them to an array", () => {
const transform = (value: number | undefined) => value && value * 2;
expect(
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export function toArray<T1, T2>(
) {
const array = [];
for (let row = 0; row < matrix.length; row++) {
for (let column = 0; column < matrix.length; column++) {
for (let column = 0; column < matrix[row].length; column++) {
const value = matrix[row][column];
array.push(transform ? transform(value, { row, column }) : value);
}
Expand Down
5 changes: 3 additions & 2 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"entryPoints": ["src/index.ts"],
"entryPoints": ["./src/index.ts"],
"out": "reference",
"readme": "none",
"excludeNotDocumented": true
"excludeNotDocumented": true,
"exclude": ["**/*.test.ts", "**/*.test.tsx", "**/*.stories.tsx"]
}
5 changes: 5 additions & 0 deletions website/docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ module.exports = {
type: "autogenerated",
dirName: ".", // generate sidebar slice from the docs folder (or versioned_docs/<version>)
},
{
type: "link",
label: "API",
href: "/docs/api",
},
],
};
2 changes: 2 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ module.exports = {
readme: "none",
excludeNotDocumented: true,
plugin: ["typedoc-plugin-rename-defaults"],
exclude: ["**/*.test.ts", "**/*.test.tsx", "**/*.stories.tsx"],
readmeTitle: "API",
},
],
],
Expand Down
14 changes: 7 additions & 7 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
},
"dependencies": {
"@algolia/client-search": "^4.9.1",
"@docusaurus/core": "^2.0.0-beta.6",
"@docusaurus/preset-classic": "^2.0.0-beta.6",
"@docusaurus/core": "^2.0.0-beta.15",
"@docusaurus/preset-classic": "^2.0.0-beta.15",
"@mdx-js/react": "^1.6.21",
"@rehooks/component-size": "^1.0.3",
"@svgr/webpack": "^5.5.0",
"@types/react": "^17.0.19",
"clsx": "^1.1.1",
"docusaurus-plugin-typedoc": "^0.15.3",
"docusaurus-plugin-typedoc": "^0.16.9",
"file-loader": "^6.2.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-spreadsheet": "^0.5.9",
"typedoc": "^0.21.6",
"typedoc-plugin-markdown": "^3.10.4",
"typedoc-plugin-rename-defaults": "^0.3.0",
"typedoc": "^0.22.11",
"typedoc-plugin-markdown": "^3.11.13",
"typedoc-plugin-rename-defaults": "^0.4.0",
"typescript": "^4.3.5",
"url-loader": "^4.1.1",
"webpack": "^5.51.1"
"webpack": "^5.68.0"
},
"devDependencies": {
"@babel/core": "^7.15.0",
Expand Down

0 comments on commit 131f2be

Please sign in to comment.