Skip to content

Commit

Permalink
JNG-4770 fix date time inputs (#75)
Browse files Browse the repository at this point in the history
* JNG-4770 fix date time inputs

* JNG-4770 migrate styles, attempt #1

* Revert "JNG-4770 migrate styles, attempt #1"

This reverts commit d8d6c48.

* JNG-4770: fix data-grid v6 layout issues

* JNG-4778 fix formatted widget

* JNG-4770 fix readme
  • Loading branch information
noherczeg authored Apr 21, 2023
1 parent c476ce4 commit 47f1521
Show file tree
Hide file tree
Showing 31 changed files with 413 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
import com.github.jknack.handlebars.internal.lang3.StringUtils;
import hu.blackbelt.judo.generator.commons.annotations.TemplateHelper;
import hu.blackbelt.judo.meta.ui.Application;
import hu.blackbelt.judo.meta.ui.NamedElement;
import hu.blackbelt.judo.meta.ui.NavigationItem;
import hu.blackbelt.judo.meta.ui.Sort;
import hu.blackbelt.judo.meta.ui.data.*;
import lombok.extern.java.Log;
import org.eclipse.emf.ecore.EObject;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

import static hu.blackbelt.judo.ui.generator.typescript.rest.commons.UiCommonsHelper.classDataName;
Expand Down Expand Up @@ -173,4 +175,22 @@ public static String getTypeForRelationOwner(RelationType relationType) {
}
return classDataName(owner, "");
}

public static List<String> getWritableDateAttributesForClass(ClassType classType) {
return classType.getAttributes().stream()
.filter(a -> a.getDataType() instanceof DateType)
.filter(a -> !a.isIsReadOnly())
.map(NamedElement::getName)
.sorted()
.collect(Collectors.toList());
}

public static List<String> getWritableDateTimeAttributesForClass(ClassType classType) {
return classType.getAttributes().stream()
.filter(a -> a.getDataType() instanceof TimestampType)
.filter(a -> !a.isIsReadOnly())
.map(NamedElement::getName)
.sorted()
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class UiImportHelper {
Map.entry("actiongroup", Set.of("Button")),
Map.entry("binarytypeinput", Set.of("TextField", "InputAdornment", "Button", "ButtonGroup")),
Map.entry("button", Set.of("Button")),
Map.entry("dateinput", Set.of("TextField", "InputAdornment")),
Map.entry("datetimeinput", Set.of("TextField", "InputAdornment")),
Map.entry("dateinput", Set.of("InputAdornment")),
Map.entry("datetimeinput", Set.of("InputAdornment")),
Map.entry("divider", Set.of("Divider")),
Map.entry("enumerationcombo", Set.of("TextField", "MenuItem", "InputAdornment")),
Map.entry("enumerationradio", Set.of("RadioGroup", "FormControlLabel", "Radio")),
Expand All @@ -61,8 +61,8 @@ public class UiImportHelper {
);

private static final Map<String, Set<String>> muiDatePickerWidgetImportPairs = Map.ofEntries(
Map.entry("dateinput", Set.of("DatePicker")),
Map.entry("datetimeinput", Set.of("DateTimePicker")),
Map.entry("dateinput", Set.of("DatePicker", "DateValidationError")),
Map.entry("datetimeinput", Set.of("DateTimePicker", "DateTimeValidationError")),
Map.entry("timeinput", Set.of("TimePicker"))
);

Expand Down Expand Up @@ -110,15 +110,15 @@ public static SortedSet<String> getMuiDataGridImports(PageDefinition pageDefinit
public static String getMuiDataGridImportsForPage(PageDefinition pageDefinition) {
SortedSet<String> imports = getMuiDataGridImports(pageDefinition);

imports.addAll(Set.of("GridSelectionModel", "GridRenderCellParams", "GridColDef", "GridValueFormatterParams"));
imports.addAll(Set.of("GridRowSelectionModel", "GridRenderCellParams", "GridColDef", "GridValueFormatterParams"));

return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}

public static String getMuiDataGridImportsForActionForm(PageDefinition pageDefinition) {
SortedSet<String> imports = getMuiDataGridImports(pageDefinition);

imports.addAll(Set.of("GridSelectionModel", "GridRenderCellParams", "GridColDef", "GridValueFormatterParams"));
imports.addAll(Set.of("GridRowSelectionModel", "GridRenderCellParams", "GridColDef", "GridValueFormatterParams"));

return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ public static Collection<String> getApiImportsForCallOperationAction(CallOperati
}

if (action.getOperation().getIsMapped()) {
res.add(classDataName((ClassType) action.getDataElement().getOwner(), ""));
res.add(classDataName((ClassType) action.getDataElement().getOwner(), "Stored"));
}

Expand Down
4 changes: 2 additions & 2 deletions judo-ui-react/src/main/resources/actor/README.md.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ npm i -g pnpm
In order for our frontend application to be able to find our running backend, we need to export the following variables:

```
export VITE_API_DEFAULT_BASE_URL="YOUR_BACKEND_URL_HERE"
export VITE_FILE_DEFAULT_BASE_URL="YOUR_BACKEND_URL_HERE"
export VITE_API_DEFAULT_BASE_URL=YOUR_BACKEND_URL_HERE
export VITE_FILE_DEFAULT_BASE_URL=YOUR_BACKEND_URL_HERE
```

For further details, please consult with [Vite](https://vitejs.dev/)'s official docs: [Env Variables and Modes](https://vitejs.dev/guide/env-and-mode.html)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"@emotion/react": "11.10.5",
"@emotion/styled": "11.10.5",
"@emotion/react": "11.10.6",
"@emotion/styled": "11.10.6",
"@fontsource/roboto": "4.5.8",
"@mdi/font": "7.1.96",
"@mui/material": "5.11.16",
"@mui/x-data-grid": "5.17.26",
"@mui/x-date-pickers": "5.0.20",
"@mui/material": "5.12.1",
"@mui/x-data-grid": "6.2.1",
"@mui/x-date-pickers": "6.2.1",
"@pandino/loader-configuration-dom": "0.8.27",
"@pandino/pandino": "0.8.27",
"@pandino/react-hooks": "0.8.27",
Expand Down
Loading

0 comments on commit 47f1521

Please sign in to comment.