From 229e1beac37c3d2025b23f8d1126f570e3f66c34 Mon Sep 17 00:00:00 2001 From: adiletelf <74559101+adiletelf@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:07:58 +0600 Subject: [PATCH] Fix scroll (#168) * Fix the bug with header not moving on scrolling horizontally * Fix npm vulnerabilities * Bump version to 2.5.9.0 * Optimize scrolling event so it doesn't occure too frequently * Rename 'cursor' to more understandable name 'pointer edge' * Move 'pointer edge' settings to 'cells' and group cells slices * Move edges settings to 'selected cells group' * Rename cells groups for better --- CHANGELOG.md | 4 + capabilities.json | 32 ++-- package-lock.json | 208 +++++++++++++----------- package.json | 2 +- pbiviz.json | 4 +- src/timeLine.ts | 37 ++++- src/timeLineSettingsModel.ts | 130 +++++++-------- stringResources/en-US/resources.resjson | 12 +- 8 files changed, 236 insertions(+), 193 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4d71c1..e0be2a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.5.9 +* Fix the bug with header not moving on scrolling horizontally +* Fix npm vulnerabilities + ## 2.5.8 * Fix the bug with dragging cursors diff --git a/capabilities.json b/capabilities.json index 5e56e6a..0ecc0fa 100644 --- a/capabilities.json +++ b/capabilities.json @@ -45,24 +45,6 @@ } } }, - "cursor": { - "properties": { - "show": { - "type": { - "bool": true - } - }, - "color": { - "type": { - "fill": { - "solid": { - "color": true - } - } - } - } - } - }, "forceSelection": { "properties": { "currentPeriod": { @@ -316,6 +298,20 @@ "type": { "numeric": true } + }, + "showEdges": { + "type": { + "bool": true + } + }, + "edgeColor": { + "type": { + "fill": { + "solid": { + "color": true + } + } + } } } }, diff --git a/package-lock.json b/package-lock.json index 2836624..38d002f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "powerbi-visuals-timeline", - "version": "2.5.8.0", + "version": "2.5.9.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "powerbi-visuals-timeline", - "version": "2.5.8.0", + "version": "2.5.9.0", "license": "MIT", "dependencies": { "@typescript-eslint/eslint-plugin": "^7.17.0", @@ -866,31 +866,12 @@ "@types/d3-path": "*" } }, - "node_modules/@types/eslint": { - "version": "8.56.5", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.5.tgz", - "integrity": "sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==", - "dev": true, - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", - "dev": true, - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" }, "node_modules/@types/express": { "version": "4.17.21", @@ -1680,10 +1661,11 @@ "dev": true }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "dev": true, + "license": "MIT", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -1693,7 +1675,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -2776,10 +2758,11 @@ "dev": true }, "node_modules/elliptic": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.5.tgz", - "integrity": "sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", + "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", "dev": true, + "license": "MIT", "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -2863,10 +2846,11 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.0.tgz", - "integrity": "sha512-dwDPwZL0dmye8Txp2gzFmA6sxALaSvdRDjPH0viLcKrtlOL3tw62nWWweVD1SdILDTJrbrL6tdWVN58Wo6U3eA==", + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dev": true, + "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -3149,6 +3133,7 @@ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3211,37 +3196,38 @@ } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", + "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", "dev": true, + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -3266,18 +3252,30 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, + "node_modules/express/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/express/node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "dev": true, + "license": "MIT", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -3292,13 +3290,15 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/express/node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, + "license": "MIT", "dependencies": { "ee-first": "1.1.1" }, @@ -3311,6 +3311,7 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -3555,6 +3556,7 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5127,10 +5129,14 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", - "dev": true + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/merge-stream": { "version": "2.0.0", @@ -5156,11 +5162,12 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -5747,10 +5754,11 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", - "dev": true + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", + "dev": true, + "license": "MIT" }, "node_modules/path-type": { "version": "4.0.0", @@ -6609,12 +6617,13 @@ } }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -6949,10 +6958,11 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dev": true, + "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -6977,6 +6987,7 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -6985,13 +6996,15 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/send/node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true, + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -7003,13 +7016,15 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/send/node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, + "license": "MIT", "dependencies": { "ee-first": "1.1.1" }, @@ -7022,6 +7037,7 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -7105,20 +7121,31 @@ "dev": true }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dev": true, + "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" } }, + "node_modules/serve-static/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/set-function-length": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz", @@ -7901,21 +7928,6 @@ "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", "dev": true }, - "node_modules/url/node_modules/qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", - "dev": true, - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -7987,12 +7999,12 @@ } }, "node_modules/webpack": { - "version": "5.93.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.93.0.tgz", - "integrity": "sha512-Y0m5oEY1LRuwly578VqluorkXbvXKh7U3rLoQCEO04M97ScRr44afGVkI0FQFsXzysk5OgFAxjZAb9rsGQVihA==", + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", "dev": true, + "license": "MIT", "dependencies": { - "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1", @@ -8001,7 +8013,7 @@ "acorn-import-attributes": "^1.9.5", "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.0", + "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", diff --git a/package.json b/package.json index bb1f6f9..7237958 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "powerbi-visuals-timeline", - "version": "2.5.8.0", + "version": "2.5.9.0", "description": "Timeline slicer is a graphical date range selector used as a filtering component in the report canvas", "repository": { "type": "git", diff --git a/pbiviz.json b/pbiviz.json index 60e0875..1cadbd6 100644 --- a/pbiviz.json +++ b/pbiviz.json @@ -1,10 +1,10 @@ { "visual": { "name": "Timeline", - "displayName": "Timeline 2.5.8.0", + "displayName": "Timeline 2.5.9.0", "guid": "Timeline1447991079100", "visualClassName": "Timeline", - "version": "2.5.8.0", + "version": "2.5.9.0", "description": "Timeline slicer is a graphical date range selector used as a filtering component in the report canvas", "supportUrl": "https://community.powerbi.com", "gitHubUrl": "https://github.com/Microsoft/powerbi-visuals-timeline" diff --git a/src/timeLine.ts b/src/timeLine.ts index a7e2899..9d7c943 100644 --- a/src/timeLine.ts +++ b/src/timeLine.ts @@ -522,7 +522,7 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual this.visualSettings.labels.fontColor.value.value = foreground.value; - this.visualSettings.cursor.color.value.value = foreground.value; + this.visualSettings.cells.edgeColor.value.value = foreground.value; } } @@ -632,6 +632,19 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual .classed(Timeline.TimelineSelectors.TimelineVisual.className, true); this.addElements(); + + let ticking = false; + this.rootSelection.on("scroll", (event) => { + if (!ticking) { + window.requestAnimationFrame(() => { + const target = event.target as HTMLDivElement; + const scrollLeft: number = target?.scrollLeft || 0; + this.headerSelection.attr("transform", `translate(${scrollLeft}, 0)`); + ticking = false; + }); + ticking = true; + } + }); } public clearUserSelection(): void { @@ -692,6 +705,7 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual this.adjustHeightOfElements(options.viewport.width); + this.resetScrollPosition(); this.timelineGranularityData = new GranularityData(this.datePeriod.startDate, this.datePeriod.endDate); @@ -963,7 +977,7 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual return cursorDataPoint.cursorIndex * Math.PI + 2 * Math.PI; }), ) - .style("fill", this.visualSettings.cursor.show.value ? this.visualSettings.cursor.color.value.value : "transparent") + .style("fill", this.visualSettings.cells.showEdges.value ? this.visualSettings.cells.edgeColor.value.value : "transparent") } public renderTimeRangeText(timelineData: ITimelineData, rangeHeaderSettings: RangeHeaderSettingsCard): void { @@ -1084,6 +1098,11 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual } public getFormattingModel(): powerbi.visuals.FormattingModel { + this.updateFormattingSettingsModel(); + return this.formattingSettingsService.buildFormattingModel(this.visualSettings); + } + + private updateFormattingSettingsModel(): void { // These options have no sense if ISO standard was picked if (this.visualSettings.weeksDeterminationStandards.weekStandard.value.value === WeekStandard.ISO8061) { this.visualSettings.weekDay.disabled = true; @@ -1091,7 +1110,6 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual } const granularity = this.getGranularityType(); - switch (granularity) { case GranularityType.year: this.visualSettings.labels.displayQuarters.visible = false; @@ -1120,7 +1138,14 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual break; } - return this.formattingSettingsService.buildFormattingModel(this.visualSettings); + if (!this.visualSettings.cells.enableManualSizing.value) { + this.visualSettings.cells.height.visible = false; + this.visualSettings.cells.width.visible = false; + } + + if (!this.visualSettings.cells.showEdges.value) { + this.visualSettings.cells.edgeColor.visible = false; + } } public selectPeriod(granularityType: GranularityType): void { @@ -1269,6 +1294,10 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual .attr("height", this.timelineProperties.legendHeight); } + private resetScrollPosition(): void { + this.headerSelection.attr("transform", null); + } + private renderGranularityFrame(granularity: GranularityType): void { d3SelectAll("g." + Timeline.TimelineSelectors.TimelineSlicer.className).remove(); diff --git a/src/timeLineSettingsModel.ts b/src/timeLineSettingsModel.ts index 25755b7..cb0a532 100644 --- a/src/timeLineSettingsModel.ts +++ b/src/timeLineSettingsModel.ts @@ -6,6 +6,7 @@ import {Month} from "./calendars/month"; import Card = formattingSettings.SimpleCard; import CompositeCard = formattingSettings.CompositeCard; import Model = formattingSettings.Model; +import Group = formattingSettings.Group; import IEnumMember = powerbi.IEnumMember; import ValidatorType = powerbi.visuals.ValidatorType; import {Weekday} from "./calendars/weekday"; @@ -56,28 +57,6 @@ class TextSizeDefaults { public static readonly Max: number = 40; } -class CursorSettingsCard extends Card { - show = new formattingSettings.ToggleSwitch({ - name: "show", - displayName: "Show", - displayNameKey: "Visual_Show", - value: true, - }); - - color = new formattingSettings.ColorPicker({ - name: "color", - displayName: "Cursor color", - displayNameKey: "Visual_CursorColor", - value: { value: "#808080" }, - }); - - topLevelSlice = this.show; - name: string = "cursor"; - displayName: string = "Cursor"; - displayNameKey: string = "Visual_Cursor"; - slices = [this.color]; -} - class ForceSelectionSettingsCard extends Card { currentPeriod = new formattingSettings.ToggleSwitch({ name: "currentPeriod", @@ -204,38 +183,10 @@ export class RangeHeaderSettingsCard extends Card { slices = [this.fontColor, this.textSize]; } -export class CellsSettingsCard extends Card { +export class CellsSettingsCard extends CompositeCard { public static readonly FillSelectedDefaultColor: string = "#ADD8E6"; public static readonly FillUnselectedDefaultColor: string = "#FFFFFF"; - fillSelected = new formattingSettings.ColorPicker({ - name: "fillSelected", - displayName: "Selected cell color", - displayNameKey: "Visual_Cell_SelectedColor", - value: { value: CellsSettingsCard.FillSelectedDefaultColor }, - }); - - strokeSelected = new formattingSettings.ColorPicker({ - name: "strokeSelected", - displayName: "Selected cell stroke color", - displayNameKey: "Visual_Cell_SelectedStrokeColor", - value: { value: "#333444" }, - }) - - fillUnselected = new formattingSettings.ColorPicker({ - name: "fillUnselected", - displayName: "Unselected cell color", - displayNameKey: "Visual_Cell_UnselectedColor", - value: { value: CellsSettingsCard.FillUnselectedDefaultColor }, - }); - - strokeUnselected = new formattingSettings.ColorPicker({ - name: "strokeUnselected", - displayName: "Unselected cell stroke color", - displayNameKey: "Visual_Cell_UnselectedStrokeColor", - value: { value: "#333444" }, - }); - strokeWidth = new formattingSettings.NumUpDown({ name: "strokeWidth", displayName: "Stroke width", @@ -285,20 +236,73 @@ export class CellsSettingsCard extends Card { }, }); + cellsGeneralGroup = new Group({ + name: "cellsGeneralGroup", + displayName: "General", + displayNameKey: "Visual_General", + slices: [this.strokeWidth, this.gapWidth, this.enableManualSizing, this.width, this.height], + }) + + fillSelected = new formattingSettings.ColorPicker({ + name: "fillSelected", + displayName: "Color", + displayNameKey: "Visual_Color", + value: { value: CellsSettingsCard.FillSelectedDefaultColor }, + }); + + strokeSelected = new formattingSettings.ColorPicker({ + name: "strokeSelected", + displayName: "Stroke color", + displayNameKey: "Visual_StrokeColor", + value: { value: "#333444" }, + }) + + showEdges = new formattingSettings.ToggleSwitch({ + name: "showEdges", + displayName: "Show edges", + displayNameKey: "Visual_ShowEdges", + value: true, + }); + + edgeColor = new formattingSettings.ColorPicker({ + name: "edgeColor", + displayName: "Edge color", + displayNameKey: "Visual_EdgeColor", + value: { value: "#808080" }, + }); + + cellsSelectedGroup = new Group({ + name: "selectedCellsGroup", + displayName: "Selected cells", + displayNameKey: "Visual_SelectedCells", + slices: [this.fillSelected, this.strokeSelected, this.showEdges, this.edgeColor], + }); + + fillUnselected = new formattingSettings.ColorPicker({ + name: "fillUnselected", + displayName: "Color", + displayNameKey: "Visual_Color", + value: { value: CellsSettingsCard.FillUnselectedDefaultColor }, + }); + + strokeUnselected = new formattingSettings.ColorPicker({ + name: "strokeUnselected", + displayName: "Stroke color", + displayNameKey: "Visual_StrokeColor", + value: { value: "#333444" }, + }); + + cellsUnselectedGroup = new Group({ + name: "unselectedCellsGroup", + displayName: "Unselected cells", + displayNameKey: "Visual_UnselectedCells", + slices: [this.fillUnselected, this.strokeUnselected], + }); + name: string = "cells"; displayName: string = "Cells"; displayNameKey: string = "Visual_Cells"; - slices = [ - this.fillSelected, - this.strokeSelected, - this.fillUnselected, - this.strokeUnselected, - this.strokeWidth, - this.gapWidth, - this.enableManualSizing, - this.width, - this.height, - ]; + groups = [this.cellsGeneralGroup, this.cellsSelectedGroup, this.cellsUnselectedGroup]; } export class GranularitySettingsCard extends Card { @@ -474,7 +478,6 @@ class ScrollAutoAdjustmentSettingsCard extends Card { export class TimeLineSettingsModel extends Model { - cursor = new CursorSettingsCard(); forceSelection = new ForceSelectionSettingsCard(); weekDay = new WeekDaySettingsCard(); weeksDeterminationStandards = new WeeksDeterminationStandardsSettingsCard(); @@ -486,7 +489,6 @@ export class TimeLineSettingsModel extends Model { scrollAutoAdjustment = new ScrollAutoAdjustmentSettingsCard(); cards: Array = [ - this.cursor, this.forceSelection, this.weeksDeterminationStandards, this.calendar, diff --git a/stringResources/en-US/resources.resjson b/stringResources/en-US/resources.resjson index 1bbe934..e928db5 100644 --- a/stringResources/en-US/resources.resjson +++ b/stringResources/en-US/resources.resjson @@ -32,19 +32,21 @@ "Visual_Day_Saturday": "Saturday", "Visual_RangeHeader": "Range Header", "Visual_Show": "Show", + "Visual_ShowEdges": "Show edges", "Visual_FontColor": "Font color", "Visual_TextSize": "Text Size", "Visual_Cells": "Cells", - "Visual_Cell_SelectedColor": "Selected cell color", - "Visual_Cell_UnselectedColor": "Unselected cell color", - "Visual_Cell_SelectedStrokeColor": "Selected cell stroke color", - "Visual_Cell_UnselectedStrokeColor": "Unselected cell stroke color", + "Visual_SelectedCells": "Selected cells", + "Visual_UnselectedCells": "Unselected cells", "Visual_Cell_EnableManualSizing": "Enable manual sizing", "Visual_Cell_Width": "Cell width", "Visual_Cell_Height": "Cell height", "Visual_Cell_StrokeWidth": "Stroke width", "Visual_Cell_GapWidth": "Gap width", "Visual_Granularity": "Granularity", + "Visual_Color": "Color", + "Visual_StrokeColor": "Stroke color", + "Visual_EdgeColor": "Edge color", "Visual_ScaleColor": "Scale color", "Visual_SliderColor": "Slider color", "Visual_Granularity_Year": "Year", @@ -62,8 +64,6 @@ "Visual_DisplayMonths": "Display months", "Visual_DisplayWeeks": "Display weeks", "Visual_DisplayDays": "Display days", - "Visual_Cursor": "Cursor", - "Visual_CursorColor": "Cursor color", "Visual_ForceSelection": "Force selection", "Visual_CurrentPeriod": "Current period", "Visual_LatestAvailableDate": "Latest available period",