@openmrs/esm-form-engine-lib 3.1.1-pre.1702 → 3.1.1-pre.1706

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  :wave: *New to O3? Be sure to review the [OpenMRS 3 Frontend Developer Documentation](https://o3-docs.openmrs.org/).* :teacher:
4
4
 
5
- # openmrs-esm-form-engine-lib
5
+ # OpenMRS ESM Form Engine Library
6
+
7
+ ![GitHub release](https://img.shields.io/github/v/release/openmrs/openmrs-esm-form-engine-lib)
8
+ ![OpenMRS CI](https://github.com/openmrs/openmrs-esm-form-engine-lib/actions/workflows/ci.yml/badge.svg)
6
9
 
7
10
  <img src="readme/form-engine.jpeg" alt="https://raw.githubusercontent.com/openmrs/openmrs-esm-form-engine-lib/main/readme/form-engine.jpeg" >
8
11
 
@@ -36,15 +39,24 @@ Key features of the Form Engine include:
36
39
 
37
40
  Read the full docs in the OpenMRS Wiki [here](https://openmrs.atlassian.net/wiki/spaces/projects/pages/68747273/O3+Form+Docs).
38
41
 
42
+ ## Adding and Managing Translations
43
+
44
+ The Form Engine uses a combination of frontend and backend features to support translations.
45
+
46
+ - **Frontend translations** - Translations for static strings within the library are managed using Transifex, a localization platform that allows for the translation of strings. This repository being a library, the language specific translations are managed within the [esm-form-engine-app](https://github.com/openmrs/openmrs-esm-patient-chart/tree/main/packages/esm-form-engine-app) in the [Patient Chart](https://github.com/openmrs/openmrs-esm-patient-chart) repository and are loaded dynamically based on the user's locale.
47
+ - **Backend translations** - Translations for pages, sections, and question labels are retrieved from the backend. These are loaded automatically based on the concept translations as well as the form translation files included within the distribution.
48
+
49
+ You can read more about translations in the [OpenMRS Wiki](https://openmrs.atlassian.net/wiki/spaces/docs/pages/105512985/How+to+Translate+OpenMRS)
50
+
39
51
  ## Getting started
40
52
 
41
53
  *NB: The Form Engine is a React library, not a standalone [O3 frontend module](https://openmrs.atlassian.net/wiki/spaces/docs/pages/151093806/Overview+of+Frontend+Modules). It can only be consumed by bundling it within a frontend module that incorporates it within a UI workflow.*
42
54
 
43
55
  ### Prerequisites
44
56
 
45
- - [Node.js](https://nodejs.org/en/about/releases) 18 or later (LTS version recommended)
57
+ - [Node.js](https://nodejs.org/en/about/releases) 20 or later (LTS version recommended)
46
58
  - [Yarn](https://yarnpkg.com/) 4.x or later (We use Yarn as our package manager)
47
- - [Git](https://git-scm.com) (for local development)
59
+ - [Git](https://git-scm.com) (for version control)
48
60
 
49
61
  ### Installation
50
62
 
@@ -146,9 +158,8 @@ To use this library as the default form engine in your O3 instance, you will nee
146
158
  ```json
147
159
  {
148
160
  "frontendModules": {
149
- ...
161
+ // Add this line to the list of frontend modules
150
162
  "@openmrs/esm-form-engine-app": "next"
151
- ...
152
163
  }
153
164
  }
154
165
  ```
@@ -0,0 +1 @@
1
+ var _openmrs_esm_form_engine_lib;(()=>{"use strict";var e,r,t,n,o,i,a,l,s,u,f,p,d,c,h,m,v,g,b,y,w,_={8008:(e,r,t)=>{var n={"./start":()=>Promise.all([t.e(277),t.e(260),t.e(72),t.e(465),t.e(299),t.e(929)]).then((()=>()=>t(2929)))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),i=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>i})}},P={};function S(e){var r=P[e];if(void 0!==r)return r.exports;var t=P[e]={id:e,loaded:!1,exports:{}};return _[e].call(t.exports,t,t.exports,S),t.loaded=!0,t.exports}S.m=_,S.c=P,S.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return S.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,S.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);S.r(o);var i={};e=e||[null,r({}),r([]),r(r)];for(var a=2&n&&t;"object"==typeof a&&!~e.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((e=>i[e]=()=>t[e]));return i.default=()=>t,S.d(o,i),o},S.d=(e,r)=>{for(var t in r)S.o(r,t)&&!S.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},S.f={},S.e=e=>Promise.all(Object.keys(S.f).reduce(((r,t)=>(S.f[t](e,r),r)),[])),S.u=e=>e+".js",S.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),S.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@openmrs/esm-form-engine-lib:",S.l=(e,r,o,i)=>{if(t[e])t[e].push(r);else{var a,l;if(void 0!==o)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var f=s[u];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==n+o){a=f;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,S.nc&&a.setAttribute("nonce",S.nc),a.setAttribute("data-webpack",n+o),a.src=e),t[e]=[r];var p=(r,n)=>{a.onerror=a.onload=null,clearTimeout(d);var o=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),r)return r(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),l&&document.head.appendChild(a)}},S.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},S.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{S.S={};var e={},r={};S.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];S.o(S.S,t)||(S.S[t]={});var i=S.S[t],a="@openmrs/esm-form-engine-lib",l=(e,r,t,n)=>{var o=i[e]=i[e]||{},l=o[r];(!l||!l.loaded&&(!n!=!l.eager?n:a>l.from))&&(o[r]={get:t,from:a,eager:!!n})},s=[];return"default"===t&&(l("@openmrs/esm-framework","6.0.3-pre.2587",(()=>Promise.all([S.e(151),S.e(72),S.e(766)]).then((()=>()=>S(5151))))),l("@openmrs/esm-patient-common-lib","9.0.1-pre.6367",(()=>Promise.all([S.e(727),S.e(277),S.e(72),S.e(465),S.e(299),S.e(499)]).then((()=>()=>S(7727))))),l("dayjs","1.11.13",(()=>S.e(353).then((()=>()=>S(4353))))),l("i18next","23.16.0",(()=>S.e(635).then((()=>()=>S(2635))))),l("react-i18next","11.18.6",(()=>Promise.all([S.e(979),S.e(72)]).then((()=>()=>S(2979))))),l("react","18.3.1",(()=>S.e(540).then((()=>()=>S(6540))))),l("swr/_internal","2.2.5",(()=>Promise.all([S.e(993),S.e(72)]).then((()=>()=>S(4993))))),l("swr/immutable","2.2.5",(()=>Promise.all([S.e(72),S.e(465),S.e(225)]).then((()=>()=>S(4225))))),l("swr/infinite","2.2.5",(()=>Promise.all([S.e(72),S.e(465),S.e(41)]).then((()=>()=>S(3041)))))),e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;S.g.importScripts&&(e=S.g.location+"");var r=S.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),S.p=e})(),o=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},i=(e,r)=>{e=o(e),r=o(r);for(var t=0;;){if(t>=e.length)return t<r.length&&"u"!=(typeof r[t])[0];var n=e[t],i=(typeof n)[0];if(t>=r.length)return"u"==i;var a=r[t],l=(typeof a)[0];if(i!=l)return"o"==i&&"n"==l||"s"==l||"u"==i;if("o"!=i&&"u"!=i&&n!=a)return n<a;t++}},a=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,o=1;o<e.length;o++)n--,t+="u"==(typeof(l=e[o]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(o=1;o<e.length;o++){var l=e[o];i.push(0===l?"not("+s()+")":1===l?"("+s()+" || "+s()+")":2===l?i.pop()+" "+i.pop():a(l))}return s();function s(){return i.pop().replace(/^\((.+)\)$/,"$1")}},l=(e,r)=>{if(0 in e){r=o(r);var t=e[0],n=t<0;n&&(t=-t-1);for(var i=0,a=1,s=!0;;a++,i++){var u,f,p=a<e.length?(typeof e[a])[0]:"";if(i>=r.length||"o"==(f=(typeof(u=r[i]))[0]))return!s||("u"==p?a>t&&!n:""==p!=n);if("u"==f){if(!s||"u"!=p)return!1}else if(s)if(p==f)if(a<=t){if(u!=e[a])return!1}else{if(n?u>e[a]:u<e[a])return!1;u!=e[a]&&(s=!1)}else if("s"!=p&&"n"!=p){if(n||a<=t)return!1;s=!1,a--}else{if(a<=t||f<p!=n)return!1;s=!1}else"s"!=p&&"n"!=p&&(s=!1,a--)}}var d=[],c=d.pop.bind(d);for(i=1;i<e.length;i++){var h=e[i];d.push(1==h?c()|c():2==h?c()&c():h?l(h,r):!c())}return!!c()},s=(e,r)=>e&&S.o(e,r),u=e=>(e.loaded=1,e.get()),f=e=>Object.keys(e).reduce(((r,t)=>(e[t].eager&&(r[t]=e[t]),r)),{}),p=(e,r,t)=>{var n=t?f(e[r]):e[r];return Object.keys(n).reduce(((e,r)=>!e||!n[e].loaded&&i(e,r)?r:e),0)},d=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+a(n)+")",c=e=>{throw new Error(e)},h=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},m=(e,r,t)=>t?t():((e,r)=>c("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),v=(e=>function(r,t,n,o,i){var a=S.I(r);return a&&a.then&&!n?a.then(e.bind(e,r,S.S[r],t,!1,o,i)):e(r,S.S[r],t,n,o,i)})(((e,r,t,n,o,i)=>{if(!s(r,t))return m(e,t,i);var a=p(r,t,n);return l(o,a)||h(d(r,t,a,o)),u(r[t][a])})),g={},b={6072:()=>v("default","react",!1,[1,18],(()=>S.e(540).then((()=>()=>S(6540))))),6766:()=>v("default","i18next",!1,[1,23],(()=>S.e(635).then((()=>()=>S(2635))))),8465:()=>v("default","swr/_internal",!1,[1,2],(()=>S.e(993).then((()=>()=>S(4993))))),2731:()=>v("default","@openmrs/esm-patient-common-lib",!1,[1,9],(()=>S.e(727).then((()=>()=>S(7727))))),3941:()=>v("default","react-i18next",!1,[1,11],(()=>S.e(979).then((()=>()=>S(2979))))),9197:()=>v("default","@openmrs/esm-framework",!1,[1,6],(()=>Promise.all([S.e(151),S.e(766)]).then((()=>()=>S(5151))))),4209:()=>v("default","swr/immutable",!1,[1,2],(()=>S.e(606).then((()=>()=>S(4225))))),231:()=>v("default","dayjs",!1,[1,1],(()=>S.e(353).then((()=>()=>S(4353))))),6339:()=>v("default","swr/infinite",!1,[1,2],(()=>S.e(422).then((()=>()=>S(3041)))))},y={72:[6072],299:[2731,3941,9197],465:[8465],499:[4209],766:[6766],929:[231,4209,6339]},w={},S.f.consumes=(e,r)=>{S.o(y,e)&&y[e].forEach((e=>{if(S.o(g,e))return r.push(g[e]);if(!w[e]){var t=r=>{g[e]=0,S.m[e]=t=>{delete S.c[e],t.exports=r()}};w[e]=!0;var n=r=>{delete g[e],S.m[e]=t=>{throw delete S.c[e],r}};try{var o=b[e]();o.then?r.push(g[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}}))},(()=>{var e={719:0};S.f.j=(r,t)=>{var n=S.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(299|465|72|766)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var i=S.p+S.u(r),a=new Error;S.l(i,(t=>{if(S.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;a.message="Loading chunk "+r+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,n[1](a)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[i,a,l]=t,s=0;if(i.some((r=>0!==e[r]))){for(n in a)S.o(a,n)&&(S.m[n]=a[n]);l&&l(S)}for(r&&r(t);s<i.length;s++)o=i[s],S.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=globalThis.webpackChunk_openmrs_esm_form_engine_lib=globalThis.webpackChunk_openmrs_esm_form_engine_lib||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),S.nc=void 0;var j=S(8008);_openmrs_esm_form_engine_lib=j})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-form-engine-lib",
3
- "version": "3.1.1-pre.1702",
3
+ "version": "3.1.1-pre.1706",
4
4
  "description": "React Form Engine for O3",
5
5
  "browser": "dist/openmrs-esm-form-engine-lib.js",
6
6
  "main": "src/index.ts",
@@ -101,6 +101,5 @@
101
101
  "*.{ts,tsx}": "eslint --cache --fix --max-warnings 0",
102
102
  "*.{css,scss,ts,tsx}": "prettier --write --list-different"
103
103
  },
104
- "packageManager": "yarn@4.5.0",
105
- "stableVersion": "3.1.0"
104
+ "packageManager": "yarn@4.5.0"
106
105
  }
@@ -24,9 +24,12 @@ const File: React.FC<FormFieldInputProps> = ({ field, value, setFieldValue }) =>
24
24
  return field.questionOptions.allowedFileTypes
25
25
  ? t(
26
26
  'fileUploadDescription',
27
- `Upload one of the following file types: ${field.questionOptions.allowedFileTypes.map(
28
- (eachItem) => ` ${eachItem}`,
29
- )}`,
27
+ 'Upload one of the following file types: {{fileTypes}}',
28
+ {
29
+ fileTypes: field.questionOptions.allowedFileTypes.map(
30
+ (eachItem) => ` ${eachItem}`,
31
+ )
32
+ }
30
33
  )
31
34
  : t('fileUploadDescriptionAny', 'Upload any file type');
32
35
  }, [field.questionOptions.allowedFileTypes, t]);
@@ -1,3 +1,5 @@
1
+ @use '@carbon/layout';
2
+
1
3
  .label {
2
4
  font-family: IBM Plex Sans;
3
5
  font-size: 14px;
@@ -28,10 +30,8 @@
28
30
  display: flex;
29
31
  align-items: center;
30
32
  margin-bottom: 1rem;
31
- }
32
-
33
- .selectorButton {
34
- margin-right: 1rem;
33
+ flex-wrap: wrap;
34
+ gap: layout.$spacing-05;
35
35
  }
36
36
 
37
37
  .caption {
@@ -1,5 +1,6 @@
1
1
  @use '@carbon/colors';
2
2
  @use '@carbon/type';
3
+ @use '@carbon/layout';
3
4
 
4
5
  .pageContent:last-child > hr {
5
6
  display: none;
@@ -39,6 +40,10 @@
39
40
  background-color: colors.$gray-10;
40
41
  }
41
42
 
43
+ .sectionContainer :global(.cds--accordion__content) {
44
+ padding-right: layout.$spacing-05;
45
+ }
46
+
42
47
  .accordionContainer {
43
48
  width: 95%;
44
49
  }
@@ -1,7 +1,8 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Button, InlineLoading } from '@carbon/react';
5
+ import { useLayoutType } from '@openmrs/esm-framework';
5
6
  import { isPageContentVisible } from '../../utils/form-helper';
6
7
  import { useCurrentActivePage } from './useCurrentActivePage';
7
8
  import { usePageObserver } from './usePageObserver';
@@ -33,6 +34,11 @@ const Sidebar: React.FC<SidebarProps> = ({
33
34
  activePages,
34
35
  evaluatedPagesVisibility,
35
36
  });
37
+ const layout = useLayoutType();
38
+ const responsiveSize = useMemo(() => {
39
+ const isTablet = layout === 'tablet';
40
+ return isTablet ? 'lg' : 'sm';
41
+ }, [layout]);
36
42
 
37
43
  return (
38
44
  <div className={styles.sidebar}>
@@ -51,7 +57,7 @@ const Sidebar: React.FC<SidebarProps> = ({
51
57
 
52
58
  <div className={styles.sideNavActions}>
53
59
  {sessionMode !== 'view' && (
54
- <Button className={styles.saveButton} disabled={isFormSubmitting} type="submit">
60
+ <Button className={styles.saveButton} disabled={isFormSubmitting} type="submit" size={responsiveSize}>
55
61
  {isFormSubmitting ? (
56
62
  <InlineLoading description={t('submitting', 'Submitting') + '...'} />
57
63
  ) : (
@@ -68,7 +74,8 @@ const Sidebar: React.FC<SidebarProps> = ({
68
74
  onCancel?.();
69
75
  handleClose?.();
70
76
  hideFormCollapseToggle();
71
- }}>
77
+ }}
78
+ size={responsiveSize}>
72
79
  {sessionMode === 'view' ? t('close', 'Close') : t('cancel', 'Cancel')}
73
80
  </Button>
74
81
  </div>
@@ -84,21 +91,24 @@ interface PageLinkProps {
84
91
  }
85
92
 
86
93
  function PageLink({ page, currentActivePage, pagesWithErrors, requestPage }: PageLinkProps) {
94
+ const { t } = useTranslation();
87
95
  const isActive = page.id === currentActivePage;
88
96
  const hasError = pagesWithErrors.includes(page.id);
97
+ const isTablet = useLayoutType() === 'tablet';
89
98
  return (
90
99
  <div
91
100
  className={classNames(styles.pageLink, {
92
101
  [styles.activePage]: isActive && !hasError,
93
102
  [styles.errorPage]: hasError && !isActive,
94
103
  [styles.activeErrorPage]: hasError && isActive,
104
+ [styles.pageLinkTablet]: isTablet,
95
105
  })}>
96
106
  <button
97
107
  onClick={(e) => {
98
108
  e.preventDefault();
99
109
  requestPage(page.id);
100
110
  }}>
101
- <span>{page.label}</span>
111
+ <span>{t(page.label)}</span>
102
112
  </button>
103
113
  </div>
104
114
  );
@@ -6,12 +6,16 @@
6
6
  border-left: 0.5rem solid colors.$teal-20;
7
7
  display: flex;
8
8
  align-items: center;
9
- height: 3rem;
9
+ height: layout.$spacing-07;
10
10
  padding: 0.25rem 0.5rem;
11
11
  background-color: colors.$white;
12
12
  margin: 0 0 0.063rem;
13
13
  }
14
14
 
15
+ .pageLinkTablet {
16
+ height: layout.$spacing-09;
17
+ }
18
+
15
19
  .pageLink button {
16
20
  @include type.type-style('body-01');
17
21
  font-family: inherit;
@@ -6,7 +6,7 @@ import { useSession, type Visit } from '@openmrs/esm-framework';
6
6
  import { FormFactoryProvider } from './provider/form-factory-provider';
7
7
  import { init, teardown } from './lifecycle';
8
8
  import { isEmpty, useFormJson } from '.';
9
- import { moduleName } from './globals';
9
+ import { formEngineAppName } from './globals';
10
10
  import { reportError } from './utils/error-utils';
11
11
  import { useFormCollapse } from './hooks/useFormCollapse';
12
12
  import { useFormWorkspaceSize } from './hooks/useFormWorkspaceSize';
@@ -74,21 +74,23 @@ const FormEngine = ({
74
74
  return patient && workspaceSize === 'ultra-wide' && mode !== 'embedded-view';
75
75
  }, [patient, mode, workspaceSize]);
76
76
 
77
- const showButtonSet = useMemo(() => {
77
+ const isFormWorkspaceTooNarrow = useMemo(() => ['narrow'].includes(workspaceSize), [workspaceSize]);
78
+
79
+ const showBottomButtonSet = useMemo(() => {
78
80
  if (mode === 'embedded-view' || isLoadingDependencies || hasMultiplePages === null) {
79
81
  return false;
80
82
  }
81
83
 
82
- return ['narrow', 'wider'].includes(workspaceSize) || !hasMultiplePages;
83
- }, [mode, workspaceSize, isLoadingDependencies, hasMultiplePages]);
84
+ return isFormWorkspaceTooNarrow || !hasMultiplePages;
85
+ }, [mode, isFormWorkspaceTooNarrow, isLoadingDependencies, hasMultiplePages]);
84
86
 
85
87
  const showSidebar = useMemo(() => {
86
88
  if (mode === 'embedded-view' || isLoadingDependencies || hasMultiplePages === null) {
87
89
  return false;
88
90
  }
89
91
 
90
- return ['extra-wide', 'ultra-wide'].includes(workspaceSize) && hasMultiplePages;
91
- }, [workspaceSize, isLoadingDependencies, hasMultiplePages]);
92
+ return !isFormWorkspaceTooNarrow && hasMultiplePages;
93
+ }, [isFormWorkspaceTooNarrow, isLoadingDependencies, hasMultiplePages]);
92
94
 
93
95
  useEffect(() => {
94
96
  reportError(formError, t('errorLoadingFormSchema', 'Error loading form schema'));
@@ -165,7 +167,7 @@ const FormEngine = ({
165
167
  setIsLoadingFormDependencies={setIsLoadingDependencies}
166
168
  />
167
169
  </div>
168
- {showButtonSet && (
170
+ {showBottomButtonSet && (
169
171
  <ButtonSet className={styles.minifiedButtons}>
170
172
  <Button
171
173
  kind="secondary"
@@ -200,7 +202,7 @@ const FormEngine = ({
200
202
 
201
203
  function I18FormEngine(props: FormEngineProps) {
202
204
  return (
203
- <I18nextProvider i18n={window.i18next} defaultNS={moduleName}>
205
+ <I18nextProvider i18n={window.i18next} defaultNS={formEngineAppName}>
204
206
  <FormEngine {...props} />
205
207
  </I18nextProvider>
206
208
  );
package/src/globals.ts CHANGED
@@ -1 +1,2 @@
1
1
  export const moduleName = '@openmrs/esm-form-engine-lib';
2
+ export const formEngineAppName = '@openmrs/esm-form-engine-app';
package/src/lifecycle.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { pageObserver } from './components/sidebar/page-observer';
2
- import setupFormEngineLibI18n from './setupI18n';
3
2
  import { type FormFieldValueAdapter } from './types';
4
3
 
5
4
  const formFieldAdapters = new Set<FormFieldValueAdapter>();
@@ -15,8 +14,6 @@ export function registerFormFieldAdaptersForCleanUp(formFieldAdaptersMap: Record
15
14
  * Invoked on mounting the "FormEngine" component
16
15
  */
17
16
  export function init() {
18
- // Setting up the i18n for the form engine library
19
- setupFormEngineLibI18n();
20
17
  }
21
18
 
22
19
  /**
package/src/setupI18n.ts DELETED
@@ -1,16 +0,0 @@
1
- import { moduleName } from './globals';
2
-
3
- function loadResourcesFromFile() {
4
- const lang = window.i18next.language;
5
- import(/* webpackMode: "lazy" */ `../translations/${lang}.json`)
6
- .then((json) => {
7
- const data = json ?? {};
8
- window?.i18next?.addResourceBundle?.(lang, moduleName, data);
9
- })
10
- .catch((err) => console.error(err));
11
- }
12
-
13
- export default function setupFormEngineLibI18n() {
14
- loadResourcesFromFile();
15
- window.i18next?.on?.('languageChanged', loadResourcesFromFile);
16
- }
@@ -1,40 +0,0 @@
1
- {
2
- "add": "Add",
3
- "addCameraImage": "Add camera image",
4
- "addFile": "Add files",
5
- "blank": "Blank",
6
- "cameraCapture": "Camera capture",
7
- "cancel": "Cancel",
8
- "chooseAnOption": "Choose an option",
9
- "clearFile": "Clear file",
10
- "close": "Close",
11
- "closeCamera": "Close camera",
12
- "closesNotification": "Closes notification",
13
- "errorLoadingFormSchema": "Error loading form schema",
14
- "errorLoadingInitialValues": "Error loading initial values",
15
- "errorRenderingField": "Error rendering field",
16
- "fieldErrorDescriptionTitle": "Validation Errors",
17
- "fileUploadDescription": "",
18
- "fileUploadDescriptionAny": "Upload any file type",
19
- "invalidWorkspaceName": "Invalid workspace name.",
20
- "invalidWorkspaceNameSubtitle": "Please provide a valid workspace name.",
21
- "launchWorkspace": "Launch Workspace",
22
- "loading": "Loading",
23
- "notification": "Notification",
24
- "nullMandatoryField": "Please fill the required fields",
25
- "preview": "Preview",
26
- "previousValue": "Previous value:",
27
- "remove": "Remove",
28
- "required": "Required",
29
- "reuseValue": "Reuse value",
30
- "save": "Save",
31
- "search": "Search",
32
- "searching": "Searching",
33
- "submitting": "Submitting",
34
- "time": "Time",
35
- "unspecified": "Unspecified",
36
- "upload": "Upload",
37
- "uploadedPhoto": "Uploaded photo",
38
- "uploadImage": "Upload image",
39
- "valuesOutOfBound": "Some of the values are out of bounds"
40
- }
@@ -1,38 +0,0 @@
1
- {
2
- "activeLoadingIndicator": "Indicador de carga activo",
3
- "add": "Agregar",
4
- "addCameraImage": "Agregar imagen de cámara",
5
- "addFile": "Agregar archivos",
6
- "cameraCapture": "Captura de cámara",
7
- "cancel": "Cancelar",
8
- "chooseAnOption": "Elegir una opción",
9
- "close": "Cerrar",
10
- "closeCamera": "Cerrar cámara",
11
- "closesNotification": "Cerrar notificación",
12
- "collapseAll": "Contraer todo",
13
- "createdRecord": "Registro creado",
14
- "createdRecordDescription": "Se creó un nuevo encuentro",
15
- "errorDescriptionTitle": "Error al guardar el formulario",
16
- "errorRenderingField": "Error al renderizar el campo",
17
- "expandAll": "Expandir todo",
18
- "fileUploadDescription": "",
19
- "fileUploadDescriptionAny": "Subir cualquier tipo de archivo",
20
- "loading": "Cargando",
21
- "notification": "Notificación",
22
- "preview": "Vista previa",
23
- "previousValue": "Valor anterior:",
24
- "removeGroup": "Eliminar grupo",
25
- "revert": "Revertir",
26
- "save": "Guardar",
27
- "search": "Buscar",
28
- "submitting": "Enviando",
29
- "time": "Tiempo",
30
- "toggleCollapseOrExpand": "Alternar entre contraer o expandir",
31
- "unspecified": "No especificado",
32
- "unspecifyAll": "No especificar todo",
33
- "updatedRecord": "Registro actualizado",
34
- "updatedRecordDescription": "Se actualizó el encuentro del paciente",
35
- "upload": "Subir",
36
- "uploadedPhoto": "Foto subida",
37
- "uploadImage": "Subir imagen"
38
- }
@@ -1,38 +0,0 @@
1
- {
2
- "activeLoadingIndicator": "Indicateur de chargement actif",
3
- "add": "Ajouter",
4
- "addCameraImage": "Ajouter une image de la caméra",
5
- "addFile": "Ajouter des fichiers",
6
- "cameraCapture": "Capture de la caméra",
7
- "cancel": "Annuler",
8
- "chooseAnOption": "Choisissez une option",
9
- "close": "Fermer",
10
- "closeCamera": "Fermer la caméra",
11
- "closesNotification": "Ferme la notification",
12
- "collapseAll": "Réduire tout",
13
- "createdRecord": "Enregistrement créé",
14
- "createdRecordDescription": "Une nouvelle rencontre a été créée",
15
- "errorDescriptionTitle": "Erreur lors de l'enregistrement du formulaire",
16
- "errorRenderingField": "Erreur lors du rendu du champ",
17
- "expandAll": "Développer tout",
18
- "fileUploadDescription": "",
19
- "fileUploadDescriptionAny": "Télécharger n'importe quel type de fichier",
20
- "loading": "Chargement",
21
- "notification": "Notification",
22
- "preview": "Aperçu",
23
- "previousValue": "Valeur précédente :",
24
- "removeGroup": "Supprimer le groupe",
25
- "revert": "Revenir",
26
- "save": "Enregistrer",
27
- "search": "Recherche",
28
- "submitting": "Soumission",
29
- "time": "Temps",
30
- "toggleCollapseOrExpand": "Basculer réduire ou développer",
31
- "unspecified": "Non spécifié",
32
- "unspecifyAll": "Tout non spécifié",
33
- "updatedRecord": "Enregistrement mis à jour",
34
- "updatedRecordDescription": "La rencontre du patient a été mise à jour",
35
- "upload": "Télécharger",
36
- "uploadedPhoto": "Photo téléchargée",
37
- "uploadImage": "Télécharger une image"
38
- }
@@ -1,38 +0,0 @@
1
- {
2
- "activeLoadingIndicator": "សិទ្ធិដំណើរការអត្ថបទកំពុងស្រលាញ់",
3
- "add": "បន្ថែម",
4
- "addCameraImage": "បន្ថែមរូបភាពសាកល្បង",
5
- "addFile": "បន្ថែមឯកសារ",
6
- "cameraCapture": "ការថតរូបភាពតាមកាមេរ៉ា",
7
- "cancel": "បោះបង់",
8
- "chooseAnOption": "ជ្រើសរើសជម្រើស",
9
- "close": "បិទ",
10
- "closeCamera": "បិទកាមេរ៉ា",
11
- "closesNotification": "បិទការជូនដំណឹង",
12
- "collapseAll": "លាក់ទាំងអស់",
13
- "createdRecord": "បានបង្កើតកំណត់ហេតុ",
14
- "createdRecordDescription": "បានបង្កើតការចូលទិន្ន័រថ្មី",
15
- "errorDescriptionTitle": "កំហុសព័ត៌មានលទ្ធផល",
16
- "errorRenderingField": "កំហុសការបង្ហាញវាល",
17
- "expandAll": "ពង្រីកទាំងអស់",
18
- "fileUploadDescription": "",
19
- "fileUploadDescriptionAny": "ផ្ទុកឡើងឯកសារប្រភេទណាមួយ",
20
- "loading": "កំពុងដំណើរការ",
21
- "notification": "ការជូនដំណឹង",
22
- "preview": "មើលជាមុន",
23
- "previousValue": "តម្លៃមុន:",
24
- "removeGroup": "យកក្រុមចេញ",
25
- "revert": "ត្រឡប់ទៅកាន់ដំណើរការដូចដើម",
26
- "save": "រក្សាទុក",
27
- "search": "ស្វែងរក",
28
- "submitting": "កំពុងដាក់ស្នើ",
29
- "time": "ពេលវេលា",
30
- "toggleCollapseOrExpand": "បិទឬពង្រីកជាមួយគ្រាប់គ្នា",
31
- "unspecified": "មិនបានបញ្ជាក់",
32
- "unspecifyAll": "មិនបានបញ្ជាក់ទាំងអស់",
33
- "updatedRecord": "កំណត់ហេតុដែលបានធ្វើបច្ចុប្បន្នភាព",
34
- "updatedRecordDescription": "ការស៊ើបអ្នកជម្រើសបានធ្វើបច្ចុប្បន្នភាព",
35
- "upload": "ផ្ទុកឡើង",
36
- "uploadedPhoto": "រូបភាពដែលបានផ្ទុកឡើង",
37
- "uploadImage": "ផ្ទុករូបភាពឡើង"
38
- }