refactor(monorepo): relocate deckgl to Superset (#17596)

This commit is contained in:
Yongjie Zhao 2021-12-09 08:45:18 +08:00 committed by GitHub
parent b7ae7f976a
commit 04e3cfa607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
127 changed files with 1914 additions and 2176 deletions

View File

@ -30,7 +30,7 @@ module.exports = {
'^src/(.*)$': '<rootDir>/src/$1',
'^spec/(.*)$': '<rootDir>/spec/$1',
// mapping to souce code instead of lib or esm module
'@superset-ui/(((?!(legacy-preset-chart-deckgl|core/src)).)*)$':
'@superset-ui/(((?!(core/src)).)*)$':
'<rootDir>/node_modules/@superset-ui/$1/src',
'@superset-ui/core/src/(.*)$':
'<rootDir>/node_modules/@superset-ui/core/src/$1',

View File

@ -8108,12 +8108,12 @@
}
},
"node_modules/@math.gl/web-mercator": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.5.3.tgz",
"integrity": "sha512-WZE9ALeTS4n3HDgkqTxcNLBU7DL0mjmPXSrcqSZIUeDY00+LCtNvMQWUAwqolpB7nD71vD6HLW8delzVuy4teA==",
"version": "3.5.6",
"resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.5.6.tgz",
"integrity": "sha512-siWHLJGp9o8fDEM1t0Rby+JXftl6il0z3927liWGzkHqFftXPHY858ShPy45ThDU8q5lyCftg8aVgrv4nfD+Zw==",
"dependencies": {
"@babel/runtime": "^7.12.0",
"gl-matrix": "^3.0.0"
"gl-matrix": "~3.3.0"
}
},
"node_modules/@mdx-js/loader": {
@ -21130,169 +21130,8 @@
"link": true
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-deckgl/-/legacy-preset-chart-deckgl-0.4.13.tgz",
"integrity": "sha512-SRyAQ5NgcqCkhkOXsnzX7+GdapUzEgD5eFEvkC+4DHgUuxQv2M1nxWhDIQ31mq3MCfygqdaY8GwR74vsHHg5Zg==",
"dependencies": {
"@math.gl/web-mercator": "^3.2.2",
"@types/d3-array": "^2.0.0",
"bootstrap-slider": "^10.0.0",
"d3-array": "^1.2.4",
"d3-color": "^1.4.1",
"d3-scale": "^3.0.0",
"deck.gl": "8.5.2",
"jquery": "^3.4.1",
"lodash": "^4.17.15",
"mapbox-gl": "^2.4.0",
"moment": "^2.20.1",
"mousetrap": "^1.6.1",
"prop-types": "^15.6.0",
"react-bootstrap-slider": "2.1.5",
"react-map-gl": "^6.1.16",
"underscore": "^1.8.3",
"urijs": "^1.18.10",
"xss": "^1.0.6"
},
"peerDependencies": {
"@superset-ui/chart-controls": "0.x.x",
"@superset-ui/core": "0.x.x",
"react": "^16.13.1"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/@mapbox/geojson-rewind": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.1.tgz",
"integrity": "sha512-eL7fMmfTBKjrb+VFHXCGv9Ot0zc3C0U+CwXo1IrP+EPwDczLoXv34Tgq3y+2mPSFNVUXgU42ILWJTC7145KPTA==",
"dependencies": {
"get-stream": "^6.0.1",
"minimist": "^1.2.5"
},
"bin": {
"geojson-rewind": "geojson-rewind"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/@mapbox/mapbox-gl-supported": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.0.tgz",
"integrity": "sha512-zu4udqYiBrKMQKwpKJ4hhPON7tz0QR/JZ3iGpHnNWFmH3Sv/ysxlICATUtGCFpsyJf2v1WpFhlzaZ3GhhKmPMA=="
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/d3-scale": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.3.0.tgz",
"integrity": "sha512-1JGp44NQCt5d1g+Yy+GeOnZP7xHo0ii8zsQp6PGzd+C1/dl0KGsp9A7Mxwp+1D1o4unbTTxVdU/ZOIEBoeZPbQ==",
"dependencies": {
"d3-array": "^2.3.0",
"d3-format": "1 - 2",
"d3-interpolate": "1.2.0 - 2",
"d3-time": "^2.1.1",
"d3-time-format": "2 - 3"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/d3-scale/node_modules/d3-array": {
"version": "2.12.1",
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz",
"integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==",
"dependencies": {
"internmap": "^1.0.0"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/d3-time": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.1.1.tgz",
"integrity": "sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ==",
"dependencies": {
"d3-array": "2"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/d3-time/node_modules/d3-array": {
"version": "2.12.1",
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz",
"integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==",
"dependencies": {
"internmap": "^1.0.0"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/get-stream": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/mapbox-gl": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-2.4.0.tgz",
"integrity": "sha512-oH5fkh209U2Zqvgs1bBS+SQVhrj8rUT9OTgZmg+20GaNthDJFYDCXvGidVAkgacuCHSIALTZKzMV1DFgO+isFQ==",
"dependencies": {
"@mapbox/geojson-rewind": "^0.5.0",
"@mapbox/geojson-types": "^1.0.2",
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
"@mapbox/mapbox-gl-supported": "^2.0.0",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/tiny-sdf": "^1.2.5",
"@mapbox/unitbezier": "^0.0.0",
"@mapbox/vector-tile": "^1.3.1",
"@mapbox/whoots-js": "^3.1.0",
"csscolorparser": "~1.0.3",
"earcut": "^2.2.2",
"geojson-vt": "^3.2.1",
"gl-matrix": "^3.3.0",
"grid-index": "^1.1.0",
"minimist": "^1.2.5",
"murmurhash-js": "^1.0.0",
"pbf": "^3.2.1",
"potpack": "^1.0.1",
"quickselect": "^2.0.0",
"rw": "^1.3.3",
"supercluster": "^7.1.3",
"tinyqueue": "^2.0.3",
"vt-pbf": "^3.1.1"
},
"engines": {
"node": ">=14.15.4"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/react-map-gl": {
"version": "6.1.16",
"resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-6.1.16.tgz",
"integrity": "sha512-d/4kFMMh2hDeZNeQOUm2wC1/as9q93EZiDmM5mGBx0LIch+9pTFgO6ZINIuUD9Zz4JqWGpthyjoKr3QKgrGiRA==",
"dependencies": {
"@babel/runtime": "^7.0.0",
"@types/geojson": "^7946.0.7",
"@types/mapbox-gl": "^2.0.3",
"mapbox-gl": "^2.3.0",
"mjolnir.js": "^2.5.0",
"prop-types": "^15.7.2",
"resize-observer-polyfill": "^1.5.1",
"viewport-mercator-project": "^7.0.3"
},
"engines": {
"node": ">= 4",
"npm": ">= 3"
},
"peerDependencies": {
"react": ">=16.3.0"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/supercluster": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.3.tgz",
"integrity": "sha512-7+bR4FbF5SYsmkHfDp61QiwCKtwNDyPsddk9TzfsDA5DQr5Goii5CVD2SXjglweFCxjrzVZf945ahqYfUIk8UA==",
"dependencies": {
"kdbush": "^3.0.0"
}
},
"node_modules/@superset-ui/legacy-preset-chart-deckgl/node_modules/viewport-mercator-project": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/viewport-mercator-project/-/viewport-mercator-project-7.0.3.tgz",
"integrity": "sha512-5nSgVK8jKTSKzOvsa8TSSd2IeQCpHfSNiBOOOMQLvzlxgWD0YoF4xRmyZio3GaLtKSE+50UB892X3R1SAMbaww==",
"dependencies": {
"@math.gl/web-mercator": "^3.4.3"
}
"resolved": "plugins/legacy-preset-chart-deckgl",
"link": true
},
"node_modules/@superset-ui/legacy-preset-chart-nvd3": {
"resolved": "plugins/legacy-preset-chart-nvd3",
@ -22241,9 +22080,9 @@
}
},
"node_modules/@types/mapbox-gl": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-2.4.0.tgz",
"integrity": "sha512-Na5vXw6Ez0L5To/+pL78dWPNoG6QlPdEDdnkSmIL5HWxemD+s0pTmTWDbMj7tcqJ2hnVyOyukVIveR9HPi7eeA==",
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-2.6.0.tgz",
"integrity": "sha512-lHdITzC0IVn9+Pq6WFkkK0N6rUKIqxsdrNeixiQdvROFn2Aeu3TDvhpuag1IdengL5WGGRuEhK6m6HB916ReLw==",
"dependencies": {
"@types/geojson": "*"
}
@ -32134,9 +31973,9 @@
}
},
"node_modules/earcut": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.2.tgz",
"integrity": "sha512-eZoZPPJcUHnfRZ0PjLvx2qBordSiO8ofC3vt+qACLM95u+4DovnbYNpQtJh0DNsWj8RnxrQytD4WA8gj5cRIaQ=="
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz",
"integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug=="
},
"node_modules/ecc-jsbn": {
"version": "0.1.2",
@ -56455,13 +56294,13 @@
"integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="
},
"node_modules/vt-pbf": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.1.tgz",
"integrity": "sha512-pHjWdrIoxurpmTcbfBWXaPwSmtPAHS105253P1qyEfSTV2HJddqjM+kIHquaT/L6lVJIk9ltTGc0IxR/G47hYA==",
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz",
"integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==",
"dependencies": {
"@mapbox/point-geometry": "0.1.0",
"@mapbox/vector-tile": "^1.3.1",
"pbf": "^3.0.5"
"pbf": "^3.2.1"
}
},
"node_modules/w3c-hr-time": {
@ -60888,6 +60727,7 @@
"@superset-ui/legacy-plugin-chart-treemap": "0.18.25",
"@superset-ui/legacy-plugin-chart-world-map": "0.18.25",
"@superset-ui/legacy-preset-chart-big-number": "0.18.25",
"@superset-ui/legacy-preset-chart-deckgl": "^0.4.13",
"@superset-ui/legacy-preset-chart-nvd3": "0.18.25",
"@superset-ui/plugin-chart-echarts": "0.18.25",
"@superset-ui/plugin-chart-table": "0.18.25",
@ -61676,6 +61516,173 @@
"react": "^15 || ^16"
}
},
"plugins/legacy-preset-chart-deckgl": {
"version": "0.4.13",
"license": "Apache-2.0",
"dependencies": {
"@math.gl/web-mercator": "^3.2.2",
"@types/d3-array": "^2.0.0",
"bootstrap-slider": "^10.0.0",
"d3-array": "^1.2.4",
"d3-color": "^1.4.1",
"d3-scale": "^3.0.0",
"deck.gl": "8.5.2",
"jquery": "^3.4.1",
"lodash": "^4.17.15",
"mapbox-gl": "^2.4.0",
"moment": "^2.20.1",
"mousetrap": "^1.6.1",
"prop-types": "^15.6.0",
"react-bootstrap-slider": "2.1.5",
"react-map-gl": "^6.1.16",
"underscore": "^1.8.3",
"urijs": "^1.18.10",
"xss": "^1.0.6"
},
"peerDependencies": {
"@superset-ui/chart-controls": "0.x.x",
"@superset-ui/core": "0.x.x",
"react": "^16.13.1",
"react-dom": "^16.13.1"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/@mapbox/geojson-rewind": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.1.tgz",
"integrity": "sha512-eL7fMmfTBKjrb+VFHXCGv9Ot0zc3C0U+CwXo1IrP+EPwDczLoXv34Tgq3y+2mPSFNVUXgU42ILWJTC7145KPTA==",
"dependencies": {
"get-stream": "^6.0.1",
"minimist": "^1.2.5"
},
"bin": {
"geojson-rewind": "geojson-rewind"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/@mapbox/mapbox-gl-supported": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz",
"integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ=="
},
"plugins/legacy-preset-chart-deckgl/node_modules/@mapbox/tiny-sdf": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.4.tgz",
"integrity": "sha512-CBtL2rhZiYmdIryksp0zh4Mmx54iClYfNb0mpYeHrZnq4z84lVjre7LBWGPEjWspEn6AiF0lxC1HaZDye89m3g=="
},
"plugins/legacy-preset-chart-deckgl/node_modules/d3-scale": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.3.0.tgz",
"integrity": "sha512-1JGp44NQCt5d1g+Yy+GeOnZP7xHo0ii8zsQp6PGzd+C1/dl0KGsp9A7Mxwp+1D1o4unbTTxVdU/ZOIEBoeZPbQ==",
"dependencies": {
"d3-array": "^2.3.0",
"d3-format": "1 - 2",
"d3-interpolate": "1.2.0 - 2",
"d3-time": "^2.1.1",
"d3-time-format": "2 - 3"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/d3-scale/node_modules/d3-array": {
"version": "2.12.1",
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz",
"integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==",
"dependencies": {
"internmap": "^1.0.0"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/d3-time": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.1.1.tgz",
"integrity": "sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ==",
"dependencies": {
"d3-array": "2"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/d3-time/node_modules/d3-array": {
"version": "2.12.1",
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz",
"integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==",
"dependencies": {
"internmap": "^1.0.0"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/get-stream": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/mapbox-gl": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-2.6.1.tgz",
"integrity": "sha512-faGbSZfcFuZ4GWwkWnJrRD3oICZAt/mVKnGuOmeBobCj9onfTRz270qSoOXeRBKd3po5VA2cCPI91YwA8DsAoQ==",
"dependencies": {
"@mapbox/geojson-rewind": "^0.5.1",
"@mapbox/geojson-types": "^1.0.2",
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
"@mapbox/mapbox-gl-supported": "^2.0.0",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/tiny-sdf": "^2.0.2",
"@mapbox/unitbezier": "^0.0.0",
"@mapbox/vector-tile": "^1.3.1",
"@mapbox/whoots-js": "^3.1.0",
"csscolorparser": "~1.0.3",
"earcut": "^2.2.3",
"geojson-vt": "^3.2.1",
"gl-matrix": "^3.3.0",
"grid-index": "^1.1.0",
"minimist": "^1.2.5",
"murmurhash-js": "^1.0.0",
"pbf": "^3.2.1",
"potpack": "^1.0.1",
"quickselect": "^2.0.0",
"rw": "^1.3.3",
"supercluster": "^7.1.4",
"tinyqueue": "^2.0.3",
"vt-pbf": "^3.1.3"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/react-map-gl": {
"version": "6.1.17",
"resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-6.1.17.tgz",
"integrity": "sha512-SKuMtvs7aQpHMJehf/GzUQnEhPWRIypTX7X2wVXGME2RBKdY0PnC1YTiy8W3aA4uwcolPvCCYB+ki3xal51ZXQ==",
"dependencies": {
"@babel/runtime": "^7.0.0",
"@types/geojson": "^7946.0.7",
"@types/mapbox-gl": "^2.0.3",
"mapbox-gl": "^2.3.0",
"mjolnir.js": "^2.5.0",
"prop-types": "^15.7.2",
"resize-observer-polyfill": "^1.5.1",
"viewport-mercator-project": "^7.0.4"
},
"engines": {
"node": ">= 4",
"npm": ">= 3"
},
"peerDependencies": {
"react": ">=16.3.0"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/supercluster": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.4.tgz",
"integrity": "sha512-GhKkRM1jMR6WUwGPw05fs66pOFWhf59lXq+Q3J3SxPvhNcmgOtLRV6aVQPMRsmXdpaeFJGivt+t7QXUPL3ff4g==",
"dependencies": {
"kdbush": "^3.0.0"
}
},
"plugins/legacy-preset-chart-deckgl/node_modules/viewport-mercator-project": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/viewport-mercator-project/-/viewport-mercator-project-7.0.4.tgz",
"integrity": "sha512-0jzpL6pIMocCKWg1C3mqi/N4UPgZC3FzwghEm1H+XsUo8hNZAyJc3QR7YqC816ibOR8aWT5pCsV+gCu8/BMJgg==",
"dependencies": {
"@math.gl/web-mercator": "^3.5.5"
}
},
"plugins/legacy-preset-chart-nvd3": {
"name": "@superset-ui/legacy-preset-chart-nvd3",
"version": "0.18.25",
@ -68130,12 +68137,12 @@
}
},
"@math.gl/web-mercator": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.5.3.tgz",
"integrity": "sha512-WZE9ALeTS4n3HDgkqTxcNLBU7DL0mjmPXSrcqSZIUeDY00+LCtNvMQWUAwqolpB7nD71vD6HLW8delzVuy4teA==",
"version": "3.5.6",
"resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.5.6.tgz",
"integrity": "sha512-siWHLJGp9o8fDEM1t0Rby+JXftl6il0z3927liWGzkHqFftXPHY858ShPy45ThDU8q5lyCftg8aVgrv4nfD+Zw==",
"requires": {
"@babel/runtime": "^7.12.0",
"gl-matrix": "^3.0.0"
"gl-matrix": "~3.3.0"
}
},
"@mdx-js/loader": {
@ -77848,6 +77855,7 @@
"@superset-ui/legacy-plugin-chart-treemap": "0.18.25",
"@superset-ui/legacy-plugin-chart-world-map": "0.18.25",
"@superset-ui/legacy-preset-chart-big-number": "0.18.25",
"@superset-ui/legacy-preset-chart-deckgl": "^0.4.13",
"@superset-ui/legacy-preset-chart-nvd3": "0.18.25",
"@superset-ui/plugin-chart-echarts": "0.18.25",
"@superset-ui/plugin-chart-table": "0.18.25",
@ -78486,9 +78494,7 @@
}
},
"@superset-ui/legacy-preset-chart-deckgl": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-deckgl/-/legacy-preset-chart-deckgl-0.4.13.tgz",
"integrity": "sha512-SRyAQ5NgcqCkhkOXsnzX7+GdapUzEgD5eFEvkC+4DHgUuxQv2M1nxWhDIQ31mq3MCfygqdaY8GwR74vsHHg5Zg==",
"version": "file:plugins/legacy-preset-chart-deckgl",
"requires": {
"@math.gl/web-mercator": "^3.2.2",
"@types/d3-array": "^2.0.0",
@ -78520,9 +78526,14 @@
}
},
"@mapbox/mapbox-gl-supported": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.0.tgz",
"integrity": "sha512-zu4udqYiBrKMQKwpKJ4hhPON7tz0QR/JZ3iGpHnNWFmH3Sv/ysxlICATUtGCFpsyJf2v1WpFhlzaZ3GhhKmPMA=="
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz",
"integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ=="
},
"@mapbox/tiny-sdf": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.4.tgz",
"integrity": "sha512-CBtL2rhZiYmdIryksp0zh4Mmx54iClYfNb0mpYeHrZnq4z84lVjre7LBWGPEjWspEn6AiF0lxC1HaZDye89m3g=="
},
"d3-scale": {
"version": "3.3.0",
@ -78570,21 +78581,21 @@
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="
},
"mapbox-gl": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-2.4.0.tgz",
"integrity": "sha512-oH5fkh209U2Zqvgs1bBS+SQVhrj8rUT9OTgZmg+20GaNthDJFYDCXvGidVAkgacuCHSIALTZKzMV1DFgO+isFQ==",
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-2.6.1.tgz",
"integrity": "sha512-faGbSZfcFuZ4GWwkWnJrRD3oICZAt/mVKnGuOmeBobCj9onfTRz270qSoOXeRBKd3po5VA2cCPI91YwA8DsAoQ==",
"requires": {
"@mapbox/geojson-rewind": "^0.5.0",
"@mapbox/geojson-rewind": "^0.5.1",
"@mapbox/geojson-types": "^1.0.2",
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
"@mapbox/mapbox-gl-supported": "^2.0.0",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/tiny-sdf": "^1.2.5",
"@mapbox/tiny-sdf": "^2.0.2",
"@mapbox/unitbezier": "^0.0.0",
"@mapbox/vector-tile": "^1.3.1",
"@mapbox/whoots-js": "^3.1.0",
"csscolorparser": "~1.0.3",
"earcut": "^2.2.2",
"earcut": "^2.2.3",
"geojson-vt": "^3.2.1",
"gl-matrix": "^3.3.0",
"grid-index": "^1.1.0",
@ -78594,15 +78605,15 @@
"potpack": "^1.0.1",
"quickselect": "^2.0.0",
"rw": "^1.3.3",
"supercluster": "^7.1.3",
"supercluster": "^7.1.4",
"tinyqueue": "^2.0.3",
"vt-pbf": "^3.1.1"
"vt-pbf": "^3.1.3"
}
},
"react-map-gl": {
"version": "6.1.16",
"resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-6.1.16.tgz",
"integrity": "sha512-d/4kFMMh2hDeZNeQOUm2wC1/as9q93EZiDmM5mGBx0LIch+9pTFgO6ZINIuUD9Zz4JqWGpthyjoKr3QKgrGiRA==",
"version": "6.1.17",
"resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-6.1.17.tgz",
"integrity": "sha512-SKuMtvs7aQpHMJehf/GzUQnEhPWRIypTX7X2wVXGME2RBKdY0PnC1YTiy8W3aA4uwcolPvCCYB+ki3xal51ZXQ==",
"requires": {
"@babel/runtime": "^7.0.0",
"@types/geojson": "^7946.0.7",
@ -78611,23 +78622,23 @@
"mjolnir.js": "^2.5.0",
"prop-types": "^15.7.2",
"resize-observer-polyfill": "^1.5.1",
"viewport-mercator-project": "^7.0.3"
"viewport-mercator-project": "^7.0.4"
}
},
"supercluster": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.3.tgz",
"integrity": "sha512-7+bR4FbF5SYsmkHfDp61QiwCKtwNDyPsddk9TzfsDA5DQr5Goii5CVD2SXjglweFCxjrzVZf945ahqYfUIk8UA==",
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.4.tgz",
"integrity": "sha512-GhKkRM1jMR6WUwGPw05fs66pOFWhf59lXq+Q3J3SxPvhNcmgOtLRV6aVQPMRsmXdpaeFJGivt+t7QXUPL3ff4g==",
"requires": {
"kdbush": "^3.0.0"
}
},
"viewport-mercator-project": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/viewport-mercator-project/-/viewport-mercator-project-7.0.3.tgz",
"integrity": "sha512-5nSgVK8jKTSKzOvsa8TSSd2IeQCpHfSNiBOOOMQLvzlxgWD0YoF4xRmyZio3GaLtKSE+50UB892X3R1SAMbaww==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/viewport-mercator-project/-/viewport-mercator-project-7.0.4.tgz",
"integrity": "sha512-0jzpL6pIMocCKWg1C3mqi/N4UPgZC3FzwghEm1H+XsUo8hNZAyJc3QR7YqC816ibOR8aWT5pCsV+gCu8/BMJgg==",
"requires": {
"@math.gl/web-mercator": "^3.4.3"
"@math.gl/web-mercator": "^3.5.5"
}
}
}
@ -79575,9 +79586,9 @@
}
},
"@types/mapbox-gl": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-2.4.0.tgz",
"integrity": "sha512-Na5vXw6Ez0L5To/+pL78dWPNoG6QlPdEDdnkSmIL5HWxemD+s0pTmTWDbMj7tcqJ2hnVyOyukVIveR9HPi7eeA==",
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-2.6.0.tgz",
"integrity": "sha512-lHdITzC0IVn9+Pq6WFkkK0N6rUKIqxsdrNeixiQdvROFn2Aeu3TDvhpuag1IdengL5WGGRuEhK6m6HB916ReLw==",
"requires": {
"@types/geojson": "*"
}
@ -87374,9 +87385,9 @@
}
},
"earcut": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.2.tgz",
"integrity": "sha512-eZoZPPJcUHnfRZ0PjLvx2qBordSiO8ofC3vt+qACLM95u+4DovnbYNpQtJh0DNsWj8RnxrQytD4WA8gj5cRIaQ=="
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz",
"integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug=="
},
"ecc-jsbn": {
"version": "0.1.2",
@ -106363,13 +106374,13 @@
"integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="
},
"vt-pbf": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.1.tgz",
"integrity": "sha512-pHjWdrIoxurpmTcbfBWXaPwSmtPAHS105253P1qyEfSTV2HJddqjM+kIHquaT/L6lVJIk9ltTGc0IxR/G47hYA==",
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz",
"integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==",
"requires": {
"@mapbox/point-geometry": "0.1.0",
"@mapbox/vector-tile": "^1.3.1",
"pbf": "^3.0.5"
"pbf": "^3.2.1"
}
},
"w3c-hr-time": {

View File

@ -229,7 +229,7 @@ export type SelectControlType =
| 'FilterBoxItemControl';
// via react-select/src/filters
interface FilterOption<T extends SelectOption> {
export interface FilterOption<T extends SelectOption> {
label: string;
value: string;
data: T;

View File

@ -62,6 +62,7 @@
"@superset-ui/legacy-plugin-chart-treemap": "0.18.25",
"@superset-ui/legacy-plugin-chart-world-map": "0.18.25",
"@superset-ui/legacy-preset-chart-big-number": "0.18.25",
"@superset-ui/legacy-preset-chart-deckgl": "^0.4.13",
"@superset-ui/legacy-preset-chart-nvd3": "0.18.25",
"@superset-ui/plugin-chart-echarts": "0.18.25",
"@superset-ui/plugin-chart-table": "0.18.25",

View File

@ -0,0 +1,101 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
import React from 'react';
import { SuperChart } from '@superset-ui/core';
import { ArcChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
import payload from './payload';
import dummyDatasource from '../../../../shared/dummyDatasource';
new ArcChartPlugin().configure({ key: 'deck_arc' }).register();
export default {
title: 'Legacy Chart Plugins/legacy-preset-chart-deckgl/ArcChartPlugin',
};
export const ArcChartViz = () => (
<SuperChart
chartType="deck_arc"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[payload]}
formData={{
datasource: '10__table',
viz_type: 'deck_arc',
granularity_sqla: 'dttm',
time_grain_sqla: null,
time_range: ' : ',
start_spatial: {
latCol: 'LATITUDE',
lonCol: 'LONGITUDE',
type: 'latlong',
},
end_spatial: {
latCol: 'LATITUDE_DEST',
lonCol: 'LONGITUDE_DEST',
type: 'latlong',
},
row_limit: 5000,
filter_nulls: true,
adhoc_filters: [],
mapbox_style: 'mapbox://styles/mapbox/light-v9',
viewport: {
altitude: 1.5,
bearing: 8.546256357301871,
height: 642,
latitude: 44.596651438714254,
longitude: -91.84340711201104,
maxLatitude: 85.05113,
maxPitch: 60,
maxZoom: 20,
minLatitude: -85.05113,
minPitch: 0,
minZoom: 0,
pitch: 60,
width: 997,
zoom: 2.929837070560775,
},
autozoom: true,
color_picker: {
a: 1,
b: 135,
g: 122,
r: 0,
},
target_color_picker: {
r: 0,
g: 122,
b: 135,
a: 1,
},
dimension: null,
label_colors: {},
stroke_width: 1,
legend_position: 'tr',
legend_format: null,
js_columns: [],
js_data_mutator: '',
js_tooltip: '',
js_onclick_href: '',
}}
/>
);

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys, no-magic-numbers */
export default {

View File

@ -0,0 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
import React from 'react';
import { SuperChart } from '@superset-ui/core';
import { GridChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
import payload from './payload';
import dummyDatasource from '../../../../shared/dummyDatasource';
new GridChartPlugin().configure({ key: 'deck_grid' }).register();
export default {
title: 'Legacy Chart Plugins/legacy-preset-chart-deckgl/GridChartPlugin',
};
export const GridChartViz = () => (
<SuperChart
chartType="deck_grid"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[payload]}
formData={{
datasource: '5__table',
viz_type: 'deck_grid',
slice_id: 69,
url_params: {},
granularity_sqla: 'dttm',
time_grain_sqla: null,
time_range: '+:+',
spatial: { latCol: 'LAT', lonCol: 'LON', type: 'latlong' },
size: 'count',
row_limit: 5000,
filter_nulls: true,
adhoc_filters: [],
mapbox_style: 'mapbox://styles/mapbox/satellite-streets-v9',
viewport: {
bearing: 155.80099696026355,
latitude: 37.7942314882596,
longitude: -122.42066918995666,
pitch: 53.470800300695146,
zoom: 12.699690845482069,
},
color_picker: { a: 1, b: 0, g: 255, r: 14 },
autozoom: true,
grid_size: 120,
extruded: true,
js_columns: [],
js_data_mutator: '',
js_tooltip: '',
js_onclick_href: '',
}}
/>
);

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
export default {

View File

@ -0,0 +1,73 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
import React from 'react';
import { SuperChart } from '@superset-ui/core';
import { HexChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
import payload from './payload';
import dummyDatasource from '../../../../shared/dummyDatasource';
new HexChartPlugin().configure({ key: 'deck_hex' }).register();
export default {
title: 'Legacy Chart Plugins/legacy-preset-chart-deckgl/HexChartPlugin',
};
export const HexChartViz = () => (
<SuperChart
chartType="deck_hex"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[payload]}
formData={{
datasource: '5__table',
viz_type: 'deck_hex',
slice_id: 68,
url_params: {},
granularity_sqla: 'dttm',
time_grain_sqla: null,
time_range: '+:+',
spatial: { latCol: 'LAT', lonCol: 'LON', type: 'latlong' },
size: 'count',
row_limit: 5000,
filter_nulls: true,
adhoc_filters: [],
mapbox_style: 'mapbox://styles/mapbox/streets-v9',
viewport: {
bearing: -2.3984797349335167,
latitude: 37.789795085160335,
longitude: -122.40632230075536,
pitch: 54.08961642447763,
zoom: 13.835465702403654,
},
color_picker: { a: 1, b: 0, g: 255, r: 14 },
autozoom: true,
grid_size: 40,
extruded: true,
js_agg_function: 'sum',
js_columns: [],
js_data_mutator: '',
js_tooltip: '',
js_onclick_href: '',
}}
/>
);

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
export default {

View File

@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
import React from 'react';
import { SuperChart } from '@superset-ui/core';
import { PathChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
import payload from './payload';
import dummyDatasource from '../../../../shared/dummyDatasource';
new PathChartPlugin().configure({ key: 'deck_path' }).register();
export default {
title: 'Legacy Chart Plugins/legacy-preset-chart-deckgl/PathChartPlugin',
};
export const PathChartViz = () => (
<SuperChart
chartType="deck_path"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[payload]}
formData={{
datasource: '11__table',
viz_type: 'deck_path',
slice_id: 72,
url_params: {},
granularity_sqla: null,
time_grain_sqla: null,
time_range: '+:+',
line_column: 'path_json',
line_type: 'json',
row_limit: 5000,
filter_nulls: true,
adhoc_filters: [],
mapbox_style: 'mapbox://styles/mapbox/light-v9',
viewport: {
altitude: 1.5,
bearing: 0,
height: 1094,
latitude: 37.73671752604488,
longitude: -122.18885402582598,
maxLatitude: 85.05113,
maxPitch: 60,
maxZoom: 20,
minLatitude: -85.05113,
minPitch: 0,
minZoom: 0,
pitch: 0,
width: 669,
zoom: 9.51847667620428,
},
color_picker: { a: 1, b: 135, g: 122, r: 0 },
line_width: 150,
reverse_long_lat: false,
autozoom: true,
js_columns: ['color'],
js_data_mutator: '',
js_tooltip: '',
js_onclick_href: '',
}}
/>
);

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
export default {

View File

@ -0,0 +1,141 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
import React from 'react';
import { SuperChart } from '@superset-ui/core';
import { PolygonChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
import payload from './payload';
import geojsonPayload from './geojsonPayload';
import dummyDatasource from '../../../../shared/dummyDatasource';
new PolygonChartPlugin().configure({ key: 'deck_polygon' }).register();
export default {
title: 'Legacy Chart Plugins/legacy-preset-chart-deckgl/PolygonChartPlugin',
};
export const GeojsonPayload = () => (
<SuperChart
chartType="deck_polygon"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[geojsonPayload]}
formData={{
datasource: '9__table',
viz_type: 'deck_polygon',
time_range: '+:+',
line_column: 'contour',
line_type: 'json',
adhoc_filters: [],
metric: 'count',
point_radius_fixed: { type: 'fix', value: 1000 },
row_limit: 10000,
reverse_long_lat: false,
filter_nulls: true,
mapbox_style: 'mapbox://styles/mapbox/light-v9',
viewport: {
longitude: 6.85236157047845,
latitude: 31.222656842808707,
zoom: 1,
bearing: 0,
pitch: 0,
},
autozoom: true,
fill_color_picker: { a: 1, b: 73, g: 65, r: 3 },
stroke_color_picker: { a: 1, b: 135, g: 122, r: 0 },
filled: true,
stroked: false,
extruded: true,
multiplier: 1,
line_width: 10,
linear_color_scheme: 'blue_white_yellow',
opacity: 80,
num_buckets: 5,
table_filter: false,
toggle_polygons: true,
legend_position: 'tr',
}}
/>
);
export const Payload = () => (
<SuperChart
chartType="deck_polygon"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[payload]}
formData={{
datasource: '9__table',
viz_type: 'deck_polygon',
slice_id: 70,
url_params: {},
granularity_sqla: null,
time_grain_sqla: null,
time_range: '+:+',
line_column: 'contour',
line_type: 'json',
adhoc_filters: [],
metric: 'population',
point_radius_fixed: { type: 'fix', value: 1000 },
row_limit: 10000,
reverse_long_lat: false,
filter_nulls: true,
mapbox_style: 'mapbox://styles/mapbox/light-v9',
viewport: {
altitude: 1.5,
bearing: 37.89506450385642,
height: 906,
latitude: 37.752020331384834,
longitude: -122.43388541747726,
maxLatitude: 85.05113,
maxPitch: 60,
maxZoom: 20,
minLatitude: -85.05113,
minPitch: 0,
minZoom: 0,
pitch: 60,
width: 667,
zoom: 11.133995608594631,
},
autozoom: true,
fill_color_picker: { a: 1, b: 73, g: 65, r: 3 },
stroke_color_picker: { a: 1, b: 135, g: 122, r: 0 },
filled: true,
stroked: false,
extruded: true,
multiplier: 1,
line_width: 10,
linear_color_scheme: 'blue_white_yellow',
opacity: 80,
num_buckets: 5,
table_filter: false,
toggle_polygons: true,
legend_position: 'tr',
legend_format: null,
js_columns: ['population', 'area'],
js_data_mutator: '',
js_tooltip: '',
js_onclick_href: '',
}}
/>
);

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export default {
cache_key: '31946c4488d1899827d283b668d83281',
cached_dttm: '2020-03-04T22:40:59',

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
export default {

View File

@ -0,0 +1,80 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
import React from 'react';
import { SuperChart } from '@superset-ui/core';
import { ScatterChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
import payload from './payload';
import dummyDatasource from '../../../../shared/dummyDatasource';
new ScatterChartPlugin().configure({ key: 'deck_scatter' }).register();
export default {
title: 'Legacy Chart Plugins/legacy-preset-chart-deckgl/ScatterChartPlugin',
};
export const ScatterChartViz = () => (
<SuperChart
chartType="deck_scatter"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[payload]}
formData={{
datasource: '5__table',
viz_type: 'deck_scatter',
slice_id: 66,
url_params: {},
granularity_sqla: 'dttm',
time_grain_sqla: null,
time_range: '+:+',
spatial: { latCol: 'LAT', lonCol: 'LON', type: 'latlong' },
row_limit: 5000,
filter_nulls: true,
adhoc_filters: [],
mapbox_style: 'mapbox://styles/mapbox/light-v9',
viewport: {
bearing: -4.952916738791771,
latitude: 37.78926922909199,
longitude: -122.42613341901688,
pitch: 4.750411100577438,
zoom: 12.729132798697304,
},
autozoom: true,
point_radius_fixed: { type: 'metric', value: 'count' },
point_unit: 'square_m',
min_radius: 2,
max_radius: 250,
multiplier: 10,
color_picker: { a: 0.82, b: 3, g: 0, r: 205 },
legend_position: 'tr',
legend_format: null,
dimension: null,
color_scheme: 'bnbColors',
label_colors: {},
js_columns: [],
js_data_mutator: '',
js_tooltip: '',
js_onclick_href: '',
granularity: null,
}}
/>
);

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
export default {

View File

@ -0,0 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
import React from 'react';
import { SuperChart } from '@superset-ui/core';
import { ScreengridChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
import payload from './payload';
import dummyDatasource from '../../../../shared/dummyDatasource';
new ScreengridChartPlugin().configure({ key: 'deck_screengrid' }).register();
export default {
title:
'Legacy Chart Plugins/legacy-preset-chart-deckgl/ScreengridChartPlugin',
};
export const ScreengridChartViz = () => (
<SuperChart
chartType="deck_screengrid"
width={400}
height={400}
datasource={dummyDatasource}
queriesData={[payload]}
formData={{
datasource: '5__table',
viz_type: 'deck_screengrid',
slice_id: 67,
url_params: {},
granularity_sqla: 'dttm',
time_grain_sqla: null,
time_range: '+:+',
spatial: { latCol: 'LAT', lonCol: 'LON', type: 'latlong' },
size: 'count',
row_limit: 5000,
filter_nulls: true,
adhoc_filters: [],
mapbox_style: 'mapbox://styles/mapbox/dark-v9',
viewport: {
bearing: -4.952916738791771,
latitude: 37.76024135844065,
longitude: -122.41827069521386,
pitch: 4.750411100577438,
zoom: 14.161641703941438,
},
autozoom: true,
grid_size: 20,
color_picker: { a: 1, b: 0, g: 255, r: 14 },
js_columns: [],
js_data_mutator: '',
js_tooltip: '',
js_onclick_href: '',
}}
/>
);

View File

@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable sort-keys */
/* eslint-disable no-magic-numbers */
export default {

View File

@ -1,3 +1,22 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## @superset-ui/legacy-preset-chart-deckgl
[![Version](https://img.shields.io/npm/v/@superset-ui/legacy-preset-chart-deckgl.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-preset-chart-deckgl.svg?style=flat-square)
@ -20,9 +39,7 @@ or register charts one by one. Configure `key`, which can be any `string`, and r
```js
import { ArcChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
new ArcChartPlugin()
.configure({ key: 'deck_arc' })
.register();
new ArcChartPlugin().configure({ key: 'deck_arc' }).register();
```
Then use it via `SuperChart`. See [storybook](https://apache-superset.github.io/superset-ui-plugins-deckgl) for more details.

View File

@ -2,6 +2,19 @@
"name": "@superset-ui/legacy-preset-chart-deckgl",
"version": "0.4.13",
"description": "Superset Legacy Chart - deck.gl",
"keywords": [
"superset"
],
"homepage": "https://github.com/apache-superset/superset-ui-plugins-deckgl#readme",
"bugs": {
"url": "https://github.com/apache-superset/superset-ui-plugins-deckgl/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/apache-superset/superset-ui-plugins-deckgl.git"
},
"license": "Apache-2.0",
"author": "Superset",
"sideEffects": true,
"main": "lib/index.js",
"module": "esm/index.js",
@ -9,22 +22,6 @@
"esm",
"lib"
],
"repository": {
"type": "git",
"url": "git+https://github.com/apache-superset/superset-ui-plugins-deckgl.git"
},
"keywords": [
"superset"
],
"author": "Superset",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/apache-superset/superset-ui-plugins-deckgl/issues"
},
"homepage": "https://github.com/apache-superset/superset-ui-plugins-deckgl#readme",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@math.gl/web-mercator": "^3.2.2",
"@types/d3-array": "^2.0.0",
@ -48,6 +45,10 @@
"peerDependencies": {
"@superset-ui/chart-controls": "0.x.x",
"@superset-ui/core": "0.x.x",
"react": "^16.13.1"
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"publishConfig": {
"access": "public"
}
}

View File

@ -23,7 +23,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import DeckGLContainer from './DeckGLContainer';
import { DeckGLContainerStyledWrapper } from './DeckGLContainer';
import PlaySlider from './components/PlaySlider';
const PLAYSLIDER_HEIGHT = 20; // px
@ -86,7 +86,7 @@ export default class AnimatableDeckGLContainer extends React.PureComponent {
return (
<div>
<DeckGLContainer
<DeckGLContainerStyledWrapper
ref={this.containerRef}
viewport={viewport}
layers={layers}

View File

@ -98,7 +98,9 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
onValuesChange(values) {
this.setState({
values: Array.isArray(values) ? values : [values, values + this.state.getStep(values)],
values: Array.isArray(values)
? values
: [values, values + this.state.getStep(values)],
});
}
@ -118,9 +120,14 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
// the granularity has to be read from the payload form_data, not the
// props formData which comes from the instantaneous controls state
const granularity =
props.payload.form_data.time_grain_sqla || props.payload.form_data.granularity || 'P1D';
props.payload.form_data.time_grain_sqla ||
props.payload.form_data.granularity ||
'P1D';
const { start, end, getStep, values, disabled } = getPlaySliderParams(timestamps, granularity);
const { start, end, getStep, values, disabled } = getPlaySliderParams(
timestamps,
granularity,
);
const { width, height, formData } = props;
let { viewport } = props;
@ -164,15 +171,21 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
// Filter by time
if (values[0] === values[1] || values[1] === this.end) {
features = features.filter(d => d.__timestamp >= values[0] && d.__timestamp <= values[1]);
features = features.filter(
d => d.__timestamp >= values[0] && d.__timestamp <= values[1],
);
} else {
features = features.filter(d => d.__timestamp >= values[0] && d.__timestamp < values[1]);
features = features.filter(
d => d.__timestamp >= values[0] && d.__timestamp < values[1],
);
}
// Show only categories selected in the legend
const cats = this.state.categories;
if (fd.dimension) {
features = features.filter(d => cats[d.cat_color] && cats[d.cat_color].enabled);
features = features.filter(
d => cats[d.cat_color] && cats[d.cat_color].enabled,
);
}
const filteredPayload = {
@ -180,7 +193,15 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
data: { ...payload.data, features },
};
return [getLayer(fd, filteredPayload, onAddFilter, this.setTooltip, this.props.datasource)];
return [
getLayer(
fd,
filteredPayload,
onAddFilter,
this.setTooltip,
this.props.datasource,
),
];
}
// eslint-disable-next-line class-methods-use-this

View File

@ -42,6 +42,7 @@ const propTypes = {
bottomMargin: PropTypes.number,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
onViewportChange: PropTypes.func,
};
const defaultProps = {
mapStyle: 'light',
@ -50,7 +51,7 @@ const defaultProps = {
bottomMargin: 0,
};
class DeckGLContainer extends React.Component {
export class DeckGLContainer extends React.Component {
constructor(props) {
super(props);
this.tick = this.tick.bind(this);
@ -133,7 +134,7 @@ class DeckGLContainer extends React.Component {
DeckGLContainer.propTypes = propTypes;
DeckGLContainer.defaultProps = defaultProps;
export default styled(DeckGLContainer)`
export const DeckGLContainerStyledWrapper = styled(DeckGLContainer)`
.deckgl-tooltip > div {
overflow: hidden;
text-overflow: ellipsis;

View File

@ -24,7 +24,7 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import { SupersetClient } from '@superset-ui/core';
import DeckGLContainer from '../DeckGLContainer';
import { DeckGLContainerStyledWrapper } from '../DeckGLContainer';
import { getExploreLongUrl } from '../utils/explore';
import layerGenerators from '../layers';
@ -57,7 +57,10 @@ class DeckMulti extends React.PureComponent {
UNSAFE_componentWillReceiveProps(nextProps) {
const { formData, payload } = nextProps;
const hasChanges = !_.isEqual(this.props.formData.deck_slices, nextProps.formData.deck_slices);
const hasChanges = !_.isEqual(
this.props.formData.deck_slices,
nextProps.formData.deck_slices,
);
if (hasChanges) {
this.loadLayers(formData, payload);
}
@ -123,7 +126,7 @@ class DeckMulti extends React.PureComponent {
const layers = Object.values(subSlicesLayers);
return (
<DeckGLContainer
<DeckGLContainerStyledWrapper
ref={this.containerRef}
mapboxApiAccessToken={payload.data.mapboxApiKey}
viewport={this.state.viewport || this.props.viewport}

View File

@ -37,8 +37,11 @@ export default {
label: t('deck.gl charts'),
validators: [validateNonEmpty],
default: [],
description: t('Pick a set of deck.gl charts to layer on top of one another'),
dataEndpoint: '/sliceasync/api/read?_flt_0_viz_type=deck_&_flt_7_viz_type=deck_multi',
description: t(
'Pick a set of deck.gl charts to layer on top of one another',
),
dataEndpoint:
'/sliceasync/api/read?_flt_0_viz_type=deck_&_flt_7_viz_type=deck_multi',
placeholder: t('Select charts'),
onAsyncErrorMessage: t('Error while fetching charts'),
mutator: data => {

View File

@ -64,14 +64,19 @@ export default class Legend extends React.PureComponent {
if (k.includes(categoryDelimiter)) {
const values = k.split(categoryDelimiter);
return this.format(values[0]) + categoryDelimiter + this.format(values[1]);
return (
this.format(values[0]) + categoryDelimiter + this.format(values[1])
);
}
return this.format(k);
}
render() {
if (Object.keys(this.props.categories).length === 0 || this.props.position === null) {
if (
Object.keys(this.props.categories).length === 0 ||
this.props.position === null
) {
return null;
}

View File

@ -63,7 +63,8 @@ export default class PlaySlider extends React.PureComponent {
const frames = Math.min(props.maxFrames, range / props.step);
const width = range / frames;
this.intervalMilliseconds = props.loopDuration / frames;
this.increment = width < props.step ? props.step : width - (width % props.step);
this.increment =
width < props.step ? props.step : width - (width % props.step);
this.onChange = this.onChange.bind(this);
this.play = this.play.bind(this);
@ -121,7 +122,9 @@ export default class PlaySlider extends React.PureComponent {
return;
}
const currentValues = Array.isArray(values) ? values : [values, values + step];
const currentValues = Array.isArray(values)
? values
: [values, values + step];
const nextValues = currentValues.map(value => value + this.increment);
const carriageReturn = nextValues[1] > end ? nextValues[0] - start : 0;
@ -135,7 +138,9 @@ export default class PlaySlider extends React.PureComponent {
return;
}
const currentValues = Array.isArray(values) ? values : [values, values + step];
const currentValues = Array.isArray(values)
? values
: [values, values + step];
const nextValues = currentValues.map(value => value - this.increment);
const carriageReturn = nextValues[0] < start ? end - nextValues[1] : 0;
@ -158,14 +163,21 @@ export default class PlaySlider extends React.PureComponent {
}
render() {
const { start, end, step, orientation, reversed, disabled, range, values } = this.props;
const { start, end, step, orientation, reversed, disabled, range, values } =
this.props;
return (
<div className="play-slider">
<div className="play-slider-controls padded">
<i className="fa fa-step-backward fa-lg slider-button " onClick={this.stepBackward} />
<i
className="fa fa-step-backward fa-lg slider-button "
onClick={this.stepBackward}
/>
<i className={this.getPlayClass()} onClick={this.play} />
<i className="fa fa-step-forward fa-lg slider-button " onClick={this.stepForward} />
<i
className="fa fa-step-forward fa-lg slider-button "
onClick={this.stepForward}
/>
</div>
<div className="play-slider-scrobbler padded">
<BootrapSliderWrapper

View File

@ -1,3 +1,22 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React, { useMemo, CSSProperties } from 'react';
import { filterXSS } from 'xss';

View File

@ -1,7 +1,3 @@
/* eslint-disable react/sort-prop-types */
/* eslint-disable react/jsx-handler-names */
/* eslint-disable camelcase */
/* eslint-disable react/no-unused-prop-types */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -21,34 +17,55 @@
* under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import { isEqual } from 'lodash';
import { Datasource, QueryFormData, JsonObject } from '@superset-ui/core';
import DeckGLContainer from './DeckGLContainer';
import {
DeckGLContainerStyledWrapper,
DeckGLContainer,
} from './DeckGLContainer';
import CategoricalDeckGLContainer from './CategoricalDeckGLContainer';
// eslint-disable-next-line import/extensions
import fitViewport from './utils/fitViewport';
import fitViewport, { Viewport } from './utils/fitViewport';
import { Point } from './types';
const propTypes = {
datasource: PropTypes.object.isRequired,
formData: PropTypes.object.isRequired,
height: PropTypes.number.isRequired,
onAddFilter: PropTypes.func,
payload: PropTypes.object.isRequired,
setControlValue: PropTypes.func.isRequired,
viewport: PropTypes.object.isRequired,
width: PropTypes.number.isRequired,
type deckGLComponentProps = {
datasource: Datasource;
formData: QueryFormData;
height: number;
onAddFilter: () => void;
payload: JsonObject;
setControlValue: () => void;
viewport: Viewport;
width: number;
};
const defaultProps = {
onAddFilter() {},
interface getLayerType<T> {
(
formData: QueryFormData,
payload: JsonObject,
onAddFilter: () => void,
setTooltip: (tooltip: string) => void,
): T;
}
interface getPointsType<T> {
(point: number[]): T;
}
type deckGLComponentState = {
viewport: Viewport;
layer: unknown;
};
export function createDeckGLComponent(getLayer, getPoints) {
export function createDeckGLComponent(
getLayer: getLayerType<unknown>,
getPoints: getPointsType<Point[]>,
): React.ComponentClass<deckGLComponentProps> {
// Higher order component
class Component extends React.PureComponent {
containerRef = React.createRef();
class Component extends React.PureComponent<
deckGLComponentProps,
deckGLComponentState
> {
containerRef: React.RefObject<DeckGLContainer> = React.createRef();
constructor(props) {
constructor(props: deckGLComponentProps) {
super(props);
const { width, height, formData } = props;
@ -58,7 +75,7 @@ export function createDeckGLComponent(getLayer, getPoints) {
width,
height,
points: getPoints(props.payload.data.features),
});
}) as Viewport;
}
this.state = {
@ -68,29 +85,32 @@ export function createDeckGLComponent(getLayer, getPoints) {
this.onViewportChange = this.onViewportChange.bind(this);
}
UNSAFE_componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps: deckGLComponentProps) {
// Only recompute the layer if anything BUT the viewport has changed
const nextFdNoVP = { ...nextProps.formData, viewport: null };
const currFdNoVP = { ...this.props.formData, viewport: null };
if (!isEqual(nextFdNoVP, currFdNoVP) || nextProps.payload !== this.props.payload) {
if (
!isEqual(nextFdNoVP, currFdNoVP) ||
nextProps.payload !== this.props.payload
) {
this.setState({ layer: this.computeLayer(nextProps) });
}
}
onViewportChange(viewport) {
onViewportChange(viewport: Viewport) {
this.setState({ viewport });
}
computeLayer(props) {
computeLayer(props: deckGLComponentProps) {
const { formData, payload, onAddFilter } = props;
return getLayer(formData, payload, onAddFilter, this.setTooltip);
}
setTooltip = tooltip => {
setTooltip = (tooltip: string) => {
const { current } = this.containerRef;
if (current) {
current.setTooltip(tooltip);
current?.setTooltip(tooltip);
}
};
@ -99,7 +119,7 @@ export function createDeckGLComponent(getLayer, getPoints) {
const { layer, viewport } = this.state;
return (
<DeckGLContainer
<DeckGLContainerStyledWrapper
ref={this.containerRef}
mapboxApiAccessToken={payload.data.mapboxApiKey}
viewport={viewport}
@ -113,15 +133,23 @@ export function createDeckGLComponent(getLayer, getPoints) {
);
}
}
Component.propTypes = propTypes;
Component.defaultProps = defaultProps;
return Component;
}
export function createCategoricalDeckGLComponent(getLayer, getPoints) {
function Component(props) {
const { datasource, formData, height, payload, setControlValue, viewport, width } = props;
export function createCategoricalDeckGLComponent(
getLayer: getLayerType<unknown>,
getPoints: getPointsType<Point[]>,
) {
return function Component(props: deckGLComponentProps) {
const {
datasource,
formData,
height,
payload,
setControlValue,
viewport,
width,
} = props;
return (
<CategoricalDeckGLContainer
@ -137,10 +165,5 @@ export function createCategoricalDeckGLComponent(getLayer, getPoints) {
height={height}
/>
);
}
Component.propTypes = propTypes;
Component.defaultProps = defaultProps;
return Component;
};
}

View File

@ -0,0 +1,28 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { default as DeckGLChartPreset } from './preset';
export { default as ArcChartPlugin } from './layers/Arc';
export { default as GeoJsonChartPlugin } from './layers/Geojson';
export { default as GridChartPlugin } from './layers/Grid';
export { default as HexChartPlugin } from './layers/Hex';
export { default as MultiChartPlugin } from './Multi';
export { default as PathChartPlugin } from './layers/Path';
export { default as PolygonChartPlugin } from './layers/Polygon';
export { default as ScatterChartPlugin } from './layers/Scatter';
export { default as ScreengridChartPlugin } from './layers/Screengrid';

View File

@ -45,7 +45,10 @@ function setTooltipContent(formData) {
value={`${o.object.targetPosition[0]}, ${o.object.targetPosition[1]}`}
/>
{formData.dimension && (
<TooltipRow label={`${formData.dimension}: `} value={`${o.object.cat_color}`} />
<TooltipRow
label={`${formData.dimension}: `}
value={`${o.object.cat_color}`}
/>
)}
</div>
);
@ -58,8 +61,10 @@ export function getLayer(fd, payload, onAddFilter, setTooltip) {
return new ArcLayer({
data,
getSourceColor: d => d.sourceColor || d.color || [sc.r, sc.g, sc.b, 255 * sc.a],
getTargetColor: d => d.targetColor || d.color || [tc.r, tc.g, tc.b, 255 * tc.a],
getSourceColor: d =>
d.sourceColor || d.color || [sc.r, sc.g, sc.b, 255 * sc.a],
getTargetColor: d =>
d.targetColor || d.color || [tc.r, tc.g, tc.b, 255 * tc.a],
id: `path-layer-${fd.slice_id}`,
strokeWidth: fd.stroke_width ? fd.stroke_width : 3,
...commonLayerProps(fd, setTooltip, setTooltipContent(fd)),

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { t, validateNonEmpty, legacyValidateInteger } from '@superset-ui/core';
import timeGrainSqlaAnimationOverrides, {
columnChoices,
@ -37,7 +37,7 @@ import {
mapboxStyle,
} from '../../utilities/Shared_DeckGL';
export default {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
@ -99,17 +99,21 @@ export default {
],
[
{
...dimension,
label: t('Categorical Color'),
description: t('Pick a dimension from which categorical colors are defined'),
name: dimension.name,
config: {
...dimension.config,
label: t('Categorical Color'),
description: t(
'Pick a dimension from which categorical colors are defined',
),
},
},
'color_scheme',
'label_colors',
],
[
{
name: 'stroke_width',
color: {
config: {
type: 'SelectControl',
freeForm: true,
label: t('Stroke Width'),
@ -126,7 +130,12 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
controlOverrides: {
@ -136,3 +145,5 @@ export default {
time_grain_sqla: timeGrainSqlaAnimationOverrides,
},
};
export default config;

View File

@ -24,7 +24,9 @@ import controlPanel from './controlPanel';
const metadata = new ChartMetadata({
category: t('Map'),
credits: ['https://uber.github.io/deck.gl'],
description: t('Plot the distance (like flight paths) between origin and destination.'),
description: t(
'Plot the distance (like flight paths) between origin and destination.',
),
name: t('deck.gl Arc'),
thumbnail,
useLegacyApi: true,

View File

@ -22,7 +22,7 @@ import PropTypes from 'prop-types';
import { GeoJsonLayer } from 'deck.gl';
// TODO import geojsonExtent from 'geojson-extent';
import DeckGLContainer from '../../DeckGLContainer';
import { DeckGLContainerStyledWrapper } from '../../DeckGLContainer';
import { hexToRGB } from '../../utils/colors';
import sandboxedEval from '../../utils/sandbox';
import { commonLayerProps } from '../common';
@ -151,7 +151,8 @@ class DeckGLGeoJson extends React.Component {
};
render() {
const { formData, payload, setControlValue, onAddFilter, viewport } = this.props;
const { formData, payload, setControlValue, onAddFilter, viewport } =
this.props;
// TODO get this to work
// if (formData.autozoom) {
@ -161,7 +162,7 @@ class DeckGLGeoJson extends React.Component {
const layer = getLayer(formData, payload, onAddFilter, this.setTooltip);
return (
<DeckGLContainer
<DeckGLContainerStyledWrapper
ref={this.containerRef}
mapboxApiAccessToken={payload.data.mapboxApiKey}
viewport={viewport}

View File

@ -16,8 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { t, legacyValidateInteger, isFeatureEnabled, FeatureFlag } from '@superset-ui/core';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import {
t,
legacyValidateInteger,
isFeatureEnabled,
FeatureFlag,
} from '@superset-ui/core';
import { formatSelectOptions } from '../../utilities/utils';
import {
filterNulls,
@ -40,13 +45,18 @@ const geojson = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndGeojsonColumn
: geojsonColumn;
export default {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [[geojson], ['row_limit'], [filterNulls], ['adhoc_filters']],
controlSetRows: [
[geojson],
['row_limit'],
[filterNulls],
['adhoc_filters'],
],
},
{
label: t('Map'),
@ -79,7 +89,14 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
};
export default config;

View File

@ -32,7 +32,10 @@ function setTooltipContent(o) {
label={`${t('Longitude and Latitude')}: `}
value={`${o.coordinate[0]}, ${o.coordinate[1]}`}
/>
<TooltipRow label={`${t('Height')}: `} value={`${o.object.elevationValue}`} />
<TooltipRow
label={`${t('Height')}: `}
value={`${o.object.elevationValue}`}
/>
</div>
);
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { t, validateNonEmpty } from '@superset-ui/core';
import {
filterNulls,
@ -32,13 +32,19 @@ import {
mapboxStyle,
} from '../../utilities/Shared_DeckGL';
export default {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [[spatial], ['size'], ['row_limit'], [filterNulls], ['adhoc_filters']],
controlSetRows: [
[spatial],
['size'],
['row_limit'],
[filterNulls],
['adhoc_filters'],
],
},
{
label: t('Map'),
@ -50,7 +56,12 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
controlOverrides: {
@ -61,3 +72,5 @@ export default {
},
},
};
export default config;

View File

@ -32,7 +32,10 @@ function setTooltipContent(o) {
label={`${t('Centroid (Longitude and Latitude)')}: `}
value={`(${o.coordinate[0]}, ${o.coordinate[1]})`}
/>
<TooltipRow label={`${t('Height')}: `} value={`${o.object.elevationValue}`} />
<TooltipRow
label={`${t('Height')}: `}
value={`${o.object.elevationValue}`}
/>
</div>
);
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { t } from '@superset-ui/core';
import { formatSelectOptions } from '../../utilities/utils';
import {
@ -33,13 +33,19 @@ import {
viewport,
} from '../../utilities/Shared_DeckGL';
export default {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [[spatial], ['size'], ['row_limit'], [filterNulls], ['adhoc_filters']],
controlSetRows: [
[spatial],
['size'],
['row_limit'],
[filterNulls],
['adhoc_filters'],
],
},
{
label: t('Map'),
@ -55,7 +61,9 @@ export default {
config: {
type: 'SelectControl',
label: t('Dynamic Aggregation Function'),
description: t('The function to use when aggregating points into groups'),
description: t(
'The function to use when aggregating points into groups',
),
default: 'sum',
clearable: false,
renderTrigger: true,
@ -80,7 +88,14 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
};
export default config;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import {
filterNulls,
@ -34,14 +34,18 @@ import {
} from '../../utilities/Shared_DeckGL';
import { dndLineColumn } from '../../utilities/sharedDndControls';
export default {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [
[isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP) ? dndLineColumn : lineColumn],
[
isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndLineColumn
: lineColumn,
],
[
{
...lineType,
@ -70,7 +74,14 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
};
export default config;

View File

@ -56,7 +56,9 @@ function setTooltipContent(formData) {
return (
<div className="deckgl-tooltip">
{o.object.name && <TooltipRow label="name: " value={`${o.object.name}`} />}
{o.object.name && (
<TooltipRow label="name: " value={`${o.object.name}`} />
)}
{o.object[formData.line_column] && (
<TooltipRow
label={`${formData.line_column}: `}
@ -64,14 +66,25 @@ function setTooltipContent(formData) {
/>
)}
{formData.metric && (
<TooltipRow label={`${metricLabel}: `} value={`${o.object[metricLabel]}`} />
<TooltipRow
label={`${metricLabel}: `}
value={`${o.object[metricLabel]}`}
/>
)}
</div>
);
};
}
export function getLayer(formData, payload, onAddFilter, setTooltip, selected, onSelect, filters) {
export function getLayer(
formData,
payload,
onAddFilter,
setTooltip,
selected,
onSelect,
filters,
) {
const fd = formData;
const fc = fd.fill_color_picker;
const sc = fd.stroke_color_picker;
@ -108,7 +121,9 @@ export function getLayer(formData, payload, onAddFilter, setTooltip, selected, o
};
const tooltipContentGenerator =
fd.line_column && fd.metric && ['json', 'geohash', 'zipcode'].includes(fd.line_type)
fd.line_column &&
fd.metric &&
['json', 'geohash', 'zipcode'].includes(fd.line_type)
? setTooltipContent(fd)
: undefined;
@ -172,9 +187,15 @@ class DeckGLPolygon extends React.Component {
// the granularity has to be read from the payload form_data, not the
// props formData which comes from the instantaneous controls state
const granularity = payload.form_data.time_grain_sqla || payload.form_data.granularity || 'P1D';
const granularity =
payload.form_data.time_grain_sqla ||
payload.form_data.granularity ||
'P1D';
const { start, end, getStep, values, disabled } = getPlaySliderParams(timestamps, granularity);
const { start, end, getStep, values, disabled } = getPlaySliderParams(
timestamps,
granularity,
);
let { viewport } = props;
if (formData.autozoom) {
@ -227,7 +248,9 @@ class DeckGLPolygon extends React.Component {
onValuesChange(values) {
this.setState({
values: Array.isArray(values) ? values : [values, values + this.state.getStep(values)],
values: Array.isArray(values)
? values
: [values, values + this.state.getStep(values)],
});
}
@ -240,9 +263,13 @@ class DeckGLPolygon extends React.Component {
// time filter
if (values[0] === values[1] || values[1] === this.end) {
filters.push(d => d.__timestamp >= values[0] && d.__timestamp <= values[1]);
filters.push(
d => d.__timestamp >= values[0] && d.__timestamp <= values[1],
);
} else {
filters.push(d => d.__timestamp >= values[0] && d.__timestamp < values[1]);
filters.push(
d => d.__timestamp >= values[0] && d.__timestamp < values[1],
);
}
const layer = getLayer(

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import timeGrainSqlaAnimationOverrides from '../../utilities/controls';
import { formatSelectOptions } from '../../utilities/utils';
@ -49,7 +49,7 @@ const lines = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndLineColumn
: lineColumn;
export default {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
@ -144,7 +144,9 @@ export default {
freeForm: true,
label: t('Bucket break points'),
choices: formatSelectOptions([]),
description: t('List of n+1 values for bucketing metric into n buckets.'),
description: t(
'List of n+1 values for bucketing metric into n buckets.',
),
renderTrigger: true,
},
},
@ -167,7 +169,9 @@ export default {
label: t('Multiple filtering'),
renderTrigger: true,
default: true,
description: t('Allow sending multiple polygons as a filter event'),
description: t(
'Allow sending multiple polygons as a filter event',
),
},
},
],
@ -176,7 +180,12 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
controlOverrides: {
@ -186,3 +195,5 @@ export default {
time_grain_sqla: timeGrainSqlaAnimationOverrides,
},
};
export default config;

View File

@ -30,7 +30,13 @@ const metadata = new ChartMetadata({
name: t('deck.gl Polygon'),
thumbnail,
useLegacyApi: true,
tags: [t('deckGL'), t('3D'), t('Multi-Dimensions'), t('Geo'), t('Experimental')],
tags: [
t('deckGL'),
t('3D'),
t('Multi-Dimensions'),
t('Geo'),
t('Experimental'),
],
});
export default class PolygonChartPlugin extends ChartPlugin {

View File

@ -40,15 +40,26 @@ function setTooltipContent(formData, verboseMap) {
value={`${o.object.position[0]}, ${o.object.position[1]}`}
/>
{o.object.cat_color && (
<TooltipRow label={`${t('Category')}: `} value={`${o.object.cat_color}`} />
<TooltipRow
label={`${t('Category')}: `}
value={`${o.object.cat_color}`}
/>
)}
{o.object.metric && (
<TooltipRow label={`${label}: `} value={`${o.object.metric}`} />
)}
{o.object.metric && <TooltipRow label={`${label}: `} value={`${o.object.metric}`} />}
</div>
);
};
}
export function getLayer(formData, payload, onAddFilter, setTooltip, datasource) {
export function getLayer(
formData,
payload,
onAddFilter,
setTooltip,
datasource,
) {
const fd = formData;
const dataWithRadius = payload.data.features.map(d => {
let radius = unitToRadius(fd.point_unit, d.radius) || 10;
@ -73,7 +84,11 @@ export function getLayer(formData, payload, onAddFilter, setTooltip, datasource)
radiusMinPixels: fd.min_radius || null,
radiusMaxPixels: fd.max_radius || null,
stroked: false,
...commonLayerProps(fd, setTooltip, setTooltipContent(fd, datasource?.verboseMap)),
...commonLayerProps(
fd,
setTooltip,
setTooltipContent(fd, datasource?.verboseMap),
),
});
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { t, validateNonEmpty } from '@superset-ui/core';
import timeGrainSqlaAnimationOverrides from '../../utilities/controls';
import {
@ -36,7 +36,7 @@ import {
mapboxStyle,
} from '../../utilities/Shared_DeckGL';
export default {
const config: ControlPanelConfig = {
onInit: controlState => ({
...controlState,
time_grain_sqla: {
@ -53,7 +53,11 @@ export default {
{
label: t('Query'),
expanded: true,
controlSetRows: [[spatial, null], ['row_limit', filterNulls], ['adhoc_filters']],
controlSetRows: [
[spatial, null],
['row_limit', filterNulls],
['adhoc_filters'],
],
},
{
label: t('Map'),
@ -83,7 +87,9 @@ export default {
['radius_km', 'Radius in kilometers'],
['radius_miles', 'Radius in miles'],
],
description: t('The unit of measure for the specified point radius'),
description: t(
'The unit of measure for the specified point radius',
),
},
},
],
@ -130,9 +136,14 @@ export default {
[legendFormat],
[
{
...dimension,
label: t('Categorical Color'),
description: t('Pick a dimension from which categorical colors are defined'),
name: dimension.name,
config: {
...dimension.config,
label: t('Categorical Color'),
description: t(
'Pick a dimension from which categorical colors are defined',
),
},
},
],
['color_scheme'],
@ -140,7 +151,12 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
controlOverrides: {
@ -150,3 +166,5 @@ export default {
time_grain_sqla: timeGrainSqlaAnimationOverrides,
},
};
export default config;

View File

@ -48,7 +48,15 @@ function setTooltipContent(o) {
);
}
export function getLayer(formData, payload, onAddFilter, setTooltip, selected, onSelect, filters) {
export function getLayer(
formData,
payload,
onAddFilter,
setTooltip,
selected,
onSelect,
filters,
) {
const fd = formData;
const c = fd.color_picker;
let data = payload.data.features.map(d => ({
@ -122,9 +130,14 @@ class DeckGLScreenGrid extends React.PureComponent {
// the granularity has to be read from the payload form_data, not the
// props formData which comes from the instantaneous controls state
const granularity =
props.payload.form_data.time_grain_sqla || props.payload.form_data.granularity || 'P1D';
props.payload.form_data.time_grain_sqla ||
props.payload.form_data.granularity ||
'P1D';
const { start, end, getStep, values, disabled } = getPlaySliderParams(timestamps, granularity);
const { start, end, getStep, values, disabled } = getPlaySliderParams(
timestamps,
granularity,
);
const { width, height, formData } = props;
let { viewport } = props;
@ -151,8 +164,10 @@ class DeckGLScreenGrid extends React.PureComponent {
onValuesChange(values) {
this.setState({
// eslint-disable-next-line react/no-access-state-in-setstate
values: Array.isArray(values) ? values : [values, values + this.state.getStep(values)],
values: Array.isArray(values)
? values
: // eslint-disable-next-line react/no-access-state-in-setstate
[values, values + this.state.getStep(values)],
});
}
@ -161,9 +176,13 @@ class DeckGLScreenGrid extends React.PureComponent {
// time filter
if (values[0] === values[1] || values[1] === this.end) {
filters.push(d => d.__timestamp >= values[0] && d.__timestamp <= values[1]);
filters.push(
d => d.__timestamp >= values[0] && d.__timestamp <= values[1],
);
} else {
filters.push(d => d.__timestamp >= values[0] && d.__timestamp < values[1]);
filters.push(
d => d.__timestamp >= values[0] && d.__timestamp < values[1],
);
}
const layer = getLayer(

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { t, validateNonEmpty } from '@superset-ui/core';
import timeGrainSqlaAnimationOverrides from '../../utilities/controls';
import {
@ -32,13 +32,19 @@ import {
mapboxStyle,
} from '../../utilities/Shared_DeckGL';
export default {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [[spatial], ['size'], ['row_limit'], [filterNulls], ['adhoc_filters']],
controlSetRows: [
[spatial],
['size'],
['row_limit'],
[filterNulls],
['adhoc_filters'],
],
},
{
label: t('Map'),
@ -54,7 +60,12 @@ export default {
},
{
label: t('Advanced'),
controlSetRows: [[jsColumns], [jsDataMutator], [jsTooltip], [jsOnclickHref]],
controlSetRows: [
[jsColumns],
[jsDataMutator],
[jsTooltip],
[jsOnclickHref],
],
},
],
controlOverrides: {
@ -66,3 +77,5 @@ export default {
time_grain_sqla: timeGrainSqlaAnimationOverrides,
},
};
export default config;

View File

@ -30,7 +30,13 @@ const metadata = new ChartMetadata({
name: t('deck.gl Screen Grid'),
thumbnail,
useLegacyApi: true,
tags: [t('deckGL'), t('Comparison'), t('Intensity'), t('Experimental'), t('Density')],
tags: [
t('deckGL'),
t('Comparison'),
t('Intensity'),
t('Experimental'),
t('Density'),
],
});
export default class ScreengridChartPlugin extends ChartPlugin {

View File

@ -19,7 +19,12 @@
import * as d3array from 'd3-array';
import sandboxedEval from '../utils/sandbox';
export function commonLayerProps(formData, setTooltip, setTooltipContent, onSelect) {
export function commonLayerProps(
formData,
setTooltip,
setTooltipContent,
onSelect,
) {
const fd = formData;
let onHover;
let tooltipContentGenerator = setTooltipContent;
@ -73,7 +78,9 @@ export function getAggFunc(type = 'sum', accessor = null) {
d3func = (arr, acc) => {
let sortedArr;
if (accessor) {
sortedArr = arr.sort((o1, o2) => d3array.ascending(accessor(o1), accessor(o2)));
sortedArr = arr.sort((o1, o2) =>
d3array.ascending(accessor(o1), accessor(o2)),
);
} else {
sortedArr = arr.sort(d3array.ascending);
}

View File

@ -19,7 +19,8 @@
const NOOP = () => {};
export default function transformProps(chartProps) {
const { datasource, height, hooks, queriesData, rawFormData, width } = chartProps;
const { datasource, height, hooks, queriesData, rawFormData, width } =
chartProps;
const { onAddFilter = NOOP, setControlValue = NOOP } = hooks;
return {

View File

@ -0,0 +1,23 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// range and point actually have different value ranges
// and also are different concept-wise
export type Range = [number, number];
export type Point = [number, number];

View File

@ -40,11 +40,18 @@ const jsFunctionInfo = (
{t(
'For more information about objects are in context in the scope of this function, refer to the',
)}
<a href={sandboxUrl}>{t(" source code of Superset's sandboxed parser")}.</a>.
<a href={sandboxUrl}>{t(" source code of Superset's sandboxed parser")}.</a>
.
</div>
);
function jsFunctionControl(label, description, extraDescr = null, height = 100, defaultText = '') {
function jsFunctionControl(
label,
description,
extraDescr = null,
height = 100,
defaultText = '',
) {
return {
type: 'TextAreaControl',
language: 'javascript',
@ -62,7 +69,9 @@ function jsFunctionControl(label, description, extraDescr = null, height = 100,
mapStateToProps: state => ({
// eslint-disable-next-line no-negated-condition
warning: !state.common.conf.ENABLE_JAVASCRIPT_CONTROLS
? t('This functionality is disabled in your environment for security reasons.')
? t(
'This functionality is disabled in your environment for security reasons.',
)
: null,
readOnly: !state.common.conf.ENABLE_JAVASCRIPT_CONTROLS,
}),
@ -86,7 +95,9 @@ export const autozoom = {
label: t('Auto Zoom'),
default: true,
renderTrigger: true,
description: t('When checked, the map will zoom to your data after each query'),
description: t(
'When checked, the map will zoom to your data after each query',
),
},
};
@ -107,7 +118,9 @@ export const jsColumns = {
...sharedControls.groupby,
label: t('Extra data for JS'),
default: [],
description: t('List of extra columns made available in Javascript functions'),
description: t(
'List of extra columns made available in Javascript functions',
),
},
};
@ -127,7 +140,9 @@ export const jsTooltip = {
name: 'js_tooltip',
config: jsFunctionControl(
t('Javascript tooltip generator'),
t('Define a function that receives the input and outputs the content for a tooltip'),
t(
'Define a function that receives the input and outputs the content for a tooltip',
),
),
};

View File

@ -20,7 +20,9 @@ export function columnChoices(datasource) {
if (datasource && datasource.columns) {
return datasource.columns
.map(col => [col.column_name, col.verbose_name || col.column_name])
.sort((opt1, opt2) => (opt1[1].toLowerCase() > opt2[1].toLowerCase() ? 1 : -1));
.sort((opt1, opt2) =>
opt1[1].toLowerCase() > opt2[1].toLowerCase() ? 1 : -1,
);
}
return [];
}
@ -47,6 +49,8 @@ export const PRIMARY_COLOR = { r: 0, g: 122, b: 135, a: 1 };
export default {
default: null,
mapStateToProps: state => ({
choices: state.datasource ? state.datasource.time_grain_sqla.filter(o => o[0] !== null) : null,
choices: state.datasource
? state.datasource.time_grain_sqla.filter(o => o[0] !== null)
: null,
}),
};

View File

@ -68,7 +68,9 @@ export function getParam(name) {
const regex = new RegExp(`[\\?&]${formattedName}=([^&#]*)`);
// eslint-disable-next-line no-restricted-globals
const results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
return results === null
? ''
: decodeURIComponent(results[1].replace(/\+/g, ' '));
}
export function mainMetric(savedMetrics) {

View File

@ -19,7 +19,10 @@
*/
import { extent } from 'd3-array';
import { scaleThreshold } from 'd3-scale';
import { getSequentialSchemeRegistry, SequentialScheme } from '@superset-ui/core';
import {
getSequentialSchemeRegistry,
SequentialScheme,
} from '@superset-ui/core';
import { hexToRGB } from './utils/colors';
const DEFAULT_NUM_BUCKETS = 10;
@ -34,13 +37,16 @@ export function getBreakPoints(
}
if (formDataBreakPoints === undefined || formDataBreakPoints.length === 0) {
// compute evenly distributed break points based on number of buckets
const numBuckets = formDataNumBuckets ? parseInt(formDataNumBuckets, 10) : DEFAULT_NUM_BUCKETS;
const numBuckets = formDataNumBuckets
? parseInt(formDataNumBuckets, 10)
: DEFAULT_NUM_BUCKETS;
const [minValue, maxValue] = extent(features, accessor);
if (minValue === undefined) {
return [];
}
const delta = (maxValue - minValue) / numBuckets;
const precision = delta === 0 ? 0 : Math.max(0, Math.ceil(Math.log10(1 / delta)));
const precision =
delta === 0 ? 0 : Math.max(0, Math.ceil(Math.log10(1 / delta)));
const extraBucket = maxValue > maxValue.toFixed(precision) ? 1 : 0;
return new Array(numBuckets + 1 + extraBucket)
@ -85,7 +91,9 @@ export function getBreakPointColorScaler(
// bucket colors into discrete colors
const n = breakPoints.length - 1;
const bucketedColors =
n > 1 ? colorScheme.getColors(n) : [colorScheme.colors[colorScheme.colors.length - 1]];
n > 1
? colorScheme.getColors(n)
: [colorScheme.colors[colorScheme.colors.length - 1]];
// repeat ends
const first = bucketedColors[0];
@ -94,9 +102,7 @@ export function getBreakPointColorScaler(
bucketedColors.push(last);
const points = breakPoints.map(p => parseFloat(p));
scaler = scaleThreshold()
.domain(points)
.range(bucketedColors);
scaler = scaleThreshold().domain(points).range(bucketedColors);
maskPoint = value => value > breakPoints[n] || value < breakPoints[0];
} else {
// interpolate colors linearly
@ -123,7 +129,8 @@ export function getBuckets(fd, features, accessor) {
const buckets = {};
breakPoints.slice(1).forEach((value, i) => {
const range = `${breakPoints[i]} - ${breakPoints[i + 1]}`;
const mid = 0.5 * (parseFloat(breakPoints[i]) + parseFloat(breakPoints[i + 1]));
const mid =
0.5 * (parseFloat(breakPoints[i]) + parseFloat(breakPoints[i + 1]));
// fix polygon doesn't show
const metricLabel = fd.metric ? fd.metric.label || fd.metric : null;
buckets[range] = {

View File

@ -0,0 +1,56 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { extent as d3Extent } from 'd3-array';
import { Point, Range } from '../types';
const LAT_LIMIT: Range = [-90, 90];
const LNG_LIMIT: Range = [-180, 180];
/**
* Expand a coordinate range by `padding` and within limits, if needed
*/
function expandIfNeeded(
[curMin, curMax]: Range,
[minBound, maxBound]: Range,
padding = 0.25,
) {
return curMin < curMax
? [curMin, curMax]
: [
Math.max(minBound, curMin - padding),
Math.min(maxBound, curMax + padding),
];
}
export default function computeBoundsFromPoints(
points: Point[],
): [Point, Point] {
const latBounds = expandIfNeeded(
d3Extent(points, (x: Point) => x[1]) as Range,
LAT_LIMIT,
);
const lngBounds = expandIfNeeded(
d3Extent(points, (x: Point) => x[0]) as Range,
LNG_LIMIT,
);
return [
[lngBounds[0], latBounds[0]],
[lngBounds[1], latBounds[1]],
];
}

View File

@ -1,3 +1,21 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import URI from 'urijs';
import { safeStringify } from './safeStringify';
@ -13,7 +31,12 @@ export function getURIDirectory(formData, endpointType = 'base') {
return directory;
}
export function getExploreLongUrl(formData, endpointType, allowOverflow = true, extraSearch = {}) {
export function getExploreLongUrl(
formData,
endpointType,
allowOverflow = true,
extraSearch = {},
) {
if (!formData.datasource) {
return null;
}
@ -28,10 +51,7 @@ export function getExploreLongUrl(formData, endpointType, allowOverflow = true,
if (endpointType === 'standalone') {
search.standalone = 'true';
}
const url = uri
.directory(directory)
.search(search)
.toString();
const url = uri.directory(directory).search(search).toString();
if (!allowOverflow && url.length > MAX_URL_LENGTH) {
const minimalFormData = {
datasource: formData.datasource,

View File

@ -0,0 +1,76 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { fitBounds } from '@math.gl/web-mercator';
import computeBoundsFromPoints from './computeBoundsFromPoints';
import { Point } from '../types';
export type Viewport = {
longtitude: number;
latitude: number;
zoom: number;
bearing?: number;
pitch?: number;
};
export type FitViewportOptions = {
points: Point[];
width: number;
height: number;
minExtent?: number;
maxZoom?: number;
offset?: [number, number];
padding?: number;
};
export default function fitViewport(
originalViewPort: Viewport,
{
points,
width,
height,
minExtent,
maxZoom,
offset,
padding = 20,
}: FitViewportOptions,
) {
const { bearing, pitch } = originalViewPort;
const bounds = computeBoundsFromPoints(points);
try {
return {
...fitBounds({
bounds,
width,
height,
minExtent,
maxZoom,
offset,
padding,
}),
bearing,
pitch,
};
} catch (error) {
// eslint-disable-next-line no-console
console.error('Could not fit viewport', error);
}
return originalViewPort;
}

View File

@ -58,7 +58,8 @@ export function kmToPixels(kilometers, latitude, zoomLevel) {
// Algorithm from: https://wiki.openstreetmap.org/wiki/Zoom_levels
const latitudeRad = latitude * (Math.PI / 180);
// Seems like the zoomLevel is off by one
const kmPerPixel = (EARTH_CIRCUMFERENCE_KM * Math.cos(latitudeRad)) / 2 ** (zoomLevel + 9);
const kmPerPixel =
(EARTH_CIRCUMFERENCE_KM * Math.cos(latitudeRad)) / 2 ** (zoomLevel + 9);
return roundDecimal(kilometers / kmPerPixel, 2);
}

View File

@ -0,0 +1,46 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Point } from '../types';
/** Format originally used by the Polygon plugin */
type CustomPolygonFeature = {
polygon: Point[];
};
/**
* Format that is geojson standard
* https://geojson.org/geojson-spec.html
*/
type GeojsonPolygonFeature = {
polygon: {
type: 'Feature';
geometry: {
type: 'Polygon';
coordinates: Point[][];
};
};
};
export default function getPointsFromPolygon(
feature: CustomPolygonFeature | GeojsonPolygonFeature,
) {
return 'geometry' in feature.polygon
? feature.polygon.geometry.coordinates[0]
: feature.polygon;
}

View File

@ -66,19 +66,18 @@ function getStepSeconds(step, start) {
* seconds, which is why we need to know the start time.
*/
const startMillliseconds = parseInt(moment(start).format('x'), 10);
const endMilliseconds = parseInt(
moment(start)
.add(step)
.format('x'),
10,
);
const endMilliseconds = parseInt(moment(start).add(step).format('x'), 10);
return endMilliseconds - startMillliseconds;
}
export function getPlaySliderParams(timestamps, timeGrain) {
const minTimestamp = moment(Number(timestamps.reduce((a, b) => (a < b ? a : b))));
const maxTimestamp = moment(Number(timestamps.reduce((a, b) => (a > b ? a : b))));
const minTimestamp = moment(
Number(timestamps.reduce((a, b) => (a < b ? a : b))),
);
const maxTimestamp = moment(
Number(timestamps.reduce((a, b) => (a > b ? a : b))),
);
let step;
let reference;
@ -122,7 +121,8 @@ export function getPlaySliderParams(timestamps, timeGrain) {
end.add(step);
}
const values = timeGrain != null ? [start, start.clone().add(step)] : [start, end];
const values =
timeGrain != null ? [start, start.clone().add(step)] : [start, end];
const disabled = timestamps.every(timestamp => timestamp === null);
return {

View File

@ -22,8 +22,9 @@
export function roundDecimal(number, precision) {
let roundedNumber;
if (precision) {
// eslint-disable-next-line no-param-reassign
roundedNumber = Math.round(number * (precision = 10 ** precision)) / precision;
roundedNumber =
// eslint-disable-next-line no-param-reassign
Math.round(number * (precision = 10 ** precision)) / precision;
} else {
roundedNumber = Math.round(number);
}

Some files were not shown because too many files have changed in this diff Show More