diff --git a/client/app/components/ApplicationArea/routeWithUserSession.tsx b/client/app/components/ApplicationArea/routeWithUserSession.tsx
index efc6e5628..ed943c3b4 100644
--- a/client/app/components/ApplicationArea/routeWithUserSession.tsx
+++ b/client/app/components/ApplicationArea/routeWithUserSession.tsx
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from "react";
-// @ts-expect-error (Must be removed after adding @redash/viz typing)
import ErrorBoundary, { ErrorBoundaryContext } from "@redash/viz/lib/components/ErrorBoundary";
import { Auth } from "@/services/auth";
import { policy } from "@/services/policy";
@@ -62,9 +61,10 @@ export function UserSessionWrapper
({ bodyClass, currentRoute, render }: UserS
return (
+ {/* @ts-expect-error FIXME */}
}>
- {({ handleError }: { handleError: UserSessionWrapperRenderChildrenProps["onError"] }) =>
+ {({ handleError } /* : { handleError: UserSessionWrapperRenderChildrenProps
["onError"] } FIXME bring back type */) =>
render({ ...currentRoute.routeParams, pageTitle: currentRoute.title, onError: handleError })
}
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 20f811a1f..e8f885200 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -15,21 +15,14 @@
"jsx": "react",
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
- "lib": [
- "dom",
- "dom.iterable",
- "esnext"
- ],
+ "lib": ["dom", "dom.iterable", "esnext"],
"forceConsistentCasingInFileNames": true,
"baseUrl": "./",
"paths": {
"@/*": ["./app/*"]
- }
+ },
+ "skipLibCheck": true
},
- "include": [
- "app/**/*"
- ],
- "exclude": [
- "dist"
- ]
+ "include": ["app/**/*"],
+ "exclude": ["dist"]
}
diff --git a/package-lock.json b/package-lock.json
index 76d06ddce..b2ce13382 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5384,22 +5384,22 @@
"dev": true
},
"@types/react": {
- "version": "16.9.41",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.41.tgz",
- "integrity": "sha512-6cFei7F7L4wwuM+IND/Q2cV1koQUvJ8iSV+Gwn0c3kvABZ691g7sp3hfEQHOUBJtccl1gPi+EyNjMIl9nGA0ug==",
+ "version": "16.14.2",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.2.tgz",
+ "integrity": "sha512-BzzcAlyDxXl2nANlabtT4thtvbbnhee8hMmH/CcJrISDBVcJS1iOsP1f0OAgSdGE0MsY9tqcrb9YoZcOFv9dbQ==",
"dev": true,
"requires": {
"@types/prop-types": "*",
- "csstype": "^2.2.0"
+ "csstype": "^3.0.2"
}
},
"@types/react-dom": {
- "version": "16.9.8",
- "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.8.tgz",
- "integrity": "sha512-ykkPQ+5nFknnlU6lDd947WbQ6TE3NNzbQAkInC2EKY1qeYdTKp7onFusmYZb+ityzx2YviqT6BXSu+LyWWJwcA==",
+ "version": "16.9.10",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.10.tgz",
+ "integrity": "sha512-ItatOrnXDMAYpv6G8UCk2VhbYVTjZT9aorLtA/OzDN9XJ2GKcfam68jutoAcILdRjsRUO8qb7AmyObF77Q8QFw==",
"dev": true,
"requires": {
- "@types/react": "*"
+ "@types/react": "^16"
}
},
"@types/sinonjs__fake-timers": {
@@ -9448,9 +9448,9 @@
}
},
"csstype": {
- "version": "2.6.11",
- "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.11.tgz",
- "integrity": "sha512-l8YyEC9NBkSm783PFTvh0FmJy7s5pFKrDp49ZL7zBGX3fWkO+N4EEyan1qqp8cwPLDcD0OSdyY6hAMoxp34JFw==",
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.5.tgz",
+ "integrity": "sha512-uVDi8LpBUKQj6sdxNaTetL6FpeCqTjOvAQuQUa/qAqq8oOd4ivkbhgnqayl0dnPal8Tb/yB1tF+gOvCBiicaiQ==",
"dev": true
},
"cubic-hermite": {
@@ -25447,9 +25447,9 @@
}
},
"typescript": {
- "version": "3.9.6",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.6.tgz",
- "integrity": "sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==",
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz",
+ "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==",
"dev": true
},
"uglify-js": {
diff --git a/package.json b/package.json
index 9a703c51a..24ee34712 100644
--- a/package.json
+++ b/package.json
@@ -95,8 +95,8 @@
"@types/hoist-non-react-statics": "^3.3.1",
"@types/lodash": "^4.14.157",
"@types/prop-types": "^15.7.3",
- "@types/react": "^16.9.41",
- "@types/react-dom": "^16.9.8",
+ "@types/react": "^16.14.2",
+ "@types/react-dom": "^16.9.10",
"@types/sql-formatter": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
@@ -144,7 +144,7 @@
"request": "^2.88.0",
"request-cookies": "^1.1.0",
"style-loader": "^2.0.0",
- "typescript": "^3.9.6",
+ "typescript": "^4.1.2",
"url-loader": "^1.1.2",
"webpack": "^4.44.2",
"webpack-build-notifier": "^0.1.30",
diff --git a/viz-lib/.babelrc b/viz-lib/.babelrc
index 43f53f573..ad10c4591 100644
--- a/viz-lib/.babelrc
+++ b/viz-lib/.babelrc
@@ -1,5 +1,5 @@
{
- "presets": ["@babel/preset-env", "@babel/preset-react"],
+ "presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
"plugins": [
"@babel/plugin-proposal-class-properties",
[
diff --git a/viz-lib/jsconfig.json b/viz-lib/jsconfig.json
deleted file mode 100644
index 6b60f37bf..000000000
--- a/viz-lib/jsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "compilerOptions": {
- "baseUrl": "./",
- "paths": {
- "@/*": ["./src/*"]
- }
- },
- "exclude": ["dist", "lib"]
-}
diff --git a/viz-lib/package-lock.json b/viz-lib/package-lock.json
index e9718ffd6..c46799845 100644
--- a/viz-lib/package-lock.json
+++ b/viz-lib/package-lock.json
@@ -339,6 +339,12 @@
"integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==",
"dev": true
},
+ "@babel/helper-validator-option": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.1.tgz",
+ "integrity": "sha512-YpJabsXlJVWP0USHjnC/AQDTLlZERbON577YUVO/wLpqyj6HAtVYnWaQaN0iUN+1/tWn3c+uKKXjRut5115Y2A==",
+ "dev": true
+ },
"@babel/helper-wrap-function": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.8.3.tgz",
@@ -498,6 +504,23 @@
"@babel/helper-plugin-utils": "^7.8.0"
}
},
+ "@babel/plugin-syntax-flow": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.12.1.tgz",
+ "integrity": "sha512-1lBLLmtxrwpm4VKmtVFselI/P3pX+G63fAtUUt6b2Nzgao77KNDwyuRt90Mj2/9pKobtt68FdvjfqohZjg/FCA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
"@babel/plugin-syntax-json-strings": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz",
@@ -570,6 +593,23 @@
"@babel/helper-plugin-utils": "^7.8.3"
}
},
+ "@babel/plugin-syntax-typescript": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.1.tgz",
+ "integrity": "sha512-UZNEcCY+4Dp9yYRCAHrHDU+9ZXLYaY9MgBXSRLkB9WjYFRR6quJBumfVrEkUxrePPBwFcpWfNKXqVRQQtm7mMA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
"@babel/plugin-transform-arrow-functions": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.8.3.tgz",
@@ -672,6 +712,24 @@
"@babel/helper-plugin-utils": "^7.8.3"
}
},
+ "@babel/plugin-transform-flow-strip-types": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.12.1.tgz",
+ "integrity": "sha512-8hAtkmsQb36yMmEtk2JZ9JnVyDSnDOdlB+0nEGzIDLuK4yR3JcEjfuFPYkdEPSh8Id+rAMeBEn+X0iVEyho6Hg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-flow": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
"@babel/plugin-transform-for-of": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.9.0.tgz",
@@ -918,6 +976,194 @@
"@babel/helper-plugin-utils": "^7.8.3"
}
},
+ "@babel/plugin-transform-typescript": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.12.1.tgz",
+ "integrity": "sha512-VrsBByqAIntM+EYMqSm59SiMEf7qkmI9dqMt6RbD/wlwueWmYcI0FFK5Fj47pP6DRZm+3teXjosKlwcZJ5lIMw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-class-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-typescript": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/generator": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz",
+ "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.5",
+ "jsesc": "^2.5.1",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-create-class-features-plugin": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.1.tgz",
+ "integrity": "sha512-hkL++rWeta/OVOBTRJc9a5Azh5mt5WgZUGAKMD8JM141YsE08K//bp1unBBieO6rUKkIPyUE0USQ30jAy3Sk1w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-member-expression-to-functions": "^7.12.1",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/helper-replace-supers": "^7.12.1",
+ "@babel/helper-split-export-declaration": "^7.10.4"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-member-expression-to-functions": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.7.tgz",
+ "integrity": "sha512-DCsuPyeWxeHgh1Dus7APn7iza42i/qXqiFPWyBDdOFtvS581JQePsc1F/nD+fHrcswhLlRc2UpYS1NwERxZhHw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/helper-optimise-call-expression": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.7.tgz",
+ "integrity": "sha512-I5xc9oSJ2h59OwyUqjv95HRyzxj53DAubUERgQMrpcCEYQyToeHA+NEcUEsVWB4j53RDeskeBJ0SgRAYHDBckw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/helper-replace-supers": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz",
+ "integrity": "sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-member-expression-to-functions": "^7.12.1",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/traverse": "^7.12.5",
+ "@babel/types": "^7.12.5"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
+ "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ },
+ "debug": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
+ }
+ },
"@babel/plugin-transform-unicode-regex": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.8.3.tgz",
@@ -996,6 +1242,24 @@
"semver": "^5.5.0"
}
},
+ "@babel/preset-flow": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/preset-flow/-/preset-flow-7.12.1.tgz",
+ "integrity": "sha512-UAoyMdioAhM6H99qPoKvpHMzxmNVXno8GYU/7vZmGaHk6/KqfDYL1W0NxszVbJ2EP271b7e6Ox+Vk2A9QsB3Sw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-transform-flow-strip-types": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
"@babel/preset-modules": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.3.tgz",
@@ -1023,6 +1287,38 @@
"@babel/plugin-transform-react-jsx-source": "^7.9.0"
}
},
+ "@babel/preset-typescript": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.12.7.tgz",
+ "integrity": "sha512-nOoIqIqBmHBSEgBXWR4Dv/XBehtIFcw9PqZw6rFYuKrzsZmOQm3PR5siLBnKZFEsDb03IegG8nSjU/iXXXYRmw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-validator-option": "^7.12.1",
+ "@babel/plugin-transform-typescript": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/register": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.12.1.tgz",
+ "integrity": "sha512-XWcmseMIncOjoydKZnWvWi0/5CUCD+ZYKhRwgYlWOrA8fGZ/FjuLRpqtIhLOVD/fvR1b9DQHtZPn68VvhpYf+Q==",
+ "dev": true,
+ "requires": {
+ "find-cache-dir": "^2.0.0",
+ "lodash": "^4.17.19",
+ "make-dir": "^2.1.0",
+ "pirates": "^4.0.0",
+ "source-map-support": "^0.5.16"
+ }
+ },
"@babel/runtime": {
"version": "7.9.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.2.tgz",
@@ -1112,6 +1408,72 @@
"minimist": "^1.2.0"
}
},
+ "@dsherret/to-absolute-glob": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz",
+ "integrity": "sha1-H2R13IvZdM6gei2vOGSzF7HdMyw=",
+ "dev": true,
+ "requires": {
+ "is-absolute": "^1.0.0",
+ "is-negated-glob": "^1.0.0"
+ }
+ },
+ "@eslint/eslintrc": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.2.tgz",
+ "integrity": "sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.12.4",
+ "debug": "^4.1.1",
+ "espree": "^7.3.0",
+ "globals": "^12.1.0",
+ "ignore": "^4.0.6",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^3.13.1",
+ "lodash": "^4.17.19",
+ "minimatch": "^3.0.4",
+ "strip-json-comments": "^3.1.1"
+ },
+ "dependencies": {
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "debug": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "globals": {
+ "version": "12.4.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
+ "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.8.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
+ }
+ },
"@istanbuljs/load-nyc-config": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
@@ -1515,6 +1877,32 @@
"resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz",
"integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q=="
},
+ "@nodelib/fs.scandir": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz",
+ "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.stat": "2.0.3",
+ "run-parallel": "^1.1.9"
+ }
+ },
+ "@nodelib/fs.stat": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz",
+ "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==",
+ "dev": true
+ },
+ "@nodelib/fs.walk": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz",
+ "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.scandir": "2.1.3",
+ "fastq": "^1.6.0"
+ }
+ },
"@plotly/d3-sankey": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/@plotly/d3-sankey/-/d3-sankey-0.7.2.tgz",
@@ -1536,6 +1924,37 @@
"elementary-circuits-directed-graph": "^1.0.4"
}
},
+ "@ts-morph/bootstrap": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@ts-morph/bootstrap/-/bootstrap-0.6.0.tgz",
+ "integrity": "sha512-ZCrY+57ktsNNe3PFnnS4U98lo95zpl8Rpqhe4NKl1c5lmnOBeBlp168D6bQYH/GCnJpErxrgAgZsSqBSh/Jk7A==",
+ "dev": true,
+ "requires": {
+ "@ts-morph/common": "~0.6.0"
+ }
+ },
+ "@ts-morph/common": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.6.0.tgz",
+ "integrity": "sha512-pI35nZz5bs3tL3btSVX2cWkAE8rc80F+Fn4TwSC6bQvn7fgn9IyLXVcAfpG6X6NBY5wN9TkSWXn/QYUkBvR/Fw==",
+ "dev": true,
+ "requires": {
+ "@dsherret/to-absolute-glob": "^2.0.2",
+ "fast-glob": "^3.2.4",
+ "fs-extra": "^9.0.1",
+ "is-negated-glob": "^1.0.0",
+ "multimatch": "^4.0.0",
+ "typescript": "~4.0.2"
+ },
+ "dependencies": {
+ "typescript": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz",
+ "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==",
+ "dev": true
+ }
+ }
+ },
"@turf/area": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@turf/area/-/area-6.0.1.tgz",
@@ -1617,6 +2036,330 @@
"@babel/types": "^7.3.0"
}
},
+ "@types/cheerio": {
+ "version": "0.22.23",
+ "resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.23.tgz",
+ "integrity": "sha512-QfHLujVMlGqcS/ePSf3Oe5hK3H8wi/yN2JYuxSB1U10VvW1fO3K8C+mURQesFYS1Hn7lspOsTT75SKq/XtydQg==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "@types/chroma-js": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.2.tgz",
+ "integrity": "sha512-fpIsY+9doOvRiBLR0xtubHmGBEVhis2z3CSWcxRDy7L2noKWXkT49c1QiU0RZ2YLc8lHitxu13HTuVItXUdD/g==",
+ "dev": true
+ },
+ "@types/d3": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/@types/d3/-/d3-6.2.0.tgz",
+ "integrity": "sha512-XhQ6sCTu+CrFLqJMsg/uRPZQrt5FlCPjPE/wvsSBYoaOZ9C1chdJSS9+2oR8+Xtk6DKGewa7/UP5icJRwAryEA==",
+ "dev": true,
+ "requires": {
+ "@types/d3-array": "*",
+ "@types/d3-axis": "*",
+ "@types/d3-brush": "*",
+ "@types/d3-chord": "*",
+ "@types/d3-color": "*",
+ "@types/d3-contour": "*",
+ "@types/d3-delaunay": "*",
+ "@types/d3-dispatch": "*",
+ "@types/d3-drag": "*",
+ "@types/d3-dsv": "*",
+ "@types/d3-ease": "*",
+ "@types/d3-fetch": "*",
+ "@types/d3-force": "*",
+ "@types/d3-format": "*",
+ "@types/d3-geo": "*",
+ "@types/d3-hierarchy": "*",
+ "@types/d3-interpolate": "*",
+ "@types/d3-path": "*",
+ "@types/d3-polygon": "*",
+ "@types/d3-quadtree": "*",
+ "@types/d3-random": "*",
+ "@types/d3-scale": "*",
+ "@types/d3-scale-chromatic": "*",
+ "@types/d3-selection": "*",
+ "@types/d3-shape": "*",
+ "@types/d3-time": "*",
+ "@types/d3-time-format": "*",
+ "@types/d3-timer": "*",
+ "@types/d3-transition": "*",
+ "@types/d3-zoom": "*"
+ }
+ },
+ "@types/d3-array": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-2.8.0.tgz",
+ "integrity": "sha512-Q0ubcGHAmCRPh90/hoYB4eKWhxYKUxphwSeQrlz2tiabQ8S9zqhaE2CZJtCaLH2cjqKcjr52WPvmOA7ha0O4ZA==",
+ "dev": true
+ },
+ "@types/d3-axis": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-2.0.0.tgz",
+ "integrity": "sha512-gUdlEwGBLl3tXGiBnBNmNzph9W3bCfa4tBgWZD60Z1eDQKTY4zyCAcZ3LksignGfKawYatmDYcBdjJ5h/54sqA==",
+ "dev": true,
+ "requires": {
+ "@types/d3-selection": "*"
+ }
+ },
+ "@types/d3-brush": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-2.1.0.tgz",
+ "integrity": "sha512-rLQqxQeXWF4ArXi81GlV8HBNwJw9EDpz0jcWvvzv548EDE4tXrayBTOHYi/8Q4FZ/Df8PGXFzxpAVQmJMjOtvQ==",
+ "dev": true,
+ "requires": {
+ "@types/d3-selection": "*"
+ }
+ },
+ "@types/d3-chord": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-2.0.0.tgz",
+ "integrity": "sha512-3nHsLY7lImpZlM/hrPeDqqW2a+lRXXoHsG54QSurDGihZAIE/doQlohs0evoHrWOJqXyn4A4xbSVEtXnMEZZiw==",
+ "dev": true
+ },
+ "@types/d3-cloud": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@types/d3-cloud/-/d3-cloud-1.2.3.tgz",
+ "integrity": "sha512-VUcRA9YWM1V5Srg444/zVxgmhVyIYBrChIr5lg+0cPGNM4J4fLdBqEeAkk9ggRPM3Um4fUy/p/gtEKbAqL/hcw==",
+ "dev": true,
+ "requires": {
+ "@types/d3": "^3"
+ },
+ "dependencies": {
+ "@types/d3": {
+ "version": "3.5.44",
+ "resolved": "https://registry.npmjs.org/@types/d3/-/d3-3.5.44.tgz",
+ "integrity": "sha512-hFEcf03YGJ2uQoDYEp3nFD5mXWxly5kf6KOstuOQFEs9sUCN7kNlKhcYkpZ3gK6PiHz4XRLkoHa80NVCJNeLBw==",
+ "dev": true
+ }
+ }
+ },
+ "@types/d3-color": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-2.0.1.tgz",
+ "integrity": "sha512-u7LTCL7RnaavFSmob2rIAJLNwu50i6gFwY9cHFr80BrQURYQBRkJ+Yv47nA3Fm7FeRhdWTiVTeqvSeOuMAOzBQ==",
+ "dev": true
+ },
+ "@types/d3-contour": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-2.0.0.tgz",
+ "integrity": "sha512-PS9UO6zBQqwHXsocbpdzZFONgK1oRUgWtjjh/iz2vM06KaXLInLiKZ9e3OLBRerc1cU2uJYpO+8zOnb6frvCGQ==",
+ "dev": true,
+ "requires": {
+ "@types/d3-array": "*",
+ "@types/geojson": "*"
+ }
+ },
+ "@types/d3-delaunay": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-5.3.0.tgz",
+ "integrity": "sha512-gJYcGxLu0xDZPccbUe32OUpeaNtd1Lz0NYJtko6ZLMyG2euF4pBzrsQXms67LHZCDFzzszw+dMhSL/QAML3bXw==",
+ "dev": true
+ },
+ "@types/d3-dispatch": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-2.0.0.tgz",
+ "integrity": "sha512-Sh0KW6z/d7uxssD7K4s4uCSzlEG/+SP+U47q098NVdOfFvUKNTvKAIV4XqjxsUuhE/854ARAREHOxkr9gQOCyg==",
+ "dev": true
+ },
+ "@types/d3-drag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-2.0.0.tgz",
+ "integrity": "sha512-VaUJPjbMnDn02tcRqsHLRAX5VjcRIzCjBfeXTLGe6QjMn5JccB5Cz4ztMRXMJfkbC45ovgJFWuj6DHvWMX1thA==",
+ "dev": true,
+ "requires": {
+ "@types/d3-selection": "*"
+ }
+ },
+ "@types/d3-dsv": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-2.0.0.tgz",
+ "integrity": "sha512-wYqy7T8tQ/DmocwxmlPujllLI5fg3lb6/FrVVWkLUD+NsRV+kcE4nbRZg10G9yjJ8pK2ZXqu+VP5jQbN13uNRQ==",
+ "dev": true
+ },
+ "@types/d3-ease": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-2.0.0.tgz",
+ "integrity": "sha512-6aZrTyX5LG+ptofVHf+gTsThLRY1nhLotJjgY4drYqk1OkJMu2UvuoZRlPw2fffjRHeYepue3/fxTufqKKmvsA==",
+ "dev": true
+ },
+ "@types/d3-fetch": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-2.0.0.tgz",
+ "integrity": "sha512-WnLepGtxepFfXRdPI8I5FTgNiHn9p4vMTTqaNCzJJfAswXx0rOY2jjeolzEU063em3iJmGZ+U79InnEeFOrCRw==",
+ "dev": true,
+ "requires": {
+ "@types/d3-dsv": "*"
+ }
+ },
+ "@types/d3-force": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-2.1.0.tgz",
+ "integrity": "sha512-LGDtC2YADu8OBniq9EBx/MOsXsMcJbEkmfSpXuz6oVdRamB+3CLCiq5EKFPEILGZQckkilGFq1ZTJ7kc289k+Q==",
+ "dev": true
+ },
+ "@types/d3-format": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-2.0.0.tgz",
+ "integrity": "sha512-uagdkftxnGkO4pZw5jEYOM5ZnZOEsh7z8j11Qxk85UkB2RzfUUxRl7R9VvvJZHwKn8l+x+rpS77Nusq7FkFmIg==",
+ "dev": true
+ },
+ "@types/d3-geo": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-2.0.0.tgz",
+ "integrity": "sha512-DHHgYXW36lnAEQMYU2udKVOxxljHrn2EdOINeSC9jWCAXwOnGn7A19B8sNsHqgpu4F7O2bSD7//cqBXD3W0Deg==",
+ "dev": true,
+ "requires": {
+ "@types/geojson": "*"
+ }
+ },
+ "@types/d3-hierarchy": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-2.0.0.tgz",
+ "integrity": "sha512-YxdskUvwzqggpnSnDQj4KVkicgjpkgXn/g/9M9iGsiToLS3nG6Ytjo1FoYhYVAAElV/fJBGVL3cQ9Hb7tcv+lw==",
+ "dev": true
+ },
+ "@types/d3-interpolate": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-2.0.0.tgz",
+ "integrity": "sha512-Wt1v2zTlEN8dSx8hhx6MoOhWQgTkz0Ukj7owAEIOF2QtI0e219paFX9rf/SLOr/UExWb1TcUzatU8zWwFby6gg==",
+ "dev": true,
+ "requires": {
+ "@types/d3-color": "*"
+ }
+ },
+ "@types/d3-path": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-2.0.0.tgz",
+ "integrity": "sha512-tXcR/9OtDdeCIsyl6eTNHC3XOAOdyc6ceF3QGBXOd9jTcK+ex/ecr00p9L9362e/op3UEPpxrToi1FHrtTSj7Q==",
+ "dev": true
+ },
+ "@types/d3-polygon": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-2.0.0.tgz",
+ "integrity": "sha512-fISnMd8ePED1G4aa4V974Jmt+ajHSgPoxMa2D0ULxMybpx0Vw4WEzhQEaMIrL3hM8HVRcKTx669I+dTy/4PhAw==",
+ "dev": true
+ },
+ "@types/d3-quadtree": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-2.0.0.tgz",
+ "integrity": "sha512-YZuJuGBnijD0H+98xMJD4oZXgv/umPXy5deu3IimYTPGH3Kr8Th6iQUff0/6S80oNBD7KtOuIHwHUCymUiRoeQ==",
+ "dev": true
+ },
+ "@types/d3-random": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-2.2.0.tgz",
+ "integrity": "sha512-Hjfj9m68NmYZzushzEG7etPvKH/nj9b9s9+qtkNG3/dbRBjQZQg1XS6nRuHJcCASTjxXlyXZnKu2gDxyQIIu9A==",
+ "dev": true
+ },
+ "@types/d3-scale": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-3.2.1.tgz",
+ "integrity": "sha512-j+FryQSVk3GHLqjOX/RsHwGHg4XByJ0xIO1ASBTgzhE9o1tgeV4kEWLOzMzJRembKalflk5F03lEkM+4V6LDrQ==",
+ "dev": true,
+ "requires": {
+ "@types/d3-time": "*"
+ }
+ },
+ "@types/d3-scale-chromatic": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-2.0.0.tgz",
+ "integrity": "sha512-Y62+2clOwZoKua84Ha0xU77w7lePiaBoTjXugT4l8Rd5LAk+Mn/ZDtrgs087a+B5uJ3jYUHHtKw5nuEzp0WBHw==",
+ "dev": true
+ },
+ "@types/d3-selection": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-2.0.0.tgz",
+ "integrity": "sha512-EF0lWZ4tg7oDFg4YQFlbOU3936e3a9UmoQ2IXlBy1+cv2c2Pv7knhKUzGlH5Hq2sF/KeDTH1amiRPey2rrLMQA==",
+ "dev": true
+ },
+ "@types/d3-shape": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-2.0.0.tgz",
+ "integrity": "sha512-NLzD02m5PiD1KLEDjLN+MtqEcFYn4ZL9+Rqc9ZwARK1cpKZXd91zBETbe6wpBB6Ia0D0VZbpmbW3+BsGPGnCpA==",
+ "dev": true,
+ "requires": {
+ "@types/d3-path": "^1"
+ },
+ "dependencies": {
+ "@types/d3-path": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-1.0.9.tgz",
+ "integrity": "sha512-NaIeSIBiFgSC6IGUBjZWcscUJEq7vpVu7KthHN8eieTV9d9MqkSOZLH4chq1PmcKy06PNe3axLeKmRIyxJ+PZQ==",
+ "dev": true
+ }
+ }
+ },
+ "@types/d3-time": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-2.0.0.tgz",
+ "integrity": "sha512-Abz8bTzy8UWDeYs9pCa3D37i29EWDjNTjemdk0ei1ApYVNqulYlGUKip/jLOpogkPSsPz/GvZCYiC7MFlEk0iQ==",
+ "dev": true
+ },
+ "@types/d3-time-format": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-3.0.0.tgz",
+ "integrity": "sha512-UpLg1mn/8PLyjr+J/JwdQJM/GzysMvv2CS8y+WYAL5K0+wbvXv/pPSLEfdNaprCZsGcXTxPsFMy8QtkYv9ueew==",
+ "dev": true
+ },
+ "@types/d3-timer": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-2.0.0.tgz",
+ "integrity": "sha512-l6stHr1VD1BWlW6u3pxrjLtJfpPZq9I3XmKIQtq7zHM/s6fwEtI1Yn6Sr5/jQTrUDCC5jkS6gWqlFGCDArDqNg==",
+ "dev": true
+ },
+ "@types/d3-transition": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-2.0.0.tgz",
+ "integrity": "sha512-UJDzI98utcZQUJt3uIit/Ho0/eBIANzrWJrTmi4+TaKIyWL2iCu7ShP0o4QajCskhyjOA7C8+4CE3b1YirTzEQ==",
+ "dev": true,
+ "requires": {
+ "@types/d3-selection": "*"
+ }
+ },
+ "@types/d3-zoom": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-2.0.0.tgz",
+ "integrity": "sha512-daL0PJm4yT0ISTGa7p2lHX0kvv9FO/IR1ooWbHR/7H4jpbaKiLux5FslyS/OvISPiJ5SXb4sOqYhO6fMB6hKRw==",
+ "dev": true,
+ "requires": {
+ "@types/d3-interpolate": "*",
+ "@types/d3-selection": "*"
+ }
+ },
+ "@types/debug": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz",
+ "integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==",
+ "dev": true
+ },
+ "@types/dompurify": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-2.0.4.tgz",
+ "integrity": "sha512-y6K7NyXTQvjr8hJNsAFAD8yshCsIJ0d+OYEFzULuIqWyWOKL2hRru1I+rorI5U0K4SLAROTNuSUFXPDTu278YA==",
+ "dev": true,
+ "requires": {
+ "@types/trusted-types": "*"
+ }
+ },
+ "@types/enzyme": {
+ "version": "3.10.8",
+ "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.8.tgz",
+ "integrity": "sha512-vlOuzqsTHxog6PV79+tvOHFb6hq4QZKMq1lLD9MaWD1oec2lHTKndn76XOpSwCA0oFTaIbKVPrgM3k78Jjd16g==",
+ "dev": true,
+ "requires": {
+ "@types/cheerio": "*",
+ "@types/react": "*"
+ }
+ },
+ "@types/geojson": {
+ "version": "7946.0.7",
+ "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.7.tgz",
+ "integrity": "sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ==",
+ "dev": true
+ },
"@types/istanbul-lib-coverage": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz",
@@ -1642,18 +2385,233 @@
"@types/istanbul-lib-report": "*"
}
},
+ "@types/jest": {
+ "version": "26.0.18",
+ "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.18.tgz",
+ "integrity": "sha512-scDPs+mELZgsFetTgBSsIxKGrlitn9t/d2ecP+S1QSIGD+31fkMBEftLfOAX5k3tU06/0PjreJIQ+gWEbbHqpw==",
+ "dev": true,
+ "requires": {
+ "jest-diff": "^26.0.0",
+ "pretty-format": "^26.0.0"
+ },
+ "dependencies": {
+ "@jest/types": {
+ "version": "26.6.2",
+ "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz",
+ "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "^2.0.0",
+ "@types/istanbul-reports": "^3.0.0",
+ "@types/node": "*",
+ "@types/yargs": "^15.0.0",
+ "chalk": "^4.0.0"
+ }
+ },
+ "@types/istanbul-reports": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz",
+ "integrity": "sha512-nwKNbvnwJ2/mndE9ItP/zc2TCzw6uuodnF4EHYWD+gCQDVBuRQL5UzbZD0/ezy1iKsFU2ZQiDqg4M9dN4+wZgA==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-report": "*"
+ }
+ },
+ "@types/yargs": {
+ "version": "15.0.11",
+ "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.11.tgz",
+ "integrity": "sha512-jfcNBxHFYJ4nPIacsi3woz1+kvUO6s1CyeEhtnDHBjHUMNj5UlW2GynmnSgiJJEdNg9yW5C8lfoNRZrHGv5EqA==",
+ "dev": true,
+ "requires": {
+ "@types/yargs-parser": "*"
+ }
+ },
+ "ansi-regex": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
+ "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "diff-sequences": {
+ "version": "26.6.2",
+ "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz",
+ "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "jest-diff": {
+ "version": "26.6.2",
+ "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz",
+ "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==",
+ "dev": true,
+ "requires": {
+ "chalk": "^4.0.0",
+ "diff-sequences": "^26.6.2",
+ "jest-get-type": "^26.3.0",
+ "pretty-format": "^26.6.2"
+ }
+ },
+ "jest-get-type": {
+ "version": "26.3.0",
+ "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz",
+ "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==",
+ "dev": true
+ },
+ "pretty-format": {
+ "version": "26.6.2",
+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz",
+ "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^26.6.2",
+ "ansi-regex": "^5.0.0",
+ "ansi-styles": "^4.0.0",
+ "react-is": "^17.0.1"
+ }
+ },
+ "react-is": {
+ "version": "17.0.1",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.1.tgz",
+ "integrity": "sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "@types/leaflet": {
+ "version": "1.5.19",
+ "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.5.19.tgz",
+ "integrity": "sha512-ZAKqfvdU/+KFoCpf8aUba09F8mfSc8R2esq++Cha3E2DgwS5K/I/4eJ+0JylrVHZivgY7PSAeXFv/izP+81/MQ==",
+ "dev": true,
+ "requires": {
+ "@types/geojson": "*"
+ }
+ },
+ "@types/minimatch": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
+ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
+ "dev": true
+ },
"@types/node": {
"version": "13.13.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.4.tgz",
"integrity": "sha512-x26ur3dSXgv5AwKS0lNfbjpCakGIduWU1DU91Zz58ONRWrIKGunmZBNv4P7N+e27sJkiGDsw/3fT4AtsqQBrBA==",
"dev": true
},
+ "@types/numeral": {
+ "version": "0.0.28",
+ "resolved": "https://registry.npmjs.org/@types/numeral/-/numeral-0.0.28.tgz",
+ "integrity": "sha512-Sjsy10w6XFHDktJJdXzBJmoondAKW+LcGpRFH+9+zXEDj0cOH8BxJuZA9vUDSMAzU1YRJlsPKmZEEiTYDlICLw==",
+ "dev": true
+ },
+ "@types/plotly.js": {
+ "version": "1.54.4",
+ "resolved": "https://registry.npmjs.org/@types/plotly.js/-/plotly.js-1.54.4.tgz",
+ "integrity": "sha512-qKqNIw09Huuzz3/vkHXQeObLPMf7jbe99uTK246ZSh502xpldJxFuOmubPgSgq3bchRVJeR+mM0Dm6/FctL6tg==",
+ "dev": true,
+ "requires": {
+ "@types/d3": "^3"
+ },
+ "dependencies": {
+ "@types/d3": {
+ "version": "3.5.44",
+ "resolved": "https://registry.npmjs.org/@types/d3/-/d3-3.5.44.tgz",
+ "integrity": "sha512-hFEcf03YGJ2uQoDYEp3nFD5mXWxly5kf6KOstuOQFEs9sUCN7kNlKhcYkpZ3gK6PiHz4XRLkoHa80NVCJNeLBw==",
+ "dev": true
+ }
+ }
+ },
+ "@types/prop-types": {
+ "version": "15.7.3",
+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
+ "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==",
+ "dev": true
+ },
+ "@types/react": {
+ "version": "17.0.0",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.0.tgz",
+ "integrity": "sha512-aj/L7RIMsRlWML3YB6KZiXB3fV2t41+5RBGYF8z+tAKU43Px8C3cYUZsDvf1/+Bm4FK21QWBrDutu8ZJ/70qOw==",
+ "dev": true,
+ "requires": {
+ "@types/prop-types": "*",
+ "csstype": "^3.0.2"
+ }
+ },
+ "@types/react-dom": {
+ "version": "17.0.0",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.0.tgz",
+ "integrity": "sha512-lUqY7OlkF/RbNtD5nIq7ot8NquXrdFrjSOR6+w9a9RFQevGi1oZO1dcJbXMeONAPKtZ2UrZOEJ5UOCVsxbLk/g==",
+ "dev": true,
+ "requires": {
+ "@types/react": "*"
+ }
+ },
"@types/stack-utils": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
"integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==",
"dev": true
},
+ "@types/tinycolor2": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/@types/tinycolor2/-/tinycolor2-1.4.2.tgz",
+ "integrity": "sha512-PeHg/AtdW6aaIO2a+98Xj7rWY4KC1E6yOy7AFknJQ7VXUGNrMlyxDFxJo7HqLtjQms/ZhhQX52mLVW/EX3JGOw==",
+ "dev": true
+ },
+ "@types/trusted-types": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz",
+ "integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw==",
+ "dev": true
+ },
"@types/yargs": {
"version": "13.0.8",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.8.tgz",
@@ -2023,6 +2981,12 @@
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
"optional": true
},
+ "ansi-colors": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
+ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
+ "dev": true
+ },
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
@@ -2114,6 +3078,12 @@
"resolved": "https://registry.npmjs.org/array-bounds/-/array-bounds-1.0.1.tgz",
"integrity": "sha512-8wdW3ZGk6UjMPJx/glyEt0sLzzwAE1bhToPsO1W2pbpR2gULyxe3BjSiuJFheP50T/GgODVPz2fuMUmIywt8cQ=="
},
+ "array-differ": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz",
+ "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==",
+ "dev": true
+ },
"array-equal": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
@@ -2144,6 +3114,12 @@
"resolved": "https://registry.npmjs.org/array-rearrange/-/array-rearrange-2.2.2.tgz",
"integrity": "sha512-UfobP5N12Qm4Qu4fwLDIi2v6+wZsSf6snYSxAMeKhrh37YGnNWZPRmVEKc/2wfms53TLQnzfpG8wCx2Y/6NG1w=="
},
+ "array-union": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
+ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
+ "dev": true
+ },
"array-unique": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
@@ -2170,6 +3146,12 @@
"es-abstract": "^1.17.0-next.1"
}
},
+ "arrify": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
+ "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
+ "dev": true
+ },
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
@@ -2236,6 +3218,12 @@
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
"dev": true
},
+ "ast-types": {
+ "version": "0.11.7",
+ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.11.7.tgz",
+ "integrity": "sha512-2mP3TwtkY/aTv5X3ZsMpNAbOnyoC/aMJwJSoaELPkHId0nSQgFcnU4dRW3isxiz7+zBexk0ym3WNVjMiQBnJSw==",
+ "dev": true
+ },
"astral-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
@@ -2260,6 +3248,12 @@
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
"dev": true
},
+ "at-least-node": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
+ "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
+ "dev": true
+ },
"atob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
@@ -2340,6 +3334,12 @@
"follow-redirects": "1.5.10"
}
},
+ "babel-core": {
+ "version": "7.0.0-bridge.0",
+ "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-7.0.0-bridge.0.tgz",
+ "integrity": "sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg==",
+ "dev": true
+ },
"babel-jest": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz",
@@ -3238,6 +4238,15 @@
"uniq": "^1.0.1"
}
},
+ "cli-cursor": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
+ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
+ "dev": true,
+ "requires": {
+ "restore-cursor": "^2.0.0"
+ }
+ },
"cliui": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
@@ -3346,6 +4355,12 @@
"lerp": "^1.0.3"
}
},
+ "colors": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
+ "dev": true
+ },
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -3553,6 +4568,17 @@
"sha.js": "^2.4.8"
}
},
+ "create-jest-runner": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/create-jest-runner/-/create-jest-runner-0.5.3.tgz",
+ "integrity": "sha512-a9VY2doMBmzRollJB3Ft3/Y5fBceSWJ4gdyVsg4/d7nP1S4715VG939s2VnITDj79YBmRgKhjGjNRv1c+Kre1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "jest-worker": "^24.0.0",
+ "throat": "^4.1.0"
+ }
+ },
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@@ -3720,6 +4746,12 @@
"cssom": "0.3.x"
}
},
+ "csstype": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.5.tgz",
+ "integrity": "sha512-uVDi8LpBUKQj6sdxNaTetL6FpeCqTjOvAQuQUa/qAqq8oOd4ivkbhgnqayl0dnPal8Tb/yB1tF+gOvCBiicaiQ==",
+ "dev": true
+ },
"cubic-hermite": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cubic-hermite/-/cubic-hermite-1.0.0.tgz",
@@ -4051,6 +5083,15 @@
"integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=",
"dev": true
},
+ "doctrine": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+ "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
"dom-serializer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
@@ -4280,6 +5321,15 @@
}
}
},
+ "enquirer": {
+ "version": "2.3.6",
+ "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
+ "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
+ "dev": true,
+ "requires": {
+ "ansi-colors": "^4.1.1"
+ }
+ },
"entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
@@ -4483,6 +5533,281 @@
}
}
},
+ "eslint": {
+ "version": "7.15.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.15.0.tgz",
+ "integrity": "sha512-Vr64xFDT8w30wFll643e7cGrIkPEU50yIiI36OdSIDoSGguIeaLzBo0vpGvzo9RECUqq7htURfwEtKqwytkqzA==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "@eslint/eslintrc": "^0.2.2",
+ "ajv": "^6.10.0",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.2",
+ "debug": "^4.0.1",
+ "doctrine": "^3.0.0",
+ "enquirer": "^2.3.5",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^2.1.0",
+ "eslint-visitor-keys": "^2.0.0",
+ "espree": "^7.3.1",
+ "esquery": "^1.2.0",
+ "esutils": "^2.0.2",
+ "file-entry-cache": "^6.0.0",
+ "functional-red-black-tree": "^1.0.1",
+ "glob-parent": "^5.0.0",
+ "globals": "^12.1.0",
+ "ignore": "^4.0.6",
+ "import-fresh": "^3.0.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "js-yaml": "^3.13.1",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.4.1",
+ "lodash": "^4.17.19",
+ "minimatch": "^3.0.4",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.1",
+ "progress": "^2.0.0",
+ "regexpp": "^3.1.0",
+ "semver": "^7.2.1",
+ "strip-ansi": "^6.0.0",
+ "strip-json-comments": "^3.1.0",
+ "table": "^5.2.3",
+ "text-table": "^0.2.0",
+ "v8-compile-cache": "^2.0.3"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
+ "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "cross-spawn": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
+ "dev": true,
+ "requires": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ }
+ },
+ "debug": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "eslint-scope": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
+ "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
+ "dev": true,
+ "requires": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^4.1.1"
+ }
+ },
+ "esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^5.2.0"
+ },
+ "dependencies": {
+ "estraverse": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
+ "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
+ "dev": true
+ }
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
+ "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "globals": {
+ "version": "12.4.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
+ "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.8.1"
+ }
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ }
+ },
+ "lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "optionator": {
+ "version": "0.9.1",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
+ "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
+ "dev": true,
+ "requires": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.3"
+ }
+ },
+ "path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "dev": true
+ },
+ "prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true
+ },
+ "semver": {
+ "version": "7.3.4",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz",
+ "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
+ },
+ "shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^3.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "^1.2.1"
+ }
+ },
+ "which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ }
+ }
+ },
"eslint-scope": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
@@ -4493,11 +5818,82 @@
"estraverse": "^4.1.1"
}
},
+ "eslint-utils": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
+ "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
+ "dev": true,
+ "requires": {
+ "eslint-visitor-keys": "^1.1.0"
+ },
+ "dependencies": {
+ "eslint-visitor-keys": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
+ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+ "dev": true
+ }
+ }
+ },
+ "eslint-visitor-keys": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
+ "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
+ "dev": true
+ },
+ "espree": {
+ "version": "7.3.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
+ "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==",
+ "dev": true,
+ "requires": {
+ "acorn": "^7.4.0",
+ "acorn-jsx": "^5.3.1",
+ "eslint-visitor-keys": "^1.3.0"
+ },
+ "dependencies": {
+ "acorn": {
+ "version": "7.4.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
+ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
+ "dev": true
+ },
+ "acorn-jsx": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
+ "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
+ "dev": true
+ },
+ "eslint-visitor-keys": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
+ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+ "dev": true
+ }
+ }
+ },
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
},
+ "esquery": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz",
+ "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^5.1.0"
+ },
+ "dependencies": {
+ "estraverse": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
+ "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
+ "dev": true
+ }
+ }
+ },
"esrecurse": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz",
@@ -4768,6 +6164,74 @@
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
"dev": true
},
+ "fast-glob": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz",
+ "integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.0",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.2",
+ "picomatch": "^2.2.1"
+ },
+ "dependencies": {
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
+ "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
"fast-isnumeric": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/fast-isnumeric/-/fast-isnumeric-1.1.4.tgz",
@@ -4787,6 +6251,15 @@
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
},
+ "fastq": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.9.0.tgz",
+ "integrity": "sha512-i7FVWL8HhVY+CTkwFxkN2mk3h+787ixS5S63eb78diVRc1MCssarHq3W5cj0av7YDSwmaV928RNag+U1etRQ7w==",
+ "dev": true,
+ "requires": {
+ "reusify": "^1.0.4"
+ }
+ },
"fb-watchman": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz",
@@ -4802,6 +6275,24 @@
"integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==",
"dev": true
},
+ "figures": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
+ "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.5"
+ }
+ },
+ "file-entry-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz",
+ "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==",
+ "dev": true,
+ "requires": {
+ "flat-cache": "^3.0.4"
+ }
+ },
"file-loader": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.0.0.tgz",
@@ -4931,6 +6422,33 @@
"resolve-dir": "^1.0.1"
}
},
+ "flat-cache": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
+ "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+ "dev": true,
+ "requires": {
+ "flatted": "^3.1.0",
+ "rimraf": "^3.0.2"
+ },
+ "dependencies": {
+ "rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ }
+ }
+ },
+ "flatted": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.0.tgz",
+ "integrity": "sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==",
+ "dev": true
+ },
"flatten-vertex-data": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/flatten-vertex-data/-/flatten-vertex-data-1.0.2.tgz",
@@ -4944,6 +6462,12 @@
"resolved": "https://registry.npmjs.org/flip-pixels/-/flip-pixels-1.0.2.tgz",
"integrity": "sha512-oXbJGbjDnfJRWPC7Va38EFhd+A8JWE5/hCiKcK8qjCdbLj9DTpsq6MEudwpRTH+V4qq+Jw7d3pUgQdSr3x3mTA=="
},
+ "flow-parser": {
+ "version": "0.139.0",
+ "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.139.0.tgz",
+ "integrity": "sha512-yEh5wJIi/BG7JZvWAWxTdfZ1uoh/W3oefJOuvUDosKFIE5H7ad8Eu6k9ba1yr83Lxn5vY6kZMG1IaiiiA/5scg==",
+ "dev": true
+ },
"flush-write-stream": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
@@ -5047,6 +6571,18 @@
"readable-stream": "^2.0.0"
}
},
+ "fs-extra": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
+ "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
+ "dev": true,
+ "requires": {
+ "at-least-node": "^1.0.0",
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^1.0.0"
+ }
+ },
"fs-readdir-recursive": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz",
@@ -6637,6 +8173,12 @@
"integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=",
"dev": true
},
+ "ignore": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+ "dev": true
+ },
"image-palette": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/image-palette/-/image-palette-2.1.0.tgz",
@@ -6662,6 +8204,24 @@
"invariant": "^2.2.0"
}
},
+ "import-fresh": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz",
+ "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==",
+ "dev": true,
+ "requires": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ },
+ "dependencies": {
+ "resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true
+ }
+ }
+ },
"import-local": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
@@ -6764,6 +8324,16 @@
"resolved": "https://registry.npmjs.org/iota-array/-/iota-array-1.0.0.tgz",
"integrity": "sha1-ge9X/l0FgUzVjCSDYyqZwwoOgIc="
},
+ "is-absolute": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
+ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==",
+ "dev": true,
+ "requires": {
+ "is-relative": "^1.0.0",
+ "is-windows": "^1.0.1"
+ }
+ },
"is-accessor-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
@@ -6946,6 +8516,12 @@
"resolved": "https://registry.npmjs.org/is-mobile/-/is-mobile-2.2.1.tgz",
"integrity": "sha512-6zELsfVFr326eq2CI53yvqq6YBanOxKBybwDT+MbMS2laBnK6Ez8m5XHSuTQQbnKRfpDzCod1CMWW5q3wZYMvA=="
},
+ "is-negated-glob": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz",
+ "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=",
+ "dev": true
+ },
"is-number": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
@@ -6999,6 +8575,15 @@
"has": "^1.0.3"
}
},
+ "is-relative": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
+ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==",
+ "dev": true,
+ "requires": {
+ "is-unc-path": "^1.0.0"
+ }
+ },
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
@@ -7041,6 +8626,15 @@
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
},
+ "is-unc-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
+ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==",
+ "dev": true,
+ "requires": {
+ "unc-path-regex": "^0.1.2"
+ }
+ },
"is-windows": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
@@ -7781,6 +9375,32 @@
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
"dev": true
},
+ "jscodeshift": {
+ "version": "0.6.4",
+ "resolved": "https://registry.npmjs.org/jscodeshift/-/jscodeshift-0.6.4.tgz",
+ "integrity": "sha512-+NF/tlNbc2WEhXUuc4WEJLsJumF84tnaMUZW2hyJw3jThKKRvsPX4sPJVgO1lPE28z0gNL+gwniLG9d8mYvQCQ==",
+ "dev": true,
+ "requires": {
+ "@babel/core": "^7.1.6",
+ "@babel/parser": "^7.1.6",
+ "@babel/plugin-proposal-class-properties": "^7.1.0",
+ "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
+ "@babel/preset-env": "^7.1.6",
+ "@babel/preset-flow": "^7.0.0",
+ "@babel/preset-typescript": "^7.1.0",
+ "@babel/register": "^7.0.0",
+ "babel-core": "^7.0.0-bridge.0",
+ "colors": "^1.1.2",
+ "flow-parser": "0.*",
+ "graceful-fs": "^4.1.11",
+ "micromatch": "^3.1.10",
+ "neo-async": "^2.5.0",
+ "node-dir": "^0.1.17",
+ "recast": "^0.16.1",
+ "temp": "^0.8.1",
+ "write-file-atomic": "^2.3.0"
+ }
+ },
"jsdom": {
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz",
@@ -7853,6 +9473,12 @@
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
},
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
+ "dev": true
+ },
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@@ -7868,6 +9494,33 @@
"minimist": "^1.2.5"
}
},
+ "json5-writer": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/json5-writer/-/json5-writer-0.1.8.tgz",
+ "integrity": "sha512-h5sqkk/vSKvESOUTBniGWs8p8nTzHsoDrxPS9enJfQVINqXv3lm+FAyizLwbrCwCn0q7NXqDBb+r8AdUdK3XZw==",
+ "dev": true,
+ "requires": {
+ "jscodeshift": "^0.6.3"
+ }
+ },
+ "jsonfile": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
+ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6",
+ "universalify": "^2.0.0"
+ },
+ "dependencies": {
+ "universalify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
+ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
+ "dev": true
+ }
+ }
+ },
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@@ -8114,6 +9767,17 @@
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
"dev": true
},
+ "log-update": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/log-update/-/log-update-3.4.0.tgz",
+ "integrity": "sha512-ILKe88NeMt4gmDvk/eb615U/IVn7K9KWGkoYbdatQ69Z65nj1ZzjM6fHXfcs0Uge+e+EGnMW7DY4T9yko8vWFg==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "^3.2.0",
+ "cli-cursor": "^2.1.0",
+ "wrap-ansi": "^5.0.0"
+ }
+ },
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
@@ -8346,6 +10010,12 @@
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
"dev": true
},
+ "merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "dev": true
+ },
"micromatch": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
@@ -8563,6 +10233,19 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
+ "multimatch": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz",
+ "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==",
+ "dev": true,
+ "requires": {
+ "@types/minimatch": "^3.0.3",
+ "array-differ": "^3.0.0",
+ "array-union": "^2.1.0",
+ "arrify": "^2.0.1",
+ "minimatch": "^3.0.4"
+ }
+ },
"mumath": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/mumath/-/mumath-3.3.4.tgz",
@@ -8746,6 +10429,15 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
+ "node-dir": {
+ "version": "0.1.17",
+ "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz",
+ "integrity": "sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU=",
+ "dev": true,
+ "requires": {
+ "minimatch": "^3.0.2"
+ }
+ },
"node-int64": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
@@ -9065,6 +10757,23 @@
"wrappy": "1"
}
},
+ "onetime": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
+ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
+ "dev": true,
+ "requires": {
+ "mimic-fn": "^1.0.0"
+ },
+ "dependencies": {
+ "mimic-fn": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
+ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
+ "dev": true
+ }
+ }
+ },
"optionator": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
@@ -9191,6 +10900,15 @@
"readable-stream": "^2.1.5"
}
},
+ "parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "requires": {
+ "callsites": "^3.0.0"
+ }
+ },
"parenthesis": {
"version": "3.1.7",
"resolved": "https://registry.npmjs.org/parenthesis/-/parenthesis-3.1.7.tgz",
@@ -9359,6 +11077,12 @@
"resolved": "https://registry.npmjs.org/pick-by-alias/-/pick-by-alias-1.2.0.tgz",
"integrity": "sha1-X3yysfIabh6ISgyHhVqko3NhEHs="
},
+ "picomatch": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
+ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
+ "dev": true
+ },
"pidtree": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz",
@@ -9729,6 +11453,12 @@
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
+ "progress": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
+ "dev": true
+ },
"promise": {
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
@@ -10168,6 +11898,26 @@
"util.promisify": "^1.0.0"
}
},
+ "recast": {
+ "version": "0.16.2",
+ "resolved": "https://registry.npmjs.org/recast/-/recast-0.16.2.tgz",
+ "integrity": "sha512-O/7qXi51DPjRVdbrpNzoBQH5dnAPQNbfoOFyRiUwreTMJfIHYOEBzwuH+c0+/BTSJ3CQyKs6ILSWXhESH6Op3A==",
+ "dev": true,
+ "requires": {
+ "ast-types": "0.11.7",
+ "esprima": "~4.0.0",
+ "private": "~0.1.5",
+ "source-map": "~0.6.1"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ }
+ }
+ },
"redeyed": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/redeyed/-/redeyed-0.4.4.tgz",
@@ -10251,6 +12001,12 @@
"es-abstract": "^1.17.0-next.1"
}
},
+ "regexpp": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
+ "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
+ "dev": true
+ },
"regexpu-core": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.0.tgz",
@@ -10508,6 +12264,16 @@
"integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",
"dev": true
},
+ "restore-cursor": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
+ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
+ "dev": true,
+ "requires": {
+ "onetime": "^2.0.0",
+ "signal-exit": "^3.0.2"
+ }
+ },
"resumer": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz",
@@ -10522,6 +12288,12 @@
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
"dev": true
},
+ "reusify": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
+ "dev": true
+ },
"right-align": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
@@ -10661,6 +12433,12 @@
"integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==",
"dev": true
},
+ "run-parallel": {
+ "version": "1.1.10",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz",
+ "integrity": "sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==",
+ "dev": true
+ },
"run-queue": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz",
@@ -10949,6 +12727,17 @@
"integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==",
"dev": true
},
+ "slice-ansi": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
+ "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "astral-regex": "^1.0.0",
+ "is-fullwidth-code-point": "^2.0.0"
+ }
+ },
"snapdragon": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
@@ -11595,6 +13384,12 @@
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
"dev": true
},
+ "strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true
+ },
"strongly-connected-components": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/strongly-connected-components/-/strongly-connected-components-1.0.1.tgz",
@@ -11708,6 +13503,18 @@
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"dev": true
},
+ "table": {
+ "version": "5.4.6",
+ "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
+ "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.10.2",
+ "lodash": "^4.17.14",
+ "slice-ansi": "^2.1.0",
+ "string-width": "^3.0.0"
+ }
+ },
"tapable": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz",
@@ -11736,6 +13543,26 @@
"through": "~2.3.8"
}
},
+ "temp": {
+ "version": "0.8.4",
+ "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.4.tgz",
+ "integrity": "sha512-s0ZZzd0BzYv5tLSptZooSjK8oj6C+c19p7Vqta9+6NPOf7r+fxq0cJe6/oN4LTC79sy5NY8ucOJNgwsKCSbfqg==",
+ "dev": true,
+ "requires": {
+ "rimraf": "~2.6.2"
+ },
+ "dependencies": {
+ "rimraf": {
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
+ "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ }
+ }
+ },
"terser": {
"version": "4.6.11",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.6.11.tgz",
@@ -11815,6 +13642,12 @@
"vectorize-text": "^3.2.1"
}
},
+ "text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
+ "dev": true
+ },
"throat": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz",
@@ -12024,6 +13857,287 @@
"cdt2d": "^1.0.0"
}
},
+ "ts-migrate": {
+ "version": "0.1.10",
+ "resolved": "https://registry.npmjs.org/ts-migrate/-/ts-migrate-0.1.10.tgz",
+ "integrity": "sha512-yARvC786gmv+HOw18GIt9PKemVfEINc5hl6Ybrkv/t80w2nxycv1MhQ/NmGNanfuO1xayqiBgoi9TNshzQQm6g==",
+ "dev": true,
+ "requires": {
+ "create-jest-runner": "^0.5.3",
+ "json5": "^2.1.1",
+ "json5-writer": "^0.1.8",
+ "ts-migrate-plugins": "^0.1.10",
+ "ts-migrate-server": "^0.1.10",
+ "typescript": "4.0.2",
+ "updatable-log": "^0.2.0",
+ "yargs": "^15.0.2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true
+ },
+ "cliui": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
+ "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
+ "dev": true,
+ "requires": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^6.2.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true
+ },
+ "locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^4.1.0"
+ }
+ },
+ "p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "dev": true,
+ "requires": {
+ "p-try": "^2.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.2.0"
+ }
+ },
+ "p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "dev": true
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
+ "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.0"
+ }
+ },
+ "typescript": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz",
+ "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ }
+ },
+ "yargs": {
+ "version": "15.4.1",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
+ "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
+ "dev": true,
+ "requires": {
+ "cliui": "^6.0.0",
+ "decamelize": "^1.2.0",
+ "find-up": "^4.1.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^4.2.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^18.1.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "18.1.3",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
+ "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "ts-migrate-plugins": {
+ "version": "0.1.10",
+ "resolved": "https://registry.npmjs.org/ts-migrate-plugins/-/ts-migrate-plugins-0.1.10.tgz",
+ "integrity": "sha512-Tk7dIpSR/fJDNVN2ZemqHAz2jV/6TvD0NgOk5BGuFXkHZQsXz+mRr2LMmxxRHPGtck8Cj9r3hzz6tLhUgyyVBQ==",
+ "dev": true,
+ "requires": {
+ "eslint": "^7.8.1",
+ "jscodeshift": "^0.7.0",
+ "ts-migrate-server": "^0.1.10",
+ "typescript": "4.0.2"
+ },
+ "dependencies": {
+ "ast-types": {
+ "version": "0.13.3",
+ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.3.tgz",
+ "integrity": "sha512-XTZ7xGML849LkQP86sWdQzfhwbt3YwIO6MqbX9mUNYY98VKaaVZP7YNNm70IpwecbkkxmfC5IYAzOQ/2p29zRA==",
+ "dev": true
+ },
+ "jscodeshift": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/jscodeshift/-/jscodeshift-0.7.1.tgz",
+ "integrity": "sha512-YMkZSyoc8zg5woZL23cmWlnFLPH/mHilonGA7Qbzs7H6M4v4PH0Qsn4jeDyw+CHhVoAnm9UxQyB0Yw1OT+mktA==",
+ "dev": true,
+ "requires": {
+ "@babel/core": "^7.1.6",
+ "@babel/parser": "^7.1.6",
+ "@babel/plugin-proposal-class-properties": "^7.1.0",
+ "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
+ "@babel/preset-env": "^7.1.6",
+ "@babel/preset-flow": "^7.0.0",
+ "@babel/preset-typescript": "^7.1.0",
+ "@babel/register": "^7.0.0",
+ "babel-core": "^7.0.0-bridge.0",
+ "colors": "^1.1.2",
+ "flow-parser": "0.*",
+ "graceful-fs": "^4.1.11",
+ "micromatch": "^3.1.10",
+ "neo-async": "^2.5.0",
+ "node-dir": "^0.1.17",
+ "recast": "^0.18.1",
+ "temp": "^0.8.1",
+ "write-file-atomic": "^2.3.0"
+ }
+ },
+ "recast": {
+ "version": "0.18.10",
+ "resolved": "https://registry.npmjs.org/recast/-/recast-0.18.10.tgz",
+ "integrity": "sha512-XNvYvkfdAN9QewbrxeTOjgINkdY/odTgTS56ZNEWL9Ml0weT4T3sFtvnTuF+Gxyu46ANcRm1ntrF6F5LAJPAaQ==",
+ "dev": true,
+ "requires": {
+ "ast-types": "0.13.3",
+ "esprima": "~4.0.0",
+ "private": "^0.1.8",
+ "source-map": "~0.6.1"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "typescript": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz",
+ "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==",
+ "dev": true
+ }
+ }
+ },
+ "ts-migrate-server": {
+ "version": "0.1.10",
+ "resolved": "https://registry.npmjs.org/ts-migrate-server/-/ts-migrate-server-0.1.10.tgz",
+ "integrity": "sha512-vwVVgg1fI1aeYmV0/qtgETGnYMl57O2FopSynLHYU8aafa1bha6xDgoBsYa8w8AYVEtyMHt2F8WsHqmnyX/dJQ==",
+ "dev": true,
+ "requires": {
+ "@ts-morph/bootstrap": "^0.6.0",
+ "typescript": "4.0.2",
+ "updatable-log": "^0.2.0"
+ },
+ "dependencies": {
+ "typescript": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz",
+ "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==",
+ "dev": true
+ }
+ }
+ },
"tslib": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
@@ -12084,6 +14198,12 @@
"prelude-ls": "~1.1.2"
}
},
+ "type-fest": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
+ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+ "dev": true
+ },
"type-name": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/type-name/-/type-name-2.0.2.tgz",
@@ -12103,6 +14223,12 @@
"dup": "^1.0.0"
}
},
+ "typescript": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz",
+ "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==",
+ "dev": true
+ },
"uglify-js": {
"version": "2.8.29",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz",
@@ -12119,6 +14245,12 @@
"integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=",
"optional": true
},
+ "unc-path-regex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
+ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=",
+ "dev": true
+ },
"unicode-canonical-property-names-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
@@ -12183,6 +14315,12 @@
"imurmurhash": "^0.1.4"
}
},
+ "universalify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz",
+ "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==",
+ "dev": true
+ },
"unquote": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz",
@@ -12234,6 +14372,17 @@
"integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==",
"dev": true
},
+ "updatable-log": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/updatable-log/-/updatable-log-0.2.0.tgz",
+ "integrity": "sha512-gR48/mTR6YFB+B1sNoap3nx8HFbEvDl0ej9KhlQTFZdmP8yL5fzFiCUfeHCUf1QvNnXowY1pM9iiGkPKrd0XyQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "figures": "^3.0.0",
+ "log-update": "^3.3.0"
+ }
+ },
"update-diff": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/update-diff/-/update-diff-1.1.0.tgz",
diff --git a/viz-lib/package.json b/viz-lib/package.json
index c5f2e79b2..4850569e3 100644
--- a/viz-lib/package.json
+++ b/viz-lib/package.json
@@ -5,10 +5,13 @@
"main": "dist/redash-visualizations.js",
"scripts": {
"clean": "rm -rf lib dist",
- "build:babel": "babel src --out-dir lib --source-maps --ignore 'src/**/*.test.js' --copy-files --no-copy-ignored",
+ "type-check": "tsc --noEmit",
+ "type-gen": "tsc --emitDeclarationOnly",
+ "build:babel:base": "babel src --out-dir lib --source-maps --ignore 'src/**/*.test.js' --copy-files --no-copy-ignored --extensions .ts,.tsx,.js,.jsx",
+ "build:babel": "npm run type-gen && npm run build:babel:base",
"build:webpack": "webpack",
"build": " NODE_ENV=production npm-run-all clean build:babel build:webpack",
- "watch:babel": "babel src --watch --out-dir lib --source-maps --ignore 'src/**/*.test.js' --copy-files --no-copy-ignored",
+ "watch:babel": "npm run build:babel:base -- --watch",
"watch:webpack": "webpack --watch",
"watch": "npm-run-all --parallel watch:*",
"version": "npm run build",
@@ -34,6 +37,20 @@
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.4",
+ "@babel/preset-typescript": "^7.12.7",
+ "@types/chroma-js": "^2.1.2",
+ "@types/d3": "^6.2.0",
+ "@types/d3-cloud": "^1.2.3",
+ "@types/debug": "^4.1.5",
+ "@types/dompurify": "^2.0.4",
+ "@types/enzyme": "^3.10.8",
+ "@types/jest": "^26.0.18",
+ "@types/leaflet": "^1.5.19",
+ "@types/numeral": "0.0.28",
+ "@types/plotly.js": "^1.54.4",
+ "@types/react": "^17.0.0",
+ "@types/react-dom": "^17.0.0",
+ "@types/tinycolor2": "^1.4.2",
"babel-loader": "^8.1.0",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-module-resolver": "^4.0.0",
@@ -50,6 +67,8 @@
"prettier": "^1.19.1",
"prop-types": "^15.7.2",
"style-loader": "^1.1.4",
+ "ts-migrate": "^0.1.10",
+ "typescript": "^4.1.2",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11"
},
diff --git a/viz-lib/src/components/ColorPicker/Input.jsx b/viz-lib/src/components/ColorPicker/Input.tsx
similarity index 79%
rename from viz-lib/src/components/ColorPicker/Input.jsx
rename to viz-lib/src/components/ColorPicker/Input.tsx
index 47b89fd6a..cca75420d 100644
--- a/viz-lib/src/components/ColorPicker/Input.jsx
+++ b/viz-lib/src/components/ColorPicker/Input.tsx
@@ -1,6 +1,5 @@
import { isNil, isArray, chunk, map, filter, toPairs } from "lodash";
import React, { useState, useEffect } from "react";
-import PropTypes from "prop-types";
import tinycolor from "tinycolor2";
import TextInput from "antd/lib/input";
import Typography from "antd/lib/typography";
@@ -8,7 +7,7 @@ import Swatch from "./Swatch";
import "./input.less";
-function preparePresets(presetColors, presetColumns) {
+function preparePresets(presetColors: any, presetColumns: any) {
presetColors = isArray(presetColors) ? map(presetColors, v => [null, v]) : toPairs(presetColors);
presetColors = map(presetColors, ([title, value]) => {
if (isNil(value)) {
@@ -23,7 +22,7 @@ function preparePresets(presetColors, presetColumns) {
return chunk(filter(presetColors), presetColumns);
}
-function validateColor(value, callback, prefix = "#") {
+function validateColor(value: any, callback: any, prefix = "#") {
if (isNil(value)) {
callback(null);
}
@@ -33,13 +32,25 @@ function validateColor(value, callback, prefix = "#") {
}
}
-export default function Input({ color, presetColors, presetColumns, onChange, onPressEnter }) {
+type OwnProps = {
+ color?: string;
+ presetColors?: string[] | {
+ [key: string]: string;
+ };
+ presetColumns?: number;
+ onChange?: (...args: any[]) => any;
+ onPressEnter?: (...args: any[]) => any;
+};
+
+type Props = OwnProps & typeof Input.defaultProps;
+
+export default function Input({ color, presetColors, presetColumns, onChange, onPressEnter }: Props) {
const [inputValue, setInputValue] = useState("");
const [isInputFocused, setIsInputFocused] = useState(false);
const presets = preparePresets(presetColors, presetColumns);
- function handleInputChange(value) {
+ function handleInputChange(value: any) {
setInputValue(value);
validateColor(value, onChange);
}
@@ -55,6 +66,7 @@ export default function Input({ color, presetColors, presetColumns, onChange, on
{map(presets, (group, index) => (
{map(group, ([title, value]) => (
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'any' is not assignable to type 'never'.
validateColor(value, onChange)} />
))}
@@ -74,17 +86,6 @@ export default function Input({ color, presetColors, presetColumns, onChange, on
);
}
-Input.propTypes = {
- color: PropTypes.string,
- presetColors: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.string), // array of colors (no tooltips)
- PropTypes.objectOf(PropTypes.string), // color name => color value
- ]),
- presetColumns: PropTypes.number,
- onChange: PropTypes.func,
- onPressEnter: PropTypes.func,
-};
-
Input.defaultProps = {
color: "#FFFFFF",
presetColors: null,
diff --git a/viz-lib/src/components/ColorPicker/Label.jsx b/viz-lib/src/components/ColorPicker/Label.tsx
similarity index 61%
rename from viz-lib/src/components/ColorPicker/Label.jsx
rename to viz-lib/src/components/ColorPicker/Label.tsx
index 1cd8a4dec..ea925d7b4 100644
--- a/viz-lib/src/components/ColorPicker/Label.jsx
+++ b/viz-lib/src/components/ColorPicker/Label.tsx
@@ -1,11 +1,21 @@
import React, { useMemo } from "react";
-import PropTypes from "prop-types";
import cx from "classnames";
import { validateColor, getColorName } from "./utils";
import "./label.less";
-export default function Label({ className, color, presetColors, ...props }) {
+type OwnProps = {
+ className?: string;
+ color?: string;
+ presetColors?: string[] | {
+ [key: string]: string;
+ };
+};
+
+type Props = OwnProps & typeof Label.defaultProps;
+
+// @ts-expect-error ts-migrate(2700) FIXME: Rest types may only be created from object types.
+export default function Label({ className, color, presetColors, ...props }: Props) {
const name = useMemo(() => getColorName(validateColor(color), presetColors), [color, presetColors]);
return (
@@ -15,15 +25,6 @@ export default function Label({ className, color, presetColors, ...props }) {
);
}
-Label.propTypes = {
- className: PropTypes.string,
- color: PropTypes.string,
- presetColors: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.string), // array of colors (no tooltips)
- PropTypes.objectOf(PropTypes.string), // color name => color value
- ]),
-};
-
Label.defaultProps = {
className: null,
color: "#FFFFFF",
diff --git a/viz-lib/src/components/ColorPicker/Swatch.jsx b/viz-lib/src/components/ColorPicker/Swatch.tsx
similarity index 60%
rename from viz-lib/src/components/ColorPicker/Swatch.jsx
rename to viz-lib/src/components/ColorPicker/Swatch.tsx
index 0be5571f6..a6848751a 100644
--- a/viz-lib/src/components/ColorPicker/Swatch.jsx
+++ b/viz-lib/src/components/ColorPicker/Swatch.tsx
@@ -1,15 +1,26 @@
import { isString } from "lodash";
import React from "react";
-import PropTypes from "prop-types";
import cx from "classnames";
import Tooltip from "antd/lib/tooltip";
import "./swatch.less";
-export default function Swatch({ className, color, title, size, style, ...props }) {
+type OwnProps = {
+ className?: string;
+ style?: any;
+ title?: string;
+ color?: string;
+ size?: number;
+};
+
+type Props = OwnProps & typeof Swatch.defaultProps;
+
+// @ts-expect-error ts-migrate(2700) FIXME: Rest types may only be created from object types.
+export default function Swatch({ className, color, title, size, style, ...props }: Props) {
const result = (
@@ -25,14 +36,6 @@ export default function Swatch({ className, color, title, size, style, ...props
return result;
}
-Swatch.propTypes = {
- className: PropTypes.string,
- style: PropTypes.object,
- title: PropTypes.string,
- color: PropTypes.string,
- size: PropTypes.number,
-};
-
Swatch.defaultProps = {
className: null,
style: null,
diff --git a/viz-lib/src/components/ColorPicker/index.jsx b/viz-lib/src/components/ColorPicker/index.tsx
similarity index 61%
rename from viz-lib/src/components/ColorPicker/index.jsx
rename to viz-lib/src/components/ColorPicker/index.tsx
index 59b33bc6d..61a4da86d 100644
--- a/viz-lib/src/components/ColorPicker/index.jsx
+++ b/viz-lib/src/components/ColorPicker/index.tsx
@@ -1,6 +1,5 @@
import { toString } from "lodash";
import React, { useState, useEffect, useMemo } from "react";
-import PropTypes from "prop-types";
import cx from "classnames";
import Popover from "antd/lib/popover";
import Card from "antd/lib/card";
@@ -17,18 +16,24 @@ import { validateColor } from "./utils";
import "./index.less";
-export default function ColorPicker({
- color,
- placement,
- presetColors,
- presetColumns,
- interactive,
- children,
- onChange,
- triggerProps,
- addonBefore,
- addonAfter,
-}) {
+type OwnProps = {
+ color?: string;
+ placement?: "top" | "left" | "right" | "bottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom";
+ presetColors?: string[] | {
+ [key: string]: string;
+ };
+ presetColumns?: number;
+ interactive?: boolean;
+ triggerProps?: any;
+ children?: React.ReactNode;
+ addonBefore?: React.ReactNode;
+ addonAfter?: React.ReactNode;
+ onChange?: (...args: any[]) => any;
+};
+
+type Props = OwnProps & typeof ColorPicker.defaultProps;
+
+export default function ColorPicker({ color, placement, presetColors, presetColumns, interactive, children, onChange, triggerProps, addonBefore, addonAfter, }: Props) {
const [visible, setVisible] = useState(false);
const validatedColor = useMemo(() => validateColor(color), [color]);
const [currentColor, setCurrentColor] = useState("");
@@ -36,6 +41,7 @@ export default function ColorPicker({
function handleApply() {
setVisible(false);
if (!interactive) {
+ // @ts-expect-error ts-migrate(2349) FIXME: This expression is not callable.
onChange(currentColor);
}
}
@@ -58,15 +64,17 @@ export default function ColorPicker({
);
}
- function handleInputChange(newColor) {
+ function handleInputChange(newColor: any) {
setCurrentColor(newColor);
if (interactive) {
+ // @ts-expect-error ts-migrate(2349) FIXME: This expression is not callable.
onChange(newColor);
}
}
useEffect(() => {
if (visible) {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string | null' is not assignable... Remove this comment to see the full error message
setCurrentColor(validatedColor);
}
}, [validatedColor, visible]);
@@ -77,6 +85,7 @@ export default function ColorPicker({
void' is not assignable t... Remove this comment to see the full error message
onChange={handleInputChange}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '() => void' is not assignable to type 'never... Remove this comment to see the full error message
onPressEnter={handleApply}
/>
@@ -107,6 +120,7 @@ export default function ColorPicker({
color={validatedColor}
size={30}
{...triggerProps}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'never... Remove this comment to see the full error message
className={cx("color-picker-trigger", triggerProps.className)}
/>
)}
@@ -116,35 +130,6 @@ export default function ColorPicker({
);
}
-ColorPicker.propTypes = {
- color: PropTypes.string,
- placement: PropTypes.oneOf([
- "top",
- "left",
- "right",
- "bottom",
- "topLeft",
- "topRight",
- "bottomLeft",
- "bottomRight",
- "leftTop",
- "leftBottom",
- "rightTop",
- "rightBottom",
- ]),
- presetColors: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.string), // array of colors (no tooltips)
- PropTypes.objectOf(PropTypes.string), // color name => color value
- ]),
- presetColumns: PropTypes.number,
- interactive: PropTypes.bool,
- triggerProps: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- children: PropTypes.node,
- addonBefore: PropTypes.node,
- addonAfter: PropTypes.node,
- onChange: PropTypes.func,
-};
-
ColorPicker.defaultProps = {
color: "#FFFFFF",
placement: "top",
diff --git a/viz-lib/src/components/ColorPicker/utils.js b/viz-lib/src/components/ColorPicker/utils.ts
similarity index 71%
rename from viz-lib/src/components/ColorPicker/utils.js
rename to viz-lib/src/components/ColorPicker/utils.ts
index 1af367043..4736e786a 100644
--- a/viz-lib/src/components/ColorPicker/utils.js
+++ b/viz-lib/src/components/ColorPicker/utils.ts
@@ -1,12 +1,12 @@
import { isArray, findKey } from "lodash";
import tinycolor from "tinycolor2";
-export function validateColor(value, fallback = null) {
+export function validateColor(value: any, fallback = null) {
value = tinycolor(value);
return value.isValid() ? "#" + value.toHex().toUpperCase() : fallback;
}
-export function getColorName(color, presetColors) {
+export function getColorName(color: any, presetColors: any) {
if (isArray(presetColors)) {
return color;
}
diff --git a/viz-lib/src/components/ErrorBoundary.jsx b/viz-lib/src/components/ErrorBoundary.tsx
similarity index 51%
rename from viz-lib/src/components/ErrorBoundary.jsx
rename to viz-lib/src/components/ErrorBoundary.tsx
index c0e7e0d72..647f16126 100644
--- a/viz-lib/src/components/ErrorBoundary.jsx
+++ b/viz-lib/src/components/ErrorBoundary.tsx
@@ -1,13 +1,12 @@
import { isFunction } from "lodash";
import React from "react";
-import PropTypes from "prop-types";
import debug from "debug";
import Alert from "antd/lib/alert";
const logger = debug("redash:errors");
export const ErrorBoundaryContext = React.createContext({
- handleError: error => {
+ handleError: (error: any) => {
// Allow calling chain to roll up, and then throw the error in global context
setTimeout(() => {
throw error;
@@ -16,23 +15,29 @@ export const ErrorBoundaryContext = React.createContext({
reset: () => {},
});
-export function ErrorMessage({ children }) {
+type OwnErrorMessageProps = {
+ children?: React.ReactNode;
+};
+
+type ErrorMessageProps = OwnErrorMessageProps & typeof ErrorMessage.defaultProps;
+
+export function ErrorMessage({ children }: ErrorMessageProps) {
return ;
}
-ErrorMessage.propTypes = {
- children: PropTypes.node,
-};
-
ErrorMessage.defaultProps = {
children: "Something went wrong.",
};
-export default class ErrorBoundary extends React.Component {
- static propTypes = {
- children: PropTypes.node,
- renderError: PropTypes.func, // error => ReactNode
- };
+type OwnErrorBoundaryProps = {
+ renderError?: (...args: any[]) => any;
+};
+
+type ErrorBoundaryState = any;
+
+type ErrorBoundaryProps = OwnErrorBoundaryProps & typeof ErrorBoundary.defaultProps;
+
+export default class ErrorBoundary extends React.Component {
static defaultProps = {
children: null,
@@ -41,10 +46,13 @@ export default class ErrorBoundary extends React.Component {
state = { error: null };
- handleError = error => {
+ handleError = (error: any) => {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'getDerivedStateFromError' does not exist... Remove this comment to see the full error message
this.setState(this.constructor.getDerivedStateFromError(error));
this.componentDidCatch(error, null);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'handleException' does not exist on type ... Remove this comment to see the full error message
if (isFunction(window.handleException)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'handleException' does not exist on type ... Remove this comment to see the full error message
window.handleException(error);
}
};
@@ -53,11 +61,11 @@ export default class ErrorBoundary extends React.Component {
this.setState({ error: null });
};
- static getDerivedStateFromError(error) {
+ static getDerivedStateFromError(error: any) {
return { error };
}
- componentDidCatch(error, errorInfo) {
+ componentDidCatch(error: any, errorInfo: any) {
logger(error, errorInfo);
}
@@ -67,6 +75,7 @@ export default class ErrorBoundary extends React.Component {
if (error) {
if (isFunction(renderError)) {
+ // @ts-expect-error ts-migrate(2349) FIXME: This expression is not callable.
return renderError(error);
}
return ;
diff --git a/viz-lib/src/components/HtmlContent.jsx b/viz-lib/src/components/HtmlContent.tsx
similarity index 51%
rename from viz-lib/src/components/HtmlContent.jsx
rename to viz-lib/src/components/HtmlContent.tsx
index d92082fed..b30f9ece3 100644
--- a/viz-lib/src/components/HtmlContent.jsx
+++ b/viz-lib/src/components/HtmlContent.tsx
@@ -6,15 +6,18 @@ const HtmlContent = React.memo(function HtmlContent({ children, ...props }) {
return (
);
});
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'propTypes' does not exist on type 'Named... Remove this comment to see the full error message
HtmlContent.propTypes = {
children: PropTypes.string,
};
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'defaultProps' does not exist on type 'Na... Remove this comment to see the full error message
HtmlContent.defaultProps = {
children: "",
};
diff --git a/viz-lib/src/components/TextAlignmentSelect/index.jsx b/viz-lib/src/components/TextAlignmentSelect/index.tsx
similarity index 87%
rename from viz-lib/src/components/TextAlignmentSelect/index.jsx
rename to viz-lib/src/components/TextAlignmentSelect/index.tsx
index 44af1541e..0ea662091 100644
--- a/viz-lib/src/components/TextAlignmentSelect/index.jsx
+++ b/viz-lib/src/components/TextAlignmentSelect/index.tsx
@@ -1,6 +1,5 @@
import { pickBy, startsWith } from "lodash";
import React from "react";
-import PropTypes from "prop-types";
import cx from "classnames";
import Radio from "antd/lib/radio";
import Tooltip from "antd/lib/tooltip";
@@ -11,7 +10,14 @@ import AlignRightOutlinedIcon from "@ant-design/icons/AlignRightOutlined";
import "./index.less";
-export default function TextAlignmentSelect({ className, ...props }) {
+type OwnProps = {
+ className?: string;
+};
+
+type Props = OwnProps & typeof TextAlignmentSelect.defaultProps;
+
+// @ts-expect-error ts-migrate(2700) FIXME: Rest types may only be created from object types.
+export default function TextAlignmentSelect({ className, ...props }: Props) {
return (
// Antd RadioGroup does not use any custom attributes
startsWith(k, "data-"))}>
@@ -36,10 +42,6 @@ export default function TextAlignmentSelect({ className, ...props }) {
);
}
-TextAlignmentSelect.propTypes = {
- className: PropTypes.string,
-};
-
TextAlignmentSelect.defaultProps = {
className: null,
};
diff --git a/viz-lib/src/components/json-view-interactive/JsonViewInteractive.jsx b/viz-lib/src/components/json-view-interactive/JsonViewInteractive.tsx
similarity index 88%
rename from viz-lib/src/components/json-view-interactive/JsonViewInteractive.jsx
rename to viz-lib/src/components/json-view-interactive/JsonViewInteractive.tsx
index 7c967e786..41ba2293c 100644
--- a/viz-lib/src/components/json-view-interactive/JsonViewInteractive.jsx
+++ b/viz-lib/src/components/json-view-interactive/JsonViewInteractive.tsx
@@ -3,11 +3,16 @@
import { isFinite, isString, isArray, isObject, keys, map } from "lodash";
import React, { useState } from "react";
import cx from "classnames";
-import PropTypes from "prop-types";
import "./json-view-interactive.less";
-function JsonBlock({ value, children, openingBrace, closingBrace, withKeys }) {
+function JsonBlock({
+ value,
+ children,
+ openingBrace,
+ closingBrace,
+ withKeys
+}: any) {
const [isExpanded, setIsExpanded] = useState(false);
const objectKeys = keys(value);
@@ -56,7 +61,10 @@ function JsonBlock({ value, children, openingBrace, closingBrace, withKeys }) {
);
}
-function JsonValue({ value, children }) {
+function JsonValue({
+ value,
+ children
+}: any) {
if (value === null || value === false || value === true || isFinite(value)) {
return (
@@ -92,7 +100,13 @@ function JsonValue({ value, children }) {
return null;
}
-export default function JsonViewInteractive({ value }) {
+type OwnJsonViewInteractiveProps = {
+ value?: any;
+};
+
+type JsonViewInteractiveProps = OwnJsonViewInteractiveProps & typeof JsonViewInteractive.defaultProps;
+
+export default function JsonViewInteractive({ value }: JsonViewInteractiveProps) {
return (
@@ -100,10 +114,6 @@ export default function JsonViewInteractive({ value }) {
);
}
-JsonViewInteractive.propTypes = {
- value: PropTypes.any, // eslint-disable-line react/forbid-prop-types
-};
-
JsonViewInteractive.defaultProps = {
// `null` will be rendered as "null" because it is a valid JSON value, so use `undefined` for no value
value: undefined,
diff --git a/viz-lib/src/components/sortable/index.jsx b/viz-lib/src/components/sortable/index.tsx
similarity index 60%
rename from viz-lib/src/components/sortable/index.jsx
rename to viz-lib/src/components/sortable/index.tsx
index c53c28ab5..e0dc569ed 100644
--- a/viz-lib/src/components/sortable/index.jsx
+++ b/viz-lib/src/components/sortable/index.tsx
@@ -1,20 +1,36 @@
import { isFunction, wrap } from "lodash";
import React, { useRef, useState } from "react";
-import PropTypes from "prop-types";
import cx from "classnames";
+// @ts-expect-error ts-migrate(2724) FIXME: Module '"../../../node_modules/react-sortable-hoc/... Remove this comment to see the full error message
import { sortableContainer, sortableElement, sortableHandle } from "react-sortable-hoc";
import "./style.less";
-export const DragHandle = sortableHandle(({ className, ...restProps }) => (
+export const DragHandle = sortableHandle(({
+ className,
+ ...restProps
+}: any) => (
));
-export const SortableContainerWrapper = sortableContainer(({ children }) => children);
+export const SortableContainerWrapper = sortableContainer(({
+ children
+}: any) => children);
-export const SortableElement = sortableElement(({ children }) => children);
+export const SortableElement = sortableElement(({
+ children
+}: any) => children);
-export function SortableContainer({ disabled, containerComponent, containerProps, children, ...wrapperProps }) {
+type OwnProps = {
+ disabled?: boolean;
+ containerComponent?: React.ReactElement;
+ containerProps?: any;
+ children?: React.ReactNode;
+};
+
+type Props = OwnProps & typeof SortableContainer.defaultProps;
+
+export function SortableContainer({ disabled, containerComponent, containerProps, children, ...wrapperProps }: Props) {
const containerRef = useRef();
const [isDragging, setIsDragging] = useState(false);
@@ -25,22 +41,26 @@ export function SortableContainer({ disabled, containerComponent, containerProps
// Disabled state:
// - forbid drag'n'drop (and therefore no need to hook events
// - don't override anything on container element
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'shouldCancelStart' does not exist on typ... Remove this comment to see the full error message
wrapperProps.shouldCancelStart = () => true;
} else {
// Enabled state:
// - use container element as a default helper element
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'helperContainer' does not exist on type ... Remove this comment to see the full error message
wrapperProps.helperContainer = wrap(wrapperProps.helperContainer, helperContainer =>
isFunction(helperContainer) ? helperContainer(containerRef.current) : containerRef.current
);
// - hook drag start/end events
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'updateBeforeSortStart' does not exist on... Remove this comment to see the full error message
wrapperProps.updateBeforeSortStart = wrap(wrapperProps.updateBeforeSortStart, (updateBeforeSortStart, ...args) => {
setIsDragging(true);
if (isFunction(updateBeforeSortStart)) {
updateBeforeSortStart(...args);
}
});
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'onSortEnd' does not exist on type '{}'.
wrapperProps.onSortEnd = wrap(wrapperProps.onSortEnd, (onSortEnd, ...args) => {
setIsDragging(false);
if (isFunction(onSortEnd)) {
@@ -60,18 +80,12 @@ export function SortableContainer({ disabled, containerComponent, containerProps
const ContainerComponent = containerComponent;
return (
+ {/* @ts-expect-error ts-migrate(2604) FIXME: JSX element type 'ContainerComponent' does not hav... Remove this comment to see the full error message */}
{children}
);
}
-SortableContainer.propTypes = {
- disabled: PropTypes.bool,
- containerComponent: PropTypes.elementType,
- containerProps: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- children: PropTypes.node,
-};
-
SortableContainer.defaultProps = {
disabled: false,
containerComponent: "div",
diff --git a/viz-lib/src/components/visualizations/editor/ContextHelp.jsx b/viz-lib/src/components/visualizations/editor/ContextHelp.tsx
similarity index 80%
rename from viz-lib/src/components/visualizations/editor/ContextHelp.jsx
rename to viz-lib/src/components/visualizations/editor/ContextHelp.tsx
index 1d23f4c4c..b0fc08afe 100644
--- a/viz-lib/src/components/visualizations/editor/ContextHelp.jsx
+++ b/viz-lib/src/components/visualizations/editor/ContextHelp.tsx
@@ -1,12 +1,18 @@
import React from "react";
-import PropTypes from "prop-types";
import Popover from "antd/lib/popover";
import QuestionCircleFilledIcon from "@ant-design/icons/QuestionCircleFilled";
import { visualizationsSettings } from "@/visualizations/visualizationsSettings";
import "./context-help.less";
-export default function ContextHelp({ icon, children, ...props }) {
+type OwnContextHelpProps = {
+ icon?: React.ReactNode;
+ children?: React.ReactNode;
+};
+
+type ContextHelpProps = OwnContextHelpProps & typeof ContextHelp.defaultProps;
+
+export default function ContextHelp({ icon, children, ...props }: ContextHelpProps) {
return (
{icon || ContextHelp.defaultIcon}
@@ -14,11 +20,6 @@ export default function ContextHelp({ icon, children, ...props }) {
);
}
-ContextHelp.propTypes = {
- icon: PropTypes.node,
- children: PropTypes.node,
-};
-
ContextHelp.defaultProps = {
icon: null,
children: null,
@@ -30,6 +31,7 @@ function NumberFormatSpecs() {
const { HelpTriggerComponent } = visualizationsSettings;
return (
{children}
@@ -34,11 +44,6 @@ export default function Section({ className, children, ...props }) {
);
}
-Section.propTypes = {
- className: PropTypes.string,
- children: PropTypes.node,
-};
-
Section.defaultProps = {
className: null,
children: null,
diff --git a/viz-lib/src/components/visualizations/editor/Switch.jsx b/viz-lib/src/components/visualizations/editor/Switch.tsx
similarity index 76%
rename from viz-lib/src/components/visualizations/editor/Switch.jsx
rename to viz-lib/src/components/visualizations/editor/Switch.tsx
index 0949d6672..6c46cb626 100644
--- a/viz-lib/src/components/visualizations/editor/Switch.jsx
+++ b/viz-lib/src/components/visualizations/editor/Switch.tsx
@@ -1,11 +1,19 @@
import React, { useMemo } from "react";
-import PropTypes from "prop-types";
import AntSwitch from "antd/lib/switch";
import Typography from "antd/lib/typography";
import "./Switch.less";
-export default function Switch({ id, children, disabled, ...props }) {
+type OwnProps = {
+ id?: string;
+ disabled?: boolean;
+ children?: React.ReactNode;
+};
+
+type Props = OwnProps & typeof Switch.defaultProps;
+
+// @ts-expect-error ts-migrate(2700) FIXME: Rest types may only be created from object types.
+export default function Switch({ id, children, disabled, ...props }: Props) {
const fallbackId = useMemo(
() =>
`visualization-editor-control-${Math.random()
@@ -29,12 +37,6 @@ export default function Switch({ id, children, disabled, ...props }) {
return ;
}
-Switch.propTypes = {
- id: PropTypes.string,
- disabled: PropTypes.bool,
- children: PropTypes.node,
-};
-
Switch.defaultProps = {
id: null,
disabled: false,
diff --git a/viz-lib/src/components/visualizations/editor/TextArea.jsx b/viz-lib/src/components/visualizations/editor/TextArea.tsx
similarity index 84%
rename from viz-lib/src/components/visualizations/editor/TextArea.jsx
rename to viz-lib/src/components/visualizations/editor/TextArea.tsx
index 855096dc0..7660775ff 100644
--- a/viz-lib/src/components/visualizations/editor/TextArea.jsx
+++ b/viz-lib/src/components/visualizations/editor/TextArea.tsx
@@ -5,7 +5,10 @@ import withControlLabel from "./withControlLabel";
import "./TextArea.less";
-function TextArea({ className, ...otherProps }) {
+function TextArea({
+ className,
+ ...otherProps
+}: any) {
return ;
}
diff --git a/viz-lib/src/components/visualizations/editor/createTabbedEditor.jsx b/viz-lib/src/components/visualizations/editor/createTabbedEditor.jsx
deleted file mode 100644
index f7c1af612..000000000
--- a/viz-lib/src/components/visualizations/editor/createTabbedEditor.jsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { isFunction, map, filter, extend, merge } from "lodash";
-import React from "react";
-import PropTypes from "prop-types";
-import Tabs from "antd/lib/tabs";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-export const UpdateOptionsStrategy = {
- replace: (existingOptions, newOptions) => merge({}, newOptions),
- shallowMerge: (existingOptions, newOptions) => extend({}, existingOptions, newOptions),
- deepMerge: (existingOptions, newOptions) => merge({}, existingOptions, newOptions),
-};
-
-export function TabbedEditor({ tabs, options, data, onOptionsChange, ...restProps }) {
- const optionsChanged = (newOptions, updateStrategy = UpdateOptionsStrategy.deepMerge) => {
- onOptionsChange(updateStrategy(options, newOptions));
- };
-
- tabs = filter(tabs, tab => (isFunction(tab.isAvailable) ? tab.isAvailable(options, data) : true));
-
- return (
-
- {map(tabs, ({ key, title, component: Component }) => (
- {isFunction(title) ? title(options) : title} }>
-
-
- ))}
-
- );
-}
-
-TabbedEditor.propTypes = {
- ...EditorPropTypes,
- tabs: PropTypes.arrayOf(
- PropTypes.shape({
- key: PropTypes.string.isRequired,
- title: PropTypes.oneOfType([
- PropTypes.string,
- PropTypes.func, // (options) => string
- ]).isRequired,
- isAvailable: PropTypes.func, // (options) => boolean
- component: PropTypes.func.isRequired,
- })
- ),
-};
-
-TabbedEditor.defaultProps = {
- tabs: [],
-};
-
-export default function createTabbedEditor(tabs) {
- return function TabbedEditorWrapper(props) {
- return ;
- };
-}
diff --git a/viz-lib/src/components/visualizations/editor/createTabbedEditor.tsx b/viz-lib/src/components/visualizations/editor/createTabbedEditor.tsx
new file mode 100644
index 000000000..5507d3cdc
--- /dev/null
+++ b/viz-lib/src/components/visualizations/editor/createTabbedEditor.tsx
@@ -0,0 +1,57 @@
+import { isFunction, map, filter, extend, merge } from "lodash";
+import React from "react";
+import Tabs from "antd/lib/tabs";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+export const UpdateOptionsStrategy = {
+ replace: (existingOptions: any, newOptions: any) => merge({}, newOptions),
+ shallowMerge: (existingOptions: any, newOptions: any) => extend({}, existingOptions, newOptions),
+ deepMerge: (existingOptions: any, newOptions: any) => merge({}, existingOptions, newOptions),
+};
+
+/*
+(ts-migrate) TODO: Migrate the remaining prop types
+...EditorPropTypes
+*/
+type OwnProps = {
+ tabs?: {
+ key: string;
+ title: string | ((...args: any[]) => any);
+ isAvailable?: (...args: any[]) => any;
+ component: (...args: any[]) => any;
+ }[];
+};
+
+type Props = OwnProps & typeof TabbedEditor.defaultProps;
+
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'options' does not exist on type 'Props'.
+export function TabbedEditor({ tabs, options, data, onOptionsChange, ...restProps }: Props) {
+ const optionsChanged = (newOptions: any, updateStrategy = UpdateOptionsStrategy.deepMerge) => {
+ onOptionsChange(updateStrategy(options, newOptions));
+ };
+
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '(number | ((() => string) & (() => string)) ... Remove this comment to see the full error message
+ tabs = filter(tabs, tab => (isFunction(tab.isAvailable) ? tab.isAvailable(options, data) : true));
+
+ return (
+
+ {map(tabs, ({ key, title, component: Component }) => (
+ {isFunction(title) ? title(options) : title} }>
+
+
+ ))}
+
+ );
+}
+
+TabbedEditor.defaultProps = {
+ tabs: [],
+};
+
+export default function createTabbedEditor(tabs: any) {
+ return function TabbedEditorWrapper(props: any) {
+ return
;
+ };
+}
diff --git a/viz-lib/src/components/visualizations/editor/index.js b/viz-lib/src/components/visualizations/editor/index.ts
similarity index 100%
rename from viz-lib/src/components/visualizations/editor/index.js
rename to viz-lib/src/components/visualizations/editor/index.ts
diff --git a/viz-lib/src/components/visualizations/editor/withControlLabel.jsx b/viz-lib/src/components/visualizations/editor/withControlLabel.tsx
similarity index 72%
rename from viz-lib/src/components/visualizations/editor/withControlLabel.jsx
rename to viz-lib/src/components/visualizations/editor/withControlLabel.tsx
index a28f2bc25..6c90ea006 100644
--- a/viz-lib/src/components/visualizations/editor/withControlLabel.jsx
+++ b/viz-lib/src/components/visualizations/editor/withControlLabel.tsx
@@ -1,13 +1,22 @@
import React, { useMemo } from "react";
import cx from "classnames";
-import PropTypes from "prop-types";
import hoistNonReactStatics from "hoist-non-react-statics";
import * as Grid from "antd/lib/grid";
import Typography from "antd/lib/typography";
import "./control-label.less";
-export function ControlLabel({ layout, label, labelProps, disabled, children }) {
+type OwnProps = {
+ layout?: "vertical" | "horizontal";
+ label?: React.ReactNode;
+ labelProps?: any;
+ disabled?: boolean;
+ children?: React.ReactNode;
+};
+
+type Props = OwnProps & typeof ControlLabel.defaultProps;
+
+export function ControlLabel({ layout, label, labelProps, disabled, children }: Props) {
if (layout === "vertical" && label) {
return (
@@ -23,6 +32,7 @@ export function ControlLabel({ layout, label, labelProps, disabled, children })
return (
@@ -39,14 +49,6 @@ export function ControlLabel({ layout, label, labelProps, disabled, children })
return children;
}
-ControlLabel.propTypes = {
- layout: PropTypes.oneOf(["vertical", "horizontal"]),
- label: PropTypes.node,
- labelProps: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- disabled: PropTypes.bool,
- children: PropTypes.node,
-};
-
ControlLabel.defaultProps = {
layout: "vertical",
label: null,
@@ -54,9 +56,17 @@ ControlLabel.defaultProps = {
children: null,
};
-export default function withControlLabel(WrappedControl) {
+export default function withControlLabel(WrappedControl: any) {
// eslint-disable-next-line react/prop-types
- function ControlWrapper({ className, id, layout, label, labelProps, disabled, ...props }) {
+ function ControlWrapper({
+ className,
+ id,
+ layout,
+ label,
+ labelProps,
+ disabled,
+ ...props
+ }: any) {
const fallbackId = useMemo(
() =>
`visualization-editor-control-${Math.random()
@@ -71,6 +81,7 @@ export default function withControlLabel(WrappedControl) {
return (
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
chroma.contrast(backgroundColor, color));
diff --git a/viz-lib/src/lib/hooks/useMemoWithDeepCompare.js b/viz-lib/src/lib/hooks/useMemoWithDeepCompare.ts
similarity index 52%
rename from viz-lib/src/lib/hooks/useMemoWithDeepCompare.js
rename to viz-lib/src/lib/hooks/useMemoWithDeepCompare.ts
index 381253cae..a42adfe17 100644
--- a/viz-lib/src/lib/hooks/useMemoWithDeepCompare.js
+++ b/viz-lib/src/lib/hooks/useMemoWithDeepCompare.ts
@@ -1,10 +1,11 @@
import { isEqual } from "lodash";
import { useMemo, useRef } from "react";
-export default function useMemoWithDeepCompare(create, inputs) {
+export default function useMemoWithDeepCompare(create: any, inputs: any) {
const valueRef = useRef();
const value = useMemo(create, inputs);
if (!isEqual(value, valueRef.current)) {
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'undefine... Remove this comment to see the full error message
valueRef.current = value;
}
return valueRef.current;
diff --git a/viz-lib/src/lib/referenceCountingCache.js b/viz-lib/src/lib/referenceCountingCache.js
deleted file mode 100644
index 35ff4721d..000000000
--- a/viz-lib/src/lib/referenceCountingCache.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import { each, debounce } from "lodash";
-
-export default function createReferenceCountingCache({ cleanupDelay = 2000 } = {}) {
- const items = {};
-
- const cleanup = debounce(() => {
- each(items, (item, key) => {
- if (item.refCount <= 0) {
- delete items[key];
- }
- });
- }, cleanupDelay);
-
- function get(key, getter) {
- if (!items[key]) {
- items[key] = {
- value: getter(),
- refCount: 0,
- };
- }
- const item = items[key];
- item.refCount += 1;
- return item.value;
- }
-
- function release(key) {
- if (items[key]) {
- const item = items[key];
- if (item.refCount > 0) {
- item.refCount -= 1;
- if (item.refCount <= 0) {
- cleanup();
- }
- }
- }
- }
-
- return { get, release };
-}
diff --git a/viz-lib/src/lib/referenceCountingCache.ts b/viz-lib/src/lib/referenceCountingCache.ts
new file mode 100644
index 000000000..778acff2e
--- /dev/null
+++ b/viz-lib/src/lib/referenceCountingCache.ts
@@ -0,0 +1,46 @@
+import { each, debounce } from "lodash";
+
+export default function createReferenceCountingCache({ cleanupDelay = 2000 } = {}) {
+ const items = {};
+
+ const cleanup = debounce(() => {
+ each(items, (item, key) => {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'refCount' does not exist on type 'never'... Remove this comment to see the full error message
+ if (item.refCount <= 0) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ delete items[key];
+ }
+ });
+ }, cleanupDelay);
+
+ function get(key: any, getter: any) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ if (!items[key]) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ items[key] = {
+ value: getter(),
+ refCount: 0,
+ };
+ }
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ const item = items[key];
+ item.refCount += 1;
+ return item.value;
+ }
+
+ function release(key: any) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ if (items[key]) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ const item = items[key];
+ if (item.refCount > 0) {
+ item.refCount -= 1;
+ if (item.refCount <= 0) {
+ cleanup();
+ }
+ }
+ }
+ }
+
+ return { get, release };
+}
diff --git a/viz-lib/src/lib/utils.js b/viz-lib/src/lib/utils.ts
similarity index 83%
rename from viz-lib/src/lib/utils.js
rename to viz-lib/src/lib/utils.ts
index 4bec7433e..ffca8731a 100644
--- a/viz-lib/src/lib/utils.js
+++ b/viz-lib/src/lib/utils.ts
@@ -1,7 +1,7 @@
import moment from "moment";
import { visualizationsSettings } from "@/visualizations/visualizationsSettings";
-function formatDateTime(value) {
+function formatDateTime(value: any) {
if (!value) {
return "";
}
@@ -14,7 +14,7 @@ function formatDateTime(value) {
return parsed.format(visualizationsSettings.dateTimeFormat);
}
-function formatDate(value) {
+function formatDate(value: any) {
if (!value) {
return "";
}
@@ -27,7 +27,7 @@ function formatDate(value) {
return parsed.format(visualizationsSettings.dateFormat);
}
-export function formatColumnValue(value, columnType = null) {
+export function formatColumnValue(value: any, columnType = null) {
if (moment.isMoment(value)) {
if (columnType === "date") {
return formatDate(value);
diff --git a/viz-lib/src/lib/value-format.jsx b/viz-lib/src/lib/value-format.tsx
similarity index 75%
rename from viz-lib/src/lib/value-format.jsx
rename to viz-lib/src/lib/value-format.tsx
index 0d8de1909..8eb4c0dc1 100644
--- a/viz-lib/src/lib/value-format.jsx
+++ b/viz-lib/src/lib/value-format.tsx
@@ -12,9 +12,9 @@ const urlPattern = /(^|[\s\n]| )((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019
const hasOwnProperty = Object.prototype.hasOwnProperty;
-export function createTextFormatter(highlightLinks) {
+export function createTextFormatter(highlightLinks: any) {
if (highlightLinks) {
- return value => {
+ return (value: any) => {
if (isString(value)) {
const Link = visualizationsSettings.LinkComponent;
value = value.replace(urlPattern, (unused, prefix, href) => {
@@ -29,10 +29,10 @@ export function createTextFormatter(highlightLinks) {
return toString(value);
};
}
- return value => toString(value);
+ return (value: any) => toString(value);
}
-function toMoment(value) {
+function toMoment(value: any) {
if (moment.isMoment(value)) {
return value;
}
@@ -43,21 +43,21 @@ function toMoment(value) {
return moment(toString(value), [moment.ISO_8601, moment.RFC_2822]);
}
-export function createDateTimeFormatter(format) {
+export function createDateTimeFormatter(format: any) {
if (isString(format) && format !== "") {
- return value => {
+ return (value: any) => {
const wrapped = toMoment(value);
return wrapped.isValid() ? wrapped.format(format) : toString(value);
};
}
- return value => toString(value);
+ return (value: any) => toString(value);
}
-export function createBooleanFormatter(values) {
+export function createBooleanFormatter(values: any) {
if (isArray(values)) {
if (values.length >= 2) {
// Both `true` and `false` specified
- return value => {
+ return (value: any) => {
if (isNil(value)) {
return "";
}
@@ -65,10 +65,10 @@ export function createBooleanFormatter(values) {
};
} else if (values.length === 1) {
// Only `true`
- return value => (value ? values[0] : "");
+ return (value: any) => value ? values[0] : "";
}
}
- return value => {
+ return (value: any) => {
if (isNil(value)) {
return "";
}
@@ -76,15 +76,15 @@ export function createBooleanFormatter(values) {
};
}
-export function createNumberFormatter(format) {
+export function createNumberFormatter(format: any) {
if (isString(format) && format !== "") {
const n = numeral(0); // cache `numeral` instance
- return value => (value === null || value === "" ? "" : n.set(value).format(format));
+ return (value: any) => value === null || value === "" ? "" : n.set(value).format(format);
}
- return value => toString(value);
+ return (value: any) => toString(value);
}
-export function formatSimpleTemplate(str, data) {
+export function formatSimpleTemplate(str: any, data: any) {
if (!isString(str)) {
return "";
}
diff --git a/viz-lib/src/services/resizeObserver.js b/viz-lib/src/services/resizeObserver.ts
similarity index 92%
rename from viz-lib/src/services/resizeObserver.js
rename to viz-lib/src/services/resizeObserver.ts
index c27b3bbae..b1825e8b3 100644
--- a/viz-lib/src/services/resizeObserver.js
+++ b/viz-lib/src/services/resizeObserver.ts
@@ -19,7 +19,7 @@ function checkItems() {
}
}
-export default function observe(node, callback) {
+export default function observe(node: any, callback: any) {
if (node && !items.has(node)) {
const shouldTrigger = items.size === 0;
items.set(node, { callback });
diff --git a/viz-lib/src/services/sanitize.js b/viz-lib/src/services/sanitize.ts
similarity index 100%
rename from viz-lib/src/services/sanitize.js
rename to viz-lib/src/services/sanitize.ts
diff --git a/viz-lib/src/visualizations/ColorPalette.js b/viz-lib/src/visualizations/ColorPalette.ts
similarity index 100%
rename from viz-lib/src/visualizations/ColorPalette.js
rename to viz-lib/src/visualizations/ColorPalette.ts
diff --git a/viz-lib/src/visualizations/Editor.jsx b/viz-lib/src/visualizations/Editor.tsx
similarity index 59%
rename from viz-lib/src/visualizations/Editor.jsx
rename to viz-lib/src/visualizations/Editor.tsx
index 1d78ce068..85fce08da 100644
--- a/viz-lib/src/visualizations/Editor.jsx
+++ b/viz-lib/src/visualizations/Editor.tsx
@@ -1,16 +1,19 @@
import React, { useMemo } from "react";
-import PropTypes from "prop-types";
import { EditorPropTypes } from "@/visualizations/prop-types";
import registeredVisualizations from "@/visualizations/registeredVisualizations";
-export default function Editor({ type, options: optionsProp, data, ...otherProps }) {
+/*
+(ts-migrate) TODO: Migrate the remaining prop types
+...EditorPropTypes
+*/
+type Props = {
+ type: string;
+} & typeof EditorPropTypes;
+
+export default function Editor({ type, options: optionsProp, data, ...otherProps }: Props) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const { Editor, getOptions } = registeredVisualizations[type];
const options = useMemo(() => getOptions(optionsProp, data), [optionsProp, data]);
return ;
}
-
-Editor.propTypes = {
- type: PropTypes.string.isRequired,
- ...EditorPropTypes,
-};
diff --git a/viz-lib/src/visualizations/Renderer.jsx b/viz-lib/src/visualizations/Renderer.tsx
similarity index 69%
rename from viz-lib/src/visualizations/Renderer.jsx
rename to viz-lib/src/visualizations/Renderer.tsx
index 3bd005f9f..781fcbbab 100644
--- a/viz-lib/src/visualizations/Renderer.jsx
+++ b/viz-lib/src/visualizations/Renderer.tsx
@@ -1,22 +1,24 @@
import { isEqual } from "lodash";
import React, { useEffect, useRef } from "react";
-import PropTypes from "prop-types";
import ErrorBoundary, { ErrorMessage } from "@/components/ErrorBoundary";
import { RendererPropTypes } from "@/visualizations/prop-types";
import registeredVisualizations from "@/visualizations/registeredVisualizations";
-export default function Renderer({
- type,
- data,
- options: optionsProp,
- visualizationName,
- addonBefore,
- addonAfter,
- ...otherProps
-}) {
+/*
+(ts-migrate) TODO: Migrate the remaining prop types
+...RendererPropTypes
+*/
+type Props = {
+ type: string;
+ addonBefore?: React.ReactNode;
+ addonAfter?: React.ReactNode;
+} & typeof RendererPropTypes;
+
+export default function Renderer({ type, data, options: optionsProp, visualizationName, addonBefore, addonAfter, ...otherProps }: Props) {
const lastOptions = useRef();
const errorHandlerRef = useRef();
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const { Renderer, getOptions } = registeredVisualizations[type];
// Avoid unnecessary updates (which may be expensive or cause issues with
@@ -31,6 +33,7 @@ export default function Renderer({
useEffect(() => {
if (errorHandlerRef.current) {
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
errorHandlerRef.current.reset();
}
}, [optionsProp, data]);
@@ -38,6 +41,7 @@ export default function Renderer({
return (
{addonBefore}
+ {/* @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call. */}
Error while rendering visualization. }>
@@ -49,10 +53,3 @@ export default function Renderer({
);
}
-
-Renderer.propTypes = {
- type: PropTypes.string.isRequired,
- addonBefore: PropTypes.node,
- addonAfter: PropTypes.node,
- ...RendererPropTypes,
-};
diff --git a/viz-lib/src/visualizations/box-plot/Editor.jsx b/viz-lib/src/visualizations/box-plot/Editor.tsx
similarity index 54%
rename from viz-lib/src/visualizations/box-plot/Editor.jsx
rename to viz-lib/src/visualizations/box-plot/Editor.tsx
index 02155a84c..b17fa3f0c 100644
--- a/viz-lib/src/visualizations/box-plot/Editor.jsx
+++ b/viz-lib/src/visualizations/box-plot/Editor.tsx
@@ -2,34 +2,39 @@ import React from "react";
import { Section, Input } from "@/components/visualizations/editor";
import { EditorPropTypes } from "@/visualizations/prop-types";
-export default function Editor({ options, onOptionsChange }) {
- const onXAxisLabelChanged = xAxisLabel => {
+export default function Editor({
+ options,
+ onOptionsChange
+}: any) {
+ const onXAxisLabelChanged = (xAxisLabel: any) => {
const newOptions = { ...options, xAxisLabel };
onOptionsChange(newOptions);
};
- const onYAxisLabelChanged = yAxisLabel => {
+ const onYAxisLabelChanged = (yAxisLabel: any) => {
const newOptions = { ...options, yAxisLabel };
onOptionsChange(newOptions);
};
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
diff --git a/viz-lib/src/visualizations/box-plot/Renderer.jsx b/viz-lib/src/visualizations/box-plot/Renderer.tsx
similarity index 73%
rename from viz-lib/src/visualizations/box-plot/Renderer.jsx
rename to viz-lib/src/visualizations/box-plot/Renderer.tsx
index f6343a8fb..e825cc988 100644
--- a/viz-lib/src/visualizations/box-plot/Renderer.jsx
+++ b/viz-lib/src/visualizations/box-plot/Renderer.tsx
@@ -6,8 +6,8 @@ import { RendererPropTypes } from "@/visualizations/prop-types";
import box from "./d3box";
import "./renderer.less";
-function calcIqr(k) {
- return d => {
+function calcIqr(k: any) {
+ return (d: any) => {
const q1 = d.quartiles[0];
const q3 = d.quartiles[2];
const iqr = (q3 - q1) * k;
@@ -29,7 +29,10 @@ function calcIqr(k) {
};
}
-function render(container, data, { xAxisLabel, yAxisLabel }) {
+function render(container: any, data: any, {
+ xAxisLabel,
+ yAxisLabel
+}: any) {
container = d3.select(container);
const containerBounds = container.node().getBoundingClientRect();
@@ -48,11 +51,12 @@ function render(container, data, { xAxisLabel, yAxisLabel }) {
let min = Infinity;
let max = -Infinity;
- const mydata = [];
+ const mydata: any = [];
let value = 0;
let d = [];
const columns = map(data.columns, col => col.name);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const xscale = d3.scale
.ordinal()
.domain(columns)
@@ -76,6 +80,7 @@ function render(container, data, { xAxisLabel, yAxisLabel }) {
});
});
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const yscale = d3.scale
.linear()
.domain([min * 0.99, max * 1.01])
@@ -83,32 +88,37 @@ function render(container, data, { xAxisLabel, yAxisLabel }) {
const chart = box()
.whiskers(calcIqr(1.5))
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'width' does not exist on type '{ (g: any... Remove this comment to see the full error message
.width(boxWidth - 2 * margin.inner)
.height(height)
.domain([min * 0.99, max * 1.01]);
const xAxis = d3.svg
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'axis' does not exist on type '(url: stri... Remove this comment to see the full error message
.axis()
.scale(xscale)
.orient("bottom");
const yAxis = d3.svg
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'axis' does not exist on type '(url: stri... Remove this comment to see the full error message
.axis()
.scale(yscale)
.orient("left");
const xLines = d3.svg
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'axis' does not exist on type '(url: stri... Remove this comment to see the full error message
.axis()
.scale(xscale)
.tickSize(height)
.orient("bottom");
const yLines = d3.svg
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'axis' does not exist on type '(url: stri... Remove this comment to see the full error message
.axis()
.scale(yscale)
.tickSize(width)
.orient("right");
- function barOffset(i) {
+ function barOffset(i: any) {
return xscale(columns[i]) + (xscale(columns[1]) - margin.inner) / 2.0;
}
@@ -174,11 +184,14 @@ function render(container, data, { xAxisLabel, yAxisLabel }) {
.attr("class", "box")
.attr("width", boxWidth)
.attr("height", height)
- .attr("transform", (_, i) => `translate(${barOffset(i)},${0})`)
+ .attr("transform", (_: any, i: any) => `translate(${barOffset(i)},${0})`)
.call(chart);
}
-export default function Renderer({ data, options }) {
+export default function Renderer({
+ data,
+ options
+}: any) {
const [container, setContainer] = useState(null);
useEffect(() => {
@@ -191,6 +204,7 @@ export default function Renderer({ data, options }) {
}
}, [container, data, options]);
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch>' is not assig... Remove this comment to see the full error message
return
;
}
diff --git a/viz-lib/src/visualizations/box-plot/d3box.js b/viz-lib/src/visualizations/box-plot/d3box.ts
similarity index 78%
rename from viz-lib/src/visualizations/box-plot/d3box.js
rename to viz-lib/src/visualizations/box-plot/d3box.ts
index 41a27b9ea..c5f9eae5d 100644
--- a/viz-lib/src/visualizations/box-plot/d3box.js
+++ b/viz-lib/src/visualizations/box-plot/d3box.ts
@@ -4,16 +4,17 @@ function box() {
let width = 1,
height = 1,
duration = 0,
- domain = null,
+ domain: any = null,
value = Number,
whiskers = boxWhiskers,
quartiles = boxQuartiles,
- tickFormat = null;
+ tickFormat: any = null;
// For each small multiple…
- function box(g) {
- g.each(function(d, i) {
+ function box(g: any) {
+ g.each(function(d: any, i: any) {
d = d.map(value).sort(d3.ascending);
+ // @ts-expect-error ts-migrate(2683) FIXME: 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
let g = d3.select(this),
n = d.length,
min = d[0],
@@ -23,6 +24,7 @@ function box() {
const quartileData = (d.quartiles = quartiles(d));
// Compute whiskers. Must return exactly 2 elements, or null.
+ // @ts-expect-error ts-migrate(2683) FIXME: 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
let whiskerIndices = whiskers && whiskers.call(this, d, i),
whiskerData = whiskerIndices && whiskerIndices.map(i => d[i]);
@@ -33,20 +35,25 @@ function box() {
: d3.range(n);
// Compute the new x-scale.
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const x1 = d3.scale
.linear()
+ // @ts-expect-error ts-migrate(2683) FIXME: 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
.domain((domain && domain.call(this, d, i)) || [min, max])
.range([height, 0]);
// Retrieve the old x-scale, if this is an update.
const x0 =
+ // @ts-expect-error ts-migrate(2683) FIXME: 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
this.__chart__ ||
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
d3.scale
.linear()
.domain([0, Infinity])
.range(x1.range());
// Stash the new scale.
+ // @ts-expect-error ts-migrate(2683) FIXME: 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
this.__chart__ = x1;
// Note: the box, median, and box tick elements are fixed in number,
@@ -84,7 +91,9 @@ function box() {
.transition()
.duration(duration)
.style("opacity", 1e-6)
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.attr("y1", d => x1(d[0]))
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.attr("y2", d => x1(d[1]))
.remove();
@@ -196,6 +205,7 @@ function box() {
.exit()
.transition()
.duration(duration)
+ // @ts-expect-error ts-migrate(2538) FIXME: Type 'unknown' cannot be used as an index type.
.attr("cy", i => x1(d[i]))
.style("opacity", 1e-6)
.remove();
@@ -263,52 +273,54 @@ function box() {
.style("opacity", 1e-6)
.remove();
});
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'flush' does not exist on type '(callback... Remove this comment to see the full error message
d3.timer.flush();
}
- box.width = function(x) {
+ box.width = function(x: any) {
if (!arguments.length) return width;
width = x;
return box;
};
- box.height = function(x) {
+ box.height = function(x: any) {
if (!arguments.length) return height;
height = x;
return box;
};
- box.tickFormat = function(x) {
+ box.tickFormat = function(x: any) {
if (!arguments.length) return tickFormat;
tickFormat = x;
return box;
};
- box.duration = function(x) {
+ box.duration = function(x: any) {
if (!arguments.length) return duration;
duration = x;
return box;
};
- box.domain = function(x) {
+ box.domain = function(x: any) {
if (!arguments.length) return domain;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'functor' does not exist on type 'typeof ... Remove this comment to see the full error message
domain = x == null ? x : d3.functor(x);
return box;
};
- box.value = function(x) {
+ box.value = function(x: any) {
if (!arguments.length) return value;
value = x;
return box;
};
- box.whiskers = function(x) {
+ box.whiskers = function(x: any) {
if (!arguments.length) return whiskers;
whiskers = x;
return box;
};
- box.quartiles = function(x) {
+ box.quartiles = function(x: any) {
if (!arguments.length) return quartiles;
quartiles = x;
return box;
@@ -317,11 +329,11 @@ function box() {
return box;
}
-function boxWhiskers(d) {
+function boxWhiskers(d: any) {
return [0, d.length - 1];
}
-function boxQuartiles(d) {
+function boxQuartiles(d: any) {
return [d3.quantile(d, 0.25), d3.quantile(d, 0.5), d3.quantile(d, 0.75)];
}
diff --git a/viz-lib/src/visualizations/box-plot/index.js b/viz-lib/src/visualizations/box-plot/index.ts
similarity index 79%
rename from viz-lib/src/visualizations/box-plot/index.js
rename to viz-lib/src/visualizations/box-plot/index.ts
index d65e24f08..de82aa5ef 100644
--- a/viz-lib/src/visualizations/box-plot/index.js
+++ b/viz-lib/src/visualizations/box-plot/index.ts
@@ -5,7 +5,9 @@ export default {
type: "BOXPLOT",
name: "Boxplot (Deprecated)",
isDeprecated: true,
- getOptions: options => ({ ...options }),
+ getOptions: (options: any) => ({
+ ...options
+ }),
Renderer,
Editor,
diff --git a/viz-lib/src/visualizations/chart/Editor/AxisSettings.jsx b/viz-lib/src/visualizations/chart/Editor/AxisSettings.jsx
deleted file mode 100644
index 6f018a8e5..000000000
--- a/viz-lib/src/visualizations/chart/Editor/AxisSettings.jsx
+++ /dev/null
@@ -1,110 +0,0 @@
-import { isString, isObject, isFinite, isNumber, merge } from "lodash";
-import React from "react";
-import PropTypes from "prop-types";
-import { useDebouncedCallback } from "use-debounce";
-import * as Grid from "antd/lib/grid";
-import { Section, Select, Input, InputNumber } from "@/components/visualizations/editor";
-
-function toNumber(value) {
- value = isNumber(value) ? value : parseFloat(value);
- return isFinite(value) ? value : null;
-}
-
-export default function AxisSettings({ id, options, features, onChange }) {
- function optionsChanged(newOptions) {
- onChange(merge({}, options, newOptions));
- }
-
- const [handleNameChange] = useDebouncedCallback(text => {
- const title = isString(text) && text !== "" ? { text } : null;
- optionsChanged({ title });
- }, 200);
-
- const [handleMinMaxChange] = useDebouncedCallback(opts => optionsChanged(opts), 200);
-
- return (
-
-
- optionsChanged({ type })}>
- {features.autoDetectType && (
-
- Auto Detect
-
- )}
-
- Datetime
-
-
- Linear
-
-
- Logarithmic
-
-
- Category
-
-
-
-
-
-
- {features.range && (
-
-
-
- handleMinMaxChange({ rangeMin: toNumber(value) })}
- />
-
-
- handleMinMaxChange({ rangeMax: toNumber(value) })}
- />
-
-
-
- )}
-
- );
-}
-
-AxisSettings.propTypes = {
- id: PropTypes.string.isRequired,
- options: PropTypes.shape({
- type: PropTypes.string.isRequired,
- title: PropTypes.shape({
- text: PropTypes.string,
- }),
- rangeMin: PropTypes.number,
- rangeMax: PropTypes.number,
- }).isRequired,
- features: PropTypes.shape({
- autoDetectType: PropTypes.bool,
- range: PropTypes.bool,
- }),
- onChange: PropTypes.func,
-};
-
-AxisSettings.defaultProps = {
- features: {},
- onChange: () => {},
-};
diff --git a/viz-lib/src/visualizations/chart/Editor/AxisSettings.tsx b/viz-lib/src/visualizations/chart/Editor/AxisSettings.tsx
new file mode 100644
index 000000000..9b5734f0a
--- /dev/null
+++ b/viz-lib/src/visualizations/chart/Editor/AxisSettings.tsx
@@ -0,0 +1,125 @@
+import { isString, isObject, isFinite, isNumber, merge } from "lodash";
+import React from "react";
+import { useDebouncedCallback } from "use-debounce";
+import * as Grid from "antd/lib/grid";
+import { Section, Select, Input, InputNumber } from "@/components/visualizations/editor";
+
+function toNumber(value: any) {
+ value = isNumber(value) ? value : parseFloat(value);
+ return isFinite(value) ? value : null;
+}
+
+type OwnProps = {
+ id: string;
+ options: {
+ type: string;
+ title?: {
+ text?: string;
+ };
+ rangeMin?: number;
+ rangeMax?: number;
+ };
+ features?: {
+ autoDetectType?: boolean;
+ range?: boolean;
+ };
+ onChange?: (...args: any[]) => any;
+};
+
+type Props = OwnProps & typeof AxisSettings.defaultProps;
+
+export default function AxisSettings({ id, options, features, onChange }: Props) {
+ function optionsChanged(newOptions: any) {
+ onChange(merge({}, options, newOptions));
+ }
+
+ const [handleNameChange] = useDebouncedCallback(text => {
+ const title = isString(text) && text !== "" ? { text } : null;
+ optionsChanged({ title });
+ }, 200);
+
+ const [handleMinMaxChange] = useDebouncedCallback(opts => optionsChanged(opts), 200);
+
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ optionsChanged({ type })}>
+ {features.autoDetectType && (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ Auto Detect
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ )}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ Datetime
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ Linear
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ Logarithmic
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ Category
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {features.range && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
+
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type '{ children: Element[]; gutter: number; type:... Remove this comment to see the full error message */}
+
+
+ handleMinMaxChange({ rangeMin: toNumber(value) })}
+ />
+
+
+ handleMinMaxChange({ rangeMax: toNumber(value) })}
+ />
+
+
+
+ )}
+
+ );
+}
+
+AxisSettings.defaultProps = {
+ features: {},
+ onChange: () => {},
+};
diff --git a/viz-lib/src/visualizations/chart/Editor/ChartTypeSelect.jsx b/viz-lib/src/visualizations/chart/Editor/ChartTypeSelect.tsx
similarity index 75%
rename from viz-lib/src/visualizations/chart/Editor/ChartTypeSelect.jsx
rename to viz-lib/src/visualizations/chart/Editor/ChartTypeSelect.tsx
index dbc978d00..04d4d6578 100644
--- a/viz-lib/src/visualizations/chart/Editor/ChartTypeSelect.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/ChartTypeSelect.tsx
@@ -1,6 +1,5 @@
import { filter, includes, map } from "lodash";
import React, { useMemo } from "react";
-import PropTypes from "prop-types";
import { Select } from "@/components/visualizations/editor";
import { visualizationsSettings } from "@/visualizations/visualizationsSettings";
@@ -15,7 +14,13 @@ const allChartTypes = [
{ type: "box", name: "Box", icon: "square-o" },
];
-export default function ChartTypeSelect({ hiddenChartTypes, ...props }) {
+type OwnProps = {
+ hiddenChartTypes?: any[]; // TODO: PropTypes.oneOf(map(allChartTypes, "type"))
+};
+
+type Props = OwnProps & typeof ChartTypeSelect.defaultProps;
+
+export default function ChartTypeSelect({ hiddenChartTypes, ...props }: Props) {
const chartTypes = useMemo(() => {
const result = [...allChartTypes];
@@ -33,19 +38,17 @@ export default function ChartTypeSelect({ hiddenChartTypes, ...props }) {
return (
{map(chartTypes, ({ type, name, icon }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
);
}
-ChartTypeSelect.propTypes = {
- hiddenChartTypes: PropTypes.arrayOf(PropTypes.oneOf(map(allChartTypes, "type"))),
-};
-
ChartTypeSelect.defaultProps = {
hiddenChartTypes: [],
};
diff --git a/viz-lib/src/visualizations/chart/Editor/ColorsSettings.test.js b/viz-lib/src/visualizations/chart/Editor/ColorsSettings.test.tsx
similarity index 95%
rename from viz-lib/src/visualizations/chart/Editor/ColorsSettings.test.js
rename to viz-lib/src/visualizations/chart/Editor/ColorsSettings.test.tsx
index 499aba83e..393ae1bf3 100644
--- a/viz-lib/src/visualizations/chart/Editor/ColorsSettings.test.js
+++ b/viz-lib/src/visualizations/chart/Editor/ColorsSettings.test.tsx
@@ -5,11 +5,11 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import ColorsSettings from "./ColorsSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(options, done) {
+function mount(options: any, done: any) {
options = getOptions(options);
return enzyme.mount(
{
+ onOptionsChange={(changedOptions: any) => {
expect(changedOptions).toMatchSnapshot();
done();
}}
diff --git a/viz-lib/src/visualizations/chart/Editor/ColorsSettings.jsx b/viz-lib/src/visualizations/chart/Editor/ColorsSettings.tsx
similarity index 70%
rename from viz-lib/src/visualizations/chart/Editor/ColorsSettings.jsx
rename to viz-lib/src/visualizations/chart/Editor/ColorsSettings.tsx
index 0a1d3e36c..543093da2 100644
--- a/viz-lib/src/visualizations/chart/Editor/ColorsSettings.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/ColorsSettings.tsx
@@ -10,7 +10,11 @@ const components = {
heatmap: HeatmapColorsSettings,
};
-export default function ColorsSettings({ options, ...props }) {
+export default function ColorsSettings({
+ options,
+ ...props
+}: any) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const Component = components[options.globalSeriesType] || DefaultColorsSettings;
return ;
}
diff --git a/viz-lib/src/visualizations/chart/Editor/ColumnMappingSelect.jsx b/viz-lib/src/visualizations/chart/Editor/ColumnMappingSelect.tsx
similarity index 62%
rename from viz-lib/src/visualizations/chart/Editor/ColumnMappingSelect.jsx
rename to viz-lib/src/visualizations/chart/Editor/ColumnMappingSelect.tsx
index b455848c5..e07f77d1f 100644
--- a/viz-lib/src/visualizations/chart/Editor/ColumnMappingSelect.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/ColumnMappingSelect.tsx
@@ -1,6 +1,5 @@
import { isString, map, uniq, flatten, filter, sortBy, keys } from "lodash";
import React from "react";
-import PropTypes from "prop-types";
import { Section, Select } from "@/components/visualizations/editor";
const MappingTypes = {
@@ -18,13 +17,23 @@ const SwappedMappingTypes = {
y: { label: "X Columns", multiple: true },
};
-export default function ColumnMappingSelect({ value, availableColumns, type, onChange, areAxesSwapped }) {
+type OwnProps = {
+ value?: string | string[];
+ availableColumns?: string[];
+ type?: any; // TODO: PropTypes.oneOf(keys(MappingTypes))
+ onChange?: (...args: any[]) => any;
+};
+
+type Props = OwnProps & typeof ColumnMappingSelect.defaultProps;
+
+export default function ColumnMappingSelect({ value, availableColumns, type, onChange, areAxesSwapped }: Props) {
const options = sortBy(filter(uniq(flatten([availableColumns, value])), v => isString(v) && v !== ""));
// this swaps the ui, as the data will be swapped on render
const { label, multiple } = !areAxesSwapped ? MappingTypes[type] : SwappedMappingTypes[type];
return (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onChange(column || null, type)}>
+ // @ts-expect-error ts-migrate(2349) FIXME: This expression is not callable.
+ onChange={(column: any) => onChange(column || null, type)}>
{map(options, c => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{c}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
@@ -45,13 +57,6 @@ export default function ColumnMappingSelect({ value, availableColumns, type, onC
);
}
-ColumnMappingSelect.propTypes = {
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
- availableColumns: PropTypes.arrayOf(PropTypes.string),
- type: PropTypes.oneOf(keys(MappingTypes)),
- onChange: PropTypes.func,
-};
-
ColumnMappingSelect.defaultProps = {
value: null,
availableColumns: [],
diff --git a/viz-lib/src/visualizations/chart/Editor/CustomChartSettings.jsx b/viz-lib/src/visualizations/chart/Editor/CustomChartSettings.jsx
deleted file mode 100644
index 522c6f103..000000000
--- a/viz-lib/src/visualizations/chart/Editor/CustomChartSettings.jsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { isNil, trimStart } from "lodash";
-import React from "react";
-import { Section, Switch, TextArea } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-const defaultCustomCode = trimStart(`
-// Available variables are x, ys, element, and Plotly
-// Type console.log(x, ys); for more info about x and ys
-// To plot your graph call Plotly.plot(element, ...)
-// Plotly examples and docs: https://plot.ly/javascript/
-`);
-
-export default function CustomChartSettings({ options, onOptionsChange }) {
- return (
-
-
-
-
- onOptionsChange({ enableConsoleLogs })}>
- Show errors in the console
-
-
-
-
- onOptionsChange({ autoRedraw })}>
- Auto update graph
-
-
-
- );
-}
-
-CustomChartSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/chart/Editor/CustomChartSettings.tsx b/viz-lib/src/visualizations/chart/Editor/CustomChartSettings.tsx
new file mode 100644
index 000000000..4b627c98a
--- /dev/null
+++ b/viz-lib/src/visualizations/chart/Editor/CustomChartSettings.tsx
@@ -0,0 +1,63 @@
+import { isNil, trimStart } from "lodash";
+import React from "react";
+import { Section, Switch, TextArea } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+const defaultCustomCode = trimStart(`
+// Available variables are x, ys, element, and Plotly
+// Type console.log(x, ys); for more info about x and ys
+// To plot your graph call Plotly.plot(element, ...)
+// Plotly examples and docs: https://plot.ly/javascript/
+`);
+
+export default function CustomChartSettings({
+ options,
+ onOptionsChange
+}: any) {
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assi... Remove this comment to see the full error message
+ onChange={(enableConsoleLogs: any) => onOptionsChange({ enableConsoleLogs })}>
+ Show errors in the console
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assignable ... Remove this comment to see the full error message
+ onChange={(autoRedraw: any) => onOptionsChange({ autoRedraw })}>
+ Auto update graph
+
+
+
+ );
+}
+
+CustomChartSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/chart/Editor/DataLabelsSettings.test.js b/viz-lib/src/visualizations/chart/Editor/DataLabelsSettings.test.tsx
similarity index 95%
rename from viz-lib/src/visualizations/chart/Editor/DataLabelsSettings.test.js
rename to viz-lib/src/visualizations/chart/Editor/DataLabelsSettings.test.tsx
index 1275e7572..bd2aed470 100644
--- a/viz-lib/src/visualizations/chart/Editor/DataLabelsSettings.test.js
+++ b/viz-lib/src/visualizations/chart/Editor/DataLabelsSettings.test.tsx
@@ -4,11 +4,11 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import DataLabelsSettings from "./DataLabelsSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(options, done) {
+function mount(options: any, done: any) {
options = getOptions(options);
return enzyme.mount(
{isShowDataLabelsAvailable && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
)}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
Data Labels
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
Use special names to access additional properties:
@@ -104,7 +113,7 @@ export default function DataLabelsSettings({ options, onOptionsChange }) {
data-test="Chart.DataLabels.TextFormat"
placeholder="(auto)"
defaultValue={options.textFormat}
- onChange={e => debouncedOnOptionsChange({ textFormat: e.target.value })}
+ onChange={(e: any) => debouncedOnOptionsChange({ textFormat: e.target.value })}
/>
diff --git a/viz-lib/src/visualizations/chart/Editor/DefaultColorsSettings.jsx b/viz-lib/src/visualizations/chart/Editor/DefaultColorsSettings.tsx
similarity index 55%
rename from viz-lib/src/visualizations/chart/Editor/DefaultColorsSettings.jsx
rename to viz-lib/src/visualizations/chart/Editor/DefaultColorsSettings.tsx
index dde5b6005..3a0cf0e84 100644
--- a/viz-lib/src/visualizations/chart/Editor/DefaultColorsSettings.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/DefaultColorsSettings.tsx
@@ -6,7 +6,11 @@ import { EditorPropTypes } from "@/visualizations/prop-types";
import ColorPalette from "@/visualizations/ColorPalette";
import getChartData from "../getChartData";
-export default function DefaultColorsSettings({ options, data, onOptionsChange }) {
+export default function DefaultColorsSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
const colors = useMemo(
() => ({
Automatic: null,
@@ -46,20 +50,28 @@ export default function DefaultColorsSettings({ options, data, onOptionsChange }
title: "Color",
dataIndex: "color",
width: "1%",
- render: (unused, item) => (
+ render: (unused: any, item: any) => (
updateSeriesOption(item.key, "color", value)}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '(value: any) => void' is not assignable to t... Remove this comment to see the full error message
+ onChange={(value: any) => updateSeriesOption(item.key, "color", value)}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'never'.
addonAfter={ }
/>
),
},
];
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'boolean[]' is not assignable to type 'object... Remove this comment to see the full error message
return ;
}
diff --git a/viz-lib/src/visualizations/chart/Editor/GeneralSettings.test.js b/viz-lib/src/visualizations/chart/Editor/GeneralSettings.test.tsx
similarity index 92%
rename from viz-lib/src/visualizations/chart/Editor/GeneralSettings.test.js
rename to viz-lib/src/visualizations/chart/Editor/GeneralSettings.test.tsx
index ebf74ae59..3563f7ab0 100644
--- a/viz-lib/src/visualizations/chart/Editor/GeneralSettings.test.js
+++ b/viz-lib/src/visualizations/chart/Editor/GeneralSettings.test.tsx
@@ -4,15 +4,15 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import GeneralSettings from "./GeneralSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function elementExists(wrapper, testId) {
+function elementExists(wrapper: any, testId: any) {
return findByTestID(wrapper, testId).length > 0;
}
-function mount(options, done) {
+function mount(options: any, done: any) {
options = getOptions(options);
return enzyme.mount(
Chart -> Editor -> General Settings", () => {
describe("Column mappings should be available", () => {
test("for bubble", () => {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
const el = mount({
globalSeriesType: "column",
seriesOptions: {
@@ -164,6 +165,7 @@ describe("Visualizations -> Chart -> Editor -> General Settings", () => {
});
test("for heatmap", () => {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
const el = mount({
globalSeriesType: "heatmap",
seriesOptions: {
@@ -179,6 +181,7 @@ describe("Visualizations -> Chart -> Editor -> General Settings", () => {
});
test("for all types except of bubble, heatmap and custom", () => {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
const el = mount({
globalSeriesType: "column",
seriesOptions: {
diff --git a/viz-lib/src/visualizations/chart/Editor/GeneralSettings.jsx b/viz-lib/src/visualizations/chart/Editor/GeneralSettings.tsx
similarity index 50%
rename from viz-lib/src/visualizations/chart/Editor/GeneralSettings.jsx
rename to viz-lib/src/visualizations/chart/Editor/GeneralSettings.tsx
index d34d8bf0c..c59742a55 100644
--- a/viz-lib/src/visualizations/chart/Editor/GeneralSettings.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/GeneralSettings.tsx
@@ -7,7 +7,7 @@ import { EditorPropTypes } from "@/visualizations/prop-types";
import ChartTypeSelect from "./ChartTypeSelect";
import ColumnMappingSelect from "./ColumnMappingSelect";
-function getAvailableColumnMappingTypes(options) {
+function getAvailableColumnMappingTypes(options: any) {
const result = ["x", "y"];
if (!includes(["custom", "heatmap"], options.globalSeriesType)) {
@@ -29,22 +29,26 @@ function getAvailableColumnMappingTypes(options) {
return result;
}
-function getMappedColumns(options, availableColumns) {
+function getMappedColumns(options: any, availableColumns: any) {
const mappedColumns = {};
const availableTypes = getAvailableColumnMappingTypes(options);
each(availableTypes, type => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
mappedColumns[type] = ColumnMappingSelect.MappingTypes[type].multiple ? [] : null;
});
availableColumns = map(availableColumns, c => c.name);
- const usedColumns = [];
+ const usedColumns: any = [];
each(options.columnMapping, (type, column) => {
if (includes(availableColumns, column) && includes(availableTypes, type)) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const { multiple } = ColumnMappingSelect.MappingTypes[type];
if (multiple) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
mappedColumns[type].push(column);
} else {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
mappedColumns[type] = column;
}
usedColumns.push(column);
@@ -57,15 +61,17 @@ function getMappedColumns(options, availableColumns) {
};
}
-function mappedColumnsToColumnMappings(mappedColumns) {
+function mappedColumnsToColumnMappings(mappedColumns: any) {
const result = {};
each(mappedColumns, (value, type) => {
if (isArray(value)) {
each(value, v => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[v] = type;
});
} else {
if (value) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[value] = type;
}
}
@@ -73,13 +79,17 @@ function mappedColumnsToColumnMappings(mappedColumns) {
return result;
}
-export default function GeneralSettings({ options, data, onOptionsChange }) {
+export default function GeneralSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
const { mappedColumns, unusedColumns } = useMemo(() => getMappedColumns(options, data.columns), [
options,
data.columns,
]);
- function handleGlobalSeriesTypeChange(globalSeriesType) {
+ function handleGlobalSeriesTypeChange(globalSeriesType: any) {
onOptionsChange({
globalSeriesType,
showDataLabels: globalSeriesType === "pie",
@@ -91,7 +101,7 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
});
}
- function handleColumnMappingChange(column, type) {
+ function handleColumnMappingChange(column: any, type: any) {
const columnMapping = mappedColumnsToColumnMappings({
...mappedColumns,
[type]: column,
@@ -99,7 +109,7 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
onOptionsChange({ columnMapping }, UpdateOptionsStrategy.shallowMerge);
}
- function handleLegendPlacementChange(value) {
+ function handleLegendPlacementChange(value: any) {
if (value === "hidden") {
onOptionsChange({ legend: { enabled: false } });
} else {
@@ -118,8 +128,10 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
{includes(["column", "line", "box"], options.globalSeriesType) && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
(
void' is not ass... Remove this comment to see the full error message
onChange={handleColumnMappingChange}
/>
))}
{includes(["bubble"], options.globalSeriesType) && (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ coefficient: toNumber(value) })}
+ onChange={(value: any) => onOptionsChange({ coefficient: toNumber(value) })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ sizemode: mode })}>
+ onChange={(mode: any) => onOptionsChange({ sizemode: mode })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Area
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Diameter
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
@@ -179,17 +203,22 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
)}
{includes(["pie"], options.globalSeriesType) && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ direction: { type } })}>
+ onChange={(type: any) => onOptionsChange({ direction: { type } })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Counterclockwise
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Clockwise
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
@@ -197,36 +226,48 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
{!includes(["custom", "heatmap"], options.globalSeriesType) && (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Hide legend
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Right
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Bottom
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
{options.legend.enabled && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ legend: { traceorder } })}>
+ onChange={(traceorder: any) => onOptionsChange({ legend: { traceorder } })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Normal
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Reversed
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
@@ -235,6 +276,7 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
)}
{includes(["box"], options.globalSeriesType) && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ series: { stacking } })}>
+ onChange={(stacking: any) => onOptionsChange({ series: { stacking } })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Disabled
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Stack
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
)}
{includes(["line", "area", "column"], options.globalSeriesType) && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ missingValuesAsZero: !!value })}>
+ onChange={(value: any) => onOptionsChange({ missingValuesAsZero: !!value })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Do not display in chart
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Convert to 0 and display in chart
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
diff --git a/viz-lib/src/visualizations/chart/Editor/HeatmapColorsSettings.jsx b/viz-lib/src/visualizations/chart/Editor/HeatmapColorsSettings.tsx
similarity index 59%
rename from viz-lib/src/visualizations/chart/Editor/HeatmapColorsSettings.jsx
rename to viz-lib/src/visualizations/chart/Editor/HeatmapColorsSettings.tsx
index 1e60ba10b..10b4cbdc2 100644
--- a/viz-lib/src/visualizations/chart/Editor/HeatmapColorsSettings.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/HeatmapColorsSettings.tsx
@@ -25,9 +25,13 @@ const ColorSchemes = [
"Custom...",
];
-export default function HeatmapColorsSettings({ options, onOptionsChange }) {
+export default function HeatmapColorsSettings({
+ options,
+ onOptionsChange
+}: any) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colorScheme: value || null })}>
+ onChange={(value: any) => onOptionsChange({ colorScheme: value || null })}>
{map(ColorSchemes, scheme => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{scheme}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
@@ -46,6 +52,7 @@ export default function HeatmapColorsSettings({ options, onOptionsChange }) {
{options.colorScheme === "Custom..." && (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ heatMinColor })}
+ onChange={(heatMinColor: any) => onOptionsChange({ heatMinColor })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ heatMaxColor })}
+ onChange={(heatMaxColor: any) => onOptionsChange({ heatMaxColor })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
diff --git a/viz-lib/src/visualizations/chart/Editor/PieColorsSettings.jsx b/viz-lib/src/visualizations/chart/Editor/PieColorsSettings.tsx
similarity index 58%
rename from viz-lib/src/visualizations/chart/Editor/PieColorsSettings.jsx
rename to viz-lib/src/visualizations/chart/Editor/PieColorsSettings.tsx
index 7a1594ee4..e8636a284 100644
--- a/viz-lib/src/visualizations/chart/Editor/PieColorsSettings.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/PieColorsSettings.tsx
@@ -6,7 +6,7 @@ import { EditorPropTypes } from "@/visualizations/prop-types";
import ColorPalette from "@/visualizations/ColorPalette";
import getChartData from "../getChartData";
-function getUniqueValues(chartData) {
+function getUniqueValues(chartData: any) {
const uniqueValuesNames = new Set();
each(chartData, series => {
each(series.data, row => {
@@ -16,7 +16,11 @@ function getUniqueValues(chartData) {
return [...uniqueValuesNames];
}
-export default function PieColorsSettings({ options, data, onOptionsChange }) {
+export default function PieColorsSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
const colors = useMemo(
() => ({
Automatic: null,
@@ -29,6 +33,7 @@ export default function PieColorsSettings({ options, data, onOptionsChange }) {
() =>
map(getUniqueValues(getChartData(data.rows, options)), value => ({
key: value,
+ // @ts-expect-error ts-migrate(2538) FIXME: Type 'unknown' cannot be used as an index type.
color: (options.valuesOptions[value] || {}).color || null,
})),
[options, data]
@@ -56,14 +61,21 @@ export default function PieColorsSettings({ options, data, onOptionsChange }) {
title: "Color",
dataIndex: "color",
width: "1%",
- render: (unused, item) => (
+ render: (unused: any, item: any) => (
updateValuesOption(item.key, "color", value)}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '(value: any) => void' is not assignable to t... Remove this comment to see the full error message
+ onChange={(value: any) => updateValuesOption(item.key, "color", value)}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'never'.
addonAfter={ }
/>
),
diff --git a/viz-lib/src/visualizations/chart/Editor/SeriesSettings.test.js b/viz-lib/src/visualizations/chart/Editor/SeriesSettings.test.tsx
similarity index 95%
rename from viz-lib/src/visualizations/chart/Editor/SeriesSettings.test.js
rename to viz-lib/src/visualizations/chart/Editor/SeriesSettings.test.tsx
index e615b8263..8ef7623f5 100644
--- a/viz-lib/src/visualizations/chart/Editor/SeriesSettings.test.js
+++ b/viz-lib/src/visualizations/chart/Editor/SeriesSettings.test.tsx
@@ -4,11 +4,11 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import SeriesSettings from "./SeriesSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(options, done) {
+function mount(options: any, done: any) {
options = getOptions(options);
return enzyme.mount(
);
+const SortableBodyRow = sortableElement((props: any) => );
-function getTableColumns(options, updateSeriesOption, debouncedUpdateSeriesOption) {
+function getTableColumns(options: any, updateSeriesOption: any, debouncedUpdateSeriesOption: any) {
const result = [
{
title: "Order",
dataIndex: "zIndex",
- render: (unused, item) => (
+ render: (unused: any, item: any) => (
{item.zIndex + 1}
@@ -27,7 +28,7 @@ function getTableColumns(options, updateSeriesOption, debouncedUpdateSeriesOptio
{
title: "Label",
dataIndex: "name",
- render: (unused, item) => (
+ render: (unused: any, item: any) => (
updateSeriesOption(item.key, "type", value)}
+ onChange={(value: any) => updateSeriesOption(item.key, "type", value)}
/>
),
});
@@ -77,7 +79,11 @@ function getTableColumns(options, updateSeriesOption, debouncedUpdateSeriesOptio
return result;
}
-export default function SeriesSettings({ options, data, onOptionsChange }) {
+export default function SeriesSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
const series = useMemo(
() =>
map(
@@ -92,6 +98,7 @@ export default function SeriesSettings({ options, data, onOptionsChange }) {
({ oldIndex, newIndex }) => {
const seriesOptions = [...series];
seriesOptions.splice(newIndex, 0, ...seriesOptions.splice(oldIndex, 1));
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'key' does not exist on type 'Boolean'.
onOptionsChange({ seriesOptions: fromPairs(map(seriesOptions, ({ key }, zIndex) => [key, { zIndex }])) });
},
[onOptionsChange, series]
@@ -124,12 +131,14 @@ export default function SeriesSettings({ options, data, onOptionsChange }) {
lockToContainerEdges
useDragHandle
helperClass="chart-editor-series-dragged-item"
- helperContainer={container => container.querySelector("tbody")}
+ helperContainer={(container: any) => container.querySelector("tbody")}
onSortEnd={handleSortEnd}
containerProps={{
className: "chart-editor-series",
}}>
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
{ index: any; }' is not as... Remove this comment to see the full error message
onRow={item => ({ index: item.zIndex })}
pagination={false}
/>
diff --git a/viz-lib/src/visualizations/chart/Editor/XAxisSettings.jsx b/viz-lib/src/visualizations/chart/Editor/XAxisSettings.jsx
deleted file mode 100644
index 8c8d6639f..000000000
--- a/viz-lib/src/visualizations/chart/Editor/XAxisSettings.jsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import React from "react";
-import { Section, Switch } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-import AxisSettings from "./AxisSettings";
-
-export default function XAxisSettings({ options, onOptionsChange }) {
- return (
-
- onOptionsChange({ xAxis })}
- />
-
-
- onOptionsChange({ sortX })}>
- Sort Values
-
-
-
-
- onOptionsChange({ reverseX })}>
- Reverse Order
-
-
-
-
- onOptionsChange({ xAxis: { labels: { enabled } } })}>
- Show Labels
-
-
-
- );
-}
-
-XAxisSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/chart/Editor/XAxisSettings.test.js b/viz-lib/src/visualizations/chart/Editor/XAxisSettings.test.tsx
similarity index 95%
rename from viz-lib/src/visualizations/chart/Editor/XAxisSettings.test.js
rename to viz-lib/src/visualizations/chart/Editor/XAxisSettings.test.tsx
index a695125d1..5f310dc38 100644
--- a/viz-lib/src/visualizations/chart/Editor/XAxisSettings.test.js
+++ b/viz-lib/src/visualizations/chart/Editor/XAxisSettings.test.tsx
@@ -4,11 +4,11 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import XAxisSettings from "./XAxisSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(options, done) {
+function mount(options: any, done: any) {
options = getOptions(options);
return enzyme.mount(
+ any' is not assignable to ty... Remove this comment to see the full error message
+ onChange={(xAxis: any) => onOptionsChange({ xAxis })}
+ />
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assignable to ty... Remove this comment to see the full error message
+ onChange={(sortX: any) => onOptionsChange({ sortX })}>
+ Sort Values
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assignable to... Remove this comment to see the full error message
+ onChange={(reverseX: any) => onOptionsChange({ reverseX })}>
+ Reverse Order
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assignable to ... Remove this comment to see the full error message
+ onChange={(enabled: any) => onOptionsChange({ xAxis: { labels: { enabled } } })}>
+ Show Labels
+
+
+
+ );
+}
+
+XAxisSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/chart/Editor/YAxisSettings.jsx b/viz-lib/src/visualizations/chart/Editor/YAxisSettings.jsx
deleted file mode 100644
index bb7f14064..000000000
--- a/viz-lib/src/visualizations/chart/Editor/YAxisSettings.jsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import React from "react";
-import { Section, Switch } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-import AxisSettings from "./AxisSettings";
-
-export default function YAxisSettings({ options, onOptionsChange }) {
- const [leftYAxis, rightYAxis] = options.yAxis;
-
- return (
-
- {!options.swappedAxes ? "Left Y Axis" : "X Axis"}
-
-
- onOptionsChange({ yAxis: [axis, rightYAxis] })}
- />
-
-
- {options.globalSeriesType !== "heatmap" && !options.swappedAxes && (
-
- Right Y Axis
-
-
- onOptionsChange({ yAxis: [leftYAxis, axis] })}
- />
-
-
-
- onOptionsChange({ alignYAxesAtZero })}>
- Align Y Axes at Zero
-
-
-
- )}
-
- {options.globalSeriesType === "heatmap" && (
-
-
- onOptionsChange({ sortY })}>
- Sort Values
-
-
-
-
- onOptionsChange({ reverseY })}>
- Reverse Order
-
-
-
- )}
-
- );
-}
-
-YAxisSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/chart/Editor/YAxisSettings.test.js b/viz-lib/src/visualizations/chart/Editor/YAxisSettings.test.tsx
similarity index 91%
rename from viz-lib/src/visualizations/chart/Editor/YAxisSettings.test.js
rename to viz-lib/src/visualizations/chart/Editor/YAxisSettings.test.tsx
index 966e31bdc..f8a40b9c3 100644
--- a/viz-lib/src/visualizations/chart/Editor/YAxisSettings.test.js
+++ b/viz-lib/src/visualizations/chart/Editor/YAxisSettings.test.tsx
@@ -4,15 +4,15 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import YAxisSettings from "./YAxisSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function elementExists(wrapper, testId) {
+function elementExists(wrapper: any, testId: any) {
return findByTestID(wrapper, testId).length > 0;
}
-function mount(options, done) {
+function mount(options: any, done: any) {
options = getOptions(options);
return enzyme.mount(
Chart -> Editor -> Y-Axis Settings", () => {
describe("for non-heatmap", () => {
test("Right Y Axis should be available", () => {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
const el = mount({
globalSeriesType: "column",
yAxis: [{ type: "linear" }, { type: "linear", opposite: true }],
@@ -102,6 +103,7 @@ describe("Visualizations -> Chart -> Editor -> Y-Axis Settings", () => {
describe("for heatmap", () => {
test("Right Y Axis should not be available", () => {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
const el = mount({
globalSeriesType: "heatmap",
yAxis: [{ type: "linear" }, { type: "linear", opposite: true }],
diff --git a/viz-lib/src/visualizations/chart/Editor/YAxisSettings.tsx b/viz-lib/src/visualizations/chart/Editor/YAxisSettings.tsx
new file mode 100644
index 000000000..3196e5daa
--- /dev/null
+++ b/viz-lib/src/visualizations/chart/Editor/YAxisSettings.tsx
@@ -0,0 +1,102 @@
+import React from "react";
+import { Section, Switch } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+import AxisSettings from "./AxisSettings";
+
+export default function YAxisSettings({
+ options,
+ onOptionsChange
+}: any) {
+ const [leftYAxis, rightYAxis] = options.yAxis;
+
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {!options.swappedAxes ? "Left Y Axis" : "X Axis"}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ any' is not assignable to typ... Remove this comment to see the full error message
+ onChange={(axis: any) => onOptionsChange({ yAxis: [axis, rightYAxis] })}
+ />
+
+
+ {options.globalSeriesType !== "heatmap" && !options.swappedAxes && (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ Right Y Axis
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ any' is not assignable to typ... Remove this comment to see the full error message
+ onChange={(axis: any) => onOptionsChange({ yAxis: [leftYAxis, axis] })}
+ />
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assig... Remove this comment to see the full error message
+ onChange={(alignYAxesAtZero: any) => onOptionsChange({ alignYAxesAtZero })}>
+ Align Y Axes at Zero
+
+
+
+ )}
+
+ {options.globalSeriesType === "heatmap" && (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assignable to ty... Remove this comment to see the full error message
+ onChange={(sortY: any) => onOptionsChange({ sortY })}>
+ Sort Values
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assignable to... Remove this comment to see the full error message
+ onChange={(reverseY: any) => onOptionsChange({ reverseY })}>
+ Reverse Order
+
+
+
+ )}
+
+ );
+}
+
+YAxisSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/chart/Editor/__snapshots__/ColorsSettings.test.js.snap b/viz-lib/src/visualizations/chart/Editor/__snapshots__/ColorsSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/chart/Editor/__snapshots__/ColorsSettings.test.js.snap
rename to viz-lib/src/visualizations/chart/Editor/__snapshots__/ColorsSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/chart/Editor/__snapshots__/DataLabelsSettings.test.js.snap b/viz-lib/src/visualizations/chart/Editor/__snapshots__/DataLabelsSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/chart/Editor/__snapshots__/DataLabelsSettings.test.js.snap
rename to viz-lib/src/visualizations/chart/Editor/__snapshots__/DataLabelsSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/chart/Editor/__snapshots__/GeneralSettings.test.js.snap b/viz-lib/src/visualizations/chart/Editor/__snapshots__/GeneralSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/chart/Editor/__snapshots__/GeneralSettings.test.js.snap
rename to viz-lib/src/visualizations/chart/Editor/__snapshots__/GeneralSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/chart/Editor/__snapshots__/SeriesSettings.test.js.snap b/viz-lib/src/visualizations/chart/Editor/__snapshots__/SeriesSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/chart/Editor/__snapshots__/SeriesSettings.test.js.snap
rename to viz-lib/src/visualizations/chart/Editor/__snapshots__/SeriesSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/chart/Editor/__snapshots__/XAxisSettings.test.js.snap b/viz-lib/src/visualizations/chart/Editor/__snapshots__/XAxisSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/chart/Editor/__snapshots__/XAxisSettings.test.js.snap
rename to viz-lib/src/visualizations/chart/Editor/__snapshots__/XAxisSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/chart/Editor/__snapshots__/YAxisSettings.test.js.snap b/viz-lib/src/visualizations/chart/Editor/__snapshots__/YAxisSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/chart/Editor/__snapshots__/YAxisSettings.test.js.snap
rename to viz-lib/src/visualizations/chart/Editor/__snapshots__/YAxisSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/chart/Editor/index.test.js b/viz-lib/src/visualizations/chart/Editor/index.test.tsx
similarity index 93%
rename from viz-lib/src/visualizations/chart/Editor/index.test.js
rename to viz-lib/src/visualizations/chart/Editor/index.test.tsx
index 0ce231307..8f1cb1fd9 100644
--- a/viz-lib/src/visualizations/chart/Editor/index.test.js
+++ b/viz-lib/src/visualizations/chart/Editor/index.test.tsx
@@ -4,15 +4,15 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import Editor from "./index";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function elementExists(wrapper, testId) {
+function elementExists(wrapper: any, testId: any) {
return findByTestID(wrapper, testId).length > 0;
}
-function mount(options, data) {
+function mount(options: any, data: any) {
options = getOptions(options);
return enzyme.mount( {}} />);
}
diff --git a/viz-lib/src/visualizations/chart/Editor/index.jsx b/viz-lib/src/visualizations/chart/Editor/index.tsx
similarity index 53%
rename from viz-lib/src/visualizations/chart/Editor/index.jsx
rename to viz-lib/src/visualizations/chart/Editor/index.tsx
index fdb3d7691..02200b843 100644
--- a/viz-lib/src/visualizations/chart/Editor/index.jsx
+++ b/viz-lib/src/visualizations/chart/Editor/index.tsx
@@ -12,48 +12,50 @@ import CustomChartSettings from "./CustomChartSettings";
import "./editor.less";
-const isCustomChart = options => options.globalSeriesType === "custom";
-const isPieChart = options => options.globalSeriesType === "pie";
+const isCustomChart = (options: any) => options.globalSeriesType === "custom";
+const isPieChart = (options: any) => options.globalSeriesType === "pie";
export default createTabbedEditor([
{
key: "General",
title: "General",
- component: props => (
-
-
- {isCustomChart(props.options) && }
-
- ),
+ component: (props: any) =>
+
+ {isCustomChart(props.options) && }
+ ,
},
{
key: "XAxis",
- title: ({ swappedAxes }) => (!swappedAxes ? "X Axis" : "Y Axis"),
+ title: ({
+ swappedAxes
+ }: any) => (!swappedAxes ? "X Axis" : "Y Axis"),
component: XAxisSettings,
- isAvailable: options => !isCustomChart(options) && !isPieChart(options),
+ isAvailable: (options: any) => !isCustomChart(options) && !isPieChart(options),
},
{
key: "YAxis",
- title: ({ swappedAxes }) => (!swappedAxes ? "Y Axis" : "X Axis"),
+ title: ({
+ swappedAxes
+ }: any) => (!swappedAxes ? "Y Axis" : "X Axis"),
component: YAxisSettings,
- isAvailable: options => !isCustomChart(options) && !isPieChart(options),
+ isAvailable: (options: any) => !isCustomChart(options) && !isPieChart(options),
},
{
key: "Series",
title: "Series",
component: SeriesSettings,
- isAvailable: options => !isCustomChart(options),
+ isAvailable: (options: any) => !isCustomChart(options),
},
{
key: "Colors",
title: "Colors",
component: ColorsSettings,
- isAvailable: options => !isCustomChart(options),
+ isAvailable: (options: any) => !isCustomChart(options),
},
{
key: "DataLabels",
title: "Data Labels",
component: DataLabelsSettings,
- isAvailable: options => !isCustomChart(options),
+ isAvailable: (options: any) => !isCustomChart(options),
},
]);
diff --git a/viz-lib/src/visualizations/chart/Renderer/CustomPlotlyChart.jsx b/viz-lib/src/visualizations/chart/Renderer/CustomPlotlyChart.tsx
similarity index 71%
rename from viz-lib/src/visualizations/chart/Renderer/CustomPlotlyChart.jsx
rename to viz-lib/src/visualizations/chart/Renderer/CustomPlotlyChart.tsx
index 78d4dc3fd..3b0e7e85f 100644
--- a/viz-lib/src/visualizations/chart/Renderer/CustomPlotlyChart.jsx
+++ b/viz-lib/src/visualizations/chart/Renderer/CustomPlotlyChart.tsx
@@ -6,7 +6,10 @@ import resizeObserver from "@/services/resizeObserver";
import getChartData from "../getChartData";
import { Plotly, prepareCustomChartData, createCustomChartRenderer } from "../plotly";
-export default function CustomPlotlyChart({ options, data }) {
+export default function CustomPlotlyChart({
+ options,
+ data
+}: any) {
const [container, setContainer] = useState(null);
const renderCustomChart = useMemo(() => createCustomChartRenderer(options.customCode, options.enableConsoleLogs), [
@@ -20,6 +23,7 @@ export default function CustomPlotlyChart({ options, data }) {
if (container) {
const unwatch = resizeObserver(container, () => {
// Clear existing data with blank data for succeeding codeCall adds data to existing plot.
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
Plotly.purge(container);
renderCustomChart(plotlyData.x, plotlyData.ys, container, Plotly);
});
@@ -30,10 +34,12 @@ export default function CustomPlotlyChart({ options, data }) {
// Cleanup when component destroyed
useEffect(() => {
if (container) {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
return () => Plotly.purge(container);
}
}, [container]);
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch>' is not assig... Remove this comment to see the full error message
return
;
}
diff --git a/viz-lib/src/visualizations/chart/Renderer/PlotlyChart.d.ts b/viz-lib/src/visualizations/chart/Renderer/PlotlyChart.d.ts
deleted file mode 100644
index 5fb2f01b1..000000000
--- a/viz-lib/src/visualizations/chart/Renderer/PlotlyChart.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import React from "react";
-export interface PlotlyChartProps {
- data: {
- rows: any[];
- columns: any[];
- }
- options: object;
-}
-declare const PlotlyChart: React.FC;
-export default PlotlyChart;
diff --git a/viz-lib/src/visualizations/chart/Renderer/PlotlyChart.jsx b/viz-lib/src/visualizations/chart/Renderer/PlotlyChart.tsx
similarity index 63%
rename from viz-lib/src/visualizations/chart/Renderer/PlotlyChart.jsx
rename to viz-lib/src/visualizations/chart/Renderer/PlotlyChart.tsx
index 29e802d36..d8cea4650 100644
--- a/viz-lib/src/visualizations/chart/Renderer/PlotlyChart.jsx
+++ b/viz-lib/src/visualizations/chart/Renderer/PlotlyChart.tsx
@@ -6,16 +6,29 @@ import { visualizationsSettings } from "@/visualizations/visualizationsSettings"
import getChartData from "../getChartData";
import initChart from "./initChart";
-export default function PlotlyChart({ options, data }) {
+export interface PlotlyChartProps {
+ data: {
+ rows: any[];
+ columns: any[];
+ }
+ options: object;
+}
+
+export default function PlotlyChart({
+ options,
+ data
+}: PlotlyChartProps) {
const [container, setContainer] = useState(null);
const [chart, setChart] = useState(null);
const errorHandler = useContext(ErrorBoundaryContext);
const errorHandlerRef = useRef();
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '{ handleError: (error: any) => void; reset: ... Remove this comment to see the full error message
errorHandlerRef.current = errorHandler;
const isMobile = useMedia({ maxWidth: 768 });
const isMobileRef = useRef();
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'boolean' is not assignable to type 'undefine... Remove this comment to see the full error message
isMobileRef.current = isMobile;
useEffect(() => {
@@ -23,7 +36,8 @@ export default function PlotlyChart({ options, data }) {
let isDestroyed = false;
const chartData = getChartData(data.rows, options);
- const _chart = initChart(container, options, chartData, visualizationsSettings, error => {
+ const _chart = initChart(container, options, chartData, visualizationsSettings, (error: any) => {
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
errorHandlerRef.current.handleError(error);
});
_chart.initialized.then(() => {
@@ -40,10 +54,12 @@ export default function PlotlyChart({ options, data }) {
useEffect(() => {
if (chart) {
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
chart.setZoomEnabled(!isMobile);
}
}, [chart, isMobile]);
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch>' is not assig... Remove this comment to see the full error message
return
;
}
diff --git a/viz-lib/src/visualizations/chart/Renderer/index.jsx b/viz-lib/src/visualizations/chart/Renderer/index.tsx
similarity index 89%
rename from viz-lib/src/visualizations/chart/Renderer/index.jsx
rename to viz-lib/src/visualizations/chart/Renderer/index.tsx
index 338a0f149..8f1259319 100644
--- a/viz-lib/src/visualizations/chart/Renderer/index.jsx
+++ b/viz-lib/src/visualizations/chart/Renderer/index.tsx
@@ -7,7 +7,10 @@ import { visualizationsSettings } from "@/visualizations/visualizationsSettings"
import "./renderer.less";
-export default function Renderer({ options, ...props }) {
+export default function Renderer({
+ options,
+ ...props
+}: any) {
if (options.globalSeriesType === "custom" && visualizationsSettings.allowCustomJSVisualizations) {
return ;
}
diff --git a/viz-lib/src/visualizations/chart/Renderer/initChart.js b/viz-lib/src/visualizations/chart/Renderer/initChart.ts
similarity index 75%
rename from viz-lib/src/visualizations/chart/Renderer/initChart.js
rename to viz-lib/src/visualizations/chart/Renderer/initChart.ts
index 29795b48d..aec9bc6b4 100644
--- a/viz-lib/src/visualizations/chart/Renderer/initChart.js
+++ b/viz-lib/src/visualizations/chart/Renderer/initChart.ts
@@ -2,8 +2,8 @@ import { isArray, isObject, isString, isFunction, startsWith, reduce, merge, map
import resizeObserver from "@/services/resizeObserver";
import { Plotly, prepareData, prepareLayout, updateData, updateAxes, updateChartSize } from "../plotly";
-function createErrorHandler(errorHandler) {
- return error => {
+function createErrorHandler(errorHandler: any) {
+ return (error: any) => {
// This error happens only when chart width is 20px and looks that
// it's safe to just ignore it: 1px less or more and chart will get fixed.
if (isString(error) && startsWith(error, "ax.dtick error")) {
@@ -21,16 +21,17 @@ function createErrorHandler(errorHandler) {
// `.process()` merges all updates into a single object and calls `Plotly.relayout()`. After that
// it calls all callbacks, collects their return values and does another loop if needed.
function initPlotUpdater() {
- let actions = [];
+ let actions: any = [];
const updater = {
- append(action) {
+ append(action: any) {
if (isArray(action) && isObject(action[0])) {
actions.push(action);
}
return updater;
},
- process(plotlyElement) {
+ // @ts-expect-error ts-migrate(7023) FIXME: 'process' implicitly has return type 'any' because... Remove this comment to see the full error message
+ process(plotlyElement: any) {
if (actions.length > 0) {
const updates = reduce(actions, (updates, action) => merge(updates, action[0]), {});
const handlers = map(actions, action => (isFunction(action[1]) ? action[1] : () => null));
@@ -48,7 +49,7 @@ function initPlotUpdater() {
return updater;
}
-export default function initChart(container, options, data, additionalOptions, onError) {
+export default function initChart(container: any, options: any, data: any, additionalOptions: any, onError: any) {
const handleError = createErrorHandler(onError);
const plotlyOptions = {
@@ -57,6 +58,7 @@ export default function initChart(container, options, data, additionalOptions, o
};
if (additionalOptions.hidePlotlyModeBar) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'displayModeBar' does not exist on type '... Remove this comment to see the full error message
plotlyOptions.displayModeBar = false;
}
@@ -67,7 +69,8 @@ export default function initChart(container, options, data, additionalOptions, o
let updater = initPlotUpdater();
- function createSafeFunction(fn) {
+ function createSafeFunction(fn: any) {
+ // @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'args' implicitly has an 'any[]' ty... Remove this comment to see the full error message
return (...args) => {
if (!isDestroyed) {
try {
@@ -95,9 +98,10 @@ export default function initChart(container, options, data, additionalOptions, o
createSafeFunction(() => {
container.on(
"plotly_restyle",
- createSafeFunction(updates => {
+ createSafeFunction((updates: any) => {
// This event is triggered if some plotly data/layout has changed.
// We need to catch only changes of traces visibility to update stacking
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'visible' does not exist on type 'object'... Remove this comment to see the full error message
if (isArray(updates) && isObject(updates[0]) && updates[0].visible) {
updateData(plotlyData, options);
updater.append(updateAxes(container, plotlyData, plotlyLayout, options)).process(container);
@@ -117,10 +121,12 @@ export default function initChart(container, options, data, additionalOptions, o
)
.catch(handleError);
+ // @ts-expect-error ts-migrate(7022) FIXME: 'result' implicitly has type 'any' because it does... Remove this comment to see the full error message
const result = {
initialized: promise.then(() => result),
- setZoomEnabled: createSafeFunction(allowZoom => {
+ setZoomEnabled: createSafeFunction((allowZoom: any) => {
const layoutUpdates = { dragmode: allowZoom ? "zoom" : false };
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ dragmode: string | boolean; }'... Remove this comment to see the full error message
return Plotly.relayout(container, layoutUpdates);
}),
destroy: createSafeFunction(() => {
diff --git a/viz-lib/src/visualizations/chart/getChartData.test.js b/viz-lib/src/visualizations/chart/getChartData.test.ts
similarity index 100%
rename from viz-lib/src/visualizations/chart/getChartData.test.js
rename to viz-lib/src/visualizations/chart/getChartData.test.ts
diff --git a/viz-lib/src/visualizations/chart/getChartData.js b/viz-lib/src/visualizations/chart/getChartData.ts
similarity index 54%
rename from viz-lib/src/visualizations/chart/getChartData.js
rename to viz-lib/src/visualizations/chart/getChartData.ts
index 3d8a51674..222889b83 100644
--- a/viz-lib/src/visualizations/chart/getChartData.js
+++ b/viz-lib/src/visualizations/chart/getChartData.ts
@@ -1,6 +1,6 @@
import { isNil, isObject, each, forOwn, sortBy, values } from "lodash";
-function addPointToSeries(point, seriesCollection, seriesName) {
+function addPointToSeries(point: any, seriesCollection: any, seriesName: any) {
if (seriesCollection[seriesName] === undefined) {
seriesCollection[seriesName] = {
name: seriesName,
@@ -12,7 +12,7 @@ function addPointToSeries(point, seriesCollection, seriesName) {
seriesCollection[seriesName].data.push(point);
}
-export default function getChartData(data, options) {
+export default function getChartData(data: any, options: any) {
const series = {};
const mappings = options.columnMapping;
@@ -22,9 +22,9 @@ export default function getChartData(data, options) {
let seriesName = null;
let xValue = 0;
const yValues = {};
- let eValue = null;
- let sizeValue = null;
- let zValue = null;
+ let eValue: any = null;
+ let sizeValue: any = null;
+ let zValue: any = null;
forOwn(row, (value, definition) => {
definition = "" + definition;
@@ -38,14 +38,18 @@ export default function getChartData(data, options) {
if (type === "x") {
xValue = value;
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
point[type] = value;
}
if (type === "y") {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
yValues[name] = value;
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
point[type] = value;
}
if (type === "yError") {
eValue = value;
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
point[type] = value;
}
@@ -54,11 +58,13 @@ export default function getChartData(data, options) {
}
if (type === "size") {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
point[type] = value;
sizeValue = value;
}
if (type === "zVal") {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
point[type] = value;
zValue = value;
}
@@ -70,16 +76,20 @@ export default function getChartData(data, options) {
if (isNil(seriesName)) {
each(yValues, (yValue, ySeriesName) => {
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '{ x: number; y: never; $raw: any; }' is not ... Remove this comment to see the full error message
point = { x: xValue, y: yValue, $raw: point.$raw };
if (eValue !== null) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yError' does not exist on type '{ $raw: ... Remove this comment to see the full error message
point.yError = eValue;
}
if (sizeValue !== null) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'size' does not exist on type '{ $raw: an... Remove this comment to see the full error message
point.size = sizeValue;
}
if (zValue !== null) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'zVal' does not exist on type '{ $raw: an... Remove this comment to see the full error message
point.zVal = zValue;
}
addPointToSeries(point, series, ySeriesName);
diff --git a/viz-lib/src/visualizations/chart/getOptions.js b/viz-lib/src/visualizations/chart/getOptions.ts
similarity index 96%
rename from viz-lib/src/visualizations/chart/getOptions.js
rename to viz-lib/src/visualizations/chart/getOptions.ts
index 2fe76ba22..4c272ff7b 100644
--- a/viz-lib/src/visualizations/chart/getOptions.js
+++ b/viz-lib/src/visualizations/chart/getOptions.ts
@@ -26,7 +26,7 @@ const DEFAULT_OPTIONS = {
missingValuesAsZero: true,
};
-export default function getOptions(options) {
+export default function getOptions(options: any) {
const result = merge(
{},
DEFAULT_OPTIONS,
diff --git a/viz-lib/src/visualizations/chart/index.js b/viz-lib/src/visualizations/chart/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/chart/index.js
rename to viz-lib/src/visualizations/chart/index.ts
diff --git a/viz-lib/src/visualizations/chart/plotly/customChartUtils.js b/viz-lib/src/visualizations/chart/plotly/customChartUtils.ts
similarity index 52%
rename from viz-lib/src/visualizations/chart/plotly/customChartUtils.js
rename to viz-lib/src/visualizations/chart/plotly/customChartUtils.ts
index f1b62f2fc..981f616b2 100644
--- a/viz-lib/src/visualizations/chart/plotly/customChartUtils.js
+++ b/viz-lib/src/visualizations/chart/plotly/customChartUtils.ts
@@ -1,14 +1,17 @@
import { each } from "lodash";
import { normalizeValue } from "./utils";
-export function prepareCustomChartData(series) {
- const x = [];
+export function prepareCustomChartData(series: any) {
+ const x: any = [];
const ys = {};
each(series, ({ name, data }) => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
ys[name] = [];
each(data, point => {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2-3 arguments, but got 1.
x.push(normalizeValue(point.x));
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
ys[name].push(normalizeValue(point.y));
});
});
@@ -16,10 +19,11 @@ export function prepareCustomChartData(series) {
return { x, ys };
}
-export function createCustomChartRenderer(code, logErrorsToConsole = false) {
+export function createCustomChartRenderer(code: any, logErrorsToConsole = false) {
// Create a function from custom code; catch syntax errors
let render = () => {};
try {
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Function' is not assignable to type '() => v... Remove this comment to see the full error message
render = new Function("x, ys, element, Plotly", code); // eslint-disable-line no-new-func
} catch (err) {
if (logErrorsToConsole) {
@@ -28,8 +32,9 @@ export function createCustomChartRenderer(code, logErrorsToConsole = false) {
}
// Return function that will invoke custom code; catch runtime errors
- return (x, ys, element, Plotly) => {
+ return (x: any, ys: any, element: any, Plotly: any) => {
try {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 0 arguments, but got 4.
render(x, ys, element, Plotly);
} catch (err) {
if (logErrorsToConsole) {
diff --git a/viz-lib/src/visualizations/chart/plotly/index.js b/viz-lib/src/visualizations/chart/plotly/index.js
deleted file mode 100644
index debc94e72..000000000
--- a/viz-lib/src/visualizations/chart/plotly/index.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import Plotly from "plotly.js/lib/core";
-import bar from "plotly.js/lib/bar";
-import pie from "plotly.js/lib/pie";
-import histogram from "plotly.js/lib/histogram";
-import box from "plotly.js/lib/box";
-import heatmap from "plotly.js/lib/heatmap";
-
-import prepareData from "./prepareData";
-import prepareLayout from "./prepareLayout";
-import updateData from "./updateData";
-import updateAxes from "./updateAxes";
-import updateChartSize from "./updateChartSize";
-import { prepareCustomChartData, createCustomChartRenderer } from "./customChartUtils";
-
-Plotly.register([bar, pie, histogram, box, heatmap]);
-Plotly.setPlotConfig({
- modeBarButtonsToRemove: ["sendDataToCloud"],
-});
-
-export {
- Plotly,
- prepareData,
- prepareLayout,
- updateData,
- updateAxes,
- updateChartSize,
- prepareCustomChartData,
- createCustomChartRenderer,
-};
diff --git a/viz-lib/src/visualizations/chart/plotly/index.ts b/viz-lib/src/visualizations/chart/plotly/index.ts
new file mode 100644
index 000000000..8680f5f6d
--- /dev/null
+++ b/viz-lib/src/visualizations/chart/plotly/index.ts
@@ -0,0 +1,36 @@
+import Plotly from "plotly.js/lib/core";
+// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
+import bar from "plotly.js/lib/bar";
+// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
+import pie from "plotly.js/lib/pie";
+// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
+import histogram from "plotly.js/lib/histogram";
+// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
+import box from "plotly.js/lib/box";
+// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
+import heatmap from "plotly.js/lib/heatmap";
+
+import prepareData from "./prepareData";
+import prepareLayout from "./prepareLayout";
+import updateData from "./updateData";
+import updateAxes from "./updateAxes";
+import updateChartSize from "./updateChartSize";
+import { prepareCustomChartData, createCustomChartRenderer } from "./customChartUtils";
+
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'register' does not exist on type 'typeof... Remove this comment to see the full error message
+Plotly.register([bar, pie, histogram, box, heatmap]);
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'setPlotConfig' does not exist on type 't... Remove this comment to see the full error message
+Plotly.setPlotConfig({
+ modeBarButtonsToRemove: ["sendDataToCloud"],
+});
+
+export {
+ Plotly,
+ prepareData,
+ prepareLayout,
+ updateData,
+ updateAxes,
+ updateChartSize,
+ prepareCustomChartData,
+ createCustomChartRenderer,
+};
diff --git a/viz-lib/src/visualizations/chart/plotly/prepareData.test.js b/viz-lib/src/visualizations/chart/plotly/prepareData.test.ts
similarity index 98%
rename from viz-lib/src/visualizations/chart/plotly/prepareData.test.js
rename to viz-lib/src/visualizations/chart/plotly/prepareData.test.ts
index 0f503dba6..43d9321d5 100644
--- a/viz-lib/src/visualizations/chart/plotly/prepareData.test.js
+++ b/viz-lib/src/visualizations/chart/plotly/prepareData.test.ts
@@ -1,8 +1,11 @@
/* eslint-disable global-require, import/no-unresolved */
import prepareData from "./prepareData";
-function cleanSeries(series) {
- return series.map(({ sourceData, ...rest }) => rest);
+function cleanSeries(series: any) {
+ return series.map(({
+ sourceData,
+ ...rest
+ }: any) => rest);
}
describe("Visualizations", () => {
diff --git a/viz-lib/src/visualizations/chart/plotly/prepareData.js b/viz-lib/src/visualizations/chart/plotly/prepareData.ts
similarity index 77%
rename from viz-lib/src/visualizations/chart/plotly/prepareData.js
rename to viz-lib/src/visualizations/chart/plotly/prepareData.ts
index b642ee4fc..7efaf0499 100644
--- a/viz-lib/src/visualizations/chart/plotly/prepareData.js
+++ b/viz-lib/src/visualizations/chart/plotly/prepareData.ts
@@ -3,11 +3,12 @@ import prepareHeatmapData from "./prepareHeatmapData";
import prepareDefaultData from "./prepareDefaultData";
import updateData from "./updateData";
-export default function prepareData(seriesList, options) {
+export default function prepareData(seriesList: any, options: any) {
switch (options.globalSeriesType) {
case "pie":
return updateData(preparePieData(seriesList, options), options);
case "heatmap":
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
return updateData(prepareHeatmapData(seriesList, options, options));
default:
return updateData(prepareDefaultData(seriesList, options), options);
diff --git a/viz-lib/src/visualizations/chart/plotly/prepareDefaultData.js b/viz-lib/src/visualizations/chart/plotly/prepareDefaultData.ts
similarity index 80%
rename from viz-lib/src/visualizations/chart/plotly/prepareDefaultData.js
rename to viz-lib/src/visualizations/chart/plotly/prepareDefaultData.ts
index f2715061a..96c423b54 100644
--- a/viz-lib/src/visualizations/chart/plotly/prepareDefaultData.js
+++ b/viz-lib/src/visualizations/chart/plotly/prepareDefaultData.ts
@@ -3,11 +3,11 @@ import chooseTextColorForBackground from "@/lib/chooseTextColorForBackground";
import { ColorPaletteArray } from "@/visualizations/ColorPalette";
import { cleanNumber, normalizeValue, getSeriesAxis } from "./utils";
-function getSeriesColor(seriesOptions, seriesIndex) {
+function getSeriesColor(seriesOptions: any, seriesIndex: any) {
return seriesOptions.color || ColorPaletteArray[seriesIndex % ColorPaletteArray.length];
}
-function getHoverInfoPattern(options) {
+function getHoverInfoPattern(options: any) {
const hasX = /{{\s*@@x\s*}}/.test(options.textFormat);
const hasName = /{{\s*@@name\s*}}/.test(options.textFormat);
let result = "text";
@@ -16,7 +16,7 @@ function getHoverInfoPattern(options) {
return result;
}
-function prepareBarSeries(series, options, additionalOptions) {
+function prepareBarSeries(series: any, options: any, additionalOptions: any) {
series.type = "bar";
series.offsetgroup = toString(additionalOptions.index);
if (options.showDataLabels) {
@@ -25,24 +25,27 @@ function prepareBarSeries(series, options, additionalOptions) {
return series;
}
-function prepareLineSeries(series, options) {
+function prepareLineSeries(series: any, options: any) {
series.mode = "lines" + (options.showDataLabels ? "+text" : "");
return series;
}
-function prepareAreaSeries(series, options) {
+function prepareAreaSeries(series: any, options: any) {
series.mode = "lines" + (options.showDataLabels ? "+text" : "");
series.fill = options.series.stacking ? "tonexty" : "tozeroy";
return series;
}
-function prepareScatterSeries(series, options) {
+function prepareScatterSeries(series: any, options: any) {
series.type = "scatter";
series.mode = "markers" + (options.showDataLabels ? "+text" : "");
return series;
}
-function prepareBubbleSeries(series, options, { seriesColor, data }) {
+function prepareBubbleSeries(series: any, options: any, {
+ seriesColor,
+ data
+}: any) {
const coefficient = options.coefficient || 1;
series.mode = "markers";
series.marker = {
@@ -53,7 +56,9 @@ function prepareBubbleSeries(series, options, { seriesColor, data }) {
return series;
}
-function prepareBoxSeries(series, options, { seriesColor }) {
+function prepareBoxSeries(series: any, options: any, {
+ seriesColor
+}: any) {
series.type = "box";
series.mode = "markers";
@@ -71,7 +76,7 @@ function prepareBoxSeries(series, options, { seriesColor }) {
return series;
}
-function prepareSeries(series, options, additionalOptions) {
+function prepareSeries(series: any, options: any, additionalOptions: any) {
const { hoverInfoPattern, index } = additionalOptions;
const seriesOptions = extend({ type: options.globalSeriesType, yAxis: 0 }, options.seriesOptions[series.name]);
@@ -85,15 +90,15 @@ function prepareSeries(series, options, additionalOptions) {
// for other types `y` is always number
const cleanYValue = includes(["bubble", "scatter"], seriesOptions.type)
? normalizeValue
- : v => {
+ : (v: any) => {
v = cleanNumber(v);
return options.missingValuesAsZero && isNil(v) ? 0.0 : v;
};
const sourceData = new Map();
- const xValues = [];
- const yValues = [];
- const yErrorValues = [];
+ const xValues: any = [];
+ const yValues: any = [];
+ const yErrorValues: any = [];
each(data, row => {
const x = normalizeValue(row.x, options.xAxis.type); // number/datetime/category
const y = cleanYValue(row.y, seriesYAxis === "y2" ? options.yAxis[1].type : options.yAxis[0].type); // depends on series type!
@@ -136,10 +141,13 @@ function prepareSeries(series, options, additionalOptions) {
case "column":
return prepareBarSeries(plotlySeries, options, additionalOptions);
case "line":
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 3.
return prepareLineSeries(plotlySeries, options, additionalOptions);
case "area":
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 3.
return prepareAreaSeries(plotlySeries, options, additionalOptions);
case "scatter":
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 3.
return prepareScatterSeries(plotlySeries, options, additionalOptions);
case "bubble":
return prepareBubbleSeries(plotlySeries, options, additionalOptions);
@@ -150,7 +158,7 @@ function prepareSeries(series, options, additionalOptions) {
}
}
-export default function prepareDefaultData(seriesList, options) {
+export default function prepareDefaultData(seriesList: any, options: any) {
const additionalOptions = {
hoverInfoPattern: getHoverInfoPattern(options),
};
diff --git a/viz-lib/src/visualizations/chart/plotly/prepareHeatmapData.js b/viz-lib/src/visualizations/chart/plotly/prepareHeatmapData.ts
similarity index 72%
rename from viz-lib/src/visualizations/chart/plotly/prepareHeatmapData.js
rename to viz-lib/src/visualizations/chart/plotly/prepareHeatmapData.ts
index 45fb75b9e..b181a2100 100644
--- a/viz-lib/src/visualizations/chart/plotly/prepareHeatmapData.js
+++ b/viz-lib/src/visualizations/chart/plotly/prepareHeatmapData.ts
@@ -12,7 +12,7 @@ const defaultColorScheme = [
[1, "#e92827"],
];
-function prepareSeries(series, options, additionalOptions) {
+function prepareSeries(series: any, options: any, additionalOptions: any) {
const { colorScheme, formatNumber } = additionalOptions;
const plotlySeries = {
@@ -24,7 +24,9 @@ function prepareSeries(series, options, additionalOptions) {
colorscale: colorScheme,
};
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'any[]' is not assignable to type 'never[]'.
plotlySeries.x = uniq(map(series.data, v => v.x));
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'any[]' is not assignable to type 'never[]'.
plotlySeries.y = uniq(map(series.data, v => v.y));
if (options.sortX) {
@@ -69,14 +71,18 @@ function prepareSeries(series, options, additionalOptions) {
if (isFinite(zMax) && options.showDataLabels) {
dataLabels.x.push(plotlySeries.x[j]);
dataLabels.y.push(plotlySeries.y[i]);
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'any' is not assignable to parame... Remove this comment to see the full error message
dataLabels.text.push(formatNumber(zValue));
if (options.colorScheme && options.colorScheme === "Custom...") {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
dataLabels.textfont.color.push("white");
} else {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
dataLabels.textfont.color.push(zValue / zMax < 0.25 ? "white" : "black");
}
}
}
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'any[]' is not assignable to para... Remove this comment to see the full error message
plotlySeries.z.push(item);
}
@@ -86,7 +92,7 @@ function prepareSeries(series, options, additionalOptions) {
return [plotlySeries];
}
-export default function prepareHeatmapData(seriesList, options) {
+export default function prepareHeatmapData(seriesList: any, options: any) {
let colorScheme = [];
if (!options.colorScheme) {
diff --git a/viz-lib/src/visualizations/chart/plotly/prepareLayout.test.js b/viz-lib/src/visualizations/chart/plotly/prepareLayout.test.ts
similarity index 100%
rename from viz-lib/src/visualizations/chart/plotly/prepareLayout.test.js
rename to viz-lib/src/visualizations/chart/plotly/prepareLayout.test.ts
diff --git a/viz-lib/src/visualizations/chart/plotly/prepareLayout.js b/viz-lib/src/visualizations/chart/plotly/prepareLayout.ts
similarity index 67%
rename from viz-lib/src/visualizations/chart/plotly/prepareLayout.js
rename to viz-lib/src/visualizations/chart/plotly/prepareLayout.ts
index fcc922815..9be2d7436 100644
--- a/viz-lib/src/visualizations/chart/plotly/prepareLayout.js
+++ b/viz-lib/src/visualizations/chart/plotly/prepareLayout.ts
@@ -1,11 +1,11 @@
import { isObject, isUndefined, filter, map } from "lodash";
import { getPieDimensions } from "./preparePieData";
-function getAxisTitle(axis) {
+function getAxisTitle(axis: any) {
return isObject(axis.title) ? axis.title.text : null;
}
-function getAxisScaleType(axis) {
+function getAxisScaleType(axis: any) {
switch (axis.type) {
case "datetime":
return "date";
@@ -16,7 +16,7 @@ function getAxisScaleType(axis) {
}
}
-function prepareXAxis(axisOptions, additionalOptions) {
+function prepareXAxis(axisOptions: any, additionalOptions: any) {
const axis = {
title: getAxisTitle(axisOptions),
type: getAxisScaleType(axisOptions),
@@ -25,20 +25,23 @@ function prepareXAxis(axisOptions, additionalOptions) {
if (additionalOptions.sortX && axis.type === "category") {
if (additionalOptions.reverseX) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'categoryorder' does not exist on type '{... Remove this comment to see the full error message
axis.categoryorder = "category descending";
} else {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'categoryorder' does not exist on type '{... Remove this comment to see the full error message
axis.categoryorder = "category ascending";
}
}
if (!isUndefined(axisOptions.labels)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'showticklabels' does not exist on type '... Remove this comment to see the full error message
axis.showticklabels = axisOptions.labels.enabled;
}
return axis;
}
-function prepareYAxis(axisOptions) {
+function prepareYAxis(axisOptions: any) {
return {
title: getAxisTitle(axisOptions),
type: getAxisScaleType(axisOptions),
@@ -48,7 +51,7 @@ function prepareYAxis(axisOptions) {
};
}
-function preparePieLayout(layout, options, data) {
+function preparePieLayout(layout: any, options: any, data: any) {
const hasName = /{{\s*@@name\s*}}/.test(options.textFormat);
const { cellsInRow, cellWidth, cellHeight, xPadding } = getPieDimensions(data);
@@ -58,7 +61,9 @@ function preparePieLayout(layout, options, data) {
} else {
layout.annotations = filter(
map(data, (series, index) => {
+ // @ts-expect-error ts-migrate(2362) FIXME: The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
const xPosition = (index % cellsInRow) * cellWidth;
+ // @ts-expect-error ts-migrate(2362) FIXME: The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
const yPosition = Math.floor(index / cellsInRow) * cellHeight;
return {
x: xPosition + (cellWidth - xPadding) / 2,
@@ -75,8 +80,8 @@ function preparePieLayout(layout, options, data) {
return layout;
}
-function prepareDefaultLayout(layout, options, data) {
- const y2Series = data.filter(s => s.yaxis === "y2");
+function prepareDefaultLayout(layout: any, options: any, data: any) {
+ const y2Series = data.filter((s: any) => s.yaxis === "y2");
layout.xaxis = prepareXAxis(options.xAxis, options);
@@ -94,14 +99,14 @@ function prepareDefaultLayout(layout, options, data) {
return layout;
}
-function prepareBoxLayout(layout, options, data) {
+function prepareBoxLayout(layout: any, options: any, data: any) {
layout = prepareDefaultLayout(layout, options, data);
layout.boxmode = "group";
layout.boxgroupgap = 0.5;
return layout;
}
-export default function prepareLayout(element, options, data) {
+export default function prepareLayout(element: any, options: any, data: any) {
const layout = {
margin: { l: 10, r: 10, b: 5, t: 20, pad: 4 },
// plot size should be at least 5x5px
diff --git a/viz-lib/src/visualizations/chart/plotly/preparePieData.js b/viz-lib/src/visualizations/chart/plotly/preparePieData.ts
similarity index 78%
rename from viz-lib/src/visualizations/chart/plotly/preparePieData.js
rename to viz-lib/src/visualizations/chart/plotly/preparePieData.ts
index 18d9608fb..80101f072 100644
--- a/viz-lib/src/visualizations/chart/plotly/preparePieData.js
+++ b/viz-lib/src/visualizations/chart/plotly/preparePieData.ts
@@ -5,7 +5,7 @@ import { ColorPaletteArray } from "@/visualizations/ColorPalette";
import { cleanNumber, normalizeValue } from "./utils";
-export function getPieDimensions(series) {
+export function getPieDimensions(series: any) {
const rows = series.length > 2 ? 2 : 1;
const cellsInRow = Math.ceil(series.length / rows);
const cellWidth = 1 / cellsInRow;
@@ -16,14 +16,14 @@ export function getPieDimensions(series) {
return { rows, cellsInRow, cellWidth, cellHeight, xPadding, yPadding };
}
-function getPieHoverInfoPattern(options) {
+function getPieHoverInfoPattern(options: any) {
const hasX = /{{\s*@@x\s*}}/.test(options.textFormat);
let result = "text";
if (!hasX) result += "+label";
return result;
}
-function prepareSeries(series, options, additionalOptions) {
+function prepareSeries(series: any, options: any, additionalOptions: any) {
const {
cellWidth,
cellHeight,
@@ -41,8 +41,8 @@ function prepareSeries(series, options, additionalOptions) {
const xPosition = (index % cellsInRow) * cellWidth;
const yPosition = Math.floor(index / cellsInRow) * cellHeight;
- const labels = [];
- const values = [];
+ const labels: any = [];
+ const values: any = [];
const sourceData = new Map();
const seriesTotal = reduce(
series.data,
@@ -94,8 +94,9 @@ function prepareSeries(series, options, additionalOptions) {
};
}
-export default function preparePieData(seriesList, options) {
+export default function preparePieData(seriesList: any, options: any) {
// we will use this to assign colors for values that have no explicitly set color
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const getDefaultColor = d3.scale
.ordinal()
.domain([])
@@ -103,6 +104,7 @@ export default function preparePieData(seriesList, options) {
const valuesColors = {};
each(options.valuesOptions, (item, key) => {
if (isString(item.color) && item.color !== "") {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
valuesColors[key] = item.color;
}
});
@@ -111,7 +113,8 @@ export default function preparePieData(seriesList, options) {
...getPieDimensions(seriesList),
hasX: includes(options.columnMapping, "x"),
hoverInfoPattern: getPieHoverInfoPattern(options),
- getValueColor: v => valuesColors[v] || getDefaultColor(v),
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ getValueColor: (v: any) => valuesColors[v] || getDefaultColor(v),
};
return map(seriesList, (series, index) => prepareSeries(series, options, { ...additionalOptions, index }));
diff --git a/viz-lib/src/visualizations/chart/plotly/updateAxes.js b/viz-lib/src/visualizations/chart/plotly/updateAxes.ts
similarity index 69%
rename from viz-lib/src/visualizations/chart/plotly/updateAxes.js
rename to viz-lib/src/visualizations/chart/plotly/updateAxes.ts
index 4f469bb60..71082230c 100644
--- a/viz-lib/src/visualizations/chart/plotly/updateAxes.js
+++ b/viz-lib/src/visualizations/chart/plotly/updateAxes.ts
@@ -1,14 +1,14 @@
import { isObject, isNumber, each } from "lodash";
-function calculateAxisRange(range, min, max) {
+function calculateAxisRange(range: any, min: any, max: any) {
return [isNumber(min) ? min : range[0], isNumber(max) ? max : range[1]];
}
-function calculateAbsoluteDiff(value, totalRange, percentageDiff) {
+function calculateAbsoluteDiff(value: any, totalRange: any, percentageDiff: any) {
return (percentageDiff * totalRange) / (1 - Math.abs(value) / totalRange - percentageDiff);
}
-function alignYAxesAtZero(axisA, axisB) {
+function alignYAxesAtZero(axisA: any, axisB: any) {
// Make sure the origin is included in both axes
axisA.range[1] = Math.max(0, axisA.range[1]);
axisB.range[1] = Math.max(0, axisB.range[1]);
@@ -40,9 +40,10 @@ function alignYAxesAtZero(axisA, axisB) {
}
}
-export default function updateAxes(plotlyElement, seriesList, layout, options) {
+export default function updateAxes(plotlyElement: any, seriesList: any, layout: any, options: any) {
const updates = {};
if (isObject(layout.yaxis)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis' does not exist on type '{}'.
updates.yaxis = {
...layout.yaxis,
autorange: true,
@@ -50,6 +51,7 @@ export default function updateAxes(plotlyElement, seriesList, layout, options) {
};
}
if (isObject(layout.yaxis2)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis2' does not exist on type '{}'.
updates.yaxis2 = {
...layout.yaxis2,
autorange: true,
@@ -64,14 +66,18 @@ export default function updateAxes(plotlyElement, seriesList, layout, options) {
if (isObject(layout.yaxis)) {
const axisOptions = options.yAxis[0];
const defaultRange = plotlyElement.layout.yaxis.range;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis' does not exist on type '{}'.
updates.yaxis.autorange = false;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis' does not exist on type '{}'.
updates.yaxis.range = calculateAxisRange(defaultRange, axisOptions.rangeMin, axisOptions.rangeMax);
}
if (isObject(layout.yaxis2)) {
const axisOptions = options.yAxis[1];
const defaultRange = plotlyElement.layout.yaxis2.range;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis2' does not exist on type '{}'.
updates.yaxis2.autorange = false;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis2' does not exist on type '{}'.
updates.yaxis2.range = calculateAxisRange(defaultRange, axisOptions.rangeMin, axisOptions.rangeMax);
}
@@ -85,19 +91,24 @@ export default function updateAxes(plotlyElement, seriesList, layout, options) {
});
const { xaxis } = layout;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis' does not exist on type '{}'.
const { yaxis, yaxis2 } = updates;
if (isObject(xaxis) && isObject(yaxis)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'xaxis' does not exist on type '{}'.
updates.xaxis = yaxis;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis' does not exist on type '{}'.
updates.yaxis = xaxis;
}
if (isObject(yaxis2)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis2' does not exist on type '{}'.
updates.yaxis2 = null;
}
}
// Align Y axes
if (options.alignYAxesAtZero && isObject(layout.yaxis) && isObject(layout.yaxis2)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'yaxis' does not exist on type '{}'.
alignYAxesAtZero(updates.yaxis, updates.yaxis2);
}
diff --git a/viz-lib/src/visualizations/chart/plotly/updateChartSize.js b/viz-lib/src/visualizations/chart/plotly/updateChartSize.ts
similarity index 89%
rename from viz-lib/src/visualizations/chart/plotly/updateChartSize.js
rename to viz-lib/src/visualizations/chart/plotly/updateChartSize.ts
index 8e3fb8fc9..3a8548e1e 100644
--- a/viz-lib/src/visualizations/chart/plotly/updateChartSize.js
+++ b/viz-lib/src/visualizations/chart/plotly/updateChartSize.ts
@@ -1,6 +1,6 @@
import { find, pick, extend } from "lodash";
-function fixLegendContainer(plotlyElement) {
+function fixLegendContainer(plotlyElement: any) {
const legend = plotlyElement.querySelector(".legend");
if (legend) {
let node = legend.parentNode;
@@ -14,7 +14,7 @@ function fixLegendContainer(plotlyElement) {
}
}
-function placeLegendNextToPlot(plotlyElement, layout) {
+function placeLegendNextToPlot(plotlyElement: any, layout: any) {
const transformName = find(
["transform", "WebkitTransform", "MozTransform", "MsTransform", "OTransform"],
prop => prop in plotlyElement.style
@@ -32,13 +32,14 @@ function placeLegendNextToPlot(plotlyElement, layout) {
const legend = plotlyElement.querySelector(".legend");
if (legend) {
+ // @ts-expect-error ts-migrate(2538) FIXME: Type 'undefined' cannot be used as an index type.
legend.style[transformName] = null;
}
return [pick(layout, ["width", "height", "legend"]), null]; // no further updates
}
-function placeLegendBelowPlot(plotlyElement, layout) {
+function placeLegendBelowPlot(plotlyElement: any, layout: any) {
const transformName = find(
["transform", "WebkitTransform", "MozTransform", "MsTransform", "OTransform"],
prop => prop in plotlyElement.style
@@ -89,6 +90,7 @@ function placeLegendBelowPlot(plotlyElement, layout) {
// so we can split container's height half by half between them.
layout.height = Math.floor(Math.max(layoutHeight / 2, layoutHeight - (bounds.bottom - bounds.top)));
// offset the legend
+ // @ts-expect-error ts-migrate(2538) FIXME: Type 'undefined' cannot be used as an index type.
legend.style[transformName] = "translate(0, " + layout.height + "px)";
return [pick(layout, ["height"]), null]; // no further updates
}
@@ -96,7 +98,7 @@ function placeLegendBelowPlot(plotlyElement, layout) {
];
}
-function placeLegendAuto(plotlyElement, layout) {
+function placeLegendAuto(plotlyElement: any, layout: any) {
if (layout.width <= 600) {
return placeLegendBelowPlot(plotlyElement, layout);
} else {
@@ -104,7 +106,7 @@ function placeLegendAuto(plotlyElement, layout) {
}
}
-export default function updateChartSize(plotlyElement, layout, options) {
+export default function updateChartSize(plotlyElement: any, layout: any, options: any) {
// update layout size to plot container
// plot size should be at least 5x5px
layout.width = Math.max(5, Math.floor(plotlyElement.offsetWidth));
diff --git a/viz-lib/src/visualizations/chart/plotly/updateData.js b/viz-lib/src/visualizations/chart/plotly/updateData.ts
similarity index 74%
rename from viz-lib/src/visualizations/chart/plotly/updateData.js
rename to viz-lib/src/visualizations/chart/plotly/updateData.ts
index af240cc33..c9cc6b912 100644
--- a/viz-lib/src/visualizations/chart/plotly/updateData.js
+++ b/viz-lib/src/visualizations/chart/plotly/updateData.ts
@@ -2,11 +2,11 @@ import { isNil, each, extend, filter, identity, includes, map, sortBy } from "lo
import { createNumberFormatter, formatSimpleTemplate } from "@/lib/value-format";
import { normalizeValue } from "./utils";
-function shouldUseUnifiedXAxis(options) {
+function shouldUseUnifiedXAxis(options: any) {
return options.sortX && options.xAxis.type === "category" && options.globalSeriesType !== "box";
}
-function defaultFormatSeriesText(item) {
+function defaultFormatSeriesText(item: any) {
let result = item["@@y"];
if (item["@@yError"] !== undefined) {
result = `${result} \u00B1 ${item["@@yError"]}`;
@@ -20,18 +20,18 @@ function defaultFormatSeriesText(item) {
return result;
}
-function defaultFormatSeriesTextForPie(item) {
+function defaultFormatSeriesTextForPie(item: any) {
return item["@@yPercent"] + " (" + item["@@y"] + ")";
}
-function createTextFormatter(options) {
+function createTextFormatter(options: any) {
if (options.textFormat === "") {
return options.globalSeriesType === "pie" ? defaultFormatSeriesTextForPie : defaultFormatSeriesText;
}
- return item => formatSimpleTemplate(options.textFormat, item);
+ return (item: any) => formatSimpleTemplate(options.textFormat, item);
}
-function formatValue(value, axis, options) {
+function formatValue(value: any, axis: any, options: any) {
let axisType = null;
switch (axis) {
case "x":
@@ -48,7 +48,7 @@ function formatValue(value, axis, options) {
return normalizeValue(value, axisType, options.dateTimeFormat);
}
-function updateSeriesText(seriesList, options) {
+function updateSeriesText(seriesList: any, options: any) {
const formatNumber = createNumberFormatter(options.numberFormat);
const formatPercent = createNumberFormatter(options.percentFormat);
const formatText = createTextFormatter(options);
@@ -61,7 +61,7 @@ function updateSeriesText(seriesList, options) {
series.text = [];
series.hover = [];
const xValues = options.globalSeriesType === "pie" ? series.labels : series.x;
- xValues.forEach(x => {
+ xValues.forEach((x: any) => {
const text = {
"@@name": series.name,
};
@@ -74,16 +74,21 @@ function updateSeriesText(seriesList, options) {
// using default (ISO) date/time format. Here we need to use custom date/time format, so we pass original value
// to `formatValue` which will call `normalizeValue` again, but this time with different date/time format
// (if needed)
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
text["@@x"] = formatValue(item.row.x, "x", options);
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
text["@@y"] = yValueIsAny ? formatValue(item.row.y, series.yaxis, options) : formatNumber(item.y);
if (item.yError !== undefined) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
text["@@yError"] = formatNumber(item.yError);
}
if (item.size !== undefined) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
text["@@size"] = formatNumber(item.size);
}
if (options.series.percentValues || options.globalSeriesType === "pie") {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
text["@@yPercent"] = formatPercent(Math.abs(item.yPercent));
}
@@ -94,22 +99,22 @@ function updateSeriesText(seriesList, options) {
});
}
-function updatePercentValues(seriesList, options) {
+function updatePercentValues(seriesList: any, options: any) {
if (options.series.percentValues) {
// Some series may not have corresponding x-values;
// do calculations for each x only for series that do have that x
const sumOfCorrespondingPoints = new Map();
each(seriesList, series => {
- series.sourceData.forEach(item => {
+ series.sourceData.forEach((item: any) => {
const sum = sumOfCorrespondingPoints.get(item.x) || 0;
sumOfCorrespondingPoints.set(item.x, sum + Math.abs(item.y || 0.0));
});
});
each(seriesList, series => {
- const yValues = [];
+ const yValues: any = [];
- series.sourceData.forEach(item => {
+ series.sourceData.forEach((item: any) => {
if (isNil(item.y) && !options.missingValuesAsZero) {
item.yPercent = null;
} else {
@@ -124,11 +129,11 @@ function updatePercentValues(seriesList, options) {
}
}
-function getUnifiedXAxisValues(seriesList, sorted) {
+function getUnifiedXAxisValues(seriesList: any, sorted: any) {
const set = new Set();
each(seriesList, series => {
// `Map.forEach` will walk items in insertion order
- series.sourceData.forEach(item => {
+ series.sourceData.forEach((item: any) => {
set.add(item.x);
});
});
@@ -137,7 +142,7 @@ function getUnifiedXAxisValues(seriesList, sorted) {
return sorted ? sortBy(result, identity) : result;
}
-function updateUnifiedXAxisValues(seriesList, options) {
+function updateUnifiedXAxisValues(seriesList: any, options: any) {
const unifiedX = getUnifiedXAxisValues(seriesList, options.sortX);
const defaultY = options.missingValuesAsZero ? 0.0 : null;
each(seriesList, series => {
@@ -158,11 +163,11 @@ function updateUnifiedXAxisValues(seriesList, options) {
});
}
-function updatePieData(seriesList, options) {
+function updatePieData(seriesList: any, options: any) {
updateSeriesText(seriesList, options);
}
-function updateLineAreaData(seriesList, options) {
+function updateLineAreaData(seriesList: any, options: any) {
// Apply "percent values" modification
updatePercentValues(seriesList, options);
if (options.series.stacking) {
@@ -176,7 +181,9 @@ function updateLineAreaData(seriesList, options) {
return null;
}
const x = series.x[i];
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const stackedY = y + (cumulativeValues[x] || 0.0);
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
cumulativeValues[x] = stackedY;
return stackedY;
});
@@ -191,7 +198,7 @@ function updateLineAreaData(seriesList, options) {
updateSeriesText(seriesList, options);
}
-function updateDefaultData(seriesList, options) {
+function updateDefaultData(seriesList: any, options: any) {
// Apply "percent values" modification
updatePercentValues(seriesList, options);
@@ -205,7 +212,7 @@ function updateDefaultData(seriesList, options) {
updateSeriesText(seriesList, options);
}
-export default function updateData(seriesList, options) {
+export default function updateData(seriesList: any, options: any) {
// Use only visible series
const visibleSeriesList = filter(seriesList, s => s.visible === true);
diff --git a/viz-lib/src/visualizations/chart/plotly/utils.js b/viz-lib/src/visualizations/chart/plotly/utils.ts
similarity index 64%
rename from viz-lib/src/visualizations/chart/plotly/utils.js
rename to viz-lib/src/visualizations/chart/plotly/utils.ts
index 71809fde3..b1551fd5b 100644
--- a/viz-lib/src/visualizations/chart/plotly/utils.js
+++ b/viz-lib/src/visualizations/chart/plotly/utils.ts
@@ -1,12 +1,13 @@
import { isUndefined } from "lodash";
import moment from "moment";
+// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'plot... Remove this comment to see the full error message
import plotlyCleanNumber from "plotly.js/src/lib/clean_number";
-export function cleanNumber(value) {
+export function cleanNumber(value: any) {
return isUndefined(value) ? value : plotlyCleanNumber(value);
}
-export function getSeriesAxis(series, options) {
+export function getSeriesAxis(series: any, options: any) {
const seriesOptions = options.seriesOptions[series.name] || { type: options.globalSeriesType };
if (seriesOptions.yAxis === 1 && (!options.series.stacking || seriesOptions.type === "line")) {
return "y2";
@@ -14,7 +15,7 @@ export function getSeriesAxis(series, options) {
return "y";
}
-export function normalizeValue(value, axisType, dateTimeFormat = "YYYY-MM-DD HH:mm:ss") {
+export function normalizeValue(value: any, axisType: any, dateTimeFormat = "YYYY-MM-DD HH:mm:ss") {
if (axisType === "datetime" && moment.utc(value).isValid()) {
value = moment.utc(value);
}
diff --git a/viz-lib/src/visualizations/choropleth/ColorPalette.js b/viz-lib/src/visualizations/choropleth/ColorPalette.ts
similarity index 100%
rename from viz-lib/src/visualizations/choropleth/ColorPalette.js
rename to viz-lib/src/visualizations/choropleth/ColorPalette.ts
diff --git a/viz-lib/src/visualizations/choropleth/Editor/BoundsSettings.jsx b/viz-lib/src/visualizations/choropleth/Editor/BoundsSettings.tsx
similarity index 71%
rename from viz-lib/src/visualizations/choropleth/Editor/BoundsSettings.jsx
rename to viz-lib/src/visualizations/choropleth/Editor/BoundsSettings.tsx
index e217c8367..0c018a8b8 100644
--- a/viz-lib/src/visualizations/choropleth/Editor/BoundsSettings.jsx
+++ b/viz-lib/src/visualizations/choropleth/Editor/BoundsSettings.tsx
@@ -8,7 +8,10 @@ import { EditorPropTypes } from "@/visualizations/prop-types";
import useLoadGeoJson from "../hooks/useLoadGeoJson";
import { getGeoJsonBounds } from "./utils";
-export default function BoundsSettings({ options, onOptionsChange }) {
+export default function BoundsSettings({
+ options,
+ onOptionsChange
+}: any) {
// Bounds may be changed in editor or on preview (by drag/zoom map).
// Changes from preview does not come frequently (only when user release mouse button),
// but changes from editor should be debounced.
@@ -51,42 +54,48 @@ export default function BoundsSettings({ options, onOptionsChange }) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'null | un... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
updateBounds(1, 0, value)}
+ onChange={(value: any) => updateBounds(1, 0, value)}
/>
updateBounds(1, 1, value)}
+ onChange={(value: any) => updateBounds(1, 1, value)}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'null | un... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
updateBounds(0, 0, value)}
+ onChange={(value: any) => updateBounds(0, 0, value)}
/>
updateBounds(0, 1, value)}
+ onChange={(value: any) => updateBounds(0, 1, value)}
/>
diff --git a/viz-lib/src/visualizations/choropleth/Editor/ColorsSettings.jsx b/viz-lib/src/visualizations/choropleth/Editor/ColorsSettings.tsx
similarity index 50%
rename from viz-lib/src/visualizations/choropleth/Editor/ColorsSettings.jsx
rename to viz-lib/src/visualizations/choropleth/Editor/ColorsSettings.tsx
index 4984252de..ffc542f56 100644
--- a/viz-lib/src/visualizations/choropleth/Editor/ColorsSettings.jsx
+++ b/viz-lib/src/visualizations/choropleth/Editor/ColorsSettings.tsx
@@ -4,30 +4,41 @@ import { Section, Select, InputNumber, ColorPicker } from "@/components/visualiz
import { EditorPropTypes } from "@/visualizations/prop-types";
import ColorPalette from "../ColorPalette";
-export default function ColorsSettings({ options, onOptionsChange }) {
+export default function ColorsSettings({
+ options,
+ onOptionsChange
+}: any) {
const [onOptionsChangeDebounced] = useDebouncedCallback(onOptionsChange, 200);
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ clusteringMode })}>
+ onChange={(clusteringMode: any) => onOptionsChange({ clusteringMode })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
quantile
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
equidistant
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
k-means
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChangeDebounced({ steps })}
+ onChange={(steps: any) => onOptionsChangeDebounced({ steps })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { min } })}
+ onChange={(min: any) => onOptionsChange({ colors: { min } })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { max } })}
+ onChange={(max: any) => onOptionsChange({ colors: { max } })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { noValue } })}
+ onChange={(noValue: any) => onOptionsChange({ colors: { noValue } })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { background } })}
+ onChange={(background: any) => onOptionsChange({ colors: { background } })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { borders } })}
+ onChange={(borders: any) => onOptionsChange({ colors: { borders } })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
diff --git a/viz-lib/src/visualizations/choropleth/Editor/FormatSettings.jsx b/viz-lib/src/visualizations/choropleth/Editor/FormatSettings.tsx
similarity index 60%
rename from viz-lib/src/visualizations/choropleth/Editor/FormatSettings.jsx
rename to viz-lib/src/visualizations/choropleth/Editor/FormatSettings.tsx
index 44a5e2ee3..728089842 100644
--- a/viz-lib/src/visualizations/choropleth/Editor/FormatSettings.jsx
+++ b/viz-lib/src/visualizations/choropleth/Editor/FormatSettings.tsx
@@ -1,6 +1,5 @@
import { map } from "lodash";
import React, { useMemo } from "react";
-import PropTypes from "prop-types";
import { useDebouncedCallback } from "use-debounce";
import * as Grid from "antd/lib/grid";
import {
@@ -17,8 +16,15 @@ import { EditorPropTypes } from "@/visualizations/prop-types";
import useLoadGeoJson from "../hooks/useLoadGeoJson";
import { getGeoJsonFields } from "./utils";
-function TemplateFormatHint({ geoJsonProperties }) {
+type OwnTemplateFormatHintProps = {
+ geoJsonProperties?: string[];
+};
+
+type TemplateFormatHintProps = OwnTemplateFormatHintProps & typeof TemplateFormatHint.defaultProps;
+
+function TemplateFormatHint({ geoJsonProperties }: TemplateFormatHintProps) {
return (
+ // @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message
@@ -44,15 +50,14 @@ function TemplateFormatHint({ geoJsonProperties }) {
);
}
-TemplateFormatHint.propTypes = {
- geoJsonProperties: PropTypes.arrayOf(PropTypes.string),
-};
-
TemplateFormatHint.defaultProps = {
geoJsonProperties: [],
};
-export default function GeneralSettings({ options, onOptionsChange }) {
+export default function GeneralSettings({
+ options,
+ onOptionsChange
+}: any) {
const [onOptionsChangeDebounced] = useDebouncedCallback(onOptionsChange, 200);
const [geoJson] = useLoadGeoJson(options.mapType);
const geoJsonFields = useMemo(() => getGeoJsonFields(geoJson), [geoJson]);
@@ -61,6 +66,7 @@ export default function GeneralSettings({ options, onOptionsChange }) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
@@ -73,7 +79,7 @@ export default function GeneralSettings({ options, onOptionsChange }) {
}
data-test="Choropleth.Editor.ValueFormat"
defaultValue={options.valueFormat}
- onChange={event => onOptionsChangeDebounced({ valueFormat: event.target.value })}
+ onChange={(event: any) => onOptionsChangeDebounced({ valueFormat: event.target.value })}
/>
@@ -81,12 +87,13 @@ export default function GeneralSettings({ options, onOptionsChange }) {
label="Value Placeholder"
data-test="Choropleth.Editor.ValuePlaceholder"
defaultValue={options.noValuePlaceholder}
- onChange={event => onOptionsChangeDebounced({ noValuePlaceholder: event.target.value })}
+ onChange={(event: any) => onOptionsChangeDebounced({ noValuePlaceholder: event.target.value })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
@@ -104,18 +112,26 @@ export default function GeneralSettings({ options, onOptionsChange }) {
data-test="Choropleth.Editor.LegendPosition"
disabled={!options.legend.visible}
defaultValue={options.legend.position}
- onChange={position => onOptionsChange({ legend: { position } })}>
+ onChange={(position: any) => onOptionsChange({ legend: { position } })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
top / left
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
top / right
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
bottom / left
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
bottom / right
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
@@ -125,12 +141,13 @@ export default function GeneralSettings({ options, onOptionsChange }) {
label="Legend Text Alignment"
disabled={!options.legend.visible}
defaultValue={options.legend.alignText}
- onChange={event => onOptionsChange({ legend: { alignText: event.target.value } })}
+ onChange={(event: any) => onOptionsChange({ legend: { alignText: event.target.value } })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
diff --git a/viz-lib/src/visualizations/choropleth/Editor/GeneralSettings.jsx b/viz-lib/src/visualizations/choropleth/Editor/GeneralSettings.tsx
similarity index 61%
rename from viz-lib/src/visualizations/choropleth/Editor/GeneralSettings.jsx
rename to viz-lib/src/visualizations/choropleth/Editor/GeneralSettings.tsx
index e9ea2e0b0..dc39db055 100644
--- a/viz-lib/src/visualizations/choropleth/Editor/GeneralSettings.jsx
+++ b/viz-lib/src/visualizations/choropleth/Editor/GeneralSettings.tsx
@@ -8,7 +8,11 @@ import { visualizationsSettings } from "@/visualizations/visualizationsSettings"
import useLoadGeoJson from "../hooks/useLoadGeoJson";
import { getGeoJsonFields } from "./utils";
-export default function GeneralSettings({ options, data, onOptionsChange }) {
+export default function GeneralSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
const [geoJson, isLoadingGeoJson] = useLoadGeoJson(options.mapType);
const geoJsonFields = useMemo(() => getGeoJsonFields(geoJson), [geoJson]);
@@ -26,6 +30,7 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
{map(visualizationsSettings.choroplethAvailableMaps, (_, mapType) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{get(visualizationsSettings, `choroplethAvailableMaps.${mapType}.name`, mapType)}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
@@ -49,10 +57,12 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
data-test="Choropleth.Editor.KeyColumn"
disabled={data.columns.length === 0}
defaultValue={options.keyColumn}
- onChange={keyColumn => onOptionsChange({ keyColumn })}>
+ onChange={(keyColumn: any) => onOptionsChange({ keyColumn })}>
{map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
@@ -65,10 +75,12 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
disabled={isLoadingGeoJson || targetFields.length === 0}
loading={isLoadingGeoJson}
value={options.targetField}
- onChange={targetField => onOptionsChange({ targetField })}>
+ onChange={(targetField: any) => onOptionsChange({ targetField })}>
{map(targetFields, field => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{fieldNames[field] || field}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
@@ -76,16 +88,19 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ valueColumn })}>
+ onChange={(valueColumn: any) => onOptionsChange({ valueColumn })}>
{map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
diff --git a/viz-lib/src/visualizations/choropleth/Editor/index.js b/viz-lib/src/visualizations/choropleth/Editor/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/choropleth/Editor/index.js
rename to viz-lib/src/visualizations/choropleth/Editor/index.ts
diff --git a/viz-lib/src/visualizations/choropleth/Editor/utils.js b/viz-lib/src/visualizations/choropleth/Editor/utils.js
deleted file mode 100644
index 836b0a890..000000000
--- a/viz-lib/src/visualizations/choropleth/Editor/utils.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { isObject, isArray, reduce, keys, uniq } from "lodash";
-import L from "leaflet";
-
-export function getGeoJsonFields(geoJson) {
- const features = isObject(geoJson) && isArray(geoJson.features) ? geoJson.features : [];
- return reduce(
- features,
- (result, feature) => {
- const properties = isObject(feature) && isObject(feature.properties) ? feature.properties : {};
- return uniq([...result, ...keys(properties)]);
- },
- []
- );
-}
-
-export function getGeoJsonBounds(geoJson) {
- if (isObject(geoJson)) {
- const layer = L.geoJSON(geoJson);
- const bounds = layer.getBounds();
- if (bounds.isValid()) {
- return [
- [bounds._southWest.lat, bounds._southWest.lng],
- [bounds._northEast.lat, bounds._northEast.lng],
- ];
- }
- }
- return null;
-}
diff --git a/viz-lib/src/visualizations/choropleth/Editor/utils.ts b/viz-lib/src/visualizations/choropleth/Editor/utils.ts
new file mode 100644
index 000000000..eaf54a6da
--- /dev/null
+++ b/viz-lib/src/visualizations/choropleth/Editor/utils.ts
@@ -0,0 +1,34 @@
+import { isObject, isArray, reduce, keys, uniq } from "lodash";
+import L from "leaflet";
+
+export function getGeoJsonFields(geoJson: any) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'features' does not exist on type 'object... Remove this comment to see the full error message
+ const features = isObject(geoJson) && isArray(geoJson.features) ? geoJson.features : [];
+ return reduce(
+ features,
+ // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
+ (result, feature) => {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'properties' does not exist on type 'obje... Remove this comment to see the full error message
+ const properties = isObject(feature) && isObject(feature.properties) ? feature.properties : {};
+ return uniq([...result, ...keys(properties)]);
+ },
+ []
+ );
+}
+
+export function getGeoJsonBounds(geoJson: any) {
+ if (isObject(geoJson)) {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'object' is not assignable to par... Remove this comment to see the full error message
+ const layer = L.geoJSON(geoJson);
+ const bounds = layer.getBounds();
+ if (bounds.isValid()) {
+ return [
+ // @ts-expect-error ts-migrate(2551) FIXME: Property '_southWest' does not exist on type 'LatL... Remove this comment to see the full error message
+ [bounds._southWest.lat, bounds._southWest.lng],
+ // @ts-expect-error ts-migrate(2551) FIXME: Property '_northEast' does not exist on type 'LatL... Remove this comment to see the full error message
+ [bounds._northEast.lat, bounds._northEast.lng],
+ ];
+ }
+ }
+ return null;
+}
diff --git a/viz-lib/src/visualizations/choropleth/Renderer/Legend.jsx b/viz-lib/src/visualizations/choropleth/Renderer/Legend.tsx
similarity index 59%
rename from viz-lib/src/visualizations/choropleth/Renderer/Legend.jsx
rename to viz-lib/src/visualizations/choropleth/Renderer/Legend.tsx
index 0c9eed990..529d9f2a3 100644
--- a/viz-lib/src/visualizations/choropleth/Renderer/Legend.jsx
+++ b/viz-lib/src/visualizations/choropleth/Renderer/Legend.tsx
@@ -1,13 +1,23 @@
import { map } from "lodash";
import React from "react";
-import PropTypes from "prop-types";
import ColorPicker from "@/components/ColorPicker";
-export default function Legend({ items, alignText }) {
+type OwnProps = {
+ items?: {
+ color: string;
+ text: string;
+ }[];
+ alignText?: "left" | "center" | "right";
+};
+
+type Props = OwnProps & typeof Legend.defaultProps;
+
+export default function Legend({ items, alignText }: Props) {
return (
{map(items, (item, index) => (
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'never'. */}
{item.text}
@@ -16,16 +26,6 @@ export default function Legend({ items, alignText }) {
);
}
-Legend.propTypes = {
- items: PropTypes.arrayOf(
- PropTypes.shape({
- color: PropTypes.string.isRequired,
- text: PropTypes.string.isRequired,
- })
- ),
- alignText: PropTypes.oneOf(["left", "center", "right"]),
-};
-
Legend.defaultProps = {
items: [],
alignText: "left",
diff --git a/viz-lib/src/visualizations/choropleth/Renderer/index.jsx b/viz-lib/src/visualizations/choropleth/Renderer/index.tsx
similarity index 61%
rename from viz-lib/src/visualizations/choropleth/Renderer/index.jsx
rename to viz-lib/src/visualizations/choropleth/Renderer/index.tsx
index d656ad034..52d136270 100644
--- a/viz-lib/src/visualizations/choropleth/Renderer/index.jsx
+++ b/viz-lib/src/visualizations/choropleth/Renderer/index.tsx
@@ -8,11 +8,16 @@ import initChoropleth from "./initChoropleth";
import { prepareData } from "./utils";
import "./renderer.less";
-export default function Renderer({ data, options, onOptionsChange }) {
+export default function Renderer({
+ data,
+ options,
+ onOptionsChange
+}: any) {
const [container, setContainer] = useState(null);
const [geoJson] = useLoadGeoJson(options.mapType);
const onBoundsChangeRef = useRef();
- onBoundsChangeRef.current = onOptionsChange ? bounds => onOptionsChange({ ...options, bounds }) : noop;
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '(...args: any[]) => void' is not assignable ... Remove this comment to see the full error message
+ onBoundsChangeRef.current = onOptionsChange ? (bounds: any) => onOptionsChange({ ...options, bounds }) : noop;
const optionsWithoutBounds = useMemoWithDeepCompare(() => omit(options, ["bounds"]), [options]);
@@ -20,7 +25,9 @@ export default function Renderer({ data, options, onOptionsChange }) {
useEffect(() => {
if (container) {
+ // @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'args' implicitly has an 'any[]' ty... Remove this comment to see the full error message
const _map = initChoropleth(container, (...args) => onBoundsChangeRef.current(...args));
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ updateLayers: (geoJson: any, d... Remove this comment to see the full error message
setMap(_map);
return () => {
_map.destroy();
@@ -30,8 +37,10 @@ export default function Renderer({ data, options, onOptionsChange }) {
useEffect(() => {
if (map) {
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
map.updateLayers(
geoJson,
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
prepareData(data.rows, optionsWithoutBounds.keyColumn, optionsWithoutBounds.valueColumn),
options // detect changes for all options except bounds, but pass them all!
);
@@ -41,11 +50,13 @@ export default function Renderer({ data, options, onOptionsChange }) {
// This may come only from editor
useEffect(() => {
if (map) {
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
map.updateBounds(options.bounds);
}
}, [map, options, onOptionsChange]);
return (
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch
>' is not assig... Remove this comment to see the full error message
);
}
diff --git a/viz-lib/src/visualizations/choropleth/Renderer/initChoropleth.js b/viz-lib/src/visualizations/choropleth/Renderer/initChoropleth.tsx
similarity index 72%
rename from viz-lib/src/visualizations/choropleth/Renderer/initChoropleth.js
rename to viz-lib/src/visualizations/choropleth/Renderer/initChoropleth.tsx
index 82e18f1d1..95e689822 100644
--- a/viz-lib/src/visualizations/choropleth/Renderer/initChoropleth.js
+++ b/viz-lib/src/visualizations/choropleth/Renderer/initChoropleth.tsx
@@ -30,11 +30,20 @@ const CustomControl = L.Control.extend({
return div;
},
onRemove() {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'getContainer' does not exist on type '{ ... Remove this comment to see the full error message
ReactDOM.unmountComponentAtNode(this.getContainer());
},
});
-function prepareLayer({ feature, layer, data, options, limits, colors, formatValue }) {
+function prepareLayer({
+ feature,
+ layer,
+ data,
+ options,
+ limits,
+ colors,
+ formatValue
+}: any) {
const value = getValueForFeature(feature, data, options.targetField);
const valueFormatted = formatValue(value);
const featureData = prepareFeatureProperties(feature, valueFormatted, data, options.targetField);
@@ -69,7 +78,7 @@ function prepareLayer({ feature, layer, data, options, limits, colors, formatVal
});
}
-function validateBounds(bounds, fallbackBounds) {
+function validateBounds(bounds: any, fallbackBounds: any) {
if (bounds) {
bounds = L.latLngBounds(bounds[0], bounds[1]);
if (bounds.isValid()) {
@@ -82,7 +91,7 @@ function validateBounds(bounds, fallbackBounds) {
return null;
}
-export default function initChoropleth(container, onBoundsChange) {
+export default function initChoropleth(container: any, onBoundsChange: any) {
const _map = L.map(container, {
center: [0.0, 0.0],
zoom: 1,
@@ -90,16 +99,19 @@ export default function initChoropleth(container, onBoundsChange) {
scrollWheelZoom: false,
maxBoundsViscosity: 1,
attributionControl: false,
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ center: [number, number]; zoom... Remove this comment to see the full error message
fullscreenControl: true,
});
- let _choropleth = null;
+ let _choropleth: any = null;
const _legend = new CustomControl();
function handleMapBoundsChange() {
if (isFunction(onBoundsChange)) {
const bounds = _map.getBounds();
onBoundsChange([
+ // @ts-expect-error ts-migrate(2551) FIXME: Property '_southWest' does not exist on type 'LatL... Remove this comment to see the full error message
[bounds._southWest.lat, bounds._southWest.lng],
+ // @ts-expect-error ts-migrate(2551) FIXME: Property '_northEast' does not exist on type 'LatL... Remove this comment to see the full error message
[bounds._northEast.lat, bounds._northEast.lng],
]);
}
@@ -118,19 +130,23 @@ export default function initChoropleth(container, onBoundsChange) {
boundsChangedFromMap = false;
});
- function updateLayers(geoJson, data, options) {
+ function updateLayers(geoJson: any, data: any, options: any) {
_map.eachLayer(layer => _map.removeLayer(layer));
_map.removeControl(_legend);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'features' does not exist on type 'object... Remove this comment to see the full error message
if (!isObject(geoJson) || !isArray(geoJson.features)) {
_choropleth = null;
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
_map.setMaxBounds(null);
return;
}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'features' does not exist on type 'object... Remove this comment to see the full error message
const { limits, colors, legend } = createScale(geoJson.features, data, options);
const formatValue = createNumberFormatter(options.valueFormat, options.noValuePlaceholder);
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'object' is not assignable to par... Remove this comment to see the full error message
_choropleth = L.geoJSON(geoJson, {
onEachFeature(feature, layer) {
prepareLayer({ feature, layer, data, options, limits, colors, formatValue });
@@ -150,7 +166,9 @@ export default function initChoropleth(container, onBoundsChange) {
_legend.setPosition(options.legend.position.replace("-", ""));
_map.addControl(_legend);
ReactDOM.render(
+ // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
({ ...item, text: formatValue(item.limit) }))}
alignText={options.legend.alignText}
/>,
@@ -159,7 +177,7 @@ export default function initChoropleth(container, onBoundsChange) {
}
}
- function updateBounds(bounds) {
+ function updateBounds(bounds: any) {
if (!boundsChangedFromMap) {
const layerBounds = _choropleth ? _choropleth.getBounds() : _map.getBounds();
bounds = validateBounds(bounds, layerBounds);
diff --git a/viz-lib/src/visualizations/choropleth/Renderer/utils.js b/viz-lib/src/visualizations/choropleth/Renderer/utils.ts
similarity index 68%
rename from viz-lib/src/visualizations/choropleth/Renderer/utils.js
rename to viz-lib/src/visualizations/choropleth/Renderer/utils.ts
index eaa4dbe14..9c574edad 100644
--- a/viz-lib/src/visualizations/choropleth/Renderer/utils.js
+++ b/viz-lib/src/visualizations/choropleth/Renderer/utils.ts
@@ -2,15 +2,15 @@ import { isString, isObject, isFinite, each, map, extend, uniq, filter, first }
import chroma from "chroma-js";
import { createNumberFormatter as createFormatter } from "@/lib/value-format";
-export function darkenColor(color) {
+export function darkenColor(color: any) {
return chroma(color)
.darken()
.hex();
}
-export function createNumberFormatter(format, placeholder) {
+export function createNumberFormatter(format: any, placeholder: any) {
const formatter = createFormatter(format);
- return value => {
+ return (value: any) => {
if (isFinite(value)) {
return formatter(value);
}
@@ -18,7 +18,7 @@ export function createNumberFormatter(format, placeholder) {
};
}
-export function prepareData(data, keyColumn, valueColumn) {
+export function prepareData(data: any, keyColumn: any, valueColumn: any) {
if (!keyColumn || !valueColumn) {
return {};
}
@@ -27,6 +27,7 @@ export function prepareData(data, keyColumn, valueColumn) {
each(data, item => {
if (item[keyColumn]) {
const value = parseFloat(item[valueColumn]);
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[item[keyColumn]] = {
code: item[keyColumn],
value: isFinite(value) ? value : undefined,
@@ -37,17 +38,19 @@ export function prepareData(data, keyColumn, valueColumn) {
return result;
}
-export function prepareFeatureProperties(feature, valueFormatted, data, targetField) {
+export function prepareFeatureProperties(feature: any, valueFormatted: any, data: any, targetField: any) {
const result = {};
each(feature.properties, (value, key) => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result["@@" + key] = value;
});
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result["@@value"] = valueFormatted;
const datum = data[feature.properties[targetField]] || {};
return extend(result, datum.item);
}
-export function getValueForFeature(feature, data, targetField) {
+export function getValueForFeature(feature: any, data: any, targetField: any) {
const code = feature.properties[targetField];
if (isString(code) && isObject(data[code])) {
return data[code].value;
@@ -55,7 +58,7 @@ export function getValueForFeature(feature, data, targetField) {
return undefined;
}
-export function getColorByValue(value, limits, colors, defaultColor) {
+export function getColorByValue(value: any, limits: any, colors: any, defaultColor: any) {
if (isFinite(value)) {
for (let i = 0; i < limits.length; i += 1) {
if (value <= limits[i]) {
@@ -66,7 +69,7 @@ export function getColorByValue(value, limits, colors, defaultColor) {
return defaultColor;
}
-export function createScale(features, data, options) {
+export function createScale(features: any, data: any, options: any) {
// Calculate limits
const values = uniq(
filter(
diff --git a/viz-lib/src/visualizations/choropleth/getOptions.js b/viz-lib/src/visualizations/choropleth/getOptions.ts
similarity index 89%
rename from viz-lib/src/visualizations/choropleth/getOptions.js
rename to viz-lib/src/visualizations/choropleth/getOptions.ts
index 17be8db0c..d9be2af08 100644
--- a/viz-lib/src/visualizations/choropleth/getOptions.js
+++ b/viz-lib/src/visualizations/choropleth/getOptions.ts
@@ -37,13 +37,14 @@ const DEFAULT_OPTIONS = {
},
};
-export default function getOptions(options) {
+export default function getOptions(options: any) {
const result = merge({}, DEFAULT_OPTIONS, options);
// Both renderer and editor always provide new `bounds` array, so no need to clone it here.
// Keeping original object also reduces amount of updates in components
result.bounds = get(options, "bounds");
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (isNil(visualizationsSettings.choroplethAvailableMaps[result.mapType])) {
result.mapType = getDefaultMap();
}
diff --git a/viz-lib/src/visualizations/choropleth/hooks/useLoadGeoJson.js b/viz-lib/src/visualizations/choropleth/hooks/useLoadGeoJson.ts
similarity index 79%
rename from viz-lib/src/visualizations/choropleth/hooks/useLoadGeoJson.js
rename to viz-lib/src/visualizations/choropleth/hooks/useLoadGeoJson.ts
index 0a7e29400..a233702ca 100644
--- a/viz-lib/src/visualizations/choropleth/hooks/useLoadGeoJson.js
+++ b/viz-lib/src/visualizations/choropleth/hooks/useLoadGeoJson.ts
@@ -6,7 +6,7 @@ import createReferenceCountingCache from "@/lib/referenceCountingCache";
const cache = createReferenceCountingCache();
-export default function useLoadGeoJson(mapType) {
+export default function useLoadGeoJson(mapType: any) {
const [geoJson, setGeoJson] = useState(null);
const [isLoading, setIsLoading] = useState(false);
@@ -18,8 +18,11 @@ export default function useLoadGeoJson(mapType) {
let cancelled = false;
const promise = cache.get(mapUrl, () => axios.get(mapUrl).catch(() => null));
- promise.then(({ data }) => {
+ promise.then(({
+ data
+ }: any) => {
if (!cancelled) {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'object | null' is not assignable... Remove this comment to see the full error message
setGeoJson(isObject(data) ? data : null);
setIsLoading(false);
}
diff --git a/viz-lib/src/visualizations/choropleth/index.js b/viz-lib/src/visualizations/choropleth/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/choropleth/index.js
rename to viz-lib/src/visualizations/choropleth/index.ts
diff --git a/viz-lib/src/visualizations/choropleth/maps/convert-projection.js b/viz-lib/src/visualizations/choropleth/maps/convert-projection.ts
similarity index 57%
rename from viz-lib/src/visualizations/choropleth/maps/convert-projection.js
rename to viz-lib/src/visualizations/choropleth/maps/convert-projection.ts
index e0012ab34..afb34aea9 100644
--- a/viz-lib/src/visualizations/choropleth/maps/convert-projection.js
+++ b/viz-lib/src/visualizations/choropleth/maps/convert-projection.ts
@@ -2,31 +2,34 @@
// Usage: `node convert-projection.js > usa-albers.geo.json`
const { each, map, filter } = require("lodash");
+// @ts-expect-error ts-migrate(2403) FIXME: Subsequent variable declarations must have the sam... Remove this comment to see the full error message
const d3 = require("d3");
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'geo' does not exist on type 'typeof impo... Remove this comment to see the full error message
const albersUSA = d3.geo.albersUsa();
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'geo' does not exist on type 'typeof impo... Remove this comment to see the full error message
const mercator = d3.geo.mercator();
const geojson = require("./usa.geo.json");
-function convertPoint(coord) {
+function convertPoint(coord: any) {
const pt = albersUSA(coord);
return pt ? mercator.invert(pt) : null;
}
-function convertLineString(points) {
+function convertLineString(points: any) {
return filter(map(points, convertPoint));
}
-function convertPolygon(polygon) {
+function convertPolygon(polygon: any) {
return map(polygon, convertLineString);
}
-function convertMultiPolygon(multiPolygon) {
+function convertMultiPolygon(multiPolygon: any) {
return map(multiPolygon, convertPolygon);
}
-each(geojson.features, feature => {
+each(geojson.features, (feature: any) => {
switch (feature.geometry.type) {
case "Polygon":
feature.geometry.coordinates = convertPolygon(feature.geometry.coordinates);
diff --git a/viz-lib/src/visualizations/cohort/Cornelius.jsx b/viz-lib/src/visualizations/cohort/Cornelius.tsx
similarity index 62%
rename from viz-lib/src/visualizations/cohort/Cornelius.jsx
rename to viz-lib/src/visualizations/cohort/Cornelius.tsx
index 951af7cde..75a912b2f 100644
--- a/viz-lib/src/visualizations/cohort/Cornelius.jsx
+++ b/viz-lib/src/visualizations/cohort/Cornelius.tsx
@@ -7,7 +7,6 @@ import { isNil, isFinite, map, extend, min, max } from "lodash";
import moment from "moment";
import chroma from "chroma-js";
import React, { useMemo } from "react";
-import PropTypes from "prop-types";
import Tooltip from "antd/lib/tooltip";
import { createNumberFormatter, formatSimpleTemplate } from "@/lib/value-format";
import chooseTextColorForBackground from "@/lib/chooseTextColorForBackground";
@@ -52,13 +51,14 @@ const defaultOptions = {
},
};
-function prepareOptions(options) {
+function prepareOptions(options: any) {
options = extend({}, defaultOptions, options, {
initialDate: moment(options.initialDate),
colors: extend({}, defaultOptions.colors, options.colors),
});
return extend(options, {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
timeLabelFormat: timeLabelFormats[options.timeInterval],
formatNumber: createNumberFormatter(options.numberFormat),
formatPercent: createNumberFormatter(options.percentFormat),
@@ -70,18 +70,19 @@ function prepareOptions(options) {
});
}
-function isLightColor(backgroundColor) {
+function isLightColor(backgroundColor: any) {
backgroundColor = chroma(backgroundColor);
const white = "#ffffff";
const black = "#000000";
return chroma.contrast(backgroundColor, white) < chroma.contrast(backgroundColor, black);
}
-function formatStageTitle(options, index) {
+function formatStageTitle(options: any, index: any) {
return formatSimpleTemplate(options.stageColumnTitle, { "@": options.initialIntervalNumber - 1 + index });
}
-function formatTimeLabel(options, offset) {
+function formatTimeLabel(options: any, offset: any) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const interval = momentInterval[options.timeInterval];
return options.initialDate
.clone()
@@ -89,7 +90,10 @@ function formatTimeLabel(options, offset) {
.format(options.timeLabelFormat);
}
-function CorneliusHeader({ options, maxRowLength }) {
+function CorneliusHeader({
+ options,
+ maxRowLength
+}: any) {
// eslint-disable-line react/prop-types
const cells = [];
for (let i = 1; i < maxRowLength; i += 1) {
@@ -109,7 +113,12 @@ function CorneliusHeader({ options, maxRowLength }) {
);
}
-function CorneliusRow({ options, data, index, maxRowLength }) {
+function CorneliusRow({
+ options,
+ data,
+ index,
+ maxRowLength
+}: any) {
// eslint-disable-line react/prop-types
const baseValue = data[0] || 0;
@@ -120,26 +129,35 @@ function CorneliusRow({ options, data, index, maxRowLength }) {
const cellProps = { key: `col${i}` };
if (isNil(percentageValue)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type '{ key... Remove this comment to see the full error message
cellProps.className = "cornelius-empty";
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type '{ key:... Remove this comment to see the full error message
cellProps.children = options.noValuePlaceholder;
} else {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type '{ key... Remove this comment to see the full error message
cellProps.className = options.displayAbsoluteValues ? "cornelius-absolute" : "cornelius-percentage";
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type '{ key:... Remove this comment to see the full error message
cellProps.children = options.displayAbsoluteValues
? options.formatNumber(value)
: options.formatPercent(percentageValue);
const backgroundColor = options.getColorForValue(percentageValue);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'style' does not exist on type '{ key: st... Remove this comment to see the full error message
cellProps.style = {
backgroundColor,
color: chooseTextColorForBackground(backgroundColor),
};
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'style' does not exist on type '{ key: st... Remove this comment to see the full error message
if (isLightColor(cellProps.style.color)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type '{ key... Remove this comment to see the full error message
cellProps.className += " cornelius-white-text";
}
if (options.rawNumberOnHover && !options.displayAbsoluteValues) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type '{ key:... Remove this comment to see the full error message
cellProps.children = (
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type '{ key:... Remove this comment to see the full error message */}
{cellProps.children}
);
@@ -158,13 +176,42 @@ function CorneliusRow({ options, data, index, maxRowLength }) {
);
}
-export default function Cornelius({ data, options }) {
+type OwnCorneliusProps = {
+ data?: number[][];
+ options?: {
+ initialDate: any; // TODO: PropTypes.instanceOf(Date)
+ timeInterval?: "daily" | "weekly" | "monthly" | "yearly";
+ noValuePlaceholder?: string;
+ rawNumberOnHover?: boolean;
+ displayAbsoluteValues?: boolean;
+ initialIntervalNumber?: number;
+ maxColumns?: number;
+ title?: string;
+ timeColumnTitle?: string;
+ peopleColumnTitle?: string;
+ stageColumnTitle?: string;
+ numberFormat?: string;
+ percentFormat?: string;
+ timeLabelFormat?: string;
+ colors?: {
+ min?: string;
+ max?: string;
+ steps?: number;
+ };
+ };
+};
+
+type CorneliusProps = OwnCorneliusProps & typeof Cornelius.defaultProps;
+
+export default function Cornelius({ data, options }: CorneliusProps) {
options = useMemo(() => prepareOptions(options), [options]);
const maxRowLength = useMemo(
() =>
min([
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'length' does not exist on type 'number'.
max(map(data, d => d.length)) || 0,
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
options.maxColumns + 1, // each row includes totals, but `maxColumns` is only for stage columns
]),
[data, options.maxColumns]
@@ -192,33 +239,6 @@ export default function Cornelius({ data, options }) {
);
}
-Cornelius.propTypes = {
- data: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),
- options: PropTypes.shape({
- initialDate: PropTypes.instanceOf(Date).isRequired,
- timeInterval: PropTypes.oneOf(["daily", "weekly", "monthly", "yearly"]),
- noValuePlaceholder: PropTypes.string,
- rawNumberOnHover: PropTypes.bool,
- displayAbsoluteValues: PropTypes.bool,
- initialIntervalNumber: PropTypes.number,
- maxColumns: PropTypes.number,
-
- title: PropTypes.string,
- timeColumnTitle: PropTypes.string,
- peopleColumnTitle: PropTypes.string,
- stageColumnTitle: PropTypes.string,
- numberFormat: PropTypes.string,
- percentFormat: PropTypes.string,
- timeLabelFormat: PropTypes.string,
-
- colors: PropTypes.shape({
- min: PropTypes.string,
- max: PropTypes.string,
- steps: PropTypes.number,
- }),
- }),
-};
-
Cornelius.defaultProps = {
data: [],
options: {},
diff --git a/viz-lib/src/visualizations/cohort/Editor/AppearanceSettings.jsx b/viz-lib/src/visualizations/cohort/Editor/AppearanceSettings.tsx
similarity index 54%
rename from viz-lib/src/visualizations/cohort/Editor/AppearanceSettings.jsx
rename to viz-lib/src/visualizations/cohort/Editor/AppearanceSettings.tsx
index beda9c741..49c0cc1ad 100644
--- a/viz-lib/src/visualizations/cohort/Editor/AppearanceSettings.jsx
+++ b/viz-lib/src/visualizations/cohort/Editor/AppearanceSettings.tsx
@@ -3,27 +3,33 @@ import { useDebouncedCallback } from "use-debounce";
import { Section, Input, Checkbox, ContextHelp } from "@/components/visualizations/editor";
import { EditorPropTypes } from "@/visualizations/prop-types";
-export default function AppearanceSettings({ options, onOptionsChange }) {
+export default function AppearanceSettings({
+ options,
+ onOptionsChange
+}: any) {
const [debouncedOnOptionsChange] = useDebouncedCallback(onOptionsChange, 200);
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
}
defaultValue={options.stageColumnTitle}
- onChange={e => debouncedOnOptionsChange({ stageColumnTitle: e.target.value })}
+ onChange={(e: any) => debouncedOnOptionsChange({ stageColumnTitle: e.target.value })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { min } })}
+ onChange={(min: any) => onOptionsChange({ colors: { min } })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { max } })}
+ onChange={(max: any) => onOptionsChange({ colors: { max } })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ colors: { steps: validateSteps(value) } })}
+ onChange={(value: any) => onOptionsChange({ colors: { steps: validateSteps(value) } })}
/>
diff --git a/viz-lib/src/visualizations/cohort/Editor/ColumnsSettings.jsx b/viz-lib/src/visualizations/cohort/Editor/ColumnsSettings.jsx
deleted file mode 100644
index 74766bb58..000000000
--- a/viz-lib/src/visualizations/cohort/Editor/ColumnsSettings.jsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import { map } from "lodash";
-import React from "react";
-import { Section, Select } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-export default function ColumnsSettings({ options, data, onOptionsChange }) {
- return (
-
-
- onOptionsChange({ dateColumn })}>
- {map(data.columns, ({ name }) => (
-
- {name}
-
- ))}
-
-
-
-
- onOptionsChange({ stageColumn })}>
- {map(data.columns, ({ name }) => (
-
- {name}
-
- ))}
-
-
-
-
- onOptionsChange({ totalColumn })}>
- {map(data.columns, ({ name }) => (
-
- {name}
-
- ))}
-
-
-
-
- onOptionsChange({ valueColumn })}>
- {map(data.columns, ({ name }) => (
-
- {name}
-
- ))}
-
-
-
- );
-}
-
-ColumnsSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/cohort/Editor/ColumnsSettings.tsx b/viz-lib/src/visualizations/cohort/Editor/ColumnsSettings.tsx
new file mode 100644
index 000000000..be5c08350
--- /dev/null
+++ b/viz-lib/src/visualizations/cohort/Editor/ColumnsSettings.tsx
@@ -0,0 +1,88 @@
+import { map } from "lodash";
+import React from "react";
+import { Section, Select } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+export default function ColumnsSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ dateColumn })}>
+ {map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ stageColumn })}>
+ {map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ totalColumn })}>
+ {map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ valueColumn })}>
+ {map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ );
+}
+
+ColumnsSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/cohort/Editor/OptionsSettings.jsx b/viz-lib/src/visualizations/cohort/Editor/OptionsSettings.tsx
similarity index 51%
rename from viz-lib/src/visualizations/cohort/Editor/OptionsSettings.jsx
rename to viz-lib/src/visualizations/cohort/Editor/OptionsSettings.tsx
index 7d5b0adf4..9224ac828 100644
--- a/viz-lib/src/visualizations/cohort/Editor/OptionsSettings.jsx
+++ b/viz-lib/src/visualizations/cohort/Editor/OptionsSettings.tsx
@@ -14,34 +14,43 @@ const CohortModes = {
simple: "Show data as is",
};
-export default function OptionsSettings({ options, onOptionsChange }) {
+export default function OptionsSettings({
+ options,
+ onOptionsChange
+}: any) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ timeInterval })}>
+ onChange={(timeInterval: any) => onOptionsChange({ timeInterval })}>
{map(CohortTimeIntervals, (name, value) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ mode })}>
+ onChange={(mode: any) => onOptionsChange({ mode })}>
{map(CohortModes, (name, value) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
diff --git a/viz-lib/src/visualizations/cohort/Editor/index.js b/viz-lib/src/visualizations/cohort/Editor/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/cohort/Editor/index.js
rename to viz-lib/src/visualizations/cohort/Editor/index.ts
diff --git a/viz-lib/src/visualizations/cohort/Renderer.jsx b/viz-lib/src/visualizations/cohort/Renderer.tsx
similarity index 94%
rename from viz-lib/src/visualizations/cohort/Renderer.jsx
rename to viz-lib/src/visualizations/cohort/Renderer.tsx
index daec777f0..bd37ae623 100644
--- a/viz-lib/src/visualizations/cohort/Renderer.jsx
+++ b/viz-lib/src/visualizations/cohort/Renderer.tsx
@@ -6,7 +6,10 @@ import "./renderer.less";
import Cornelius from "./Cornelius";
-export default function Renderer({ data, options }) {
+export default function Renderer({
+ data,
+ options
+}: any) {
const { data: cohortData, initialDate } = useMemo(() => prepareData(data, options), [data, options]);
const corneliusOptions = useMemo(
diff --git a/viz-lib/src/visualizations/cohort/getOptions.js b/viz-lib/src/visualizations/cohort/getOptions.ts
similarity index 92%
rename from viz-lib/src/visualizations/cohort/getOptions.js
rename to viz-lib/src/visualizations/cohort/getOptions.ts
index 4c78290b8..4efe2abb5 100644
--- a/viz-lib/src/visualizations/cohort/getOptions.js
+++ b/viz-lib/src/visualizations/cohort/getOptions.ts
@@ -27,6 +27,6 @@ const DEFAULT_OPTIONS = {
},
};
-export default function getOptions(options) {
+export default function getOptions(options: any) {
return merge({}, DEFAULT_OPTIONS, options);
}
diff --git a/viz-lib/src/visualizations/cohort/index.js b/viz-lib/src/visualizations/cohort/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/cohort/index.js
rename to viz-lib/src/visualizations/cohort/index.ts
diff --git a/viz-lib/src/visualizations/cohort/prepareData.js b/viz-lib/src/visualizations/cohort/prepareData.ts
similarity index 68%
rename from viz-lib/src/visualizations/cohort/prepareData.js
rename to viz-lib/src/visualizations/cohort/prepareData.ts
index 1cd199a2b..22324e464 100644
--- a/viz-lib/src/visualizations/cohort/prepareData.js
+++ b/viz-lib/src/visualizations/cohort/prepareData.ts
@@ -7,39 +7,44 @@ const momentInterval = {
monthly: "months",
};
-function groupData(sortedData) {
+function groupData(sortedData: any) {
const result = {};
_.each(sortedData, item => {
const date = moment(item.date);
const groupKey = date.valueOf();
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[groupKey] = result[groupKey] || {
date,
total: parseInt(item.total, 10) || 0,
values: {},
};
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[groupKey].values[item.stage] = parseInt(item.value, 10) || null;
});
return _.values(result);
}
-function prepareDiagonalData(sortedData, options) {
+function prepareDiagonalData(sortedData: any, options: any) {
const timeInterval = options.timeInterval;
const grouped = groupData(sortedData);
const firstStage = _.min(_.map(sortedData, i => i.stage));
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const stageCount = moment(_.last(grouped).date).diff(_.first(grouped).date, momentInterval[timeInterval]);
let lastStage = firstStage + stageCount;
- let previousDate = null;
+ let previousDate: any = null;
- const data = [];
+ const data: any = [];
_.each(grouped, group => {
if (previousDate !== null) {
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
let diff = Math.abs(previousDate.diff(group.date, momentInterval[timeInterval]));
while (diff > 1) {
const row = [0];
for (let stage = firstStage; stage <= lastStage; stage += 1) {
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
row.push(group.values[stage] || 0);
}
data.push(row);
@@ -49,10 +54,13 @@ function prepareDiagonalData(sortedData, options) {
}
}
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
previousDate = group.date;
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const row = [group.total];
for (let stage = firstStage; stage <= lastStage; stage += 1) {
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
row.push(group.values[stage] || 0);
}
// It should be diagonal, so decrease count of stages for each next row
@@ -64,18 +72,19 @@ function prepareDiagonalData(sortedData, options) {
return data;
}
-function prepareSimpleData(sortedData, options) {
+function prepareSimpleData(sortedData: any, options: any) {
const timeInterval = options.timeInterval;
const grouped = groupData(sortedData);
const stages = _.map(sortedData, i => i.stage);
const firstStage = _.min(stages);
const lastStage = _.max(stages);
- let previousDate = null;
+ let previousDate: any = null;
- const data = [];
+ const data: any = [];
_.each(grouped, group => {
if (previousDate !== null) {
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
let diff = Math.abs(previousDate.diff(group.date, momentInterval[timeInterval]));
while (diff > 1) {
data.push([0]);
@@ -83,10 +92,13 @@ function prepareSimpleData(sortedData, options) {
}
}
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
previousDate = group.date;
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const row = [group.total];
for (let stage = firstStage; stage <= lastStage; stage += 1) {
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
row.push(group.values[stage]);
}
@@ -96,7 +108,7 @@ function prepareSimpleData(sortedData, options) {
return data;
}
-function isDataValid(rawData, options) {
+function isDataValid(rawData: any, options: any) {
const columnNames = _.map(rawData.columns, c => c.name);
return (
rawData.rows.length > 0 &&
@@ -107,7 +119,7 @@ function isDataValid(rawData, options) {
);
}
-export default function prepareData(rawData, options) {
+export default function prepareData(rawData: any, options: any) {
if (!isDataValid(rawData, options)) {
return { data: [], initialDate: null };
}
diff --git a/viz-lib/src/visualizations/counter/Editor/FormatSettings.jsx b/viz-lib/src/visualizations/counter/Editor/FormatSettings.jsx
deleted file mode 100644
index 74c84b357..000000000
--- a/viz-lib/src/visualizations/counter/Editor/FormatSettings.jsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import React from "react";
-import { Section, Input, InputNumber, Switch } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-import { isValueNumber } from "../utils";
-
-export default function FormatSettings({ options, data, onOptionsChange }) {
- const inputsEnabled = isValueNumber(data.rows, options);
- return (
-
-
- onOptionsChange({ stringDecimal })}
- />
-
-
-
-
-
-
-
-
-
-
-
- onOptionsChange({ formatTargetValue })}>
- Format Target Value
-
-
-
- );
-}
-
-FormatSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/counter/Editor/FormatSettings.tsx b/viz-lib/src/visualizations/counter/Editor/FormatSettings.tsx
new file mode 100644
index 000000000..2c3891a7b
--- /dev/null
+++ b/viz-lib/src/visualizations/counter/Editor/FormatSettings.tsx
@@ -0,0 +1,92 @@
+import React from "react";
+import { Section, Input, InputNumber, Switch } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+import { isValueNumber } from "../utils";
+
+export default function FormatSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
+ const inputsEnabled = isValueNumber(data.rows, options);
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ stringDecimal })}
+ />
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assi... Remove this comment to see the full error message
+ onChange={(formatTargetValue: any) => onOptionsChange({ formatTargetValue })}>
+ Format Target Value
+
+
+
+ );
+}
+
+FormatSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/counter/Editor/GeneralSettings.jsx b/viz-lib/src/visualizations/counter/Editor/GeneralSettings.jsx
deleted file mode 100644
index 86b70da8e..000000000
--- a/viz-lib/src/visualizations/counter/Editor/GeneralSettings.jsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { map } from "lodash";
-import React from "react";
-import { Section, Select, Input, InputNumber, Switch } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-export default function GeneralSettings({ options, data, visualizationName, onOptionsChange }) {
- return (
-
-
-
-
- onOptionsChange({ counterColName })}>
- {map(data.columns, col => (
-
- {col.name}
-
- ))}
-
-
-
-
- onOptionsChange({ rowNumber })}
- />
-
-
-
- onOptionsChange({ targetColName })}>
- No target value
- {map(data.columns, col => (
-
- {col.name}
-
- ))}
-
-
-
-
- onOptionsChange({ targetRowNumber })}
- />
-
-
-
- onOptionsChange({ countRow })}>
- Count Rows
-
-
-
- );
-}
-
-GeneralSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/counter/Editor/GeneralSettings.tsx b/viz-lib/src/visualizations/counter/Editor/GeneralSettings.tsx
new file mode 100644
index 000000000..c84e7a144
--- /dev/null
+++ b/viz-lib/src/visualizations/counter/Editor/GeneralSettings.tsx
@@ -0,0 +1,105 @@
+import { map } from "lodash";
+import React from "react";
+import { Section, Select, Input, InputNumber, Switch } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+export default function GeneralSettings({
+ options,
+ data,
+ visualizationName,
+ onOptionsChange
+}: any) {
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ counterColName })}>
+ {map(data.columns, col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {col.name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ rowNumber })}
+ />
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ targetColName })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ No target value
+ {map(data.columns, col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {col.name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ targetRowNumber })}
+ />
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ any' is not assignable to... Remove this comment to see the full error message
+ onChange={(countRow: any) => onOptionsChange({ countRow })}>
+ Count Rows
+
+
+
+ );
+}
+
+GeneralSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/counter/Editor/index.js b/viz-lib/src/visualizations/counter/Editor/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/counter/Editor/index.js
rename to viz-lib/src/visualizations/counter/Editor/index.ts
diff --git a/viz-lib/src/visualizations/counter/Renderer.jsx b/viz-lib/src/visualizations/counter/Renderer.tsx
similarity index 63%
rename from viz-lib/src/visualizations/counter/Renderer.jsx
rename to viz-lib/src/visualizations/counter/Renderer.tsx
index ea7cadf14..5ad85eabf 100644
--- a/viz-lib/src/visualizations/counter/Renderer.jsx
+++ b/viz-lib/src/visualizations/counter/Renderer.tsx
@@ -8,7 +8,7 @@ import { getCounterData } from "./utils";
import "./render.less";
-function getCounterStyles(scale) {
+function getCounterStyles(scale: any) {
return {
msTransform: `scale(${scale})`,
MozTransform: `scale(${scale})`,
@@ -17,13 +17,17 @@ function getCounterStyles(scale) {
};
}
-function getCounterScale(container) {
+function getCounterScale(container: any) {
const inner = container.firstChild;
const scale = Math.min(container.offsetWidth / inner.offsetWidth, container.offsetHeight / inner.offsetHeight);
return Number(isFinite(scale) ? scale : 1).toFixed(2); // keep only two decimal places
}
-export default function Renderer({ data, options, visualizationName }) {
+export default function Renderer({
+ data,
+ options,
+ visualizationName
+}: any) {
const [scale, setScale] = useState("1.00");
const [container, setContainer] = useState(null);
@@ -45,12 +49,19 @@ export default function Renderer({ data, options, visualizationName }) {
}, [data, options, container]);
const {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'showTrend' does not exist on type '{}'.
showTrend,
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'trendPositive' does not exist on type '{... Remove this comment to see the full error message
trendPositive,
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValue' does not exist on type '{}... Remove this comment to see the full error message
counterValue,
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValueTooltip' does not exist on t... Remove this comment to see the full error message
counterValueTooltip,
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValue' does not exist on type '{}'... Remove this comment to see the full error message
targetValue,
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValueTooltip' does not exist on ty... Remove this comment to see the full error message
targetValueTooltip,
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterLabel' does not exist on type '{}... Remove this comment to see the full error message
counterLabel,
} = getCounterData(data.rows, options, visualizationName);
return (
@@ -59,6 +70,7 @@ export default function Renderer({ data, options, visualizationName }) {
"trend-positive": showTrend && trendPositive,
"trend-negative": showTrend && !trendPositive,
})}>
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch>' is not assig... Remove this comment to see the full error message */}
diff --git a/viz-lib/src/visualizations/counter/index.js b/viz-lib/src/visualizations/counter/index.ts
similarity index 84%
rename from viz-lib/src/visualizations/counter/index.js
rename to viz-lib/src/visualizations/counter/index.ts
index 22b993226..35c232463 100644
--- a/viz-lib/src/visualizations/counter/index.js
+++ b/viz-lib/src/visualizations/counter/index.ts
@@ -15,7 +15,10 @@ const DEFAULT_OPTIONS = {
export default {
type: "COUNTER",
name: "Counter",
- getOptions: options => ({ ...DEFAULT_OPTIONS, ...options }),
+ getOptions: (options: any) => ({
+ ...DEFAULT_OPTIONS,
+ ...options
+ }),
Renderer,
Editor,
diff --git a/viz-lib/src/visualizations/counter/utils.test.js b/viz-lib/src/visualizations/counter/utils.test.ts
similarity index 99%
rename from viz-lib/src/visualizations/counter/utils.test.js
rename to viz-lib/src/visualizations/counter/utils.test.ts
index 561d4162e..65a7fc34f 100644
--- a/viz-lib/src/visualizations/counter/utils.test.js
+++ b/viz-lib/src/visualizations/counter/utils.test.ts
@@ -1,6 +1,6 @@
import { getCounterData } from "./utils";
-let dummy;
+let dummy: any;
describe("Visualizations -> Counter -> Utils", () => {
beforeEach(() => {
diff --git a/viz-lib/src/visualizations/counter/utils.js b/viz-lib/src/visualizations/counter/utils.ts
similarity index 57%
rename from viz-lib/src/visualizations/counter/utils.js
rename to viz-lib/src/visualizations/counter/utils.ts
index 666bbfe47..04d98f7ea 100644
--- a/viz-lib/src/visualizations/counter/utils.js
+++ b/viz-lib/src/visualizations/counter/utils.ts
@@ -4,7 +4,7 @@ import numeral from "numeral";
// TODO: allow user to specify number format string instead of delimiters only
// It will allow to remove this function (move all that weird formatting logic to a migration
// that will set number format for all existing counter visualization)
-function numberFormat(value, decimalPoints, decimalDelimiter, thousandsDelimiter) {
+function numberFormat(value: any, decimalPoints: any, decimalDelimiter: any, thousandsDelimiter: any) {
// Temporarily update locale data (restore defaults after formatting)
const locale = numeral.localeData();
const savedDelimiters = locale.delimiters;
@@ -42,7 +42,7 @@ function numberFormat(value, decimalPoints, decimalDelimiter, thousandsDelimiter
// 0 - special case, use first record
// 1..N - 1-based record number from beginning (wraps if greater than dataset size)
// -1..-N - 1-based record number from end (wraps if greater than dataset size)
-function getRowNumber(index, rowsCount) {
+function getRowNumber(index: any, rowsCount: any) {
index = parseInt(index, 10) || 0;
if (index === 0) {
return index;
@@ -51,7 +51,13 @@ function getRowNumber(index, rowsCount) {
return index > 0 ? wrappedIndex : rowsCount - wrappedIndex - 1;
}
-function formatValue(value, { stringPrefix, stringSuffix, stringDecimal, stringDecChar, stringThouSep }) {
+function formatValue(value: any, {
+ stringPrefix,
+ stringSuffix,
+ stringDecimal,
+ stringDecChar,
+ stringThouSep
+}: any) {
if (isNumber(value)) {
value = numberFormat(value, stringDecimal, stringDecChar, stringThouSep);
return toString(stringPrefix) + value + toString(stringSuffix);
@@ -59,14 +65,14 @@ function formatValue(value, { stringPrefix, stringSuffix, stringDecimal, stringD
return toString(value);
}
-function formatTooltip(value, formatString) {
+function formatTooltip(value: any, formatString: any) {
if (isNumber(value)) {
return numeral(value).format(formatString);
}
return toString(value);
}
-export function getCounterData(rows, options, visualizationName) {
+export function getCounterData(rows: any, options: any, visualizationName: any) {
const result = {};
const rowsCount = rows.length;
@@ -74,39 +80,55 @@ export function getCounterData(rows, options, visualizationName) {
const counterColName = options.counterColName;
const targetColName = options.targetColName;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterLabel' does not exist on type '{}... Remove this comment to see the full error message
result.counterLabel = options.counterLabel || visualizationName;
if (options.countRow) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValue' does not exist on type '{}... Remove this comment to see the full error message
result.counterValue = rowsCount;
} else if (counterColName) {
const rowNumber = getRowNumber(options.rowNumber, rowsCount);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValue' does not exist on type '{}... Remove this comment to see the full error message
result.counterValue = rows[rowNumber][counterColName];
}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'showTrend' does not exist on type '{}'.
result.showTrend = false;
if (targetColName) {
const targetRowNumber = getRowNumber(options.targetRowNumber, rowsCount);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValue' does not exist on type '{}'... Remove this comment to see the full error message
result.targetValue = rows[targetRowNumber][targetColName];
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValue' does not exist on type '{}... Remove this comment to see the full error message
if (Number.isFinite(result.counterValue) && isFinite(result.targetValue)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValue' does not exist on type '{}... Remove this comment to see the full error message
const delta = result.counterValue - result.targetValue;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'showTrend' does not exist on type '{}'.
result.showTrend = true;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'trendPositive' does not exist on type '{... Remove this comment to see the full error message
result.trendPositive = delta >= 0;
}
} else {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValue' does not exist on type '{}'... Remove this comment to see the full error message
result.targetValue = null;
}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValueTooltip' does not exist on t... Remove this comment to see the full error message
result.counterValueTooltip = formatTooltip(result.counterValue, options.tooltipFormat);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValueTooltip' does not exist on ty... Remove this comment to see the full error message
result.targetValueTooltip = formatTooltip(result.targetValue, options.tooltipFormat);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'counterValue' does not exist on type '{}... Remove this comment to see the full error message
result.counterValue = formatValue(result.counterValue, options);
if (options.formatTargetValue) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValue' does not exist on type '{}'... Remove this comment to see the full error message
result.targetValue = formatValue(result.targetValue, options);
} else {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValue' does not exist on type '{}'... Remove this comment to see the full error message
if (isFinite(result.targetValue)) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'targetValue' does not exist on type '{}'... Remove this comment to see the full error message
result.targetValue = numeral(result.targetValue).format("0[.]00[0]");
}
}
@@ -115,7 +137,7 @@ export function getCounterData(rows, options, visualizationName) {
return result;
}
-export function isValueNumber(rows, options) {
+export function isValueNumber(rows: any, options: any) {
if (options.countRow) {
return true; // array length is always a number
}
diff --git a/viz-lib/src/visualizations/details/DetailsRenderer.jsx b/viz-lib/src/visualizations/details/DetailsRenderer.tsx
similarity index 83%
rename from viz-lib/src/visualizations/details/DetailsRenderer.jsx
rename to viz-lib/src/visualizations/details/DetailsRenderer.tsx
index 92a4493e6..c869cc1a9 100644
--- a/viz-lib/src/visualizations/details/DetailsRenderer.jsx
+++ b/viz-lib/src/visualizations/details/DetailsRenderer.tsx
@@ -8,7 +8,7 @@ import Pagination from "antd/lib/pagination";
import "./details.less";
-function renderValue(value, type) {
+function renderValue(value: any, type: any) {
const formats = {
date: visualizationsSettings.dateFormat,
datetime: visualizationsSettings.dateTimeFormat,
@@ -16,6 +16,7 @@ function renderValue(value, type) {
if (type === "date" || type === "datetime") {
if (moment.isMoment(value)) {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return value.format(formats[type]);
}
}
@@ -23,7 +24,9 @@ function renderValue(value, type) {
return "" + value;
}
-export default function DetailsRenderer({ data }) {
+export default function DetailsRenderer({
+ data
+}: any) {
const [page, setPage] = useState(0);
if (!data || !data.rows || data.rows.length === 0) {
@@ -33,7 +36,7 @@ export default function DetailsRenderer({ data }) {
const types = mapValues(keyBy(data.columns, "name"), "type");
// We use columsn to maintain order of columns in the view.
- const columns = data.columns.map(column => column.name);
+ const columns = data.columns.map((column: any) => column.name);
const row = data.rows[page];
return (
diff --git a/viz-lib/src/visualizations/details/index.js b/viz-lib/src/visualizations/details/index.ts
similarity index 72%
rename from viz-lib/src/visualizations/details/index.js
rename to viz-lib/src/visualizations/details/index.ts
index 207100dc1..27a946c7c 100644
--- a/viz-lib/src/visualizations/details/index.js
+++ b/viz-lib/src/visualizations/details/index.ts
@@ -5,7 +5,10 @@ const DEFAULT_OPTIONS = {};
export default {
type: "DETAILS",
name: "Details View",
- getOptions: options => ({ ...DEFAULT_OPTIONS, ...options }),
+ getOptions: (options: any) => ({
+ ...DEFAULT_OPTIONS,
+ ...options
+ }),
Renderer: DetailsRenderer,
defaultColumns: 2,
defaultRows: 2,
diff --git a/viz-lib/src/visualizations/funnel/Editor/AppearanceSettings.jsx b/viz-lib/src/visualizations/funnel/Editor/AppearanceSettings.tsx
similarity index 58%
rename from viz-lib/src/visualizations/funnel/Editor/AppearanceSettings.jsx
rename to viz-lib/src/visualizations/funnel/Editor/AppearanceSettings.tsx
index 239f54c30..573f2e4f4 100644
--- a/viz-lib/src/visualizations/funnel/Editor/AppearanceSettings.jsx
+++ b/viz-lib/src/visualizations/funnel/Editor/AppearanceSettings.tsx
@@ -3,11 +3,15 @@ import { useDebouncedCallback } from "use-debounce";
import { Section, Input, InputNumber, ContextHelp } from "@/components/visualizations/editor";
import { EditorPropTypes } from "@/visualizations/prop-types";
-export default function AppearanceSettings({ options, onOptionsChange }) {
+export default function AppearanceSettings({
+ options,
+ onOptionsChange
+}: any) {
const [onOptionsChangeDebounced] = useDebouncedCallback(onOptionsChange, 200);
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChangeDebounced({ itemsLimit })}
+ onChange={(itemsLimit: any) => onOptionsChangeDebounced({ itemsLimit })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChangeDebounced({ percentValuesRange: { min } })}
+ onChange={(min: any) => onOptionsChangeDebounced({ percentValuesRange: { min } })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChangeDebounced({ percentValuesRange: { max } })}
+ onChange={(max: any) => onOptionsChangeDebounced({ percentValuesRange: { max } })}
/>
diff --git a/viz-lib/src/visualizations/funnel/Editor/GeneralSettings.jsx b/viz-lib/src/visualizations/funnel/Editor/GeneralSettings.jsx
deleted file mode 100644
index dad4cd1ff..000000000
--- a/viz-lib/src/visualizations/funnel/Editor/GeneralSettings.jsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import { map } from "lodash";
-import React, { useMemo } from "react";
-import { useDebouncedCallback } from "use-debounce";
-import { Section, Select, Input, Checkbox } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-export default function GeneralSettings({ options, data, onOptionsChange }) {
- const columnNames = useMemo(() => map(data.columns, c => c.name), [data]);
-
- const [onOptionsChangeDebounced] = useDebouncedCallback(onOptionsChange, 200);
-
- return (
-
-
- onOptionsChange({ stepCol: { colName: colName || null } })}>
- {map(columnNames, col => (
-
- {col}
-
- ))}
-
-
-
-
-
-
- onOptionsChange({ valueCol: { colName: colName || null } })}>
- {map(columnNames, col => (
-
- {col}
-
- ))}
-
-
-
-
-
-
- onOptionsChange({ autoSort: !event.target.checked })}>
- Custom Sorting
-
-
-
- {!options.autoSort && (
-
-
- onOptionsChange({ sortKeyCol: { colName: colName || null } })}>
- {map(columnNames, col => (
-
- {col}
-
- ))}
-
-
-
-
- onOptionsChange({ sortKeyCol: { reverse: order === "desc" } })}>
-
- ascending
-
-
- descending
-
-
-
-
- )}
-
- );
-}
-
-GeneralSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/funnel/Editor/GeneralSettings.tsx b/viz-lib/src/visualizations/funnel/Editor/GeneralSettings.tsx
new file mode 100644
index 000000000..b9f721757
--- /dev/null
+++ b/viz-lib/src/visualizations/funnel/Editor/GeneralSettings.tsx
@@ -0,0 +1,137 @@
+import { map } from "lodash";
+import React, { useMemo } from "react";
+import { useDebouncedCallback } from "use-debounce";
+import { Section, Select, Input, Checkbox } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+export default function GeneralSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
+ const columnNames = useMemo(() => map(data.columns, c => c.name), [data]);
+
+ const [onOptionsChangeDebounced] = useDebouncedCallback(onOptionsChange, 200);
+
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ stepCol: { colName: colName || null } })}>
+ {map(columnNames, col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {col}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ valueCol: { colName: colName || null } })}>
+ {map(columnNames, col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {col}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ autoSort: !event.target.checked })}>
+ Custom Sorting
+
+
+
+ {!options.autoSort && (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ sortKeyCol: { colName: colName || null } })}>
+ {map(columnNames, col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {col}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ onOptionsChange({ sortKeyCol: { reverse: order === "desc" } })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ascending
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ descending
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+
+
+
+ )}
+
+ );
+}
+
+GeneralSettings.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/funnel/Editor/index.js b/viz-lib/src/visualizations/funnel/Editor/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/funnel/Editor/index.js
rename to viz-lib/src/visualizations/funnel/Editor/index.ts
diff --git a/viz-lib/src/visualizations/funnel/Renderer/FunnelBar.jsx b/viz-lib/src/visualizations/funnel/Renderer/FunnelBar.tsx
similarity index 68%
rename from viz-lib/src/visualizations/funnel/Renderer/FunnelBar.jsx
rename to viz-lib/src/visualizations/funnel/Renderer/FunnelBar.tsx
index d223f5f68..8d6054826 100644
--- a/viz-lib/src/visualizations/funnel/Renderer/FunnelBar.jsx
+++ b/viz-lib/src/visualizations/funnel/Renderer/FunnelBar.tsx
@@ -1,10 +1,19 @@
import React from "react";
-import PropTypes from "prop-types";
import cx from "classnames";
import "./funnel-bar.less";
-export default function FunnelBar({ color, value, align, className, children }) {
+type OwnProps = {
+ color?: string;
+ value?: number;
+ align?: "left" | "center" | "right";
+ className?: string;
+ children?: React.ReactNode;
+};
+
+type Props = OwnProps & typeof FunnelBar.defaultProps;
+
+export default function FunnelBar({ color, value, align, className, children }: Props) {
return (
@@ -13,14 +22,6 @@ export default function FunnelBar({ color, value, align, className, children })
);
}
-FunnelBar.propTypes = {
- color: PropTypes.string,
- value: PropTypes.number,
- align: PropTypes.oneOf(["left", "center", "right"]),
- className: PropTypes.string,
- children: PropTypes.node,
-};
-
FunnelBar.defaultProps = {
color: "#dadada",
value: 0.0,
diff --git a/viz-lib/src/visualizations/funnel/Renderer/index.jsx b/viz-lib/src/visualizations/funnel/Renderer/index.tsx
similarity index 71%
rename from viz-lib/src/visualizations/funnel/Renderer/index.jsx
rename to viz-lib/src/visualizations/funnel/Renderer/index.tsx
index a6e6b85b5..2f30fe860 100644
--- a/viz-lib/src/visualizations/funnel/Renderer/index.jsx
+++ b/viz-lib/src/visualizations/funnel/Renderer/index.tsx
@@ -14,7 +14,10 @@ function generateRowKeyPrefix() {
return Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36) + ":";
}
-export default function Renderer({ data, options }) {
+export default function Renderer({
+ data,
+ options
+}: any) {
const funnelData = useMemo(() => prepareData(data.rows, options), [data, options]);
// eslint-disable-next-line react-hooks/exhaustive-deps
const rowKeyPrefix = useMemo(() => generateRowKeyPrefix(), [funnelData]);
@@ -23,7 +26,7 @@ export default function Renderer({ data, options }) {
const formatPercentValue = useMemo(() => {
const format = createNumberFormatter(options.percentFormat);
- return value => {
+ return (value: any) => {
if (value < options.percentValuesRange.min) {
return `<${format(options.percentValuesRange.min)}`;
}
@@ -39,6 +42,7 @@ export default function Renderer({ data, options }) {
return [];
}
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const maxToPrevious = maxBy(funnelData, d => (isFinite(d.pctPrevious) ? d.pctPrevious : 0)).pctPrevious;
return [
{
@@ -46,18 +50,17 @@ export default function Renderer({ data, options }) {
dataIndex: "step",
width: "25%",
className: "text-ellipsis",
- render: text => (
-
- {text}
-
- ),
+ render: (text: any) =>
+ {text}
+ ,
},
{
title: options.valueCol.displayAs,
dataIndex: "value",
width: "45%",
align: "center",
- render: (value, item) => (
+ render: (value: any, item: any) => (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
{formatValue(value)}
@@ -68,18 +71,17 @@ export default function Renderer({ data, options }) {
dataIndex: "pctMax",
width: "15%",
align: "center",
- render: value => formatPercentValue(value),
+ render: (value: any) => formatPercentValue(value),
},
{
title: "% Previous",
dataIndex: "pctPrevious",
width: "15%",
align: "center",
- render: value => (
-
- {formatPercentValue(value)}
-
- ),
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
+ render: (value: any) =>
+ {formatPercentValue(value)}
+ ,
},
];
}, [options.stepCol.displayAs, options.valueCol.displayAs, funnelData, formatValue, formatPercentValue]);
@@ -91,6 +93,7 @@ export default function Renderer({ data, options }) {
return (
rowKeyPrefix + index}
diff --git a/viz-lib/src/visualizations/funnel/Renderer/prepareData.js b/viz-lib/src/visualizations/funnel/Renderer/prepareData.ts
similarity index 68%
rename from viz-lib/src/visualizations/funnel/Renderer/prepareData.js
rename to viz-lib/src/visualizations/funnel/Renderer/prepareData.ts
index 2872366cd..718d594fe 100644
--- a/viz-lib/src/visualizations/funnel/Renderer/prepareData.js
+++ b/viz-lib/src/visualizations/funnel/Renderer/prepareData.ts
@@ -2,7 +2,7 @@ import { map, maxBy, sortBy, toString } from "lodash";
import moment from "moment";
import { visualizationsSettings } from "@/visualizations/visualizationsSettings";
-function stepValueToString(value) {
+function stepValueToString(value: any) {
if (moment.isMoment(value)) {
const format = visualizationsSettings.dateTimeFormat || "DD/MM/YYYY HH:mm";
return value.format(format);
@@ -10,7 +10,7 @@ function stepValueToString(value) {
return toString(value);
}
-export default function prepareData(rows, options) {
+export default function prepareData(rows: any, options: any) {
if (rows.length === 0 || !options.stepCol.colName || !options.valueCol.colName) {
return [];
}
@@ -28,9 +28,12 @@ export default function prepareData(rows, options) {
value: parseFloat(row[options.valueCol.colName]) || 0.0,
}));
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
const maxVal = maxBy(data, d => d.value).value;
data.forEach((d, i) => {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'pctMax' does not exist on type '{ step: ... Remove this comment to see the full error message
d.pctMax = (d.value / maxVal) * 100.0;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'pctPrevious' does not exist on type '{ s... Remove this comment to see the full error message
d.pctPrevious = i === 0 || d.value === data[i - 1].value ? 100.0 : (d.value / data[i - 1].value) * 100.0;
});
diff --git a/viz-lib/src/visualizations/funnel/getOptions.js b/viz-lib/src/visualizations/funnel/getOptions.ts
similarity index 94%
rename from viz-lib/src/visualizations/funnel/getOptions.js
rename to viz-lib/src/visualizations/funnel/getOptions.ts
index 95392dd1f..41ab44520 100644
--- a/viz-lib/src/visualizations/funnel/getOptions.js
+++ b/viz-lib/src/visualizations/funnel/getOptions.ts
@@ -11,7 +11,9 @@ const DEFAULT_OPTIONS = {
percentFormat: "0[.]00%",
};
-export default function getOptions(options, { columns }) {
+export default function getOptions(options: any, {
+ columns
+}: any) {
options = merge({}, DEFAULT_OPTIONS, options);
// Validate
diff --git a/viz-lib/src/visualizations/funnel/index.js b/viz-lib/src/visualizations/funnel/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/funnel/index.js
rename to viz-lib/src/visualizations/funnel/index.ts
diff --git a/viz-lib/src/visualizations/index.js b/viz-lib/src/visualizations/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/index.js
rename to viz-lib/src/visualizations/index.ts
diff --git a/viz-lib/src/visualizations/map/Editor/FormatSettings.jsx b/viz-lib/src/visualizations/map/Editor/FormatSettings.tsx
similarity index 66%
rename from viz-lib/src/visualizations/map/Editor/FormatSettings.jsx
rename to viz-lib/src/visualizations/map/Editor/FormatSettings.tsx
index 393566f6a..a2e3ae027 100644
--- a/viz-lib/src/visualizations/map/Editor/FormatSettings.jsx
+++ b/viz-lib/src/visualizations/map/Editor/FormatSettings.tsx
@@ -6,6 +6,7 @@ import { EditorPropTypes } from "@/visualizations/prop-types";
function TemplateFormatHint() {
// eslint-disable-line react/prop-types
return (
+ // @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message
All query result columns can be referenced using
{"{{ column_name }}"} syntax.
@@ -15,13 +16,17 @@ function TemplateFormatHint() {
);
}
-export default function FormatSettings({ options, onOptionsChange }) {
+export default function FormatSettings({
+ options,
+ onOptionsChange
+}: any) {
const [onOptionsChangeDebounced] = useDebouncedCallback(onOptionsChange, 200);
const templateFormatHint =
;
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
diff --git a/viz-lib/src/visualizations/map/Editor/GeneralSettings.jsx b/viz-lib/src/visualizations/map/Editor/GeneralSettings.tsx
similarity index 51%
rename from viz-lib/src/visualizations/map/Editor/GeneralSettings.jsx
rename to viz-lib/src/visualizations/map/Editor/GeneralSettings.tsx
index f63cb3e62..d020d9a86 100644
--- a/viz-lib/src/visualizations/map/Editor/GeneralSettings.jsx
+++ b/viz-lib/src/visualizations/map/Editor/GeneralSettings.tsx
@@ -3,11 +3,15 @@ import React, { useMemo } from "react";
import { Section, Select } from "@/components/visualizations/editor";
import { EditorPropTypes } from "@/visualizations/prop-types";
-function getColumns(column, unusedColumns) {
+function getColumns(column: any, unusedColumns: any) {
return filter([column, ...unusedColumns], v => !isNil(v));
}
-export default function GeneralSettings({ options, data, onOptionsChange }) {
+export default function GeneralSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
const unusedColumns = useMemo(
() =>
difference(
@@ -19,34 +23,41 @@ export default function GeneralSettings({ options, data, onOptionsChange }) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ latColName })}>
+ onChange={(latColName: any) => onOptionsChange({ latColName })}>
{map(getColumns(options.latColName, unusedColumns), col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{col}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ lonColName })}>
+ onChange={(lonColName: any) => onOptionsChange({ lonColName })}>
{map(getColumns(options.lonColName, unusedColumns), col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{col}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ classify: column || null })}>
+ onChange={(column: any) => onOptionsChange({ classify: column || null })}>
{map(getColumns(options.classify, unusedColumns), col => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{col}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
diff --git a/viz-lib/src/visualizations/map/Editor/GroupsSettings.jsx b/viz-lib/src/visualizations/map/Editor/GroupsSettings.tsx
similarity index 58%
rename from viz-lib/src/visualizations/map/Editor/GroupsSettings.jsx
rename to viz-lib/src/visualizations/map/Editor/GroupsSettings.tsx
index ecaa505b4..c3bfab05c 100644
--- a/viz-lib/src/visualizations/map/Editor/GroupsSettings.jsx
+++ b/viz-lib/src/visualizations/map/Editor/GroupsSettings.tsx
@@ -7,7 +7,11 @@ import ColorPalette from "@/visualizations/ColorPalette";
import prepareData from "../prepareData";
-export default function GroupsSettings({ options, data, onOptionsChange }) {
+export default function GroupsSettings({
+ options,
+ data,
+ onOptionsChange
+}: any) {
const groups = useMemo(
() => map(prepareData(data, options), ({ name }) => ({ name, color: (options.groups[name] || {}).color || null })),
[data, options]
@@ -43,14 +47,21 @@ export default function GroupsSettings({ options, data, onOptionsChange }) {
title: "Color",
dataIndex: "color",
width: "1%",
- render: (unused, item) => (
+ render: (unused: any, item: any) => (
updateGroupOption(item.name, "color", value)}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '(value: any) => void' is not assignable to t... Remove this comment to see the full error message
+ onChange={(value: any) => updateGroupOption(item.name, "color", value)}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'never'.
addonAfter={ }
/>
),
diff --git a/viz-lib/src/visualizations/map/Editor/StyleSettings.jsx b/viz-lib/src/visualizations/map/Editor/StyleSettings.tsx
similarity index 59%
rename from viz-lib/src/visualizations/map/Editor/StyleSettings.jsx
rename to viz-lib/src/visualizations/map/Editor/StyleSettings.tsx
index 208f3edb8..5bacc17c7 100644
--- a/viz-lib/src/visualizations/map/Editor/StyleSettings.jsx
+++ b/viz-lib/src/visualizations/map/Editor/StyleSettings.tsx
@@ -61,7 +61,7 @@ const CustomColorPalette = {
...ColorPalette,
};
-function getCustomIconOptionFields(iconShape) {
+function getCustomIconOptionFields(iconShape: any) {
switch (iconShape) {
case "doughnut":
return { showIcon: false, showBackgroundColor: true, showBorderColor: true };
@@ -73,7 +73,10 @@ function getCustomIconOptionFields(iconShape) {
}
}
-export default function StyleSettings({ options, onOptionsChange }) {
+export default function StyleSettings({
+ options,
+ onOptionsChange
+}: any) {
const [debouncedOnOptionsChange] = useDebouncedCallback(onOptionsChange, 200);
const { showIcon, showBackgroundColor, showBorderColor } = useMemo(
@@ -85,22 +88,27 @@ export default function StyleSettings({ options, onOptionsChange }) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ mapTileUrl })}>
+ onChange={(mapTileUrl: any) => onOptionsChange({ mapTileUrl })}>
{map(mapTiles, ({ name, url }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
Markers
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
{!isCustomMarkersStyleAllowed && (
+ // @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message
Custom marker styles are not available
@@ -129,41 +139,56 @@ export default function StyleSettings({ options, onOptionsChange }) {
{isCustomMarkersStyleAllowed && options.customizeMarkers && (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
onOptionsChange({ iconShape })}>
+ onChange={(iconShape: any) => onOptionsChange({ iconShape })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Marker + Icon
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Circle
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Circle Dot
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Circle + Icon
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Square Dot
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
Square + Icon
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
{showIcon && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
Icon
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
Enter an icon name from{" "}
@@ -180,12 +205,13 @@ export default function StyleSettings({ options, onOptionsChange }) {
}
data-test="Map.Editor.MarkerIcon"
defaultValue={options.iconFont}
- onChange={event => debouncedOnOptionsChange({ iconFont: event.target.value })}
+ onChange={(event: any) => debouncedOnOptionsChange({ iconFont: event.target.value })}
/>
)}
{showIcon && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ foregroundColor })}
+ onChange={(foregroundColor: any) => onOptionsChange({ foregroundColor })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
)}
{showBackgroundColor && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ backgroundColor })}
+ onChange={(backgroundColor: any) => onOptionsChange({ backgroundColor })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
)}
{showBorderColor && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ borderColor })}
+ onChange={(borderColor: any) => onOptionsChange({ borderColor })}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={ }
/>
diff --git a/viz-lib/src/visualizations/map/Editor/index.js b/viz-lib/src/visualizations/map/Editor/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/map/Editor/index.js
rename to viz-lib/src/visualizations/map/Editor/index.ts
diff --git a/viz-lib/src/visualizations/map/Renderer.jsx b/viz-lib/src/visualizations/map/Renderer.tsx
similarity index 62%
rename from viz-lib/src/visualizations/map/Renderer.jsx
rename to viz-lib/src/visualizations/map/Renderer.tsx
index b2333283a..451360cde 100644
--- a/viz-lib/src/visualizations/map/Renderer.jsx
+++ b/viz-lib/src/visualizations/map/Renderer.tsx
@@ -5,16 +5,21 @@ import { RendererPropTypes } from "@/visualizations/prop-types";
import prepareData from "./prepareData";
import initMap from "./initMap";
-function useMemoWithDeepCompare(create, inputs) {
+function useMemoWithDeepCompare(create: any, inputs: any) {
const valueRef = useRef();
const value = useMemo(create, inputs);
if (!isEqual(value, valueRef.current)) {
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'undefine... Remove this comment to see the full error message
valueRef.current = value;
}
return valueRef.current;
}
-export default function Renderer({ data, options, onOptionsChange }) {
+export default function Renderer({
+ data,
+ options,
+ onOptionsChange
+}: any) {
const [container, setContainer] = useState(null);
const optionsWithoutBounds = useMemoWithDeepCompare(() => omit(options, ["bounds"]), [options]);
@@ -26,6 +31,7 @@ export default function Renderer({ data, options, onOptionsChange }) {
useEffect(() => {
if (container) {
const _map = initMap(container);
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ onBoundsChange: () => void; up... Remove this comment to see the full error message
setMap(_map);
return () => {
_map.destroy();
@@ -35,24 +41,28 @@ export default function Renderer({ data, options, onOptionsChange }) {
useEffect(() => {
if (map) {
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
map.updateLayers(groups, optionsWithoutBounds);
}
}, [map, groups, optionsWithoutBounds]);
useEffect(() => {
if (map) {
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
map.updateBounds(options.bounds);
}
}, [map, options.bounds]);
useEffect(() => {
if (map && onOptionsChange) {
- map.onBoundsChange = bounds => {
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
+ map.onBoundsChange = (bounds: any) => {
onOptionsChange(merge({}, options, { bounds }));
};
}
}, [map, options, onOptionsChange]);
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch
>' is not assig... Remove this comment to see the full error message
return
;
}
diff --git a/viz-lib/src/visualizations/map/getOptions.js b/viz-lib/src/visualizations/map/getOptions.ts
similarity index 93%
rename from viz-lib/src/visualizations/map/getOptions.js
rename to viz-lib/src/visualizations/map/getOptions.ts
index a87209ac4..b8dc804fb 100644
--- a/viz-lib/src/visualizations/map/getOptions.js
+++ b/viz-lib/src/visualizations/map/getOptions.ts
@@ -24,7 +24,7 @@ const DEFAULT_OPTIONS = {
},
};
-export default function getOptions(options) {
+export default function getOptions(options: any) {
options = merge({}, DEFAULT_OPTIONS, options);
options.mapTileUrl = options.mapTileUrl || DEFAULT_OPTIONS.mapTileUrl;
diff --git a/viz-lib/src/visualizations/map/index.js b/viz-lib/src/visualizations/map/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/map/index.js
rename to viz-lib/src/visualizations/map/index.ts
diff --git a/viz-lib/src/visualizations/map/initMap.js b/viz-lib/src/visualizations/map/initMap.ts
similarity index 70%
rename from viz-lib/src/visualizations/map/initMap.js
rename to viz-lib/src/visualizations/map/initMap.ts
index 49952732b..a81dbaa00 100644
--- a/viz-lib/src/visualizations/map/initMap.js
+++ b/viz-lib/src/visualizations/map/initMap.ts
@@ -7,8 +7,11 @@ import "leaflet.markercluster/dist/MarkerCluster.css";
import "leaflet.markercluster/dist/MarkerCluster.Default.css";
import "beautifymarker";
import "beautifymarker/leaflet-beautify-marker-icon.css";
+// @ts-expect-error ts-migrate(2307) FIXME: Cannot find module 'leaflet/dist/images/marker-ico... Remove this comment to see the full error message
import markerIcon from "leaflet/dist/images/marker-icon.png";
+// @ts-expect-error ts-migrate(2307) FIXME: Cannot find module 'leaflet/dist/images/marker-ico... Remove this comment to see the full error message
import markerIconRetina from "leaflet/dist/images/marker-icon-2x.png";
+// @ts-expect-error ts-migrate(2307) FIXME: Cannot find module 'leaflet/dist/images/marker-sha... Remove this comment to see the full error message
import markerShadow from "leaflet/dist/images/marker-shadow.png";
import "leaflet-fullscreen";
import "leaflet-fullscreen/dist/leaflet.fullscreen.css";
@@ -24,6 +27,7 @@ L.Icon.Default.mergeOptions({
shadowUrl: markerShadow,
});
+// @ts-expect-error ts-migrate(2339) FIXME: Property '_getIconUrl' does not exist on type 'Def... Remove this comment to see the full error message
delete L.Icon.Default.prototype._getIconUrl;
const iconAnchors = {
@@ -40,15 +44,17 @@ const popupAnchors = {
circle: [1, -3],
};
-const createHeatpointMarker = (lat, lon, color) =>
+const createHeatpointMarker = (lat: any, lon: any, color: any) =>
L.circleMarker([lat, lon], { fillColor: color, fillOpacity: 0.9, stroke: false });
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'MarkerClusterIcon' does not exist on typ... Remove this comment to see the full error message
L.MarkerClusterIcon = L.DivIcon.extend({
options: {
color: null,
className: "marker-cluster",
iconSize: new L.Point(40, 40),
},
+ // @ts-expect-error ts-migrate(7019) FIXME: Rest parameter 'args' implicitly has an 'any[]' ty... Remove this comment to see the full error message
createIcon(...args) {
const color = chroma(this.options.color);
const textColor = chooseTextColorForBackground(color);
@@ -65,14 +71,24 @@ L.MarkerClusterIcon = L.DivIcon.extend({
return icon;
},
});
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'markerClusterIcon' does not exist on typ... Remove this comment to see the full error message
L.markerClusterIcon = (...args) => new L.MarkerClusterIcon(...args);
-function createIconMarker(lat, lon, { iconShape, iconFont, foregroundColor, backgroundColor, borderColor }) {
+function createIconMarker(lat: any, lon: any, {
+ iconShape,
+ iconFont,
+ foregroundColor,
+ backgroundColor,
+ borderColor
+}: any) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'BeautifyIcon' does not exist on type 'ty... Remove this comment to see the full error message
const icon = L.BeautifyIcon.icon({
iconShape,
icon: iconFont,
iconSize: iconShape === "rectangle" ? [22, 22] : false,
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
iconAnchor: iconAnchors[iconShape],
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
popupAnchor: popupAnchors[iconShape],
prefix: "fa",
textColor: foregroundColor,
@@ -83,15 +99,20 @@ function createIconMarker(lat, lon, { iconShape, iconFont, foregroundColor, back
return L.marker([lat, lon], { icon });
}
-function createMarkerClusterGroup(color) {
+function createMarkerClusterGroup(color: any) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'markerClusterGroup' does not exist on ty... Remove this comment to see the full error message
return L.markerClusterGroup({
- iconCreateFunction(cluster) {
+ iconCreateFunction(cluster: any) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'markerClusterIcon' does not exist on typ... Remove this comment to see the full error message
return L.markerClusterIcon({ color, html: cluster.getChildCount() });
},
});
}
-function createMarkersLayer(options, { color, points }) {
+function createMarkersLayer(options: any, {
+ color,
+ points
+}: any) {
const { classify, clusterMarkers, customizeMarkers } = options;
const result = clusterMarkers ? createMarkerClusterGroup(color) : L.featureGroup();
@@ -141,11 +162,12 @@ function createMarkersLayer(options, { color, points }) {
return result;
}
-export default function initMap(container) {
+export default function initMap(container: any) {
const _map = L.map(container, {
center: [0.0, 0.0],
zoom: 1,
scrollWheelZoom: false,
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ center: [number, number]; zoom... Remove this comment to see the full error message
fullscreenControl: true,
});
const _tileLayer = L.tileLayer("//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
@@ -158,6 +180,7 @@ export default function initMap(container) {
let boundsChangedFromMap = false;
const onMapMoveEnd = () => {
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 0 arguments, but got 1.
onBoundsChange(_map.getBounds());
};
_map.on("focus", () => {
@@ -169,7 +192,7 @@ export default function initMap(container) {
boundsChangedFromMap = false;
});
- function updateLayers(groups, options) {
+ function updateLayers(groups: any, options: any) {
_tileLayer.setUrl(options.mapTileUrl);
_markerLayers.eachLayer(layer => {
@@ -191,7 +214,7 @@ export default function initMap(container) {
}
}
- function updateBounds(bounds) {
+ function updateBounds(bounds: any) {
if (!boundsChangedFromMap) {
bounds = bounds
? L.latLngBounds([bounds._southWest.lat, bounds._southWest.lng], [bounds._northEast.lat, bounds._northEast.lng])
diff --git a/viz-lib/src/visualizations/map/prepareData.js b/viz-lib/src/visualizations/map/prepareData.ts
similarity index 80%
rename from viz-lib/src/visualizations/map/prepareData.js
rename to viz-lib/src/visualizations/map/prepareData.ts
index c61fcfdbf..50d797540 100644
--- a/viz-lib/src/visualizations/map/prepareData.js
+++ b/viz-lib/src/visualizations/map/prepareData.ts
@@ -1,7 +1,8 @@
import d3 from "d3";
import { isNil, extend, map, filter, groupBy, omit } from "lodash";
-export default function prepareData(data, options) {
+export default function prepareData(data: any, options: any) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const colorScale = d3.scale.category10();
const { classify, latColName, lonColName } = options;
diff --git a/viz-lib/src/visualizations/pivot/Editor.jsx b/viz-lib/src/visualizations/pivot/Editor.jsx
deleted file mode 100644
index 53eba4e5e..000000000
--- a/viz-lib/src/visualizations/pivot/Editor.jsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { merge } from "lodash";
-import React from "react";
-import { Section, Switch } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-export default function Editor({ options, onOptionsChange }) {
- const updateOptions = updates => {
- onOptionsChange(merge({}, options, updates));
- };
-
- return (
-
-
- updateOptions({ controls: { enabled: !enabled } })}>
- Show Pivot Controls
-
-
-
- updateOptions({ rendererOptions: { table: { rowTotals } } })}>
- Show Row Totals
-
-
-
- updateOptions({ rendererOptions: { table: { colTotals } } })}>
- Show Column Totals
-
-
-
- );
-}
-
-Editor.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/pivot/Editor.tsx b/viz-lib/src/visualizations/pivot/Editor.tsx
new file mode 100644
index 000000000..92954222c
--- /dev/null
+++ b/viz-lib/src/visualizations/pivot/Editor.tsx
@@ -0,0 +1,61 @@
+import { merge } from "lodash";
+import React from "react";
+import { Section, Switch } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+export default function Editor({
+ options,
+ onOptionsChange
+}: any) {
+ const updateOptions = (updates: any) => {
+ onOptionsChange(merge({}, options, updates));
+ };
+
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ void' is not assignable to... Remove this comment to see the full error message
+ onChange={(enabled: any) => updateOptions({ controls: { enabled: !enabled } })}>
+ Show Pivot Controls
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ void' is not assignable ... Remove this comment to see the full error message
+ onChange={(rowTotals: any) => updateOptions({ rendererOptions: { table: { rowTotals } } })}>
+ Show Row Totals
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ void' is not assignable ... Remove this comment to see the full error message
+ onChange={(colTotals: any) => updateOptions({ rendererOptions: { table: { colTotals } } })}>
+ Show Column Totals
+
+
+
+ );
+}
+
+Editor.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/pivot/Renderer.jsx b/viz-lib/src/visualizations/pivot/Renderer.tsx
similarity index 85%
rename from viz-lib/src/visualizations/pivot/Renderer.jsx
rename to viz-lib/src/visualizations/pivot/Renderer.tsx
index dcc8207f0..cde949014 100644
--- a/viz-lib/src/visualizations/pivot/Renderer.jsx
+++ b/viz-lib/src/visualizations/pivot/Renderer.tsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect, useMemo } from "react";
import { get, find, pick, map, mapValues } from "lodash";
+// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'reac... Remove this comment to see the full error message
import PivotTableUI from "react-pivottable/PivotTableUI";
import { RendererPropTypes } from "@/visualizations/prop-types";
import { formatColumnValue } from "@/lib/utils";
@@ -27,11 +28,18 @@ const VALID_OPTIONS = [
"rendererOptions",
];
-function formatRows({ rows, columns }) {
+function formatRows({
+ rows,
+ columns
+}: any) {
return map(rows, row => mapValues(row, (value, key) => formatColumnValue(value, find(columns, { name: key }).type)));
}
-export default function Renderer({ data, options, onOptionsChange }) {
+export default function Renderer({
+ data,
+ options,
+ onOptionsChange
+}: any) {
const [config, setConfig] = useState({ ...options });
const dataRows = useMemo(() => formatRows(data), [data]);
@@ -39,7 +47,7 @@ export default function Renderer({ data, options, onOptionsChange }) {
setConfig({ ...options });
}, [options]);
- const onChange = updatedOptions => {
+ const onChange = (updatedOptions: any) => {
const validOptions = pick(updatedOptions, VALID_OPTIONS);
setConfig({ ...validOptions });
onOptionsChange(validOptions);
diff --git a/viz-lib/src/visualizations/pivot/index.js b/viz-lib/src/visualizations/pivot/index.ts
similarity index 86%
rename from viz-lib/src/visualizations/pivot/index.js
rename to viz-lib/src/visualizations/pivot/index.ts
index 992bfbaf1..afba7151f 100644
--- a/viz-lib/src/visualizations/pivot/index.js
+++ b/viz-lib/src/visualizations/pivot/index.ts
@@ -18,7 +18,7 @@ const DEFAULT_OPTIONS = {
export default {
type: "PIVOT",
name: "Pivot Table",
- getOptions: options => merge({}, DEFAULT_OPTIONS, options),
+ getOptions: (options: any) => merge({}, DEFAULT_OPTIONS, options),
Renderer,
Editor,
diff --git a/viz-lib/src/visualizations/prop-types.js b/viz-lib/src/visualizations/prop-types.js
deleted file mode 100644
index 49074c1e9..000000000
--- a/viz-lib/src/visualizations/prop-types.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import PropTypes from "prop-types";
-
-const VisualizationOptions = PropTypes.object; // eslint-disable-line react/forbid-prop-types
-
-const Data = PropTypes.shape({
- columns: PropTypes.arrayOf(PropTypes.object).isRequired,
- rows: PropTypes.arrayOf(PropTypes.object).isRequired,
-});
-
-export const VisualizationType = PropTypes.shape({
- id: PropTypes.number,
- type: PropTypes.string.isRequired,
- name: PropTypes.string.isRequired,
- options: VisualizationOptions.isRequired, // eslint-disable-line react/forbid-prop-types
-});
-
-// For each visualization's renderer
-export const RendererPropTypes = {
- visualizationName: PropTypes.string,
- data: Data.isRequired,
- options: VisualizationOptions.isRequired,
- onOptionsChange: PropTypes.func, // (newOptions) => void
-};
-
-// For each visualization's editor
-export const EditorPropTypes = {
- visualizationName: PropTypes.string,
- data: Data.isRequired,
- options: VisualizationOptions.isRequired,
- onOptionsChange: PropTypes.func.isRequired, // (newOptions) => void
-};
diff --git a/viz-lib/src/visualizations/prop-types.ts b/viz-lib/src/visualizations/prop-types.ts
new file mode 100644
index 000000000..c1ce10ec7
--- /dev/null
+++ b/viz-lib/src/visualizations/prop-types.ts
@@ -0,0 +1,46 @@
+import PropTypes from "prop-types";
+
+const VisualizationOptions = PropTypes.object;
+type VisualizationOptions = any;
+
+type Data = {
+ columns: any[];
+ rows: any[];
+}; // eslint-disable-line react/forbid-prop-types
+
+const Data: PropTypes.Requireable = PropTypes.shape({
+ columns: PropTypes.arrayOf(PropTypes.object).isRequired,
+ rows: PropTypes.arrayOf(PropTypes.object).isRequired,
+});
+
+type VisualizationType = {
+ id?: number;
+ type: string;
+ name: string;
+ options: VisualizationOptions;
+};
+
+// @ts-expect-error ts-migrate(2322) FIXME: Type 'Requireable = PropTypes.shape({
+ id: PropTypes.number,
+ type: PropTypes.string.isRequired,
+ name: PropTypes.string.isRequired,
+ options: VisualizationOptions.isRequired,
+});
+export { VisualizationType };
+
+// For each visualization's renderer
+export const RendererPropTypes = {
+ visualizationName: PropTypes.string,
+ data: Data.isRequired,
+ options: VisualizationOptions.isRequired,
+ onOptionsChange: PropTypes.func, // (newOptions) => void
+};
+
+// For each visualization's editor
+export const EditorPropTypes = {
+ visualizationName: PropTypes.string,
+ data: Data.isRequired,
+ options: VisualizationOptions.isRequired,
+ onOptionsChange: PropTypes.func.isRequired, // (newOptions) => void
+};
diff --git a/viz-lib/src/visualizations/registeredVisualizations.js b/viz-lib/src/visualizations/registeredVisualizations.ts
similarity index 53%
rename from viz-lib/src/visualizations/registeredVisualizations.js
rename to viz-lib/src/visualizations/registeredVisualizations.ts
index 3d09afc81..15a0419bd 100644
--- a/viz-lib/src/visualizations/registeredVisualizations.js
+++ b/viz-lib/src/visualizations/registeredVisualizations.ts
@@ -15,34 +15,51 @@ import sunburstVisualization from "./sunburst";
import tableVisualization from "./table";
import wordCloudVisualization from "./word-cloud";
-const VisualizationConfig = PropTypes.shape({
- type: PropTypes.string.isRequired,
- name: PropTypes.string.isRequired,
- getOptions: PropTypes.func.isRequired, // (existingOptions: object, data: { columns[], rows[] }) => object
- isDefault: PropTypes.bool,
- isDeprecated: PropTypes.bool,
- Renderer: PropTypes.func.isRequired,
- Editor: PropTypes.func,
+type VisualizationConfig = {
+ type: string;
+ name: string;
+ getOptions: (...args: any[]) => any;
+ isDefault?: boolean;
+ isDeprecated?: boolean;
+ Renderer: (...args: any[]) => any;
+ Editor?: (...args: any[]) => any;
+ autoHeight?: boolean;
+ defaultRows?: number;
+ defaultColumns?: number;
+ minRows?: number;
+ maxRows?: number;
+ minColumns?: number;
+ maxColumns?: number;
+};
- // other config options
- autoHeight: PropTypes.bool,
- defaultRows: PropTypes.number,
- defaultColumns: PropTypes.number,
- minRows: PropTypes.number,
- maxRows: PropTypes.number,
- minColumns: PropTypes.number,
- maxColumns: PropTypes.number,
+// @ts-expect-error ts-migrate(2322) FIXME: Type 'Requireable = PropTypes.shape({
+ type: PropTypes.string.isRequired,
+ name: PropTypes.string.isRequired,
+ getOptions: PropTypes.func.isRequired,
+ isDefault: PropTypes.bool,
+ isDeprecated: PropTypes.bool,
+ Renderer: PropTypes.func.isRequired,
+ Editor: PropTypes.func,
+ // other config options
+ autoHeight: PropTypes.bool,
+ defaultRows: PropTypes.number,
+ defaultColumns: PropTypes.number,
+ minRows: PropTypes.number,
+ maxRows: PropTypes.number,
+ minColumns: PropTypes.number,
+ maxColumns: PropTypes.number,
});
const registeredVisualizations = {};
-function validateVisualizationConfig(config) {
+function validateVisualizationConfig(config: any) {
const typeSpecs = { config: VisualizationConfig };
const values = { config };
PropTypes.checkPropTypes(typeSpecs, values, "prop", "registerVisualization");
}
-function registerVisualization(config) {
+function registerVisualization(config: any) {
validateVisualizationConfig(config);
config = {
Editor: () => null,
@@ -50,10 +67,12 @@ function registerVisualization(config) {
isDefault: config.isDefault && !config.isDeprecated,
};
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (registeredVisualizations[config.type]) {
throw new Error(`Visualization ${config.type} already registered.`);
}
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
registeredVisualizations[config.type] = config;
}
@@ -81,12 +100,15 @@ export default registeredVisualizations;
export function getDefaultVisualization() {
// return any visualization explicitly marked as default, or any non-deprecated otherwise
return (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'isDefault' does not exist on type 'never... Remove this comment to see the full error message
find(registeredVisualizations, visualization => visualization.isDefault) ||
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'isDeprecated' does not exist on type 'ne... Remove this comment to see the full error message
find(registeredVisualizations, visualization => !visualization.isDeprecated)
);
}
export function newVisualization(type = null, options = {}) {
+ // @ts-expect-error ts-migrate(2538) FIXME: Type 'null' cannot be used as an index type.
const visualization = type ? registeredVisualizations[type] : getDefaultVisualization();
return {
type: visualization.type,
diff --git a/viz-lib/src/visualizations/sankey/Editor.jsx b/viz-lib/src/visualizations/sankey/Editor.tsx
similarity index 100%
rename from viz-lib/src/visualizations/sankey/Editor.jsx
rename to viz-lib/src/visualizations/sankey/Editor.tsx
diff --git a/viz-lib/src/visualizations/sankey/Renderer.jsx b/viz-lib/src/visualizations/sankey/Renderer.tsx
similarity index 77%
rename from viz-lib/src/visualizations/sankey/Renderer.jsx
rename to viz-lib/src/visualizations/sankey/Renderer.tsx
index 2511eb9ca..9d9e2cbf1 100644
--- a/viz-lib/src/visualizations/sankey/Renderer.jsx
+++ b/viz-lib/src/visualizations/sankey/Renderer.tsx
@@ -5,7 +5,9 @@ import { RendererPropTypes } from "@/visualizations/prop-types";
import initSankey from "./initSankey";
import "./renderer.less";
-export default function Renderer({ data }) {
+export default function Renderer({
+ data
+}: any) {
const [container, setContainer] = useState(null);
const render = useMemo(() => initSankey(data), [data]);
@@ -20,6 +22,7 @@ export default function Renderer({ data }) {
}
}, [container, render]);
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch>' is not assig... Remove this comment to see the full error message
return
;
}
diff --git a/viz-lib/src/visualizations/sankey/d3sankey.js b/viz-lib/src/visualizations/sankey/d3sankey.ts
similarity index 62%
rename from viz-lib/src/visualizations/sankey/d3sankey.js
rename to viz-lib/src/visualizations/sankey/d3sankey.ts
index 1ee9baac3..6fc05ddb5 100644
--- a/viz-lib/src/visualizations/sankey/d3sankey.js
+++ b/viz-lib/src/visualizations/sankey/d3sankey.ts
@@ -2,11 +2,11 @@
import d3 from "d3";
-function center(node) {
+function center(node: any) {
return node.y + node.dy / 2;
}
-function value(link) {
+function value(link: any) {
return link.value;
}
@@ -15,16 +15,18 @@ function Sankey() {
let nodeWidth = 24;
let nodePadding = 8;
let size = [1, 1];
- let nodes = [];
- let links = [];
+ let nodes: any = [];
+ let links: any = [];
// Populate the sourceLinks and targetLinks for each node.
// Also, if the source and target are not objects, assume they are indices.
function computeNodeLinks() {
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
nodes.forEach(node => {
node.sourceLinks = [];
node.targetLinks = [];
});
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'link' implicitly has an 'any' type.
links.forEach(link => {
let source = link.source;
let target = link.target;
@@ -37,12 +39,14 @@ function Sankey() {
// Compute the value (size) of each node by summing the associated links.
function computeNodeValues() {
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
nodes.forEach(node => {
node.value = Math.max(d3.sum(node.sourceLinks, value), d3.sum(node.targetLinks, value));
});
}
- function moveSinksRight(x) {
+ function moveSinksRight(x: any) {
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
nodes.forEach(node => {
if (!node.sourceLinks.length) {
node.x = x - 1;
@@ -50,7 +54,8 @@ function Sankey() {
});
}
- function scaleNodeBreadths(kx) {
+ function scaleNodeBreadths(kx: any) {
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
nodes.forEach(node => {
node.x *= kx;
});
@@ -62,13 +67,13 @@ function Sankey() {
// nodes with no outgoing links are assigned the maximum breadth.
function computeNodeBreadths() {
let remainingNodes = nodes;
- let nextNodes;
+ let nextNodes: any;
let x = 0;
- function assignBreadth(node) {
+ function assignBreadth(node: any) {
node.x = x;
node.dx = nodeWidth;
- node.sourceLinks.forEach(link => {
+ node.sourceLinks.forEach((link: any) => {
if (nextNodes.indexOf(link.target) < 0) {
nextNodes.push(link.target);
}
@@ -84,42 +89,48 @@ function Sankey() {
moveSinksRight(x);
x = Math.max(
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
d3.max(nodes, n => n.x),
2
); // get new maximum x value (min 2)
scaleNodeBreadths((size[0] - nodeWidth) / (x - 1));
}
- function computeNodeDepths(iterations) {
+ function computeNodeDepths(iterations: any) {
const nodesByBreadth = d3
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'nest' does not exist on type 'typeof imp... Remove this comment to see the full error message
.nest()
- .key(d => d.x)
+ .key((d: any) => d.x)
.sortKeys(d3.ascending)
.entries(nodes)
- .map(d => d.values);
+ .map((d: any) => d.values);
function initializeNodeDepth() {
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const ky = d3.min(nodesByBreadth, n => (size[1] - (n.length - 1) * nodePadding) / d3.sum(n, value));
- nodesByBreadth.forEach(n => {
- n.forEach((node, i) => {
+ nodesByBreadth.forEach((n: any) => {
+ n.forEach((node: any, i: any) => {
node.y = i;
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
node.dy = node.value * ky;
});
});
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'link' implicitly has an 'any' type.
links.forEach(link => {
+ // @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
link.dy = link.value * ky;
});
}
- function relaxLeftToRight(alpha) {
- function weightedSource(link) {
+ function relaxLeftToRight(alpha: any) {
+ function weightedSource(link: any) {
return center(link.source) * link.value;
}
- nodesByBreadth.forEach(n => {
- n.forEach(node => {
+ nodesByBreadth.forEach((n: any) => {
+ n.forEach((node: any) => {
if (node.targetLinks.length) {
const y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value);
node.y += (y - center(node)) * alpha;
@@ -129,7 +140,7 @@ function Sankey() {
}
function resolveCollisions() {
- nodesByBreadth.forEach(nodes => {
+ nodesByBreadth.forEach((nodes: any) => {
const n = nodes.length;
let node;
let dy;
@@ -171,12 +182,12 @@ function Sankey() {
resolveCollisions();
}
- function relaxRightToLeft(alpha) {
+ function relaxRightToLeft(alpha: any) {
nodesByBreadth
.slice()
.reverse()
- .forEach(nodes => {
- nodes.forEach(node => {
+ .forEach((nodes: any) => {
+ nodes.forEach((node: any) => {
if (node.sourceLinks.length) {
const y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value);
node.y += (y - center(node)) * alpha;
@@ -184,74 +195,82 @@ function Sankey() {
});
});
- function weightedTarget(link) {
+ function weightedTarget(link: any) {
return center(link.target) * link.value;
}
}
- function ascendingDepth(a, b) {
+ function ascendingDepth(a: any, b: any) {
return a.y - b.y;
}
}
function computeLinkDepths() {
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
nodes.forEach(node => {
node.sourceLinks.sort(ascendingTargetDepth);
node.targetLinks.sort(ascendingSourceDepth);
});
+ // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
nodes.forEach(node => {
let sy = 0,
ty = 0;
- node.sourceLinks.forEach(link => {
+ node.sourceLinks.forEach((link: any) => {
link.sy = sy;
sy += link.dy;
});
- node.targetLinks.forEach(link => {
+ node.targetLinks.forEach((link: any) => {
link.ty = ty;
ty += link.dy;
});
});
- function ascendingSourceDepth(a, b) {
+ function ascendingSourceDepth(a: any, b: any) {
return a.source.y - b.source.y;
}
- function ascendingTargetDepth(a, b) {
+ function ascendingTargetDepth(a: any, b: any) {
return a.target.y - b.target.y;
}
}
- sankey.nodeWidth = function(_) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'nodeWidth' does not exist on type '{}'.
+ sankey.nodeWidth = function(_: any) {
if (!arguments.length) return nodeWidth;
nodeWidth = +_;
return sankey;
};
- sankey.nodePadding = function(_) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'nodePadding' does not exist on type '{}'... Remove this comment to see the full error message
+ sankey.nodePadding = function(_: any) {
if (!arguments.length) return nodePadding;
nodePadding = +_;
return sankey;
};
- sankey.nodes = function(_) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'nodes' does not exist on type '{}'.
+ sankey.nodes = function(_: any) {
if (!arguments.length) return nodes;
nodes = _;
return sankey;
};
- sankey.links = function(_) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'links' does not exist on type '{}'.
+ sankey.links = function(_: any) {
if (!arguments.length) return links;
links = _;
return sankey;
};
- sankey.size = function(_) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'size' does not exist on type '{}'.
+ sankey.size = function(_: any) {
if (!arguments.length) return size;
size = _;
return sankey;
};
- sankey.layout = function(iterations) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'layout' does not exist on type '{}'.
+ sankey.layout = function(iterations: any) {
computeNodeLinks();
computeNodeValues();
computeNodeBreadths();
@@ -260,15 +279,17 @@ function Sankey() {
return sankey;
};
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'relayout' does not exist on type '{}'.
sankey.relayout = function() {
computeLinkDepths();
return sankey;
};
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'link' does not exist on type '{}'.
sankey.link = function() {
let curvature = 0.5;
- function link(d) {
+ function link(d: any) {
const x0 = d.source.x + d.source.dx;
const x1 = d.target.x;
const xi = d3.interpolateNumber(x0, x1);
@@ -280,7 +301,7 @@ function Sankey() {
return `M${x0},${y0}C${x2},${y0} ${x3},${y1} ${x1},${y1}`;
}
- link.curvature = _ => {
+ link.curvature = (_: any) => {
if (!arguments.length) return curvature;
curvature = +_;
return link;
diff --git a/viz-lib/src/visualizations/sankey/index.js b/viz-lib/src/visualizations/sankey/index.ts
similarity index 74%
rename from viz-lib/src/visualizations/sankey/index.js
rename to viz-lib/src/visualizations/sankey/index.ts
index 689380f3f..b744d83a8 100644
--- a/viz-lib/src/visualizations/sankey/index.js
+++ b/viz-lib/src/visualizations/sankey/index.ts
@@ -4,7 +4,9 @@ import Editor from "./Editor";
export default {
type: "SANKEY",
name: "Sankey",
- getOptions: options => ({ ...options }),
+ getOptions: (options: any) => ({
+ ...options
+ }),
Renderer,
Editor,
diff --git a/viz-lib/src/visualizations/sankey/initSankey.js b/viz-lib/src/visualizations/sankey/initSankey.ts
similarity index 64%
rename from viz-lib/src/visualizations/sankey/initSankey.js
rename to viz-lib/src/visualizations/sankey/initSankey.ts
index 6eb0a1f72..3a1e30fb6 100644
--- a/viz-lib/src/visualizations/sankey/initSankey.js
+++ b/viz-lib/src/visualizations/sankey/initSankey.ts
@@ -2,28 +2,28 @@ import { isNil, map, extend, sortBy, includes, filter, reduce, find, keys, value
import d3 from "d3";
import d3sankey from "./d3sankey";
-function getConnectedNodes(node) {
+function getConnectedNodes(node: any) {
// source link = this node is the source, I need the targets
- const nodes = [];
- node.sourceLinks.forEach(link => {
+ const nodes: any = [];
+ node.sourceLinks.forEach((link: any) => {
nodes.push(link.target);
});
- node.targetLinks.forEach(link => {
+ node.targetLinks.forEach((link: any) => {
nodes.push(link.source);
});
return nodes;
}
-function graph(data) {
+function graph(data: any) {
const nodesDict = {};
const links = {};
- const nodes = [];
+ const nodes: any = [];
- const validKey = key => key !== "value";
+ const validKey = (key: any) => key !== "value";
const dataKeys = sortBy(filter(keys(data[0]), validKey), identity);
- function normalizeName(name) {
+ function normalizeName(name: any) {
if (!isNil(name)) {
return "" + name;
}
@@ -31,29 +31,33 @@ function graph(data) {
return "Exit";
}
- function getNode(name, level) {
+ function getNode(name: any, level: any) {
name = normalizeName(name);
const key = `${name}:${String(level)}`;
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
let node = nodesDict[key];
if (!node) {
node = { name };
node.id = nodes.push(node) - 1;
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
nodesDict[key] = node;
}
return node;
}
- function getLink(source, target) {
+ function getLink(source: any, target: any) {
+ // @ts-expect-error ts-migrate(2538) FIXME: Type 'any[]' cannot be used as an index type.
let link = links[[source, target]];
if (!link) {
link = { target, source, value: 0 };
+ // @ts-expect-error ts-migrate(2538) FIXME: Type 'any[]' cannot be used as an index type.
links[[source, target]] = link;
}
return link;
}
- function addLink(sourceName, targetName, value, depth) {
+ function addLink(sourceName: any, targetName: any, value: any, depth: any) {
if ((sourceName === "" || !sourceName) && depth > 1) {
return;
}
@@ -64,7 +68,7 @@ function graph(data) {
link.value += parseInt(value, 10);
}
- data.forEach(row => {
+ data.forEach((row: any) => {
addLink(row[dataKeys[0]], row[dataKeys[1]], row.value || 0, 1);
addLink(row[dataKeys[1]], row[dataKeys[2]], row.value || 0, 2);
addLink(row[dataKeys[2]], row[dataKeys[3]], row.value || 0, 3);
@@ -72,6 +76,7 @@ function graph(data) {
addLink(row[dataKeys[4]], null, row.value || 0, 5); // this line ensures that the last stage has a corresponding exit node
});
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const color = d3.scale.category20();
return {
@@ -80,19 +85,21 @@ function graph(data) {
};
}
-function spreadNodes(height, data) {
+function spreadNodes(height: any, data: any) {
const nodesByBreadth = d3
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'nest' does not exist on type 'typeof imp... Remove this comment to see the full error message
.nest()
- .key(d => d.x)
+ .key((d: any) => d.x)
.entries(data.nodes)
- .map(d => d.values);
+ .map((d: any) => d.values);
- nodesByBreadth.forEach(nodes => {
+ nodesByBreadth.forEach((nodes: any) => {
nodes = filter(
sortBy(nodes, node => -node.value),
node => node.name !== "Exit"
);
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const sum = d3.sum(nodes, o => o.dy);
const padding = (height - sum) / nodes.length;
@@ -107,14 +114,14 @@ function spreadNodes(height, data) {
});
}
-function isDataValid(data) {
+function isDataValid(data: any) {
// data should contain column named 'value', otherwise no reason to render anything at all
return data && !!find(data.columns, c => c.name === "value");
}
-export default function initSankey(data) {
+export default function initSankey(data: any) {
if (!isDataValid(data)) {
- return element => {
+ return (element: any) => {
d3.select(element)
.selectAll("*")
.remove();
@@ -122,9 +129,9 @@ export default function initSankey(data) {
}
data = graph(data.rows);
- const format = d => d3.format(",.0f")(d); // TODO: editor option ?
+ const format = (d: any) => d3.format(",.0f")(d); // TODO: editor option ?
- return element => {
+ return (element: any) => {
d3.select(element)
.selectAll("*")
.remove();
@@ -154,6 +161,7 @@ export default function initSankey(data) {
// Set the sankey diagram properties
const sankey = d3sankey()
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'nodeWidth' does not exist on type '{}'.
.nodeWidth(15)
.nodePadding(10)
.size([width, height]);
@@ -175,13 +183,17 @@ export default function initSankey(data) {
.data(data.links)
.enter()
.append("path")
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.filter(l => l.target.name !== "Exit")
.attr("class", "link")
.attr("d", path)
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.style("stroke-width", d => Math.max(1, d.dy))
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.sort((a, b) => b.dy - a.dy);
// add the link titles
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
link.append("title").text(d => `${d.source.name} → ${d.target.name}\n${format(d.value)}`);
const node = svg
@@ -190,11 +202,13 @@ export default function initSankey(data) {
.data(data.nodes)
.enter()
.append("g")
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.filter(n => n.name !== "Exit")
.attr("class", "node")
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.attr("transform", d => `translate(${d.x},${d.y})`);
- function nodeMouseOver(currentNode) {
+ function nodeMouseOver(currentNode: any) {
let nodes = getConnectedNodes(currentNode);
nodes = map(nodes, i => i.id);
node
@@ -202,6 +216,7 @@ export default function initSankey(data) {
if (d === currentNode) {
return false;
}
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
return !includes(nodes, d.id);
})
.style("opacity", 0.2);
@@ -219,24 +234,32 @@ export default function initSankey(data) {
node.on("mouseover", nodeMouseOver).on("mouseout", nodeMouseOut);
// add the rectangles for the nodes
+ // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
node
.append("rect")
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.attr("height", d => d.dy)
.attr("width", sankey.nodeWidth())
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.style("fill", d => d.color)
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.style("stroke", d => d3.rgb(d.color).darker(2))
.append("title")
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.text(d => `${d.name}\n${format(d.value)}`);
// add in the title for the nodes
node
.append("text")
.attr("x", -6)
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.attr("y", d => d.dy / 2)
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.text(d => d.name)
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.filter(d => d.x < width / 2)
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
diff --git a/viz-lib/src/visualizations/sunburst/Editor.jsx b/viz-lib/src/visualizations/sunburst/Editor.tsx
similarity index 82%
rename from viz-lib/src/visualizations/sunburst/Editor.jsx
rename to viz-lib/src/visualizations/sunburst/Editor.tsx
index 2d9ed8737..1babae09e 100644
--- a/viz-lib/src/visualizations/sunburst/Editor.jsx
+++ b/viz-lib/src/visualizations/sunburst/Editor.tsx
@@ -5,6 +5,7 @@ export default function Editor() {
return (
This visualization expects the query result to have rows in one of the following formats:
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
Option 1:
@@ -24,6 +25,7 @@ export default function Editor() {
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
Option 2:
diff --git a/viz-lib/src/visualizations/sunburst/Renderer.jsx b/viz-lib/src/visualizations/sunburst/Renderer.tsx
similarity index 77%
rename from viz-lib/src/visualizations/sunburst/Renderer.jsx
rename to viz-lib/src/visualizations/sunburst/Renderer.tsx
index c701a42d8..b0f613189 100644
--- a/viz-lib/src/visualizations/sunburst/Renderer.jsx
+++ b/viz-lib/src/visualizations/sunburst/Renderer.tsx
@@ -5,7 +5,9 @@ import { RendererPropTypes } from "@/visualizations/prop-types";
import initSunburst from "./initSunburst";
import "./renderer.less";
-export default function Renderer({ data }) {
+export default function Renderer({
+ data
+}: any) {
const [container, setContainer] = useState(null);
const render = useMemo(() => initSunburst(data), [data]);
@@ -20,6 +22,7 @@ export default function Renderer({ data }) {
}
}, [container, render]);
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch>' is not assig... Remove this comment to see the full error message
return
;
}
diff --git a/viz-lib/src/visualizations/sunburst/index.js b/viz-lib/src/visualizations/sunburst/index.ts
similarity index 76%
rename from viz-lib/src/visualizations/sunburst/index.js
rename to viz-lib/src/visualizations/sunburst/index.ts
index 580a7e45f..d12f51008 100644
--- a/viz-lib/src/visualizations/sunburst/index.js
+++ b/viz-lib/src/visualizations/sunburst/index.ts
@@ -4,7 +4,9 @@ import Editor from "./Editor";
export default {
type: "SUNBURST_SEQUENCE",
name: "Sunburst Sequence",
- getOptions: options => ({ ...options }),
+ getOptions: (options: any) => ({
+ ...options
+ }),
Renderer,
Editor,
diff --git a/viz-lib/src/visualizations/sunburst/initSunburst.js b/viz-lib/src/visualizations/sunburst/initSunburst.ts
similarity index 72%
rename from viz-lib/src/visualizations/sunburst/initSunburst.js
rename to viz-lib/src/visualizations/sunburst/initSunburst.ts
index 450c7a206..b44c59de0 100644
--- a/viz-lib/src/visualizations/sunburst/initSunburst.js
+++ b/viz-lib/src/visualizations/sunburst/initSunburst.ts
@@ -6,15 +6,16 @@ import * as d3 from "d3";
import { has, map, keys, groupBy, sortBy, filter, find, compact, first, every, identity } from "lodash";
const exitNode = "<<>>";
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const colors = d3.scale.category10();
// helper function colorMap - color gray if "end" is detected
-function colorMap(d) {
+function colorMap(d: any) {
return colors(d.name);
}
// Return array of ancestors of nodes, highest first, but excluding the root.
-function getAncestors(node) {
+function getAncestors(node: any) {
const path = [];
let current = node;
@@ -25,7 +26,7 @@ function getAncestors(node) {
return path;
}
-function buildNodesFromHierarchyData(data) {
+function buildNodesFromHierarchyData(data: any) {
const grouped = groupBy(data, "sequence");
return map(grouped, value => {
@@ -38,8 +39,8 @@ function buildNodesFromHierarchyData(data) {
});
}
-function buildNodesFromTableData(data) {
- const validKey = key => key !== "value";
+function buildNodesFromTableData(data: any) {
+ const validKey = (key: any) => key !== "value";
const dataKeys = sortBy(filter(keys(data[0]), validKey), identity);
return map(data, (row, sequence) => ({
@@ -49,12 +50,12 @@ function buildNodesFromTableData(data) {
}));
}
-function isDataInHierarchyFormat(data) {
+function isDataInHierarchyFormat(data: any) {
const firstRow = first(data);
return every(["sequence", "stage", "node", "value"], field => has(firstRow, field));
}
-function buildHierarchy(data) {
+function buildHierarchy(data: any) {
data = isDataInHierarchyFormat(data) ? buildNodesFromHierarchyData(data) : buildNodesFromTableData(data);
// build tree
@@ -63,7 +64,7 @@ function buildHierarchy(data) {
children: [],
};
- data.forEach(d => {
+ data.forEach((d: any) => {
const nodes = d.nodes;
const size = parseInt(d.size, 10);
@@ -77,33 +78,43 @@ function buildHierarchy(data) {
if (!children) {
currentNode.children = children = [];
children.push({
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'never'.
name: exitNode,
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'any' is not assignable to type 'never'.
size: currentNode.size,
});
}
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'name' does not exist on type 'never'.
let childNode = find(children, child => child.name === nodeName);
if (isLeaf && childNode) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type 'never'... Remove this comment to see the full error message
childNode.children = childNode.children || [];
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type 'never'... Remove this comment to see the full error message
childNode.children.push({
name: exitNode,
size,
});
} else if (isLeaf) {
children.push({
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'any' is not assignable to type 'never'.
name: nodeName,
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'number' is not assignable to type 'never'.
size,
});
} else {
if (!childNode) {
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '{ name: any; children: never[]; }' is not as... Remove this comment to see the full error message
childNode = {
name: nodeName,
children: [],
};
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'undefined' is not assignable to ... Remove this comment to see the full error message
children.push(childNode);
}
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'undefined' is not assignable to type '{ name... Remove this comment to see the full error message
currentNode = childNode;
}
}
@@ -112,13 +123,13 @@ function buildHierarchy(data) {
return root;
}
-function isDataValid(data) {
+function isDataValid(data: any) {
return data && data.rows.length > 0;
}
-export default function initSunburst(data) {
+export default function initSunburst(data: any) {
if (!isDataValid(data)) {
- return element => {
+ return (element: any) => {
d3.select(element)
.selectAll("*")
.remove();
@@ -127,7 +138,7 @@ export default function initSunburst(data) {
data = buildHierarchy(data.rows);
- return element => {
+ return (element: any) => {
d3.select(element)
.selectAll("*")
.remove();
@@ -163,18 +174,20 @@ export default function initSunburst(data) {
let totalSize = 0;
// create d3.layout.partition
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'layout' does not exist on type 'typeof i... Remove this comment to see the full error message
const partition = d3.layout
.partition()
.size([2 * Math.PI, radius * radius])
- .value(d => d.size);
+ .value((d: any) => d.size);
// create arcs for drawing D3 paths
const arc = d3.svg
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'arc' does not exist on type '(url: strin... Remove this comment to see the full error message
.arc()
- .startAngle(d => d.x)
- .endAngle(d => d.x + d.dx)
- .innerRadius(d => Math.sqrt(d.y))
- .outerRadius(d => Math.sqrt(d.y + d.dy));
+ .startAngle((d: any) => d.x)
+ .endAngle((d: any) => d.x + d.dx)
+ .innerRadius((d: any) => Math.sqrt(d.y))
+ .outerRadius((d: any) => Math.sqrt(d.y + d.dy));
/**
* Define and initialize D3 select references and div-containers
@@ -212,7 +225,7 @@ export default function initSunburst(data) {
const lastCrumb = breadcrumbs.append("text").classed("lastCrumb", true);
// Generate a string representation for drawing a breadcrumb polygon.
- function breadcrumbPoints(d, i) {
+ function breadcrumbPoints(d: any, i: any) {
const points = [];
points.push("0,0");
points.push(`${b.w},0`);
@@ -228,8 +241,9 @@ export default function initSunburst(data) {
}
// Update the breadcrumb breadcrumbs to show the current sequence and percentage.
- function updateBreadcrumbs(ancestors, percentageString) {
+ function updateBreadcrumbs(ancestors: any, percentageString: any) {
// Data join, where primary key = name + depth.
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
const g = breadcrumbs.selectAll("g").data(ancestors, d => d.name + d.depth);
// Add breadcrumb and label for entering nodes.
@@ -249,6 +263,7 @@ export default function initSunburst(data) {
.attr("dy", "0.35em")
.attr("font-size", "10px")
.attr("text-anchor", "middle")
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.text(d => d.name);
// Set position for entering and updating nodes.
@@ -270,10 +285,11 @@ export default function initSunburst(data) {
// helper function mouseover to handle mouseover events/animations and calculation
// of ancestor nodes etc
- function mouseover(d) {
+ function mouseover(d: any) {
// build percentage string
const percentage = ((100 * d.value) / totalSize).toPrecision(3);
let percentageString = `${percentage}%`;
+ // @ts-expect-error ts-migrate(2365) FIXME: Operator '<' cannot be applied to types 'string' a... Remove this comment to see the full error message
if (percentage < 1) {
percentageString = "< 1.0%";
}
@@ -310,7 +326,9 @@ export default function initSunburst(data) {
.transition()
.duration(1000)
.attr("opacity", 1)
+ // @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 2.
.each("end", function endClick() {
+ // @ts-expect-error ts-migrate(2683) FIXME: 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
d3.select(this).on("mouseover", mouseover);
});
@@ -321,12 +339,12 @@ export default function initSunburst(data) {
// Build only nodes of a threshold "visible" sizes to improve efficiency
// 0.005 radians = 0.29 degrees
- const nodes = partition.nodes(data).filter(d => d.dx > 0.005 && d.name !== exitNode);
+ const nodes = partition.nodes(data).filter((d: any) => d.dx > 0.005 && d.name !== exitNode);
// this section is required to update the colors.domain() every time the data updates
const uniqueNames = (function uniqueNames(a) {
- const output = [];
- a.forEach(d => {
+ const output: any = [];
+ a.forEach((d: any) => {
if (output.indexOf(d.name) === -1) output.push(d.name);
});
return output;
@@ -341,6 +359,7 @@ export default function initSunburst(data) {
.enter()
.append("path")
.classed("nodePath", true)
+ // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
.attr("display", d => (d.depth ? null : "none"))
.attr("d", arc)
.attr("fill", colorMap)
@@ -352,6 +371,7 @@ export default function initSunburst(data) {
vis.on("click", click);
// Update totalSize of the tree = value of root node from partition.
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
totalSize = path.node().__data__.value;
};
}
diff --git a/viz-lib/src/visualizations/table/Editor/ColumnEditor.jsx b/viz-lib/src/visualizations/table/Editor/ColumnEditor.jsx
deleted file mode 100644
index 8d736d431..000000000
--- a/viz-lib/src/visualizations/table/Editor/ColumnEditor.jsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { map, keys } from "lodash";
-import React from "react";
-import { useDebouncedCallback } from "use-debounce";
-import PropTypes from "prop-types";
-import * as Grid from "antd/lib/grid";
-import { Section, Select, Input, Checkbox, TextAlignmentSelect } from "@/components/visualizations/editor";
-
-import ColumnTypes from "../columns";
-
-export default function ColumnEditor({ column, onChange }) {
- function handleChange(changes) {
- onChange({ ...column, ...changes });
- }
-
- const [handleChangeDebounced] = useDebouncedCallback(handleChange, 200);
-
- const AdditionalOptions = ColumnTypes[column.displayAs].Editor || null;
-
- return (
-
-
-
-
- handleChange({ allowSearch: event.target.checked })}>
- Use for search
-
-
-
-
-
-
- handleChange({ displayAs })}>
- {map(ColumnTypes, ({ friendlyName }, key) => (
-
- {friendlyName}
-
- ))}
-
-
-
- {AdditionalOptions &&
}
-
- );
-}
-
-ColumnEditor.propTypes = {
- column: PropTypes.shape({
- name: PropTypes.string.isRequired,
- title: PropTypes.string,
- visible: PropTypes.bool,
- alignContent: PropTypes.oneOf(["left", "center", "right"]),
- displayAs: PropTypes.oneOf(keys(ColumnTypes)),
- }).isRequired,
- onChange: PropTypes.func,
-};
-
-ColumnEditor.defaultProps = {
- onChange: () => {},
-};
diff --git a/viz-lib/src/visualizations/table/Editor/ColumnEditor.tsx b/viz-lib/src/visualizations/table/Editor/ColumnEditor.tsx
new file mode 100644
index 000000000..992cbc797
--- /dev/null
+++ b/viz-lib/src/visualizations/table/Editor/ColumnEditor.tsx
@@ -0,0 +1,100 @@
+import { map, keys } from "lodash";
+import React from "react";
+import { useDebouncedCallback } from "use-debounce";
+import * as Grid from "antd/lib/grid";
+import { Section, Select, Input, Checkbox, TextAlignmentSelect } from "@/components/visualizations/editor";
+
+import ColumnTypes from "../columns";
+
+type OwnProps = {
+ column: {
+ name: string;
+ title?: string;
+ visible?: boolean;
+ alignContent?: "left" | "center" | "right";
+ displayAs?: any; // TODO: PropTypes.oneOf(keys(ColumnTypes))
+ };
+ onChange?: (...args: any[]) => any;
+};
+
+type Props = OwnProps & typeof ColumnEditor.defaultProps;
+
+export default function ColumnEditor({ column, onChange }: Props) {
+ function handleChange(changes: any) {
+ onChange({ ...column, ...changes });
+ }
+
+ const [handleChangeDebounced] = useDebouncedCallback(handleChange, 200);
+
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ const AdditionalOptions = ColumnTypes[column.displayAs].Editor || null;
+
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ handleChange({ allowSearch: event.target.checked })}>
+ Use for search
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ handleChange({ displayAs })}>
+ {map(ColumnTypes, ({ friendlyName }, key) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {friendlyName}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+
+ {AdditionalOptions &&
}
+
+ );
+}
+
+ColumnEditor.defaultProps = {
+ onChange: () => {},
+};
diff --git a/viz-lib/src/visualizations/table/Editor/ColumnsSettings.test.js b/viz-lib/src/visualizations/table/Editor/ColumnsSettings.test.tsx
similarity index 95%
rename from viz-lib/src/visualizations/table/Editor/ColumnsSettings.test.js
rename to viz-lib/src/visualizations/table/Editor/ColumnsSettings.test.tsx
index 4540157fb..741f8a1c4 100644
--- a/viz-lib/src/visualizations/table/Editor/ColumnsSettings.test.js
+++ b/viz-lib/src/visualizations/table/Editor/ColumnsSettings.test.tsx
@@ -4,11 +4,11 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import ColumnsSettings from "./ColumnsSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(options, done) {
+function mount(options: any, done: any) {
const data = {
columns: [{ name: "a", type: "string" }],
rows: [{ a: "test" }],
diff --git a/viz-lib/src/visualizations/table/Editor/ColumnsSettings.jsx b/viz-lib/src/visualizations/table/Editor/ColumnsSettings.tsx
similarity index 79%
rename from viz-lib/src/visualizations/table/Editor/ColumnsSettings.jsx
rename to viz-lib/src/visualizations/table/Editor/ColumnsSettings.tsx
index f5ebaef4e..f0fc24245 100644
--- a/viz-lib/src/visualizations/table/Editor/ColumnsSettings.jsx
+++ b/viz-lib/src/visualizations/table/Editor/ColumnsSettings.tsx
@@ -3,6 +3,7 @@ import React from "react";
import Collapse from "antd/lib/collapse";
import Tooltip from "antd/lib/tooltip";
import Typography from "antd/lib/typography";
+// @ts-expect-error ts-migrate(2724) FIXME: Module '"../../../../node_modules/react-sortable-h... Remove this comment to see the full error message
import { sortableElement } from "react-sortable-hoc";
import { SortableContainer, DragHandle } from "@/components/sortable";
import { EditorPropTypes } from "@/visualizations/prop-types";
@@ -16,8 +17,11 @@ const { Text } = Typography;
const SortableItem = sortableElement(Collapse.Panel);
-export default function ColumnsSettings({ options, onOptionsChange }) {
- function handleColumnChange(newColumn, event) {
+export default function ColumnsSettings({
+ options,
+ onOptionsChange
+}: any) {
+ function handleColumnChange(newColumn: any, event: any) {
if (event) {
event.stopPropagation();
}
@@ -25,7 +29,10 @@ export default function ColumnsSettings({ options, onOptionsChange }) {
onOptionsChange({ columns });
}
- function handleColumnsReorder({ oldIndex, newIndex }) {
+ function handleColumnsReorder({
+ oldIndex,
+ newIndex
+ }: any) {
const columns = [...options.columns];
columns.splice(newIndex, 0, ...columns.splice(oldIndex, 1));
onOptionsChange({ columns });
@@ -37,11 +44,12 @@ export default function ColumnsSettings({ options, onOptionsChange }) {
lockAxis="y"
useDragHandle
helperClass="table-editor-columns-dragged-item"
- helperContainer={container => container.firstChild}
+ helperContainer={(container: any) => container.firstChild}
onSortEnd={handleColumnsReorder}
containerProps={{
className: "table-visualization-editor-columns",
}}>
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
{map(options.columns, (column, index) => (
}>
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type '(newColumn: any, event: any) => void' is not... Remove this comment to see the full error message */}
))}
diff --git a/viz-lib/src/visualizations/table/Editor/GridSettings.test.js b/viz-lib/src/visualizations/table/Editor/GridSettings.test.tsx
similarity index 90%
rename from viz-lib/src/visualizations/table/Editor/GridSettings.test.js
rename to viz-lib/src/visualizations/table/Editor/GridSettings.test.tsx
index 81922dd0b..70ad9e3f5 100644
--- a/viz-lib/src/visualizations/table/Editor/GridSettings.test.js
+++ b/viz-lib/src/visualizations/table/Editor/GridSettings.test.tsx
@@ -4,11 +4,11 @@ import enzyme from "enzyme";
import getOptions from "../getOptions";
import GridSettings from "./GridSettings";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(options, done) {
+function mount(options: any, done: any) {
const data = { columns: [], rows: [] };
options = getOptions(options, data);
return enzyme.mount(
diff --git a/viz-lib/src/visualizations/table/Editor/GridSettings.jsx b/viz-lib/src/visualizations/table/Editor/GridSettings.tsx
similarity index 53%
rename from viz-lib/src/visualizations/table/Editor/GridSettings.jsx
rename to viz-lib/src/visualizations/table/Editor/GridSettings.tsx
index 4b26c24d1..95b8d6b83 100644
--- a/viz-lib/src/visualizations/table/Editor/GridSettings.jsx
+++ b/viz-lib/src/visualizations/table/Editor/GridSettings.tsx
@@ -5,17 +5,23 @@ import { EditorPropTypes } from "@/visualizations/prop-types";
const ALLOWED_ITEM_PER_PAGE = [5, 10, 15, 20, 25, 50, 100, 150, 200, 250, 500];
-export default function GridSettings({ options, onOptionsChange }) {
+export default function GridSettings({
+ options,
+ onOptionsChange
+}: any) {
return (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
onOptionsChange({ itemsPerPage })}>
+ onChange={(itemsPerPage: any) => onOptionsChange({ itemsPerPage })}>
{map(ALLOWED_ITEM_PER_PAGE, value => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
{value}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
))}
diff --git a/viz-lib/src/visualizations/table/Editor/__snapshots__/ColumnsSettings.test.js.snap b/viz-lib/src/visualizations/table/Editor/__snapshots__/ColumnsSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/Editor/__snapshots__/ColumnsSettings.test.js.snap
rename to viz-lib/src/visualizations/table/Editor/__snapshots__/ColumnsSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/Editor/__snapshots__/GridSettings.test.js.snap b/viz-lib/src/visualizations/table/Editor/__snapshots__/GridSettings.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/Editor/__snapshots__/GridSettings.test.js.snap
rename to viz-lib/src/visualizations/table/Editor/__snapshots__/GridSettings.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/Editor/index.jsx b/viz-lib/src/visualizations/table/Editor/index.tsx
similarity index 100%
rename from viz-lib/src/visualizations/table/Editor/index.jsx
rename to viz-lib/src/visualizations/table/Editor/index.tsx
diff --git a/viz-lib/src/visualizations/table/Renderer.jsx b/viz-lib/src/visualizations/table/Renderer.tsx
similarity index 65%
rename from viz-lib/src/visualizations/table/Renderer.jsx
rename to viz-lib/src/visualizations/table/Renderer.tsx
index 55e0c0a34..1014a556e 100644
--- a/viz-lib/src/visualizations/table/Renderer.jsx
+++ b/viz-lib/src/visualizations/table/Renderer.tsx
@@ -1,6 +1,5 @@
import { filter, map, get, initial, last, reduce } from "lodash";
import React, { useMemo, useState, useEffect } from "react";
-import PropTypes from "prop-types";
import Table from "antd/lib/table";
import Input from "antd/lib/input";
import InfoCircleFilledIcon from "@ant-design/icons/InfoCircleFilled";
@@ -11,13 +10,16 @@ import { prepareColumns, initRows, filterRows, sortRows } from "./utils";
import "./renderer.less";
-function joinColumns(array, separator = ", ") {
+function joinColumns(array: any, separator = ", ") {
return reduce(
array,
(result, item, index) => {
+ // @ts-expect-error ts-migrate(2365) FIXME: Operator '>' cannot be applied to types 'string' a... Remove this comment to see the full error message
if (index > 0) {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
result.push(separator);
}
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'any' is not assignable to parame... Remove this comment to see the full error message
result.push(item);
return result;
},
@@ -25,7 +27,7 @@ function joinColumns(array, separator = ", ") {
);
}
-function getSearchColumns(columns, { limit = Infinity, renderColumn = col => col.title } = {}) {
+function getSearchColumns(columns: any, { limit = Infinity, renderColumn = (col: any) => col.title } = {}) {
const firstColumns = map(columns.slice(0, limit), col => renderColumn(col));
const restColumns = map(columns.slice(limit), col => col.title);
if (restColumns.length > 0) {
@@ -37,7 +39,9 @@ function getSearchColumns(columns, { limit = Infinity, renderColumn = col => col
return firstColumns;
}
-function SearchInputInfoIcon({ searchColumns }) {
+function SearchInputInfoIcon({
+ searchColumns
+}: any) {
return (
any;
+};
+
+type SearchInputProps = OwnSearchInputProps & typeof SearchInput.defaultProps;
+
+// @ts-expect-error ts-migrate(2339) FIXME: Property 'searchColumns' does not exist on type 'S... Remove this comment to see the full error message
+function SearchInput({ searchColumns, ...props }: SearchInputProps) {
if (searchColumns.length <= 0) {
return null;
}
@@ -67,15 +78,14 @@ function SearchInput({ searchColumns, ...props }) {
);
}
-SearchInput.propTypes = {
- onChange: PropTypes.func,
-};
-
SearchInput.defaultProps = {
onChange: () => {},
};
-export default function Renderer({ options, data }) {
+export default function Renderer({
+ options,
+ data
+}: any) {
const [searchTerm, setSearchTerm] = useState("");
const [orderBy, setOrderBy] = useState([]);
@@ -84,11 +94,13 @@ export default function Renderer({ options, data }) {
const tableColumns = useMemo(() => {
const searchInput =
searchColumns.length > 0 ? (
- setSearchTerm(event.target.value)} />
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '(event: any) => void' is not assignable to t... Remove this comment to see the full error message
+ setSearchTerm(event.target.value)} />
) : null;
- return prepareColumns(options.columns, searchInput, orderBy, newOrderBy => {
+ return prepareColumns(options.columns, searchInput, orderBy, (newOrderBy: any) => {
setOrderBy(newOrderBy);
// Remove text selection - may occur accidentally
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
document.getSelection().removeAllRanges();
});
}, [options.columns, searchColumns, orderBy]);
@@ -115,10 +127,12 @@ export default function Renderer({ options, data }) {
className="table-fixed-header"
data-percy="show-scrollbars"
data-test="TableVisualization"
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '{ key: any; dataIndex: string; align: any; s... Remove this comment to see the full error message
columns={tableColumns}
dataSource={preparedRows}
pagination={{
size: get(options, "paginationSize", ""),
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'TablePagi... Remove this comment to see the full error message
position: "bottom",
pageSize: options.itemsPerPage,
hideOnSinglePage: true,
diff --git a/viz-lib/src/visualizations/table/columns/__snapshots__/boolean.test.js.snap b/viz-lib/src/visualizations/table/columns/__snapshots__/boolean.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/columns/__snapshots__/boolean.test.js.snap
rename to viz-lib/src/visualizations/table/columns/__snapshots__/boolean.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/columns/__snapshots__/datetime.test.js.snap b/viz-lib/src/visualizations/table/columns/__snapshots__/datetime.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/columns/__snapshots__/datetime.test.js.snap
rename to viz-lib/src/visualizations/table/columns/__snapshots__/datetime.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/columns/__snapshots__/image.test.js.snap b/viz-lib/src/visualizations/table/columns/__snapshots__/image.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/columns/__snapshots__/image.test.js.snap
rename to viz-lib/src/visualizations/table/columns/__snapshots__/image.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/columns/__snapshots__/link.test.js.snap b/viz-lib/src/visualizations/table/columns/__snapshots__/link.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/columns/__snapshots__/link.test.js.snap
rename to viz-lib/src/visualizations/table/columns/__snapshots__/link.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/columns/__snapshots__/number.test.js.snap b/viz-lib/src/visualizations/table/columns/__snapshots__/number.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/columns/__snapshots__/number.test.js.snap
rename to viz-lib/src/visualizations/table/columns/__snapshots__/number.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/columns/__snapshots__/text.test.js.snap b/viz-lib/src/visualizations/table/columns/__snapshots__/text.test.tsx.snap
similarity index 100%
rename from viz-lib/src/visualizations/table/columns/__snapshots__/text.test.js.snap
rename to viz-lib/src/visualizations/table/columns/__snapshots__/text.test.tsx.snap
diff --git a/viz-lib/src/visualizations/table/columns/boolean.test.js b/viz-lib/src/visualizations/table/columns/boolean.test.tsx
similarity index 82%
rename from viz-lib/src/visualizations/table/columns/boolean.test.js
rename to viz-lib/src/visualizations/table/columns/boolean.test.tsx
index 84dfa2a8d..28c0bcedd 100644
--- a/viz-lib/src/visualizations/table/columns/boolean.test.js
+++ b/viz-lib/src/visualizations/table/columns/boolean.test.tsx
@@ -3,13 +3,14 @@ import enzyme from "enzyme";
import Column from "./boolean";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(column, done) {
+function mount(column: any, done: any) {
return enzyme.mount(
{
diff --git a/viz-lib/src/visualizations/table/columns/boolean.jsx b/viz-lib/src/visualizations/table/columns/boolean.tsx
similarity index 55%
rename from viz-lib/src/visualizations/table/columns/boolean.jsx
rename to viz-lib/src/visualizations/table/columns/boolean.tsx
index 0c0c68d31..7d4c90d3c 100644
--- a/viz-lib/src/visualizations/table/columns/boolean.jsx
+++ b/viz-lib/src/visualizations/table/columns/boolean.tsx
@@ -1,11 +1,19 @@
import React from "react";
-import PropTypes from "prop-types";
import { useDebouncedCallback } from "use-debounce";
import { Section, Input } from "@/components/visualizations/editor";
import { createBooleanFormatter } from "@/lib/value-format";
-function Editor({ column, onChange }) {
- function handleChange(index, value) {
+type Props = {
+ column: {
+ name: string;
+ booleanValues?: string[];
+ };
+ onChange: (...args: any[]) => any;
+};
+
+function Editor({ column, onChange }: Props) {
+ function handleChange(index: any, value: any) {
+ // @ts-expect-error ts-migrate(2488) FIXME: Type 'string[] | undefined' must have a '[Symbol.i... Remove this comment to see the full error message
const booleanValues = [...column.booleanValues];
booleanValues.splice(index, 1, value);
onChange({ booleanValues });
@@ -15,6 +23,7 @@ function Editor({ column, onChange }) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
);
}
-Editor.propTypes = {
- column: PropTypes.shape({
- name: PropTypes.string.isRequired,
- booleanValues: PropTypes.arrayOf(PropTypes.string),
- }).isRequired,
- onChange: PropTypes.func.isRequired,
-};
-
-export default function initBooleanColumn(column) {
+export default function initBooleanColumn(column: any) {
const format = createBooleanFormatter(column.booleanValues);
- function prepareData(row) {
+ function prepareData(row: any) {
return {
text: format(row[column.name]),
};
}
- function BooleanColumn({ row }) {
+ function BooleanColumn({
+ row
+ }: any) {
// eslint-disable-line react/prop-types
const { text } = prepareData(row);
return text;
diff --git a/viz-lib/src/visualizations/table/columns/datetime.test.js b/viz-lib/src/visualizations/table/columns/datetime.test.tsx
similarity index 77%
rename from viz-lib/src/visualizations/table/columns/datetime.test.js
rename to viz-lib/src/visualizations/table/columns/datetime.test.tsx
index 324ca6479..0741da737 100644
--- a/viz-lib/src/visualizations/table/columns/datetime.test.js
+++ b/viz-lib/src/visualizations/table/columns/datetime.test.tsx
@@ -3,13 +3,14 @@ import enzyme from "enzyme";
import Column from "./datetime";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(column, done) {
+function mount(column: any, done: any) {
return enzyme.mount(
{
diff --git a/viz-lib/src/visualizations/table/columns/datetime.jsx b/viz-lib/src/visualizations/table/columns/datetime.tsx
similarity index 64%
rename from viz-lib/src/visualizations/table/columns/datetime.jsx
rename to viz-lib/src/visualizations/table/columns/datetime.tsx
index fc9ca9f9c..4a9242d48 100644
--- a/viz-lib/src/visualizations/table/columns/datetime.jsx
+++ b/viz-lib/src/visualizations/table/columns/datetime.tsx
@@ -1,13 +1,21 @@
import React from "react";
-import PropTypes from "prop-types";
import { useDebouncedCallback } from "use-debounce";
import { Section, Input, ContextHelp } from "@/components/visualizations/editor";
import { createDateTimeFormatter } from "@/lib/value-format";
-function Editor({ column, onChange }) {
+type Props = {
+ column: {
+ name: string;
+ dateTimeFormat?: string;
+ };
+ onChange: (...args: any[]) => any;
+};
+
+function Editor({ column, onChange }: Props) {
const [onChangeDebounced] = useDebouncedCallback(onChange, 200);
return (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
);
}
-Editor.propTypes = {
- column: PropTypes.shape({
- name: PropTypes.string.isRequired,
- dateTimeFormat: PropTypes.string,
- }).isRequired,
- onChange: PropTypes.func.isRequired,
-};
-
-export default function initDateTimeColumn(column) {
+export default function initDateTimeColumn(column: any) {
const format = createDateTimeFormatter(column.dateTimeFormat);
- function prepareData(row) {
+ function prepareData(row: any) {
return {
text: format(row[column.name]),
};
}
- function DateTimeColumn({ row }) {
+ function DateTimeColumn({
+ row
+ }: any) {
// eslint-disable-line react/prop-types
const { text } = prepareData(row);
return text;
diff --git a/viz-lib/src/visualizations/table/columns/image.test.js b/viz-lib/src/visualizations/table/columns/image.test.tsx
similarity index 88%
rename from viz-lib/src/visualizations/table/columns/image.test.js
rename to viz-lib/src/visualizations/table/columns/image.test.tsx
index 3e46434b9..82b96041f 100644
--- a/viz-lib/src/visualizations/table/columns/image.test.js
+++ b/viz-lib/src/visualizations/table/columns/image.test.tsx
@@ -3,13 +3,14 @@ import enzyme from "enzyme";
import Column from "./image";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(column, done) {
+function mount(column: any, done: any) {
return enzyme.mount(
{
diff --git a/viz-lib/src/visualizations/table/columns/image.jsx b/viz-lib/src/visualizations/table/columns/image.tsx
similarity index 51%
rename from viz-lib/src/visualizations/table/columns/image.jsx
rename to viz-lib/src/visualizations/table/columns/image.tsx
index db5e34aab..2e7d35699 100644
--- a/viz-lib/src/visualizations/table/columns/image.jsx
+++ b/viz-lib/src/visualizations/table/columns/image.tsx
@@ -1,66 +1,85 @@
import { extend, trim } from "lodash";
import React from "react";
-import PropTypes from "prop-types";
import { useDebouncedCallback } from "use-debounce";
import { Section, Input, ControlLabel, ContextHelp } from "@/components/visualizations/editor";
import { formatSimpleTemplate } from "@/lib/value-format";
-function Editor({ column, onChange }) {
+type Props = {
+ column: {
+ name: string;
+ imageUrlTemplate?: string;
+ imageWidth?: string;
+ imageHeight?: string;
+ imageTitleTemplate?: string;
+ };
+ onChange: (...args: any[]) => any;
+};
+
+function Editor({ column, onChange }: Props) {
const [onChangeDebounced] = useDebouncedCallback(onChange, 200);
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
Size
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
Any positive integer value that specifies size in pixels.
Leave empty to use default value.
}>
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
onChangeDebounced({ imageWidth: event.target.value })}
+ onChange={(event: any) => onChangeDebounced({ imageWidth: event.target.value })}
/>
×
onChangeDebounced({ imageHeight: event.target.value })}
+ onChange={(event: any) => onChangeDebounced({ imageHeight: event.target.value })}
/>
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
Format specs {ContextHelp.defaultIcon}}>
All columns can be referenced using
{"{{ column_name }}"} syntax.
@@ -75,19 +94,8 @@ function Editor({ column, onChange }) {
);
}
-Editor.propTypes = {
- column: PropTypes.shape({
- name: PropTypes.string.isRequired,
- imageUrlTemplate: PropTypes.string,
- imageWidth: PropTypes.string,
- imageHeight: PropTypes.string,
- imageTitleTemplate: PropTypes.string,
- }).isRequired,
- onChange: PropTypes.func.isRequired,
-};
-
-export default function initImageColumn(column) {
- function prepareData(row) {
+export default function initImageColumn(column: any) {
+ function prepareData(row: any) {
row = extend({ "@": row[column.name] }, row);
const src = trim(formatSimpleTemplate(column.imageUrlTemplate, row));
@@ -102,21 +110,29 @@ export default function initImageColumn(column) {
const result = { src };
if (Number.isFinite(width) && width > 0) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'width' does not exist on type '{ src: st... Remove this comment to see the full error message
result.width = width;
}
if (Number.isFinite(height) && height > 0) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'height' does not exist on type '{ src: s... Remove this comment to see the full error message
result.height = height;
}
if (title !== "") {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'text' does not exist on type '{ src: str... Remove this comment to see the full error message
result.text = title; // `text` is used for search
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'title' does not exist on type '{ src: st... Remove this comment to see the full error message
result.title = title;
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'alt' does not exist on type '{ src: stri... Remove this comment to see the full error message
result.alt = title;
}
return result;
}
- function ImageColumn({ row }) {
+ function ImageColumn({
+ row
+ }: any) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'text' does not exist on type '{}'.
// eslint-disable-line react/prop-types
const { text, ...props } = prepareData(row);
return
;
diff --git a/viz-lib/src/visualizations/table/columns/index.js b/viz-lib/src/visualizations/table/columns/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/table/columns/index.js
rename to viz-lib/src/visualizations/table/columns/index.ts
diff --git a/viz-lib/src/visualizations/table/columns/json.jsx b/viz-lib/src/visualizations/table/columns/json.tsx
similarity index 88%
rename from viz-lib/src/visualizations/table/columns/json.jsx
rename to viz-lib/src/visualizations/table/columns/json.tsx
index 19ba9b4e4..7cb7e29a0 100644
--- a/viz-lib/src/visualizations/table/columns/json.jsx
+++ b/viz-lib/src/visualizations/table/columns/json.tsx
@@ -3,8 +3,8 @@ import React from "react";
import JsonViewInteractive from "@/components/json-view-interactive/JsonViewInteractive";
import { visualizationsSettings } from "@/visualizations/visualizationsSettings";
-export default function initJsonColumn(column) {
- function prepareData(row) {
+export default function initJsonColumn(column: any) {
+ function prepareData(row: any) {
const text = row[column.name];
if (isString(text) && text.length <= visualizationsSettings.tableCellMaxJSONSize) {
try {
@@ -16,7 +16,9 @@ export default function initJsonColumn(column) {
return { text, value: undefined };
}
- function JsonColumn({ row }) {
+ function JsonColumn({
+ row
+ }: any) {
// eslint-disable-line react/prop-types
const { text, value } = prepareData(row);
if (isUndefined(value)) {
diff --git a/viz-lib/src/visualizations/table/columns/link.test.js b/viz-lib/src/visualizations/table/columns/link.test.tsx
similarity index 88%
rename from viz-lib/src/visualizations/table/columns/link.test.js
rename to viz-lib/src/visualizations/table/columns/link.test.tsx
index cd36adf86..81bb3345d 100644
--- a/viz-lib/src/visualizations/table/columns/link.test.js
+++ b/viz-lib/src/visualizations/table/columns/link.test.tsx
@@ -3,13 +3,14 @@ import enzyme from "enzyme";
import Column from "./link";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(column, done) {
+function mount(column: any, done: any) {
return enzyme.mount(
{
diff --git a/viz-lib/src/visualizations/table/columns/link.jsx b/viz-lib/src/visualizations/table/columns/link.tsx
similarity index 54%
rename from viz-lib/src/visualizations/table/columns/link.jsx
rename to viz-lib/src/visualizations/table/columns/link.tsx
index c9c424706..ca9ef026e 100644
--- a/viz-lib/src/visualizations/table/columns/link.jsx
+++ b/viz-lib/src/visualizations/table/columns/link.tsx
@@ -1,42 +1,56 @@
import { extend, trim } from "lodash";
import React from "react";
-import PropTypes from "prop-types";
import { useDebouncedCallback } from "use-debounce";
import { Section, Input, Checkbox, ContextHelp } from "@/components/visualizations/editor";
import { formatSimpleTemplate } from "@/lib/value-format";
-function Editor({ column, onChange }) {
+type Props = {
+ column: {
+ name: string;
+ linkUrlTemplate?: string;
+ linkTextTemplate?: string;
+ linkTitleTemplate?: string;
+ linkOpenInNewTab?: boolean;
+ };
+ onChange: (...args: any[]) => any;
+};
+
+function Editor({ column, onChange }: Props) {
const [onChangeDebounced] = useDebouncedCallback(onChange, 200);
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+ {/* @ts-expect-error ts-migrate(2746) FIXME: This JSX tag's 'children' prop expects a single ch... Remove this comment to see the full error message */}
Format specs {ContextHelp.defaultIcon}}>
All columns can be referenced using
{"{{ column_name }}"} syntax.
@@ -64,19 +81,8 @@ function Editor({ column, onChange }) {
);
}
-Editor.propTypes = {
- column: PropTypes.shape({
- name: PropTypes.string.isRequired,
- linkUrlTemplate: PropTypes.string,
- linkTextTemplate: PropTypes.string,
- linkTitleTemplate: PropTypes.string,
- linkOpenInNewTab: PropTypes.bool,
- }).isRequired,
- onChange: PropTypes.func.isRequired,
-};
-
-export default function initLinkColumn(column) {
- function prepareData(row) {
+export default function initLinkColumn(column: any) {
+ function prepareData(row: any) {
row = extend({ "@": row[column.name] }, row);
const href = trim(formatSimpleTemplate(column.linkUrlTemplate, row));
@@ -93,16 +99,21 @@ export default function initLinkColumn(column) {
};
if (title !== "") {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'title' does not exist on type '{ href: s... Remove this comment to see the full error message
result.title = title;
}
if (column.linkOpenInNewTab) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'target' does not exist on type '{ href: ... Remove this comment to see the full error message
result.target = "_blank";
}
return result;
}
- function LinkColumn({ row }) {
+ function LinkColumn({
+ row
+ }: any) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'text' does not exist on type '{}'.
// eslint-disable-line react/prop-types
const { text, ...props } = prepareData(row);
return
{text} ;
diff --git a/viz-lib/src/visualizations/table/columns/number.test.js b/viz-lib/src/visualizations/table/columns/number.test.tsx
similarity index 76%
rename from viz-lib/src/visualizations/table/columns/number.test.js
rename to viz-lib/src/visualizations/table/columns/number.test.tsx
index b41f8f5ba..6b11db106 100644
--- a/viz-lib/src/visualizations/table/columns/number.test.js
+++ b/viz-lib/src/visualizations/table/columns/number.test.tsx
@@ -3,13 +3,14 @@ import enzyme from "enzyme";
import Column from "./number";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(column, done) {
+function mount(column: any, done: any) {
return enzyme.mount(
{
diff --git a/viz-lib/src/visualizations/table/columns/number.jsx b/viz-lib/src/visualizations/table/columns/number.tsx
similarity index 64%
rename from viz-lib/src/visualizations/table/columns/number.jsx
rename to viz-lib/src/visualizations/table/columns/number.tsx
index a990b3f5c..232c0cdbe 100644
--- a/viz-lib/src/visualizations/table/columns/number.jsx
+++ b/viz-lib/src/visualizations/table/columns/number.tsx
@@ -1,13 +1,21 @@
import React from "react";
-import PropTypes from "prop-types";
import { useDebouncedCallback } from "use-debounce";
import { Section, Input, ContextHelp } from "@/components/visualizations/editor";
import { createNumberFormatter } from "@/lib/value-format";
-function Editor({ column, onChange }) {
+type Props = {
+ column: {
+ name: string;
+ numberFormat?: string;
+ };
+ onChange: (...args: any[]) => any;
+};
+
+function Editor({ column, onChange }: Props) {
const [onChangeDebounced] = useDebouncedCallback(onChange, 200);
return (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
);
}
-Editor.propTypes = {
- column: PropTypes.shape({
- name: PropTypes.string.isRequired,
- numberFormat: PropTypes.string,
- }).isRequired,
- onChange: PropTypes.func.isRequired,
-};
-
-export default function initNumberColumn(column) {
+export default function initNumberColumn(column: any) {
const format = createNumberFormatter(column.numberFormat);
- function prepareData(row) {
+ function prepareData(row: any) {
return {
text: format(row[column.name]),
};
}
- function NumberColumn({ row }) {
+ function NumberColumn({
+ row
+ }: any) {
// eslint-disable-line react/prop-types
const { text } = prepareData(row);
return text;
diff --git a/viz-lib/src/visualizations/table/columns/text.test.js b/viz-lib/src/visualizations/table/columns/text.test.tsx
similarity index 82%
rename from viz-lib/src/visualizations/table/columns/text.test.js
rename to viz-lib/src/visualizations/table/columns/text.test.tsx
index 708e6794e..8eaa367bc 100644
--- a/viz-lib/src/visualizations/table/columns/text.test.js
+++ b/viz-lib/src/visualizations/table/columns/text.test.tsx
@@ -3,13 +3,14 @@ import enzyme from "enzyme";
import Column from "./text";
-function findByTestID(wrapper, testId) {
+function findByTestID(wrapper: any, testId: any) {
return wrapper.find(`[data-test="${testId}"]`);
}
-function mount(column, done) {
+function mount(column: any, done: any) {
return enzyme.mount(
{
diff --git a/viz-lib/src/visualizations/table/columns/text.jsx b/viz-lib/src/visualizations/table/columns/text.tsx
similarity index 66%
rename from viz-lib/src/visualizations/table/columns/text.jsx
rename to viz-lib/src/visualizations/table/columns/text.tsx
index 87c34d3d7..623de0839 100644
--- a/viz-lib/src/visualizations/table/columns/text.jsx
+++ b/viz-lib/src/visualizations/table/columns/text.tsx
@@ -1,12 +1,21 @@
import React from "react";
-import PropTypes from "prop-types";
import HtmlContent from "@/components/HtmlContent";
import { Section, Checkbox } from "@/components/visualizations/editor";
import { createTextFormatter } from "@/lib/value-format";
-function Editor({ column, onChange }) {
+type Props = {
+ column: {
+ name: string;
+ allowHTML?: boolean;
+ highlightLinks?: boolean;
+ };
+ onChange: (...args: any[]) => any;
+};
+
+function Editor({ column, onChange }: Props) {
return (
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
{column.allowHTML && (
+ // @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
{text} : text;
diff --git a/viz-lib/src/visualizations/table/getOptions.js b/viz-lib/src/visualizations/table/getOptions.ts
similarity index 78%
rename from viz-lib/src/visualizations/table/getOptions.js
rename to viz-lib/src/visualizations/table/getOptions.ts
index d35e43edc..90ac5d1bc 100644
--- a/viz-lib/src/visualizations/table/getOptions.js
+++ b/viz-lib/src/visualizations/table/getOptions.ts
@@ -8,7 +8,7 @@ const DEFAULT_OPTIONS = {
const filterTypes = ["filter", "multi-filter", "multiFilter"];
-function getColumnNameWithoutType(column) {
+function getColumnNameWithoutType(column: any) {
let typeSplit;
if (column.indexOf("::") !== -1) {
typeSplit = "::";
@@ -30,11 +30,11 @@ function getColumnNameWithoutType(column) {
return parts[0];
}
-function getColumnContentAlignment(type) {
+function getColumnContentAlignment(type: any) {
return ["integer", "float", "boolean", "date", "datetime"].indexOf(type) >= 0 ? "right" : "left";
}
-function getDefaultColumnsOptions(columns) {
+function getDefaultColumnsOptions(columns: any) {
const displayAs = {
integer: "number",
float: "number",
@@ -46,6 +46,7 @@ function getDefaultColumnsOptions(columns) {
return _.map(columns, (col, index) => ({
name: col.name,
type: col.type,
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
displayAs: displayAs[col.type] || "string",
visible: true,
order: 100000 + index,
@@ -58,17 +59,20 @@ function getDefaultColumnsOptions(columns) {
}));
}
-function getDefaultFormatOptions(column) {
+function getDefaultFormatOptions(column: any) {
const dateTimeFormat = {
date: visualizationsSettings.dateFormat || "DD/MM/YYYY",
datetime: visualizationsSettings.dateTimeFormat || "DD/MM/YYYY HH:mm",
};
const numberFormat = {
+ // @ts-expect-error ts-migrate(2551) FIXME: Property 'integerFormat' does not exist on type '{... Remove this comment to see the full error message
integer: visualizationsSettings.integerFormat || "0,0",
float: visualizationsSettings.floatFormat || "0,0.00",
};
return {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
dateTimeFormat: dateTimeFormat[column.type],
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
numberFormat: numberFormat[column.type],
booleanValues: visualizationsSettings.booleanValues || ["false", "true"],
// `image` cell options
@@ -84,7 +88,7 @@ function getDefaultFormatOptions(column) {
};
}
-function wereColumnsReordered(queryColumns, visualizationColumns) {
+function wereColumnsReordered(queryColumns: any, visualizationColumns: any) {
queryColumns = _.map(queryColumns, col => col.name);
visualizationColumns = _.map(visualizationColumns, col => col.name);
@@ -105,7 +109,7 @@ function wereColumnsReordered(queryColumns, visualizationColumns) {
return false;
}
-function getColumnsOptions(columns, visualizationColumns) {
+function getColumnsOptions(columns: any, visualizationColumns: any) {
const options = getDefaultColumnsOptions(columns);
if (wereColumnsReordered(columns, visualizationColumns)) {
@@ -121,7 +125,9 @@ function getColumnsOptions(columns, visualizationColumns) {
return _.sortBy(options, "order");
}
-export default function getOptions(options, { columns }) {
+export default function getOptions(options: any, {
+ columns
+}: any) {
options = { ...DEFAULT_OPTIONS, ...options };
options.columns = _.map(getColumnsOptions(columns, options.columns), col => ({
...getDefaultFormatOptions(col),
diff --git a/viz-lib/src/visualizations/table/index.js b/viz-lib/src/visualizations/table/index.ts
similarity index 100%
rename from viz-lib/src/visualizations/table/index.js
rename to viz-lib/src/visualizations/table/index.ts
diff --git a/viz-lib/src/visualizations/table/utils.js b/viz-lib/src/visualizations/table/utils.tsx
similarity index 60%
rename from viz-lib/src/visualizations/table/utils.js
rename to viz-lib/src/visualizations/table/utils.tsx
index 804534607..298cdb7f9 100644
--- a/viz-lib/src/visualizations/table/utils.js
+++ b/viz-lib/src/visualizations/table/utils.tsx
@@ -4,7 +4,7 @@ import cx from "classnames";
import Tooltip from "antd/lib/tooltip";
import ColumnTypes from "./columns";
-function nextOrderByDirection(direction) {
+function nextOrderByDirection(direction: any) {
switch (direction) {
case "ascend":
return "descend";
@@ -15,20 +15,25 @@ function nextOrderByDirection(direction) {
}
}
-function toggleOrderBy(columnName, orderBy = [], multiColumnSort = false) {
+function toggleOrderBy(columnName: any, orderBy = [], multiColumnSort = false) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'name' does not exist on type 'never'.
const index = findIndex(orderBy, i => i.name === columnName);
const item = { name: columnName, direction: "ascend" };
if (index >= 0) {
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'string | null' is not assignable to type 'st... Remove this comment to see the full error message
item.direction = nextOrderByDirection(orderBy[index].direction);
}
if (multiColumnSort) {
if (!item.direction) {
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'name' does not exist on type 'never'.
return filter(orderBy, i => i.name !== columnName);
}
if (index >= 0) {
+ // @ts-expect-error ts-migrate(2322) FIXME: Type '{ name: any; direction: string; }' is not as... Remove this comment to see the full error message
orderBy[index] = item;
} else {
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ name: any; direction: string; ... Remove this comment to see the full error message
orderBy.push(item);
}
return [...orderBy];
@@ -36,15 +41,16 @@ function toggleOrderBy(columnName, orderBy = [], multiColumnSort = false) {
return item.direction ? [item] : [];
}
-function getOrderByInfo(orderBy) {
+function getOrderByInfo(orderBy: any) {
const result = {};
each(orderBy, ({ name, direction }, index) => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[name] = { direction, index: index + 1 };
});
return result;
}
-export function prepareColumns(columns, searchInput, orderBy, onOrderByChange) {
+export function prepareColumns(columns: any, searchInput: any, orderBy: any, onOrderByChange: any) {
columns = filter(columns, "visible");
columns = sortBy(columns, "order");
@@ -52,9 +58,12 @@ export function prepareColumns(columns, searchInput, orderBy, onOrderByChange) {
const orderByInfo = getOrderByInfo(orderBy);
let tableColumns = map(columns, column => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const isAscend = orderByInfo[column.name] && orderByInfo[column.name].direction === "ascend";
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const isDescend = orderByInfo[column.name] && orderByInfo[column.name].direction === "descend";
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const sortColumnIndex = isMultiColumnSort && orderByInfo[column.name] ? orderByInfo[column.name].index : null;
const result = {
@@ -85,13 +94,15 @@ export function prepareColumns(columns, searchInput, orderBy, onOrderByChange) {
className: cx({
"table-visualization-column-is-sorted": isAscend || isDescend,
}),
- onClick: event => onOrderByChange(toggleOrderBy(column.name, orderBy, event.shiftKey)),
+ onClick: (event: any) => onOrderByChange(toggleOrderBy(column.name, orderBy, event.shiftKey)),
}),
};
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const initColumn = ColumnTypes[column.displayAs];
const Component = initColumn(column);
- result.render = (unused, row) => ({
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'render' does not exist on type '{ key: a... Remove this comment to see the full error message
+ result.render = (unused: any, row: any) => ({
children: ,
props: { className: `display-as-${column.displayAs}` },
});
@@ -101,10 +112,13 @@ export function prepareColumns(columns, searchInput, orderBy, onOrderByChange) {
tableColumns.push({
key: "###Redash::Visualizations::Table::Spacer###",
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'null' is not assignable to type 'string'.
dataIndex: null,
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'Element'.
title: "",
className: "table-visualization-spacer",
render: () => "",
+ // @ts-expect-error ts-migrate(2741) FIXME: Property 'onClick' is missing in type '{ className... Remove this comment to see the full error message
onHeaderCell: () => ({ className: "table-visualization-spacer" }),
});
@@ -114,6 +128,7 @@ export function prepareColumns(columns, searchInput, orderBy, onOrderByChange) {
{
key: "table-search",
title: searchInput,
+ // @ts-expect-error ts-migrate(2741) FIXME: Property 'onClick' is missing in type '{ className... Remove this comment to see the full error message
onHeaderCell: () => ({ className: "table-visualization-search" }),
children: tableColumns,
},
@@ -123,17 +138,18 @@ export function prepareColumns(columns, searchInput, orderBy, onOrderByChange) {
return tableColumns;
}
-export function initRows(rows) {
+export function initRows(rows: any) {
return map(rows, (record, index) => ({ key: `record${index}`, record }));
}
-export function filterRows(rows, searchTerm, searchColumns) {
+export function filterRows(rows: any, searchTerm: any, searchColumns: any) {
if (searchTerm !== "" && searchColumns.length > 0) {
searchTerm = searchTerm.toUpperCase();
const matchFields = map(searchColumns, column => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const initColumn = ColumnTypes[column.displayAs];
const { prepareData } = initColumn(column);
- return row => {
+ return (row: any) => {
const { text } = prepareData(row);
return (
toString(text)
@@ -148,7 +164,7 @@ export function filterRows(rows, searchTerm, searchColumns) {
return rows;
}
-export function sortRows(rows, orderBy) {
+export function sortRows(rows: any, orderBy: any) {
if (orderBy.length === 0 || rows.length === 0) {
return rows;
}
@@ -164,10 +180,12 @@ export function sortRows(rows, orderBy) {
vb = b.record[orderBy[i].name];
if (isNil(va) || va < vb) {
// if a < b - we should return -1, but take in account direction
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return -1 * directions[orderBy[i].direction];
}
if (va > vb || isNil(vb)) {
// if a > b - we should return 1, but take in account direction
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return 1 * directions[orderBy[i].direction];
}
}
diff --git a/viz-lib/src/visualizations/visualizationsSettings.js b/viz-lib/src/visualizations/visualizationsSettings.tsx
similarity index 75%
rename from viz-lib/src/visualizations/visualizationsSettings.js
rename to viz-lib/src/visualizations/visualizationsSettings.tsx
index e4025e8db..0439d1f70 100644
--- a/viz-lib/src/visualizations/visualizationsSettings.js
+++ b/viz-lib/src/visualizations/visualizationsSettings.tsx
@@ -1,9 +1,15 @@
import React from "react";
import { extend } from "lodash";
-import PropTypes from "prop-types";
import Tooltip from "antd/lib/tooltip";
-function HelpTrigger({ title, href, className, children }) {
+type HelpTriggerProps = {
+ title?: React.ReactNode;
+ href: string;
+ className?: string;
+ children?: React.ReactNode;
+};
+
+function HelpTrigger({ title, href, className, children }: HelpTriggerProps) {
return (
;
}
@@ -50,6 +49,6 @@ export const visualizationsSettings = {
choroplethAvailableMaps: {},
};
-export function updateVisualizationsSettings(options) {
+export function updateVisualizationsSettings(options: any) {
extend(visualizationsSettings, options);
}
diff --git a/viz-lib/src/visualizations/word-cloud/Editor.jsx b/viz-lib/src/visualizations/word-cloud/Editor.jsx
deleted file mode 100644
index d199b05c9..000000000
--- a/viz-lib/src/visualizations/word-cloud/Editor.jsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import { map, merge } from "lodash";
-import React from "react";
-import * as Grid from "antd/lib/grid";
-import { Section, Select, InputNumber, ControlLabel } from "@/components/visualizations/editor";
-import { EditorPropTypes } from "@/visualizations/prop-types";
-
-export default function Editor({ options, data, onOptionsChange }) {
- const optionsChanged = newOptions => {
- onOptionsChange(merge({}, options, newOptions));
- };
-
- return (
-
-
- optionsChanged({ column })}>
- {map(data.columns, ({ name }) => (
-
- {name}
-
- ))}
-
-
-
- optionsChanged({ frequenciesColumn })}>
-
- (count word frequencies automatically)
-
- {map(data.columns, ({ name }) => (
-
- {name}
-
- ))}
-
-
-
-
-
-
- optionsChanged({ wordLengthLimit: { min: value > 0 ? value : null } })}
- />
-
-
- optionsChanged({ wordLengthLimit: { max: value > 0 ? value : null } })}
- />
-
-
-
-
-
-
-
-
- optionsChanged({ wordCountLimit: { min: value > 0 ? value : null } })}
- />
-
-
- optionsChanged({ wordCountLimit: { max: value > 0 ? value : null } })}
- />
-
-
-
-
-
- );
-}
-
-Editor.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/word-cloud/Editor.tsx b/viz-lib/src/visualizations/word-cloud/Editor.tsx
new file mode 100644
index 000000000..f539e7671
--- /dev/null
+++ b/viz-lib/src/visualizations/word-cloud/Editor.tsx
@@ -0,0 +1,113 @@
+import { map, merge } from "lodash";
+import React from "react";
+import * as Grid from "antd/lib/grid";
+import { Section, Select, InputNumber, ControlLabel } from "@/components/visualizations/editor";
+import { EditorPropTypes } from "@/visualizations/prop-types";
+
+export default function Editor({
+ options,
+ data,
+ onOptionsChange
+}: any) {
+ const optionsChanged = (newOptions: any) => {
+ onOptionsChange(merge({}, options, newOptions));
+ };
+
+ return (
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ optionsChanged({ column })}>
+ {map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ optionsChanged({ frequenciesColumn })}>
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ (count word frequencies automatically)
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ {map(data.columns, ({ name }) => (
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message
+
+ {name}
+ {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'Option' does not exist on type '({ class... Remove this comment to see the full error message */}
+
+ ))}
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'null | un... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
+
+
+ optionsChanged({ wordLengthLimit: { min: value > 0 ? value : null } })}
+ />
+
+
+ optionsChanged({ wordLengthLimit: { max: value > 0 ? value : null } })}
+ />
+
+
+
+
+ {/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'null | un... Remove this comment to see the full error message */}
+
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'Element' is not assignable to type 'null | u... Remove this comment to see the full error message */}
+
+
+ optionsChanged({ wordCountLimit: { min: value > 0 ? value : null } })}
+ />
+
+
+ optionsChanged({ wordCountLimit: { max: value > 0 ? value : null } })}
+ />
+
+
+
+
+
+ );
+}
+
+Editor.propTypes = EditorPropTypes;
diff --git a/viz-lib/src/visualizations/word-cloud/Renderer.jsx b/viz-lib/src/visualizations/word-cloud/Renderer.tsx
similarity index 68%
rename from viz-lib/src/visualizations/word-cloud/Renderer.jsx
rename to viz-lib/src/visualizations/word-cloud/Renderer.tsx
index 29dfc5442..c1c4ade1e 100644
--- a/viz-lib/src/visualizations/word-cloud/Renderer.jsx
+++ b/viz-lib/src/visualizations/word-cloud/Renderer.tsx
@@ -7,12 +7,13 @@ import { RendererPropTypes } from "@/visualizations/prop-types";
import "./renderer.less";
-function computeWordFrequencies(rows, column) {
+function computeWordFrequencies(rows: any, column: any) {
const result = {};
each(rows, row => {
const wordsList = toString(row[column]).split(/\s/g);
each(wordsList, d => {
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[d] = (result[d] || 0) + 1;
});
});
@@ -20,13 +21,14 @@ function computeWordFrequencies(rows, column) {
return result;
}
-function getWordsWithFrequencies(rows, wordColumn, frequencyColumn) {
+function getWordsWithFrequencies(rows: any, wordColumn: any, frequencyColumn: any) {
const result = {};
each(rows, row => {
const count = parseFloat(row[frequencyColumn]);
if (Number.isFinite(count) && count > 0) {
const word = toString(row[wordColumn]);
+ // @ts-expect-error ts-migrate(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[word] = count;
}
});
@@ -34,7 +36,10 @@ function getWordsWithFrequencies(rows, wordColumn, frequencyColumn) {
return result;
}
-function applyLimitsToWords(words, { wordLength, wordCount }) {
+function applyLimitsToWords(words: any, {
+ wordLength,
+ wordCount
+}: any) {
wordLength.min = Number.isFinite(wordLength.min) ? wordLength.min : null;
wordLength.max = Number.isFinite(wordLength.max) ? wordLength.max : null;
@@ -49,8 +54,8 @@ function applyLimitsToWords(words, { wordLength, wordCount }) {
});
}
-function prepareWords(rows, options) {
- let result = [];
+function prepareWords(rows: any, options: any) {
+ let result: any = [];
if (options.column) {
if (options.frequenciesColumn) {
@@ -66,15 +71,18 @@ function prepareWords(rows, options) {
// Add additional attributes
const counts = map(result, item => item.count);
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const wordSize = d3.scale
.linear()
.domain([min(counts), max(counts)])
.range([10, 100]); // min/max word size
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'scale' does not exist on type 'typeof im... Remove this comment to see the full error message
const color = d3.scale.category20();
each(result, (item, index) => {
item.size = wordSize(item.count);
item.color = color(index);
+ // @ts-expect-error ts-migrate(2362) FIXME: The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
item.angle = (index % 2) * 90; // make it stable between renderings
});
@@ -84,7 +92,7 @@ function prepareWords(rows, options) {
});
}
-function scaleElement(node, container) {
+function scaleElement(node: any, container: any) {
node.style.transform = null;
const { width: nodeWidth, height: nodeHeight } = node.getBoundingClientRect();
const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();
@@ -99,19 +107,21 @@ function createLayout() {
const fontFamily = window.getComputedStyle(document.body).fontFamily;
return (
+ // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
cloud()
// make the area large enough to contain even very long words; word cloud will be placed in the center of the area
// TODO: dimensions probably should be larger, but `d3-cloud` has some performance issues related to these values
.size([5000, 5000])
.padding(3)
.font(fontFamily)
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'angle' does not exist on type 'Word'.
.rotate(d => d.angle)
.fontSize(d => d.size)
.random(() => 0.5)
); // do not place words randomly - use compact layout
}
-function render(container, words) {
+function render(container: any, words: any) {
container = d3.select(container);
container.selectAll("*").remove();
@@ -121,12 +131,12 @@ function render(container, words) {
.data(words)
.enter()
.append("text")
- .style("font-size", d => `${d.size}px`)
- .style("font-family", d => d.font)
- .style("fill", d => d.color)
+ .style("font-size", (d: any) => `${d.size}px`)
+ .style("font-family", (d: any) => d.font)
+ .style("fill", (d: any) => d.color)
.attr("text-anchor", "middle")
- .attr("transform", d => `translate(${[d.x, d.y]}) rotate(${d.rotate})`)
- .text(d => d.text);
+ .attr("transform", (d: any) => `translate(${[d.x, d.y]}) rotate(${d.rotate})`)
+ .text((d: any) => d.text);
const svgBounds = svg.node().getBoundingClientRect();
const gBounds = g.node().getBoundingClientRect();
@@ -137,16 +147,22 @@ function render(container, words) {
scaleElement(svg.node(), container.node());
}
-export default function Renderer({ data, options }) {
+export default function Renderer({
+ data,
+ options
+}: any) {
const [container, setContainer] = useState(null);
const [words, setWords] = useState([]);
const layout = useMemo(createLayout, []);
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type '() => () => layout.Cloud {
layout
.words(prepareWords(data.rows, options))
+ // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Word[]' is not assignable to par... Remove this comment to see the full error message
.on("end", w => setWords(w))
.start();
+ // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
return () => layout.on("end", null).stop();
}, [layout, data, options, setWords]);
@@ -159,6 +175,7 @@ export default function Renderer({ data, options }) {
useEffect(() => {
if (container) {
const unwatch = resizeObserver(container, () => {
+ // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
const svg = container.querySelector("svg");
if (svg) {
scaleElement(svg, container);
@@ -168,6 +185,7 @@ export default function Renderer({ data, options }) {
}
}, [container]);
+ // @ts-expect-error ts-migrate(2322) FIXME: Type 'Dispatch>' is not assig... Remove this comment to see the full error message
return
;
}
diff --git a/viz-lib/src/visualizations/word-cloud/index.js b/viz-lib/src/visualizations/word-cloud/index.ts
similarity index 84%
rename from viz-lib/src/visualizations/word-cloud/index.js
rename to viz-lib/src/visualizations/word-cloud/index.ts
index 1cc46482a..933096155 100644
--- a/viz-lib/src/visualizations/word-cloud/index.js
+++ b/viz-lib/src/visualizations/word-cloud/index.ts
@@ -13,7 +13,7 @@ const DEFAULT_OPTIONS = {
export default {
type: "WORD_CLOUD",
name: "Word Cloud",
- getOptions: options => merge({}, DEFAULT_OPTIONS, options),
+ getOptions: (options: any) => merge({}, DEFAULT_OPTIONS, options),
Renderer,
Editor,
diff --git a/viz-lib/tsconfig.json b/viz-lib/tsconfig.json
new file mode 100644
index 000000000..a465ac7aa
--- /dev/null
+++ b/viz-lib/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "target": "es2019",
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "jsx": "react",
+ "types": ["node", "jest"],
+ "outDir": "lib",
+ "declaration": true,
+ "strict": true,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "baseUrl": "./",
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ },
+ "include": ["src/**/*"]
+}
diff --git a/viz-lib/webpack.config.js b/viz-lib/webpack.config.js
index 72ba2258c..283036343 100644
--- a/viz-lib/webpack.config.js
+++ b/viz-lib/webpack.config.js
@@ -5,7 +5,7 @@ const isProduction = process.env.NODE_ENV === "production";
module.exports = {
mode: isProduction ? "production" : "development",
- entry: "./src/index.js",
+ entry: "./src/index.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "redash-visualizations.js",
@@ -13,12 +13,12 @@ module.exports = {
},
resolve: {
symlinks: false,
- extensions: [".js", ".jsx"],
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
},
module: {
rules: [
{
- test: /\.jsx?$/,
+ test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: ["babel-loader"],
},