@openmrs/esm-framework 10.0.1-pre.4947 → 10.0.1-pre.4966
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/.turbo/turbo-build.log +1 -1
- package/mock-jest.tsx +33 -31
- package/mock.tsx +33 -31
- package/package.json +20 -20
package/.turbo/turbo-build.log
CHANGED
package/mock-jest.tsx
CHANGED
|
@@ -111,7 +111,7 @@ export const navigateAndLaunchWorkspace = jest.fn();
|
|
|
111
111
|
export const useWorkspaces = jest.fn();
|
|
112
112
|
export const useWorkspace2Context = jest.fn();
|
|
113
113
|
|
|
114
|
-
export const OpenmrsDatePicker = jest.fn(({ id, labelText, value, onChange, isInvalid, invalidText }) => (
|
|
114
|
+
export const OpenmrsDatePicker = jest.fn(({ id, labelText, value, onChange, invalid, isInvalid, invalidText }) => (
|
|
115
115
|
<>
|
|
116
116
|
<label htmlFor={id}>{labelText}</label>
|
|
117
117
|
<input
|
|
@@ -120,39 +120,41 @@ export const OpenmrsDatePicker = jest.fn(({ id, labelText, value, onChange, isIn
|
|
|
120
120
|
value={value ? dayjs(value).format('DD/MM/YYYY') : ''}
|
|
121
121
|
onChange={(evt) => onChange?.(dayjs(evt.target.value).toDate())}
|
|
122
122
|
/>
|
|
123
|
-
{isInvalid && <span>{invalidText}</span>}
|
|
123
|
+
{(invalid || isInvalid) && <span>{invalidText}</span>}
|
|
124
124
|
</>
|
|
125
125
|
));
|
|
126
126
|
|
|
127
|
-
export const OpenmrsDateRangePicker = jest.fn(
|
|
128
|
-
|
|
129
|
-
const [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
127
|
+
export const OpenmrsDateRangePicker = jest.fn(
|
|
128
|
+
({ id, labelText, value = [], onChange, invalid, isInvalid, invalidText }) => {
|
|
129
|
+
const [inputValue, setInputValue] = useState(() => {
|
|
130
|
+
const [start, end] = value;
|
|
131
|
+
const formattedStart = start ? dayjs(start).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
132
|
+
const formattedEnd = end ? dayjs(end).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
133
|
+
return `${formattedStart}–${formattedEnd}`;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const handleChange = (e) => {
|
|
137
|
+
const raw = e.target.value;
|
|
138
|
+
setInputValue(raw);
|
|
139
|
+
|
|
140
|
+
const [startStr, endStr] = raw.split('–');
|
|
141
|
+
const start = dayjs(startStr, 'DD/MM/YYYY', true);
|
|
142
|
+
const end = dayjs(endStr, 'DD/MM/YYYY', true);
|
|
143
|
+
|
|
144
|
+
if (start.isValid() && end.isValid()) {
|
|
145
|
+
onChange?.([start.toDate(), end.toDate()]);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div>
|
|
151
|
+
<label htmlFor={id}>{labelText}</label>
|
|
152
|
+
<input id={id} type="text" value={inputValue} onChange={handleChange} />
|
|
153
|
+
{(invalid || isInvalid) && <span>{invalidText}</span>}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
);
|
|
156
158
|
|
|
157
159
|
/* esm-utils */
|
|
158
160
|
export {
|
package/mock.tsx
CHANGED
|
@@ -112,7 +112,7 @@ export const navigateAndLaunchWorkspace = vi.fn();
|
|
|
112
112
|
export const useWorkspaces = vi.fn();
|
|
113
113
|
export const useWorkspace2Context = vi.fn();
|
|
114
114
|
|
|
115
|
-
export const OpenmrsDatePicker = vi.fn(({ id, labelText, value, onChange, isInvalid, invalidText }) => (
|
|
115
|
+
export const OpenmrsDatePicker = vi.fn(({ id, labelText, value, onChange, invalid, isInvalid, invalidText }) => (
|
|
116
116
|
<>
|
|
117
117
|
<label htmlFor={id}>{labelText}</label>
|
|
118
118
|
<input
|
|
@@ -121,39 +121,41 @@ export const OpenmrsDatePicker = vi.fn(({ id, labelText, value, onChange, isInva
|
|
|
121
121
|
value={value ? dayjs(value).format('DD/MM/YYYY') : ''}
|
|
122
122
|
onChange={(evt) => onChange?.(dayjs(evt.target.value).toDate())}
|
|
123
123
|
/>
|
|
124
|
-
{isInvalid && <span>{invalidText}</span>}
|
|
124
|
+
{(invalid || isInvalid) && <span>{invalidText}</span>}
|
|
125
125
|
</>
|
|
126
126
|
));
|
|
127
127
|
|
|
128
|
-
export const OpenmrsDateRangePicker = vi.fn(
|
|
129
|
-
|
|
130
|
-
const [
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
128
|
+
export const OpenmrsDateRangePicker = vi.fn(
|
|
129
|
+
({ id, labelText, value = [], onChange, invalid, isInvalid, invalidText }) => {
|
|
130
|
+
const [inputValue, setInputValue] = useState(() => {
|
|
131
|
+
const [start, end] = value;
|
|
132
|
+
const formattedStart = start ? dayjs(start).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
133
|
+
const formattedEnd = end ? dayjs(end).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
134
|
+
return `${formattedStart}–${formattedEnd}`;
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const handleChange = (e) => {
|
|
138
|
+
const raw = e.target.value;
|
|
139
|
+
setInputValue(raw);
|
|
140
|
+
|
|
141
|
+
const [startStr, endStr] = raw.split('–');
|
|
142
|
+
const start = dayjs(startStr, 'DD/MM/YYYY', true);
|
|
143
|
+
const end = dayjs(endStr, 'DD/MM/YYYY', true);
|
|
144
|
+
|
|
145
|
+
if (start.isValid() && end.isValid()) {
|
|
146
|
+
onChange?.([start.toDate(), end.toDate()]);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<div>
|
|
152
|
+
<label htmlFor={id}>{labelText}</label>
|
|
153
|
+
<input id={id} type="text" value={inputValue} onChange={handleChange} />
|
|
154
|
+
{(invalid || isInvalid) && <span>{invalidText}</span>}
|
|
155
|
+
</div>
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
);
|
|
157
159
|
|
|
158
160
|
/* esm-utils */
|
|
159
161
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-framework",
|
|
3
|
-
"version": "10.0.1-pre.
|
|
3
|
+
"version": "10.0.1-pre.4966",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -59,24 +59,24 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@openmrs/esm-api": "10.0.1-pre.
|
|
63
|
-
"@openmrs/esm-config": "10.0.1-pre.
|
|
64
|
-
"@openmrs/esm-context": "10.0.1-pre.
|
|
65
|
-
"@openmrs/esm-dynamic-loading": "10.0.1-pre.
|
|
66
|
-
"@openmrs/esm-emr-api": "10.0.1-pre.
|
|
67
|
-
"@openmrs/esm-error-handling": "10.0.1-pre.
|
|
68
|
-
"@openmrs/esm-expression-evaluator": "10.0.1-pre.
|
|
69
|
-
"@openmrs/esm-extensions": "10.0.1-pre.
|
|
70
|
-
"@openmrs/esm-feature-flags": "10.0.1-pre.
|
|
71
|
-
"@openmrs/esm-globals": "10.0.1-pre.
|
|
72
|
-
"@openmrs/esm-navigation": "10.0.1-pre.
|
|
73
|
-
"@openmrs/esm-offline": "10.0.1-pre.
|
|
74
|
-
"@openmrs/esm-react-utils": "10.0.1-pre.
|
|
75
|
-
"@openmrs/esm-routes": "10.0.1-pre.
|
|
76
|
-
"@openmrs/esm-state": "10.0.1-pre.
|
|
77
|
-
"@openmrs/esm-styleguide": "10.0.1-pre.
|
|
78
|
-
"@openmrs/esm-translations": "10.0.1-pre.
|
|
79
|
-
"@openmrs/esm-utils": "10.0.1-pre.
|
|
62
|
+
"@openmrs/esm-api": "10.0.1-pre.4966",
|
|
63
|
+
"@openmrs/esm-config": "10.0.1-pre.4966",
|
|
64
|
+
"@openmrs/esm-context": "10.0.1-pre.4966",
|
|
65
|
+
"@openmrs/esm-dynamic-loading": "10.0.1-pre.4966",
|
|
66
|
+
"@openmrs/esm-emr-api": "10.0.1-pre.4966",
|
|
67
|
+
"@openmrs/esm-error-handling": "10.0.1-pre.4966",
|
|
68
|
+
"@openmrs/esm-expression-evaluator": "10.0.1-pre.4966",
|
|
69
|
+
"@openmrs/esm-extensions": "10.0.1-pre.4966",
|
|
70
|
+
"@openmrs/esm-feature-flags": "10.0.1-pre.4966",
|
|
71
|
+
"@openmrs/esm-globals": "10.0.1-pre.4966",
|
|
72
|
+
"@openmrs/esm-navigation": "10.0.1-pre.4966",
|
|
73
|
+
"@openmrs/esm-offline": "10.0.1-pre.4966",
|
|
74
|
+
"@openmrs/esm-react-utils": "10.0.1-pre.4966",
|
|
75
|
+
"@openmrs/esm-routes": "10.0.1-pre.4966",
|
|
76
|
+
"@openmrs/esm-state": "10.0.1-pre.4966",
|
|
77
|
+
"@openmrs/esm-styleguide": "10.0.1-pre.4966",
|
|
78
|
+
"@openmrs/esm-translations": "10.0.1-pre.4966",
|
|
79
|
+
"@openmrs/esm-utils": "10.0.1-pre.4966"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"dayjs": "1.x",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"swr": "2.x"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@openmrs/typedoc-plugin-file-categories": "10.0.1-pre.
|
|
92
|
+
"@openmrs/typedoc-plugin-file-categories": "10.0.1-pre.4966",
|
|
93
93
|
"@swc/cli": "0.8.1",
|
|
94
94
|
"@swc/core": "1.15.21",
|
|
95
95
|
"@vitest/coverage-v8": "^4.1.2",
|