diff --git a/CHANGELOG.md b/CHANGELOG.md index 8657abe1..5638de2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,27 @@ This log documents significant changes for the [@aehrc/smart-forms-renderer](htt Changelog only includes changes from version 0.36.0 onwards. +## [0.41.0] - 2024-09-25 +### Changed +- Significantly improved performance by reducing the number of re-renders. +- Adjusted renderer's background color to be #fafafa. +- Removed left and right paddings from the renderer - it now takes up the full width of its container. + +### Fixed +- Fixed inconsistencies when syncing the renderer's internal state with externally-generated QuestionnaireResponses. +- Fixed inconsistencies with internal IDs for tracking repeating items and groups. +- Fixed an issue where the renderer's theme was overriding the parent app's styles. +- Fixed issues with lodash dependencies in package.json. + +### Added +- Added a library function removeInternalIdsFromResponse() to remove internal IDs for tracking repeating items. + + ## [0.40.1] - 2024-09-18 ### Fixed - Fix date validation error message for two matches. - Fix generation of internal IDs for repeat items and groups to be consistent and sync-able with externally-generated QuestionnaireResponses. -- Add simple, minimal fix to dynamically adjust field positions based on viewport +- Added a simple, minimal fix to dynamically adjust field positions based on viewport ## [0.40.0] - 2024-09-06 ### Added @@ -19,8 +35,6 @@ Changelog only includes changes from version 0.36.0 onwards. ### Changed - Refactored `repeat` items so that it tracks item instances using the QuestionnaireResponse, instead of using React's `useState`. -Note: This is a huge change for performance improvements, and was able to pass all the end-to-end and Chromatic tests - but please proceed carefully and test thoroughly before using this version in production. - ### Fixed - Fixed an issue where `string` and `text` items were automatically removing inputted trailing whitespaces. diff --git a/apps/demo-renderer-app/package-lock.json b/apps/demo-renderer-app/package-lock.json index 995534d6..a3e33839 100644 --- a/apps/demo-renderer-app/package-lock.json +++ b/apps/demo-renderer-app/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "dependencies": { "@aehrc/sdc-populate": "^2.3.1", - "@aehrc/smart-forms-renderer": "^0.40.3", + "@aehrc/smart-forms-renderer": "^0.41.0", "@radix-ui/react-collapsible": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", @@ -56,9 +56,9 @@ } }, "node_modules/@aehrc/smart-forms-renderer": { - "version": "0.40.3", - "resolved": "https://registry.npmjs.org/@aehrc/smart-forms-renderer/-/smart-forms-renderer-0.40.3.tgz", - "integrity": "sha512-/kqS0nuvAwNo+Z+AQHudcGDzvYhh8R/VqtIdNuiIm/ag//9zss9lUMnBuAPYTrmdSSsbIQa3CPUq85aNNMhtnw==", + "version": "0.41.0", + "resolved": "https://registry.npmjs.org/@aehrc/smart-forms-renderer/-/smart-forms-renderer-0.41.0.tgz", + "integrity": "sha512-nGP9xOmaWByQgUvMhn/6LAKI1dyFTGbmQxvXuaq/u1WdSY9+oZ0HNF71ymcm8mP7BqN5LvadFdCb69GRFI2mFQ==", "dependencies": { "@aehrc/sdc-populate": "^2.3.1", "@iconify/react": "^4.1.1", @@ -72,6 +72,7 @@ "lodash.debounce": "^4.0.8", "lodash.difference": "^4.5.0", "lodash.intersection": "^4.4.0", + "lodash.isequal": "^4.5.0", "nanoid": "^5.0.7", "react-beautiful-dnd": "^13.1.1", "react-dnd": "^16.0.1", @@ -3403,6 +3404,21 @@ "node": ">=10" } }, + "node_modules/@expo/cli/node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "optional": true, + "peer": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/@expo/cli/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8738,9 +8754,9 @@ } }, "node_modules/@rnx-kit/chromium-edge-launcher/node_modules/@types/node": { - "version": "18.19.50", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.50.tgz", - "integrity": "sha512-xonK+NRrMBRtkL1hVCc3G+uXtjh1Al4opBLjqVmipe5ZAaBYWW6cNAiBVZ1BvmkBhep698rP3UM3aRAdSALuhg==", + "version": "18.19.51", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.51.tgz", + "integrity": "sha512-IIMkWEIVQDlBpi6pPeGqTqOx7KbzGC3EgIyH8NrxplXOwWw0uVl9vthJUMFrxD7kcEfcRp7jIkgpB28M6JnfWA==", "optional": true, "peer": true, "dependencies": { @@ -9035,9 +9051,9 @@ "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" }, "node_modules/@types/node": { - "version": "22.6.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.6.1.tgz", - "integrity": "sha512-V48tCfcKb/e6cVUigLAaJDAILdMP0fUW6BidkPK4GpGjXcfbnoHasCZDwz3N3yVt5we2RHm4XTQCpv0KJz9zqw==", + "version": "22.7.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.0.tgz", + "integrity": "sha512-MOdOibwBs6KW1vfqz2uKMlxq5xAfAZ98SZjO8e3XnAbFnTJtAspqhWk7hrdSAs9/Y14ZWMiy7/MxMUzAOadYEw==", "dependencies": { "undici-types": "~6.19.2" } @@ -9070,9 +9086,9 @@ "integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==" }, "node_modules/@types/react": { - "version": "18.3.8", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.8.tgz", - "integrity": "sha512-syBUrW3/XpnW4WJ41Pft+I+aPoDVbrBVQGEnbD7NijDGlVC+8gV/XKRY+7vMDlfPpbwYt0l1vd/Sj8bJGMbs9Q==", + "version": "18.3.9", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.9.tgz", + "integrity": "sha512-+BpAVyTpJkNWWSSnaLBk6ePpHLOGJKnEQNbINNovPWzvEUyAe3e+/d494QdEh71RekM/qV7lw6jzf1HGrJyAtQ==", "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" @@ -9652,19 +9668,6 @@ "proxy-from-env": "^1.1.0" } }, - "node_modules/axios/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/b64-lite": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/b64-lite/-/b64-lite-1.4.0.tgz", @@ -9749,9 +9752,9 @@ } }, "node_modules/babel-plugin-react-compiler": { - "version": "0.0.0-experimental-6067d4e-20240923", - "resolved": "https://registry.npmjs.org/babel-plugin-react-compiler/-/babel-plugin-react-compiler-0.0.0-experimental-6067d4e-20240923.tgz", - "integrity": "sha512-0vYsWhC8W4BUIS5cLiGBJkOpj8bINpbATo9O9scZ7vxL6/+jMIomUkX+k+R0lpG0ztu0x8QVMENwoFCawdZEbQ==", + "version": "0.0.0-experimental-6067d4e-20240924", + "resolved": "https://registry.npmjs.org/babel-plugin-react-compiler/-/babel-plugin-react-compiler-0.0.0-experimental-6067d4e-20240924.tgz", + "integrity": "sha512-Xprt5PqHZKqF2H8Di7y+o9j1RTFsNGJ6ntBcRFu8kcChy5sVSVVIKXq+FBezcBhVChzaRrUb+OV/nWZlJH1aJA==", "optional": true, "peer": true, "dependencies": { @@ -10034,9 +10037,9 @@ } }, "node_modules/browserslist": { - "version": "4.23.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", - "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", + "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", "devOptional": true, "funding": [ { @@ -10053,8 +10056,8 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001646", - "electron-to-chromium": "^1.5.4", + "caniuse-lite": "^1.0.30001663", + "electron-to-chromium": "^1.5.28", "node-releases": "^2.0.18", "update-browserslist-db": "^1.1.0" }, @@ -10946,15 +10949,9 @@ } }, "node_modules/date-fns": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", - "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", - "optional": true, - "peer": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/kossnocorp" - } + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", + "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" }, "node_modules/dayjs": { "version": "1.11.13", @@ -12676,11 +12673,6 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/fhirpath/node_modules/date-fns": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", - "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" - }, "node_modules/fhirpath/node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -12901,11 +12893,9 @@ } }, "node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "optional": true, - "peer": true, + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -15406,11 +15396,6 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/lforms/node_modules/date-fns": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", - "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" - }, "node_modules/lforms/node_modules/fhirpath": { "version": "3.13.2", "resolved": "https://registry.npmjs.org/fhirpath/-/fhirpath-3.13.2.tgz", @@ -15796,6 +15781,11 @@ "resolved": "https://registry.npmjs.org/lodash.intersection/-/lodash.intersection-4.4.0.tgz", "integrity": "sha512-N+L0cCfnqMv6mxXtSPeKt+IavbOBBSiAEkKyLasZ8BVcP9YXQgxLO12oPR8OyURwKV8l5vJKiE1M8aS70heuMg==" }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", diff --git a/apps/demo-renderer-app/package.json b/apps/demo-renderer-app/package.json index 1101f141..978008d4 100644 --- a/apps/demo-renderer-app/package.json +++ b/apps/demo-renderer-app/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@aehrc/sdc-populate": "^2.3.1", - "@aehrc/smart-forms-renderer": "^0.40.3", + "@aehrc/smart-forms-renderer": "^0.41.0", "@radix-ui/react-collapsible": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", diff --git a/package-lock.json b/package-lock.json index 83e06421..1fc8f260 100644 --- a/package-lock.json +++ b/package-lock.json @@ -111,6 +111,43 @@ "yui-lint": "^0.2.0" } }, + "apps/smart-forms-app/node_modules/@aehrc/smart-forms-renderer": { + "version": "0.40.3", + "resolved": "https://registry.npmjs.org/@aehrc/smart-forms-renderer/-/smart-forms-renderer-0.40.3.tgz", + "integrity": "sha512-/kqS0nuvAwNo+Z+AQHudcGDzvYhh8R/VqtIdNuiIm/ag//9zss9lUMnBuAPYTrmdSSsbIQa3CPUq85aNNMhtnw==", + "dependencies": { + "@aehrc/sdc-populate": "^2.3.1", + "@iconify/react": "^4.1.1", + "dayjs": "^1.11.10", + "deep-diff": "^1.0.2", + "fhirclient": "^2.5.2", + "fhirpath": "3.11.0", + "html-react-parser": "4.2.10", + "js-base64": "^3.7.7", + "lodash.clonedeep": "^4.5.0", + "lodash.debounce": "^4.0.8", + "lodash.difference": "^4.5.0", + "lodash.intersection": "^4.4.0", + "nanoid": "^5.0.7", + "react-beautiful-dnd": "^13.1.1", + "react-dnd": "^16.0.1", + "react-dnd-html5-backend": "^16.0.1", + "react-markdown": "^8.0.7", + "style-to-object": "^1.0.6", + "zustand": "^4.5.5" + }, + "peerDependencies": { + "@emotion/react": "^11.11.3", + "@emotion/styled": "^11.11.0", + "@mui/icons-material": "^5.15.10", + "@mui/lab": "^5.0.0-alpha.165", + "@mui/material": "^5.15.10", + "@mui/x-date-pickers": "^6.19.4", + "@tanstack/react-query": "^4.36.0", + "react": ">=17.0.0", + "react-dom": ">=17.0.0" + } + }, "apps/smart-forms-app/node_modules/@typescript-eslint/parser": { "version": "6.21.0", "dev": true, @@ -217,6 +254,11 @@ "balanced-match": "^1.0.0" } }, + "apps/smart-forms-app/node_modules/inline-style-parser": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz", + "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==" + }, "apps/smart-forms-app/node_modules/lru-cache": { "version": "6.0.0", "dev": true, @@ -273,6 +315,14 @@ "url": "https://opencollective.com/storybook" } }, + "apps/smart-forms-app/node_modules/style-to-object": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.8.tgz", + "integrity": "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==", + "dependencies": { + "inline-style-parser": "0.2.4" + } + }, "apps/smart-forms-app/node_modules/yallist": { "version": "4.0.0", "dev": true, @@ -481,6 +531,56 @@ "node": ">=18.0" } }, + "documentation/node_modules/@aehrc/smart-forms-renderer": { + "version": "0.40.3", + "resolved": "https://registry.npmjs.org/@aehrc/smart-forms-renderer/-/smart-forms-renderer-0.40.3.tgz", + "integrity": "sha512-/kqS0nuvAwNo+Z+AQHudcGDzvYhh8R/VqtIdNuiIm/ag//9zss9lUMnBuAPYTrmdSSsbIQa3CPUq85aNNMhtnw==", + "dependencies": { + "@aehrc/sdc-populate": "^2.3.1", + "@iconify/react": "^4.1.1", + "dayjs": "^1.11.10", + "deep-diff": "^1.0.2", + "fhirclient": "^2.5.2", + "fhirpath": "3.11.0", + "html-react-parser": "4.2.10", + "js-base64": "^3.7.7", + "lodash.clonedeep": "^4.5.0", + "lodash.debounce": "^4.0.8", + "lodash.difference": "^4.5.0", + "lodash.intersection": "^4.4.0", + "nanoid": "^5.0.7", + "react-beautiful-dnd": "^13.1.1", + "react-dnd": "^16.0.1", + "react-dnd-html5-backend": "^16.0.1", + "react-markdown": "^8.0.7", + "style-to-object": "^1.0.6", + "zustand": "^4.5.5" + }, + "peerDependencies": { + "@emotion/react": "^11.11.3", + "@emotion/styled": "^11.11.0", + "@mui/icons-material": "^5.15.10", + "@mui/lab": "^5.0.0-alpha.165", + "@mui/material": "^5.15.10", + "@mui/x-date-pickers": "^6.19.4", + "@tanstack/react-query": "^4.36.0", + "react": ">=17.0.0", + "react-dom": ">=17.0.0" + } + }, + "documentation/node_modules/inline-style-parser": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz", + "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==" + }, + "documentation/node_modules/style-to-object": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.8.tgz", + "integrity": "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==", + "dependencies": { + "inline-style-parser": "0.2.4" + } + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "devOptional": true, @@ -10649,6 +10749,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">=10" } @@ -39984,7 +40085,7 @@ }, "packages/smart-forms-renderer": { "name": "@aehrc/smart-forms-renderer", - "version": "0.40.3", + "version": "0.41.0", "license": "Apache-2.0", "dependencies": { "@aehrc/sdc-populate": "^2.3.1", diff --git a/packages/smart-forms-renderer/package.json b/packages/smart-forms-renderer/package.json index d35e7dea..40a4b77e 100644 --- a/packages/smart-forms-renderer/package.json +++ b/packages/smart-forms-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@aehrc/smart-forms-renderer", - "version": "0.40.3", + "version": "0.41.0", "description": "FHIR Structured Data Captured (SDC) rendering engine for Smart Forms", "main": "lib/index.js", "scripts": {