diff --git a/Changelog.md b/Changelog.md index 51f477476..be9233045 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +## 4.2.7 +* Remove lax `d3compat.eventHandler` workarounds, not necessary if code consistently uses d3@5 or d3@6 event handler signatures +* Remove extra `d3compat.eventHandler` identified with strict event handler +* Fix event handling in focus ordinal bar example ([#1826](https://github.com/dc-js/dc.js/issues/1826)) +* Change composite bar line example to illustrate using `xAxisPadding` with `centerBar` to draw compoisite bar/line properly ([#1827](https://github.com/dc-js/dc.js/issues/1827)) + ## 4.2.6 * Isolate D3 compatibility layers, allowing more efficient module imports, by Patrik Kullman ([#1822](https://github.com/dc-js/dc.js/issues/1822) / [#1823](https://github.com/dc-js/dc.js/issues/1823) / [#1824](https://github.com/dc-js/dc.js/issues/1824)) diff --git a/package-lock.json b/package-lock.json index f74096fbb..2653a0bcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dc", - "version": "4.2.5", + "version": "4.2.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -979,32 +979,12 @@ } }, "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } + "fill-range": "^7.0.1" } }, "buffer": { @@ -1689,9 +1669,9 @@ "dev": true }, "d3": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/d3/-/d3-6.5.0.tgz", - "integrity": "sha512-gr7FoRecKtBkBxelTeGVYERRTPgjPFLh2rOBisHdbXe3RIrVLjCo7COZYMSeFeiwVPOHDtxAGJlvN7XssNAIcg==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/d3/-/d3-6.6.2.tgz", + "integrity": "sha512-wvC9cZe05bUCo00VFKXLQJWmWhGv0U43Qv0gn+tkl144S7bV22E80Gnp06BEuJVuwVfa6+S8UOfl8H9Ru/cmgA==", "requires": { "d3-array": "2", "d3-axis": "2", @@ -1726,17 +1706,17 @@ } }, "d3-array": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.11.0.tgz", - "integrity": "sha512-26clcwmHQEdsLv34oNKq5Ia9tQ26Y/4HqS3dQzF42QBUqymZJ+9PORcN1G52bt37NsL2ABoX4lvyYZc+A9Y0zw==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", + "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", "requires": { "internmap": "^1.0.0" } }, "d3-axis": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-2.0.0.tgz", - "integrity": "sha512-9nzB0uePtb+u9+dWir+HTuEAKJOEUYJoEwbJPsZ1B4K3iZUgzJcSENQ05Nj7S4CIfbZZ8/jQGoUzGKFznBhiiQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-2.1.0.tgz", + "integrity": "sha512-z/G2TQMyuf0X3qP+Mh+2PimoJD41VOCjViJzT0BHeL/+JQAofkiWZbWxlwFGb1N8EN+Cl/CW+MUKbVzr1689Cw==" }, "d3-brush": { "version": "2.1.0", @@ -1879,9 +1859,9 @@ "integrity": "sha512-0D9P8TRj6qDAtHhRQn6EfdOtHMfsUWanl3yb/84C4DqpZ+VsgfI5iTVRNRbELCfNvRfpMr8OrqqUTQ6ANGCijw==" }, "d3-scale": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.3.tgz", - "integrity": "sha512-8E37oWEmEzj57bHcnjPVOBS3n4jqakOeuv1EDdQSiSrYnMCBdMd3nc4HtKk7uia8DUHcY/CGuJ42xxgtEYrX0g==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.4.tgz", + "integrity": "sha512-PG6gtpbPCFqKbvdBEswQcJcTzHC8VEd/XzezF5e68KlkT4/ggELw/nR1tv863jY6ufKTvDlzCMZvhe06codbbA==", "requires": { "d3-array": "^2.3.0", "d3-format": "1 - 2", @@ -1905,9 +1885,9 @@ "integrity": "sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA==" }, "d3-shape": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-2.0.0.tgz", - "integrity": "sha512-djpGlA779ua+rImicYyyjnOjeubyhql1Jyn1HK0bTyawuH76UQRWXd+pftr67H6Fa8hSwetkgb/0id3agKWykw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-2.1.0.tgz", + "integrity": "sha512-PnjUqfM2PpskbSLTJvAzp2Wv4CZsnAgTfcVRTwW03QR3MkXF8Uo7B1y/lWkAsmbKwuecto++4NlsYcvYpXpTHA==", "requires": { "d3-path": "1 - 2" } @@ -3047,26 +3027,12 @@ "dev": true }, "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } + "to-regex-range": "^5.0.1" } }, "finalhandler": { @@ -3563,6 +3529,31 @@ "rimraf": "~3.0.2" }, "dependencies": { + "grunt-cli": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.3.2.tgz", + "integrity": "sha512-8OHDiZZkcptxVXtMfDxJvmN7MVJNE8L/yIcPb4HB7TlyFD1kDvjHrb62uhySsU14wJx9ORMnTuhRMQ40lH/orQ==", + "dev": true, + "requires": { + "grunt-known-options": "~1.1.0", + "interpret": "~1.1.0", + "liftoff": "~2.5.0", + "nopt": "~4.0.1", + "v8flags": "~3.1.1" + }, + "dependencies": { + "nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dev": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + } + } + }, "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -3577,20 +3568,29 @@ "requires": { "glob": "^7.1.3" } + }, + "v8flags": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz", + "integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } } } }, "grunt-cli": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.3.2.tgz", - "integrity": "sha512-8OHDiZZkcptxVXtMfDxJvmN7MVJNE8L/yIcPb4HB7TlyFD1kDvjHrb62uhySsU14wJx9ORMnTuhRMQ40lH/orQ==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.2.tgz", + "integrity": "sha512-wsu6BZh7KCnfeaSkDrKIAvOlqGKxNRTZjc8xfZlvxCByQIqUfZ31kh5uHpPnhQ4NdVgvaWaVxa1LUbVU80nACw==", "dev": true, "requires": { - "grunt-known-options": "~1.1.0", + "grunt-known-options": "~1.1.1", "interpret": "~1.1.0", - "liftoff": "~2.5.0", + "liftup": "~3.0.1", "nopt": "~4.0.1", - "v8flags": "~3.1.1" + "v8flags": "~3.2.0" }, "dependencies": { "nopt": { @@ -4171,6 +4171,26 @@ "kind-of": "^4.0.0" }, "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "kind-of": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", @@ -4543,9 +4563,9 @@ } }, "internmap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.0.tgz", - "integrity": "sha512-SdoDWwNOTE2n4JWUsLn4KXZGuZPjPF9yyOGc8bnfWnBQh7BD/l80rzSznKc/r4Y0aQ7z3RTk9X+tV4tHBpu+dA==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", + "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==" }, "interpret": { "version": "1.1.0", @@ -4616,6 +4636,15 @@ "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", "dev": true }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -4707,24 +4736,10 @@ "dev": true }, "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true }, "is-number-like": { "version": "1.0.8", @@ -5401,6 +5416,58 @@ "resolve": "^1.1.7" }, "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "findup-sync": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", @@ -5421,6 +5488,106 @@ "requires": { "is-extglob": "^2.1.0" } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "liftup": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/liftup/-/liftup-3.0.1.tgz", + "integrity": "sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==", + "dev": true, + "requires": { + "extend": "^3.0.2", + "findup-sync": "^4.0.0", + "fined": "^1.2.0", + "flagged-respawn": "^1.0.1", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.1", + "rechoir": "^0.7.0", + "resolve": "^1.19.0" + }, + "dependencies": { + "findup-sync": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-4.0.0.tgz", + "integrity": "sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^4.0.2", + "resolve-dir": "^1.0.1" + } + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } } } }, @@ -5839,24 +6006,13 @@ "dev": true }, "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "dev": true, "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" + "braces": "^3.0.1", + "picomatch": "^2.0.5" } }, "mime": { @@ -7223,12 +7379,12 @@ } }, "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz", + "integrity": "sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==", "dev": true, "requires": { - "resolve": "^1.1.6" + "resolve": "^1.9.0" } }, "redent": { @@ -7345,9 +7501,9 @@ "dev": true }, "repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", + "integrity": "sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ==", "dev": true }, "repeat-string": { @@ -8319,9 +8475,9 @@ } }, "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", + "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", "dev": true }, "sourcemap-codec": { @@ -9014,13 +9170,12 @@ } }, "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" + "is-number": "^7.0.0" } }, "toidentifier": { @@ -9348,9 +9503,9 @@ "dev": true }, "v8flags": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz", - "integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", "dev": true, "requires": { "homedir-polyfill": "^1.0.1" @@ -9631,9 +9786,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "yallist": { diff --git a/package.json b/package.json index 90769d40d..d1669b068 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dc", - "version": "4.2.6", + "version": "4.2.7", "license": "Apache-2.0", "copyright": "2020", "description": "A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js ", @@ -25,7 +25,7 @@ "url": "https://github.com/dc-js/dc.js.git" }, "dependencies": { - "d3": "^6.5.0" + "d3": "^6.6.2" }, "devDependencies": { "@chiragrupani/karma-chromium-edge-launcher": "^2.1.0", @@ -39,7 +39,7 @@ "eslint-plugin-promise": "^4.3.1", "file-saver": "^1.3.8", "grunt": "^1.3.0", - "grunt-cli": "^1.3.2", + "grunt-cli": "^1.4.2", "grunt-contrib-connect": "~2.0", "grunt-contrib-copy": "~1.0", "grunt-contrib-cssmin": "3.x", diff --git a/spec/bar-chart-spec.js b/spec/bar-chart-spec.js index 3e0182c26..8f75590e0 100644 --- a/spec/bar-chart-spec.js +++ b/spec/bar-chart-spec.js @@ -271,7 +271,7 @@ describe('dc.BarChart', () => { expect(dimension.top(Infinity).length).toEqual(10); // fake a click const abar = chart.selectAll('rect.bar:nth-child(3)'); - abar.on('click')(abar.datum()); + dc.d3compat.callHandler(abar.on('click'), null, {}, abar.datum()); expect(dimension.top(Infinity).length).toEqual(1); }); }); @@ -285,7 +285,7 @@ describe('dc.BarChart', () => { expect(dimension.top(Infinity).length).toEqual(10); // fake a click const alabel = chart.select('text.barLabel'); - alabel.on('click')(alabel.datum()); + dc.d3compat.callHandler(alabel.on('click'), null, {}, alabel.datum()); expect(dimension.top(Infinity).length).toEqual(3); }); }); @@ -356,14 +356,14 @@ describe('dc.BarChart', () => { beforeEach(() => { chart.brushOn(false) .on('renderlet', _chart => { - _chart.selectAll('rect.bar').on('click', d => _chart.onClick(d)); + _chart.selectAll('rect.bar').on('click', dc.d3compat.eventHandler(d => _chart.onClick(d))); }) .render(); }); it('clicking causes another dimension to be filtered', () => { expect(dimension.top(Infinity).length).toEqual(10); const abar = chart.selectAll('rect.bar:nth-child(3)'); - abar.on('click')(abar.datum()); + dc.d3compat.callHandler(abar.on('click'), null, {}, abar.datum()); expect(dimension.top(Infinity).length).toEqual(3); }); }); @@ -688,7 +688,7 @@ describe('dc.BarChart', () => { .render(); firstItem = chart.select('g.dc-legend g.dc-legend-item'); - firstItem.on('mouseover')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseover'), null, {}, firstItem.datum()); }); describe('when a legend item is hovered over', () => { @@ -707,14 +707,14 @@ describe('dc.BarChart', () => { describe('when a legend item is hovered out', () => { it('should remove highlighting from corresponding lines and areas', () => { - firstItem.on('mouseout')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseout'), null, {}, firstItem.datum()); nthStack(0).forEachBar(bar => { expect(bar.classed('highlight')).toBeFalsy(); }); }); it('should fade in non-corresponding lines and areas', () => { - firstItem.on('mouseout')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseout'), null, {}, firstItem.datum()); nthStack(1).forEachBar(bar => { expect(bar.classed('fadeout')).toBeFalsy(); }); diff --git a/spec/box-plot-spec.js b/spec/box-plot-spec.js index 129aa6b97..a32caa672 100644 --- a/spec/box-plot-spec.js +++ b/spec/box-plot-spec.js @@ -282,7 +282,7 @@ describe('dc.BoxPlot', () => { describe('clicking on a box', () => { beforeEach(() => { - box(0).on('click').call(chart, box(0).datum()); + dc.d3compat.callHandler(box(0).on('click'), chart, {}, box(0).datum()); }); it('should apply a filter to the chart', () => { diff --git a/spec/bubble-chart-spec.js b/spec/bubble-chart-spec.js index 407f4c96f..98acd6eca 100644 --- a/spec/bubble-chart-spec.js +++ b/spec/bubble-chart-spec.js @@ -678,7 +678,7 @@ describe('dc.bubbleChart', () => { describe('column filtering with straight crossfilter', () => { beforeEach(() => { const axisLabel = d3.select(heatMap.selectAll('.cols.axis text').nodes()[3]); - axisLabel.on('click')(axisLabel.datum()); + dc.d3compat.callHandler(axisLabel.on('click'), null, {}, axisLabel.datum()); d3.timerFlush(); }); it('updates bubble radii correctly', () => { @@ -696,7 +696,7 @@ describe('dc.bubbleChart', () => { chart.group(clone_group(sepalGroup)); chart.render(); const axisLabel = d3.select(heatMap.selectAll('.cols.axis text').nodes()[3]); - axisLabel.on('click')(axisLabel.datum()); + dc.d3compat.callHandler(axisLabel.on('click'), null, {}, axisLabel.datum()); d3.timerFlush(); }); it('updates bubble radii correctly', () => { diff --git a/spec/composite-chart-spec.js b/spec/composite-chart-spec.js index f0e1b1895..6beb1978c 100644 --- a/spec/composite-chart-spec.js +++ b/spec/composite-chart-spec.js @@ -368,10 +368,10 @@ describe('dc.compositeChart', () => { it('should properly delegate highlighting to its children', () => { const firstItem = chart.select('g.dc-legend g.dc-legend-item'); - firstItem.on('mouseover')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseover'), null, {}, firstItem.datum()); expect(chart.selectAll('rect.highlight').size()).toBe(6); expect(chart.selectAll('path.fadeout').size()).toBe(4); - firstItem.on('mouseout')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseout'), null, {}, firstItem.datum()); expect(chart.selectAll('rect.highlight').size()).toBe(0); expect(chart.selectAll('path.fadeout').size()).toBe(0); }); @@ -379,7 +379,7 @@ describe('dc.compositeChart', () => { it('should hide hidable child stacks', () => { const dateValueGroupLine2 = d3.select(chart.selectAll('g.dc-legend g.dc-legend-item').nodes()[3]); - dateValueGroupLine2.on('click')(dateValueGroupLine2.datum()); + dc.d3compat.callHandler(dateValueGroupLine2.on('click'), null, {}, dateValueGroupLine2.datum()); expect(dateValueGroupLine2.text()).toBe('Date Value Group Line 2'); expect(d3.select(chart.selectAll('g.dc-legend g.dc-legend-item').nodes()[3]).classed('fadeout')).toBeTruthy(); expect(chart.selectAll('path.line').size()).toEqual(3); diff --git a/spec/heatmap-spec.js b/spec/heatmap-spec.js index dd561ef40..18e2bde0e 100644 --- a/spec/heatmap-spec.js +++ b/spec/heatmap-spec.js @@ -297,7 +297,7 @@ describe('dc.heatmap', () => { function clickCellOnChart (_chart, x, y) { const oneCell = _chart.selectAll('.box-group').filter(d => d.key[0] === x && d.key[1] === y); - oneCell.select('rect').on('click')(oneCell.datum()); + dc.d3compat.callHandler(oneCell.select('rect').on('click'), null, {}, oneCell.datum()); return oneCell; } @@ -339,9 +339,9 @@ describe('dc.heatmap', () => { it('should toggle a filter for the clicked box', () => { chart.selectAll('.box-group').each(function (d) { const cell = d3.select(this).select('rect'); - cell.on('click')(d); + dc.d3compat.callHandler(cell.on('click'), null, {}, d); expect(chart.hasFilter(d.key)).toBeTruthy(); - cell.on('click')(d); + dc.d3compat.callHandler(cell.on('click'), null, {}, d); expect(chart.hasFilter(d.key)).toBeFalsy(); }); }); @@ -360,15 +360,15 @@ describe('dc.heatmap', () => { it('should filter all cells on that axis', () => { chart.selectAll('.cols.axis text').each(function (d) { const axisLabel = d3.select(this); - axisLabel.on('click')(d); + dc.d3compat.callHandler(axisLabel.on('click'), null, {}, d); assertOnlyThisAxisIsFiltered(chart, 0, d); - axisLabel.on('click')(d); + dc.d3compat.callHandler(axisLabel.on('click'), null, {}, d); }); chart.selectAll('.rows.axis text').each(function (d) { const axisLabel = d3.select(this); - axisLabel.on('click')(d); + dc.d3compat.callHandler(axisLabel.on('click'), null, {}, d); assertOnlyThisAxisIsFiltered(chart, 1, d); - axisLabel.on('click')(d); + dc.d3compat.callHandler(axisLabel.on('click'), null, {}, d); }); }); }); @@ -377,7 +377,7 @@ describe('dc.heatmap', () => { const boxNodes = chart.selectAll('.box-group').nodes(); const box = d3.select(boxNodes[Math.floor(Math.random() * boxNodes.length)]); - box.select('rect').on('click')(box.datum()); + dc.d3compat.callHandler(box.select('rect').on('click'), null, {}, box.datum()); expect(chart.hasFilter(box.datum().key)).toBeTruthy(); @@ -386,11 +386,11 @@ describe('dc.heatmap', () => { const columns = chart.selectAll('.cols.axis text'); const column = columns.filter(columnData => columnData === xVal); - column.on('click')(column.datum()); + dc.d3compat.callHandler(column.on('click'), null, {}, column.datum()); assertOnlyThisAxisIsFiltered(chart, 0, xVal); - column.on('click')(column.datum()); + dc.d3compat.callHandler(column.on('click'), null, {}, column.datum()); }); }); describe('with all cells on that axis already filtered', () => { @@ -399,7 +399,7 @@ describe('dc.heatmap', () => { chart.selectAll('.box-group').each(function (d) { const box = d3.select(this); if (d.key[0] === xVal) { - box.select('rect').on('click')(box.datum()); + dc.d3compat.callHandler(box.select('rect').on('click'), null, {}, box.datum()); } }); @@ -408,7 +408,7 @@ describe('dc.heatmap', () => { const columns = chart.selectAll('.cols.axis text'); const column = columns.filter(columnData => columnData === xVal); - column.on('click')(column.datum()); + dc.d3compat.callHandler(column.on('click'), null, {}, column.datum()); chart.select('.box-group').each(d => { expect(chart.hasFilter(d.key)).toBeFalsy(); diff --git a/spec/html-legend-spec.js b/spec/html-legend-spec.js index 1e2ee4982..94eeb9de2 100644 --- a/spec/html-legend-spec.js +++ b/spec/html-legend-spec.js @@ -66,7 +66,8 @@ describe('dc.htmlLegend', () => { }); it('not allow hiding stacks be default', () => { - legendItem(0, 'vertical').on('click').call(legendItem(0).nodes()[0], legendItem(0, 'vertical').datum()); + dc.d3compat.callHandler(legendItem(0, 'vertical').on('click'), + legendItem(0).nodes()[0], {}, legendItem(0, 'vertical').datum()); expect(chart.selectAll('path.line').size()).toBe(3); }); @@ -100,7 +101,7 @@ describe('dc.htmlLegend', () => { it('not allow hiding stacks be default', () => { const firstLegendItem = legendItem(0, 'horizontal'); - firstLegendItem.on('click').call(firstLegendItem.nodes()[0], firstLegendItem.datum()); + dc.d3compat.callHandler(firstLegendItem.on('click'), firstLegendItem.nodes()[0], {}, firstLegendItem.datum()); expect(chart.selectAll('path.line').size()).toBe(3); }); }); diff --git a/spec/legend-spec.js b/spec/legend-spec.js index fe6ba4082..f395a1f1c 100644 --- a/spec/legend-spec.js +++ b/spec/legend-spec.js @@ -69,7 +69,7 @@ describe('dc.legend', () => { }); it('not allow hiding stacks be default', () => { - legendItem(0).on('click').call(legendItem(0).nodes()[0], legendItem(0).datum()); + dc.d3compat.callHandler(legendItem(0).on('click'), legendItem(0).nodes()[0], {}, legendItem(0).datum()); expect(chart.selectAll('path.line').size()).toBe(3); }); @@ -241,7 +241,7 @@ describe('dc.legend', () => { describe('clicking on a legend item', () => { beforeEach(() => { - legendItem(0).on('click').call(legendItem(0).nodes()[0], legendItem(0).datum()); + dc.d3compat.callHandler(legendItem(0).on('click'), legendItem(0).nodes()[0], {}, legendItem(0).datum()); }); it('should fade out the legend item', () => { @@ -253,13 +253,13 @@ describe('dc.legend', () => { }); it('disable hover highlighting for that legend item', () => { - legendItem(0).on('mouseover')(legendItem(0).datum()); + dc.d3compat.callHandler(legendItem(0).on('mouseover'), null, {}, legendItem(0).datum()); expect(d3.select(chart.selectAll('path.line').nodes()[1]).classed('fadeout')).toBeFalsy(); }); describe('clicking on a faded out legend item', () => { beforeEach(() => { - legendItem(0).on('click').call(legendItem(0).nodes()[0], legendItem(0).datum()); + dc.d3compat.callHandler(legendItem(0).on('click'), legendItem(0).nodes()[0], {}, legendItem(0).datum()); }); it('should unfade the legend item', () => { @@ -289,9 +289,9 @@ describe('dc.legend', () => { it('keyboard focus on legend item should highlight chart item', () => { - chart - .select('g.dc-legend').select('g.dc-legend-item text') - .on('focus').call(legendItem(0).nodes()[0], legendItem(0).datum()); + dc.d3compat.callHandler( + chart.select('g.dc-legend').select('g.dc-legend-item text').on('focus'), + legendItem(0).nodes()[0], {}, legendItem(0).datum()); expect(d3.select(chart.selectAll('path.line').nodes()[0]).classed('highlight')).toBeTruthy(); }); diff --git a/spec/line-chart-spec.js b/spec/line-chart-spec.js index db74ed6f9..016642adc 100644 --- a/spec/line-chart-spec.js +++ b/spec/line-chart-spec.js @@ -64,7 +64,7 @@ describe('dc.lineChart', () => { it('should change the radius on mousemove', () => { chart.selectAll('circle.dot').each(function () { const dot = d3.select(this); - dot.on('mousemove').call(this); + dc.d3compat.callHandler(dot.on('mousemove'), this, {}); expect(dot.attr('r')).toBe('5'); }); }); @@ -72,8 +72,8 @@ describe('dc.lineChart', () => { it('should revert to original radius on mouseout', () => { chart.selectAll('circle.dot').each(function () { const dot = d3.select(this); - dot.on('mousemove').call(this); - dot.on('mouseout').call(this); + dc.d3compat.callHandler(dot.on('mousemove'), this, {}); + dc.d3compat.callHandler(dot.on('mouseout'), this, {}); expect(dot.attr('r')).toBe('2'); }); }); @@ -93,7 +93,7 @@ describe('dc.lineChart', () => { it('should not change showing the data point on mousemove', () => { chart.selectAll('circle.dot').each(function () { const dot = d3.select(this); - dot.on('mousemove').call(this); + dc.d3compat.callHandler(dot.on('mousemove'), this, {}); expect(dot.style('fill-opacity')).toBeWithinDelta(0.8); expect(dot.style('stroke-opacity')).toBeWithinDelta(0.8); }); @@ -102,8 +102,8 @@ describe('dc.lineChart', () => { it('should not change returning to extremely low opacity on hover out', () => { chart.selectAll('circle.dot').each(function () { const dot = d3.select(this); - dot.on('mousemove').call(this); - dot.on('mouseout').call(this); + dc.d3compat.callHandler(dot.on('mousemove'), this, {}); + dc.d3compat.callHandler(dot.on('mouseout'), this, {}); expect(dot.style('fill-opacity')).toBeWithinDelta(1e-6); expect(dot.style('stroke-opacity')).toBeWithinDelta(1e-6); }); @@ -214,7 +214,7 @@ describe('dc.lineChart', () => { it('should become visible when hovered over', () => { chart.selectAll('circle.dot').each(function () { const dot = d3.select(this); - dot.on('mousemove').call(this); + dc.d3compat.callHandler(dot.on('mousemove'), this, {}); expect(dot.style('fill-opacity')).toBeWithinDelta(0.8); expect(dot.style('stroke-opacity')).toBeWithinDelta(0.8); }); @@ -223,8 +223,8 @@ describe('dc.lineChart', () => { it('should return to extremely low opacity on hover out', () => { chart.selectAll('circle.dot').each(function () { const dot = d3.select(this); - dot.on('mousemove').call(this); - dot.on('mouseout').call(this); + dc.d3compat.callHandler(dot.on('mousemove'), this, {}); + dc.d3compat.callHandler(dot.on('mouseout'), this, {}); expect(dot.style('fill-opacity')).toBeWithinDelta(1e-6); expect(dot.style('stroke-opacity')).toBeWithinDelta(1e-6); }); @@ -252,7 +252,7 @@ describe('dc.lineChart', () => { let x; beforeEach(() => { const dot = chart.select('circle.dot'); - dot.on('mousemove').call(dot.nodes()[0]); + dc.d3compat.callHandler(dot.on('mousemove'), dot.nodes()[0], {}); x = dot.attr('cx'); }); @@ -268,7 +268,7 @@ describe('dc.lineChart', () => { let x; beforeEach(() => { const dot = chart.select('circle.dot'); - dot.on('mousemove').call(dot.nodes()[0]); + dc.d3compat.callHandler(dot.on('mousemove'), dot.nodes()[0], {}); x = dot.attr('cx'); }); @@ -284,7 +284,7 @@ describe('dc.lineChart', () => { beforeEach(() => { chart.useRightYAxis(true).render(); const dot = chart.select('circle.dot'); - dot.on('mousemove').call(dot.nodes()[0]); + dc.d3compat.callHandler(dot.on('mousemove'), dot.nodes()[0], {}); x = dot.attr('cx'); }); @@ -617,7 +617,7 @@ describe('dc.lineChart', () => { .render(); firstItem = chart.select('g.dc-legend g.dc-legend-item'); - firstItem.on('mouseover')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseover'), {}, null, firstItem.datum()); }); describe('when a legend item is hovered over', () => { @@ -634,13 +634,13 @@ describe('dc.lineChart', () => { describe('when a legend item is hovered out', () => { it('should remove highlighting from corresponding lines and areas', () => { - firstItem.on('mouseout')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseout'), null, {}, firstItem.datum()); expect(nthLine(0).classed('highlight')).toBeFalsy(); expect(nthArea(0).classed('highlight')).toBeFalsy(); }); it('should fade in non-corresponding lines and areas', () => { - firstItem.on('mouseout')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseout'), null, {}, firstItem.datum()); expect(nthLine(1).classed('fadeout')).toBeFalsy(); expect(nthArea(1).classed('fadeout')).toBeFalsy(); }); diff --git a/spec/pie-chart-spec.js b/spec/pie-chart-spec.js index 5af8aee74..2834c4708 100644 --- a/spec/pie-chart-spec.js +++ b/spec/pie-chart-spec.js @@ -729,17 +729,17 @@ describe('dc.pieChart', () => { it('hovering on label should highlight corresponding slice', () => { chart.selectAll('#pie-chart-external-labeling text.pie-slice').each(function (d, i) { const legendItem = d3.select(this); - legendItem.on('mouseover')(legendItem.datum(), i); + dc.d3compat.callHandler(legendItem.on('mouseover'), null, {}, legendItem.datum(), i); expect(chart.select(`g.pie-slice._${i}`).classed('highlight')).toBeTruthy(); - legendItem.on('mouseout')(legendItem.datum()); + dc.d3compat.callHandler(legendItem.on('mouseout'), null, {}, legendItem.datum()); }); }); it('unhovering label removes highlight from corresponding slice', () => { chart.selectAll('#pie-chart-external-labeling text.pie-slice').each(function (d, i) { const legendItem = d3.select(this); - legendItem.on('mouseover')(legendItem.datum(), i); - legendItem.on('mouseout')(legendItem.datum(), i); + dc.d3compat.callHandler(legendItem.on('mouseover'), null, {}, legendItem.datum(), i); + dc.d3compat.callHandler(legendItem.on('mouseout'), null, {}, legendItem.datum(), i); expect(chart.select(`.pie-slice._${i}`).classed('highlight')).toBeFalsy(); }); @@ -748,17 +748,17 @@ describe('dc.pieChart', () => { it('hovering on path should highlight corresponding slice', () => { chart.selectAll('#pie-chart-external-labeling polyline.pie-path').each(function (d, i) { const legendItem = d3.select(this); - legendItem.on('mouseover')(legendItem.datum(), i); + dc.d3compat.callHandler(legendItem.on('mouseover'), null, {}, legendItem.datum(), i); expect(chart.select(`g.pie-slice._${i}`).classed('highlight')).toBeTruthy(); - legendItem.on('mouseout')(legendItem.datum()); + dc.d3compat.callHandler(legendItem.on('mouseout'), null, {}, legendItem.datum()); }); }); it('unhovering label removes highlight from corresponding slice', () => { chart.selectAll('#pie-chart-external-labeling polyline.pie-path').each(function (d, i) { const legendItem = d3.select(this); - legendItem.on('mouseover')(legendItem.datum(), i); - legendItem.on('mouseout')(legendItem.datum(), i); + dc.d3compat.callHandler(legendItem.on('mouseover'), null, {}, legendItem.datum(), i); + dc.d3compat.callHandler(legendItem.on('mouseout'), null, {}, legendItem.datum(), i); expect(chart.select(`.pie-slice._${i}`).classed('highlight')).toBeFalsy(); }); @@ -789,17 +789,17 @@ describe('dc.pieChart', () => { it('hovering on items should highlight corresponding slice', () => { chart.selectAll('g.dc-legend g.dc-legend-item').each(function (d, i) { const legendItem = d3.select(this); - legendItem.on('mouseover')(legendItem.datum()); + dc.d3compat.callHandler(legendItem.on('mouseover'), null, {}, legendItem.datum()); expect(chart.select(`g.pie-slice._${i}`).classed('highlight')).toBeTruthy(); - legendItem.on('mouseout')(legendItem.datum()); + dc.d3compat.callHandler(legendItem.on('mouseout'), null, {}, legendItem.datum()); }); }); it('unhovering removes highlight from corresponding slice', () => { chart.selectAll('g.dc-legend g.dc-legend-item').each(function (d, i) { const legendItem = d3.select(this); - legendItem.on('mouseover')(legendItem.datum()); - legendItem.on('mouseout')(legendItem.datum()); + dc.d3compat.callHandler(legendItem.on('mouseover'), null, {}, legendItem.datum()); + dc.d3compat.callHandler(legendItem.on('mouseout'), null, {}, legendItem.datum()); expect(chart.select(`g.pie-slice._${i}`).classed('highlight')).toBeFalsy(); }); @@ -807,7 +807,7 @@ describe('dc.pieChart', () => { it('clicking on items filters them', () => { chart.selectAll('g.dc-legend g.dc-legend-item').each(function (d, i) { const legendItem = d3.select(this); - legendItem.on('click')(legendItem.datum()); + dc.d3compat.callHandler(legendItem.on('click'), null, {}, legendItem.datum()); expect(chart.hasFilter(d.name)).toBeTruthy(); diff --git a/spec/scatter-plot-spec.js b/spec/scatter-plot-spec.js index 52250abbb..635b971c4 100644 --- a/spec/scatter-plot-spec.js +++ b/spec/scatter-plot-spec.js @@ -450,7 +450,7 @@ describe('dc.scatterPlot', () => { describe('hovering', () => { beforeEach(() => { - firstItem.on('mouseover')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseover'), null, {}, firstItem.datum()); }); describe('when a legend item is hovered over', () => { @@ -466,7 +466,7 @@ describe('dc.scatterPlot', () => { describe('when a legend item is hovered out', () => { beforeEach(() => { - firstItem.on('mouseout')(firstItem.datum()); + dc.d3compat.callHandler(firstItem.on('mouseout'), null, {}, firstItem.datum()); }); it('should remove highlighting from corresponding lines and areas', () => { diff --git a/spec/text-filter-widget-spec.js b/spec/text-filter-widget-spec.js index 318f274b8..319121762 100644 --- a/spec/text-filter-widget-spec.js +++ b/spec/text-filter-widget-spec.js @@ -53,7 +53,7 @@ describe('dc.textFilterWidget', () => { const mockTyping = function (q) { const i = d3.select('input'); i.nodes()[0].value = q; - i.on('input').call(i.node(), i.datum()); + dc.d3compat.callHandler(i.on('input'), i.node(), {}, i.datum()); }; beforeEach(() => { diff --git a/src/charts/row-chart.js b/src/charts/row-chart.js index 88c139887..97e3898d5 100644 --- a/src/charts/row-chart.js +++ b/src/charts/row-chart.js @@ -197,7 +197,7 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { .classed('selected', d => (this.hasFilter()) ? this._isSelectedRow(d) : false); if (this._keyboardAccessible) { - this._makeKeyboardAccessible(d3compat.eventHandler(d => this._onClick(d))); + this._makeKeyboardAccessible(d => this._onClick(d)); } transition(rect, this.transitionDuration(), this.transitionDelay()) diff --git a/src/compat/d3v5.js b/src/compat/d3v5.js index 85819afb5..f01e31e8e 100644 --- a/src/compat/d3v5.js +++ b/src/compat/d3v5.js @@ -9,14 +9,14 @@ const majorVer = +version[0]; if (majorVer < 6) { Object.assign(d3compat, { - eventHandler: handler => function eventHandler (a ,b) { - if (a && a.target) { - // d3@v6 - b is __data__, a is the event - handler.call(this, b, a); - } else { - // older d3 - a is __data__, event from global d3.event - handler.call(this, a, event); - } + eventHandler: handler => function eventHandler (d, _) { + handler.call(this, d, event); + }, + // manual firing of event, usu for tests + callHandler: function callHandler (handler, that, _, d) { + // note: dropping event as well as any extra args + // d3@6 does not pass extra args anymore, so we can't use them and remain compatible + handler.call(that, d); }, nester: ({key, sortKeys, sortValues, entries}) => { const nester = nest().key(key); @@ -30,4 +30,4 @@ if (majorVer < 6) { }, pointer: (evt, elem) => mouse(elem) }); -} \ No newline at end of file +} diff --git a/src/compat/d3v6.js b/src/compat/d3v6.js index 9c4bfcf05..3806799f7 100644 --- a/src/compat/d3v6.js +++ b/src/compat/d3v6.js @@ -9,14 +9,12 @@ const majorVer = +version[0]; if (majorVer > 5) { Object.assign(d3compat, { - eventHandler: handler => function (a, b) { - if (a && a.target) { - // d3@v6 - b is __data__, a is the event - handler.call(this, b, a); - } else { - // older d3 - a is __data__, event from global d3.event - handler.call(this, a); - } + eventHandler: handler => function eventHandler (event, d) { + handler.call(this, d, event); + }, + // manual firing of event, usu for tests + callHandler: function callHandler (handler, that, event, d) { + handler.call(that, event, d); }, nester: ({key, sortKeys, sortValues, entries}) => { if (sortValues) { @@ -26,7 +24,7 @@ if (majorVer > 5) { if (sortKeys) { out = out.sort(sortKeys); } - + // remap to d3@v5 structure return out.map(e => ({ key: `${e[0]}`, // d3@v5 always returns key as string @@ -35,4 +33,4 @@ if (majorVer > 5) { }, pointer }); -} \ No newline at end of file +} diff --git a/web-src/examples/composite-bar-line.html b/web-src/examples/composite-bar-line.html index cd9098234..f54943521 100644 --- a/web-src/examples/composite-bar-line.html +++ b/web-src/examples/composite-bar-line.html @@ -44,7 +44,7 @@ composite .width(768) .height(480) - .x(d3.scaleLinear().domain([2.9,16.1])) + .x(d3.scaleLinear()).xAxisPadding(0.5).elasticX(true) .yAxisLabel("The Y Axis") .legend(dc.legend().x(80).y(20).itemHeight(13).gap(5)) .renderHorizontalGridLines(true) diff --git a/web-src/examples/focus-ordinal-bar.html b/web-src/examples/focus-ordinal-bar.html index 91b13ed66..0a618e82a 100644 --- a/web-src/examples/focus-ordinal-bar.html +++ b/web-src/examples/focus-ordinal-bar.html @@ -132,7 +132,7 @@ } }; focus.on('pretransition', function(chart) { - chart.selectAll('rect.bar').on('click.ordinal-select', function(d) { + chart.selectAll('rect.bar').on('click.ordinal-select', dc.d3compat.eventHandler(function(d) { var i = focusFilter.indexOf(d.data.key); if(i >= 0) focusFilter.splice(i, 1); @@ -140,7 +140,7 @@ focusFilter.push(d.data.key); chart.applyFilter(); chart.redrawGroup(); - }); + })); }); focus.on('preRedraw', function(chart) {