From 567aa8a90cc38ba9c37c1cd9014181d631d63da7 Mon Sep 17 00:00:00 2001 From: samuelmale Date: Tue, 6 Aug 2024 21:37:50 +0300 Subject: [PATCH] More fixes --- src/components/group/obs-group.component.tsx | 21 +- src/components/group/obs-group.scss | 3 +- .../inputs/radio/radio.component.tsx | 2 +- .../renderer/form/form-renderer.component.tsx | 4 +- .../section/section-renderer.component.tsx | 28 +- .../renderer/section/section-renderer.scss | 13 - src/components/repeat/repeat.component.tsx | 2 +- src/components/repeat/repeat.scss | 2 +- yarn.lock | 522 +++++------------- 9 files changed, 149 insertions(+), 448 deletions(-) diff --git a/src/components/group/obs-group.component.tsx b/src/components/group/obs-group.component.tsx index 9f3719b5f..e709adbfd 100644 --- a/src/components/group/obs-group.component.tsx +++ b/src/components/group/obs-group.component.tsx @@ -12,30 +12,11 @@ export const ObsGroup: React.FC = ({ field }) => { ?.filter((child) => !child.isHidden) .map((child, index) => { const keyId = child.id + '_' + index; - const rendering = child.questionOptions.rendering; if (formFieldAdapters[child.type]) { return (
-
-
- -
-
+
); diff --git a/src/components/group/obs-group.scss b/src/components/group/obs-group.scss index 94206f561..349cf4b81 100644 --- a/src/components/group/obs-group.scss +++ b/src/components/group/obs-group.scss @@ -8,6 +8,5 @@ } .groupContainer { - margin-top: 0.5rem; - margin-bottom: 1.5rem; + margin: 0.5rem 0; } diff --git a/src/components/inputs/radio/radio.component.tsx b/src/components/inputs/radio/radio.component.tsx index e45431b01..b9526c9d5 100644 --- a/src/components/inputs/radio/radio.component.tsx +++ b/src/components/inputs/radio/radio.component.tsx @@ -53,7 +53,7 @@ const Radio: React.FC = ({ field, value, errors, warnings, value={answer.concept} key={index} onClick={(e) => { - if (field.value && e.target.checked) { + if (value && e.target.checked) { e.target.checked = false; handleChange(null); } else { diff --git a/src/components/renderer/form/form-renderer.component.tsx b/src/components/renderer/form/form-renderer.component.tsx index d3a333b06..acfe203c0 100644 --- a/src/components/renderer/form/form-renderer.component.tsx +++ b/src/components/renderer/form/form-renderer.component.tsx @@ -66,8 +66,8 @@ export const FormRenderer = ({ processorContext, initialValues, setIsLoadingForm {formJson.pages.map((page) => { const pageHasNoVisibleContent = - page.sections.every((section) => section.isHidden) || - page.sections.every((section) => section.questions.every((question) => question.isHidden)) || + page.sections?.every((section) => section.isHidden) || + page.sections?.every((section) => section.questions?.every((question) => question.isHidden)) || isTrue(page.isHidden); if (!page.isSubform && pageHasNoVisibleContent) { return null; diff --git a/src/components/renderer/section/section-renderer.component.tsx b/src/components/renderer/section/section-renderer.component.tsx index 983b5559d..e1efcfda2 100644 --- a/src/components/renderer/section/section-renderer.component.tsx +++ b/src/components/renderer/section/section-renderer.component.tsx @@ -6,10 +6,8 @@ import { FormFieldRenderer } from '../field/form-field-renderer.component'; import styles from './section-renderer.scss'; import classNames from 'classnames'; import { hasRendering } from '../../../utils/common-utils'; -import Tooltip from '../../inputs/tooltip/tooltip.component'; export const SectionRenderer = ({ section }: { section: FormSection }) => { - const { t } = useTranslation(); const { formFieldAdapters } = useFormProviderContext(); const sectionId = useMemo(() => section.label.replace(/\s/g, ''), [section.label]); return ( @@ -17,31 +15,7 @@ export const SectionRenderer = ({ section }: { section: FormSection }) => { {section.questions.map((question) => formFieldAdapters[question.type] ? (
-
-
- -
- {/** TODO: move tooltip to the form-field renderer; see: https://github.com/openmrs/openmrs-form-engine-lib/pull/351 */} - {!question.isHidden && question.questionInfo && ( -
- -
- )} -
+
) : null, )} diff --git a/src/components/renderer/section/section-renderer.scss b/src/components/renderer/section/section-renderer.scss index 3540baf8e..6301f5c20 100644 --- a/src/components/renderer/section/section-renderer.scss +++ b/src/components/renderer/section/section-renderer.scss @@ -14,19 +14,6 @@ flex-basis: 100%; } -.questionInfoContainer { - margin: 0 0.25rem; -} - .questionInfoDefault { display: flex; } - -.questionInfoCentralized { - display: flex; - align-items: center !important; - - > .questionInfoContainer { - padding-top: 1.5rem; - } -} diff --git a/src/components/repeat/repeat.component.tsx b/src/components/repeat/repeat.component.tsx index 2d9f824cc..b9a826801 100644 --- a/src/components/repeat/repeat.component.tsx +++ b/src/components/repeat/repeat.component.tsx @@ -141,7 +141,7 @@ const Repeat: React.FC = ({ field }) => {
)} - {isGrouped ?
{component}
: component} +
{component}
{!isViewMode(sessionMode) && ( =1.45.0 <1.65.0" sass-loader: "npm:^12.3.0" style-loader: "npm:^3.3.1" @@ -3700,7 +3459,7 @@ __metadata: webpack-stats-plugin: "npm:^1.0.3" peerDependencies: webpack: 5.x - checksum: 10/354c6f1fdf0cf2da9345120a3635473bdeab7bd0cb6004294533c57c5212e8414de03148e008d7e7ec3d74e37699965d65ade088c6ab871f8aeb634ae8c78860 + checksum: 10/a812b16104c65cae4d3ca8e1c2db35fe36bfd64b3dd7e81641e68cf776eb38c27f9f376f5ffd081c56e7e5a2c3769d43d070ce4a66b1af49981049fde0dbc66b languageName: node linkType: hard @@ -13985,14 +13744,15 @@ __metadata: languageName: node linkType: hard -"mini-css-extract-plugin@npm:^2.4.5": - version: 2.7.3 - resolution: "mini-css-extract-plugin@npm:2.7.3" +"mini-css-extract-plugin@npm:^2.9.0": + version: 2.9.0 + resolution: "mini-css-extract-plugin@npm:2.9.0" dependencies: schema-utils: "npm:^4.0.0" + tapable: "npm:^2.2.1" peerDependencies: webpack: ^5.0.0 - checksum: 10/7cbc44a48aba5e62254490cf1fb4237525355cdd27f28d4820b206fae8333181cf49b2df61c59202f4d422dd66649add715b697bba7e277ff5eab8813ac8d062 + checksum: 10/4c9ee9c0c6160a64a4884d5a92a1a5c0b68d556cd00f975cf6c8a79b51ac90e6130a37b3832b17d377d0cb1b31c0313c8c023458d4f69e95fe3424a8b43d834f languageName: node linkType: hard @@ -14653,11 +14413,11 @@ __metadata: linkType: hard "openmrs@npm:next": - version: 5.6.1-pre.2051 - resolution: "openmrs@npm:5.6.1-pre.2051" + version: 5.7.3-pre.2161 + resolution: "openmrs@npm:5.7.3-pre.2161" dependencies: - "@openmrs/esm-app-shell": "npm:5.6.1-pre.2051" - "@openmrs/webpack-config": "npm:5.6.1-pre.2051" + "@openmrs/esm-app-shell": "npm:5.7.3-pre.2161" + "@openmrs/webpack-config": "npm:5.7.3-pre.2161" "@pnpm/npm-conf": "npm:^2.1.0" "@swc/core": "npm:^1.3.58" autoprefixer: "npm:^10.4.2" @@ -14665,31 +14425,38 @@ __metadata: browserslist-config-openmrs: "npm:^1.0.1" chalk: "npm:^4.1.2" copy-webpack-plugin: "npm:^11.0.0" + css-loader: "npm:^5.2.4" cssnano: "npm:^5.0.16" ejs: "npm:^3.1.8" glob: "npm:^7.1.3" html-webpack-plugin: "npm:^5.5.0" inquirer: "npm:^7.3.3" - mini-css-extract-plugin: "npm:^2.4.5" + lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" + mini-css-extract-plugin: "npm:^2.9.0" node-watch: "npm:^0.7.4" npm-registry-fetch: "npm:^14.0.3" pacote: "npm:^15.0.0" postcss: "npm:^8.4.6" postcss-loader: "npm:^6.2.1" rimraf: "npm:^3.0.2" + sass-loader: "npm:^12.3.0" semver: "npm:^7.3.4" + style-loader: "npm:^3.3.1" swc-loader: "npm:^0.2.3" tar: "npm:^6.0.5" typescript: "npm:^4.6.4" webpack: "npm:^5.88.0" + webpack-bundle-analyzer: "npm:^4.5.0" webpack-cli: "npm:^4.10.0" webpack-dev-server: "npm:^4.10.1" webpack-pwa-manifest: "npm:^4.3.0" + webpack-stats-plugin: "npm:^1.0.3" workbox-webpack-plugin: "npm:^6.4.1" yargs: "npm:^17.6.2" bin: openmrs: ./dist/cli.js - checksum: 10/f3163b17f020795d01654cff0009c5a816dee14e53a4ecc84276f41d8211272ddb5ffcc1ad3d4f3304d68b5a7b17e5644bd0cc127c3627103605fc6d6e628578 + checksum: 10/a2ffdf9d33f126308bab7dac55e4a62454471e1ddc561df9fe77b64c4d753992170188c17a5b202c130e9b77c0effc9e4df438a329e1991b341ed0df9358a74e languageName: node linkType: hard @@ -17733,13 +17500,6 @@ __metadata: languageName: node linkType: hard -"systemjs@npm:^6.8.3": - version: 6.14.0 - resolution: "systemjs@npm:6.14.0" - checksum: 10/c38756dd86d1e5dbf6621eb72f617438ceaa636cf1f78be4e9069a2aedc02035525ae84a83342ecf27688e07db3b091c34d4cbccad8250832886f7ea13004bea - languageName: node - linkType: hard - "tabbable@npm:^6.0.0, tabbable@npm:^6.2.0": version: 6.2.0 resolution: "tabbable@npm:6.2.0" @@ -17754,7 +17514,7 @@ __metadata: languageName: node linkType: hard -"tapable@npm:^2.0.0, tapable@npm:^2.1.1, tapable@npm:^2.2.0": +"tapable@npm:^2.0.0, tapable@npm:^2.1.1, tapable@npm:^2.2.0, tapable@npm:^2.2.1": version: 2.2.1 resolution: "tapable@npm:2.2.1" checksum: 10/1769336dd21481ae6347611ca5fca47add0962fd8e80466515032125eca0084a4f0ede11e65341b9c0018ef4e1cf1ad820adbb0fba7cc99865c6005734000b0a