Skip to content

Commit

Permalink
Disable typing in datepicker (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
tschumpr authored Feb 28, 2024
2 parents 02f2f55 + 813345a commit 233e752
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- Renamed various codelists to have more evocative names (e.g. `location_precision` instead of `qt_location`, `plasticity` instead of `mlpr101`, …)
- Remove stratigraphy kind.
- Split generic join table `layer_codelists` into 6 separate join tables for each many to many relationship between layer and codelist.
- Prevent typing dates in profile and filter, only allow selecting date in datepicker.

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion src/client/cypress/e2e/editor/bulkedit.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("Test the borehole bulk edit feature.", () => {
cy.wrap(el).scrollIntoView().type(`A${index}`),
);

cy.get("form .field > .react-datepicker-wrapper input")
cy.get("form .field > .react-datepicker-wrapper .datepicker-input")
.should("have.length", 3)
.each((el, index, list) => {
cy.wrap(el).click();
Expand Down
4 changes: 2 additions & 2 deletions src/client/cypress/e2e/filter.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe("Search filter tests", () => {
// input values
cy.contains("Creation date")
.next()
.find(".react-datepicker-wrapper input")
.find(".react-datepicker-wrapper .datepicker-input")
.click();

cy.get(".react-datepicker__year-select").select("2021");
Expand All @@ -164,7 +164,7 @@ describe("Search filter tests", () => {
.parent()
.parent()
.next()
.find(".react-datepicker-wrapper input")
.find(".react-datepicker-wrapper .datepicker-input")
.click();

cy.get(".react-datepicker__year-select").select("2021");
Expand Down
8 changes: 8 additions & 0 deletions src/client/src/commons/form/dateField.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.react-datepicker-popper {
z-index: 999 !important;
}

.datepicker-input {
opacity: 1 !important;
}

.datepicker-input input[disabled] {
opacity: 1 !important;
}
2 changes: 2 additions & 0 deletions src/client/src/commons/form/dateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ class DateField extends React.Component {
iconPosition="left"
placeholder={placeholder}
spellCheck="false"
className="datepicker-input"
value={
moment(this.state.date).isValid()
? moment(this.state.date).format("DD.MM.YYYY")
: ""
}
disabled={true}
readOnly={!isEditable}
/>
</div>
Expand Down

0 comments on commit 233e752

Please sign in to comment.