pcm-shared-components 2.1.391 → 2.1.392
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.
|
@@ -54,6 +54,22 @@ const REQUIRED_ERROR_KEY_BY_TYPE = {
|
|
|
54
54
|
yes_no: 'animal.required_error_yes_no'
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
// A native <input type="date"> only opens its calendar popup on its own when the browser's tiny
|
|
58
|
+
// built-in icon is clicked -- clicking anywhere else in the field just places the text caret
|
|
59
|
+
// (still lets someone type the year/month/day directly, which showPicker() doesn't change). Most
|
|
60
|
+
// people expect clicking anywhere in the box to open the calendar. showPicker() is Chrome/Edge/
|
|
61
|
+
// Firefox only as of this writing (not Safari) and throws if called on a disabled/read-only input
|
|
62
|
+
// or outside a user gesture, so this fails silently rather than breaking the click -- on an
|
|
63
|
+
// unsupported browser, the field just falls back to manual typing and the browser's own
|
|
64
|
+
// icon-click affordance, exactly as before.
|
|
65
|
+
const openNativeDatePicker = e => {
|
|
66
|
+
try {
|
|
67
|
+
e.target.showPicker?.();
|
|
68
|
+
} catch {
|
|
69
|
+
// ignore -- unsupported browser or transient DOM state, typing/icon-click still work
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
57
73
|
/**
|
|
58
74
|
* Tab-per-item editor for a lot's animal or vehicle detail fields: one tab per item (green
|
|
59
75
|
* check when every required field is answered, amber warning triangle otherwise), an "Add"
|
|
@@ -479,6 +495,9 @@ export const AnimalVehicleDetailsEditor = props => {
|
|
|
479
495
|
fullWidth: true,
|
|
480
496
|
InputLabelProps: {
|
|
481
497
|
shrink: true
|
|
498
|
+
},
|
|
499
|
+
inputProps: {
|
|
500
|
+
onClick: openNativeDatePicker
|
|
482
501
|
}
|
|
483
502
|
});
|
|
484
503
|
} else {
|