-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCrudSchemas.java
More file actions
49 lines (45 loc) · 1.91 KB
/
Copy pathCrudSchemas.java
File metadata and controls
49 lines (45 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package rsp.app.posts.components;
import rsp.compositions.schema.DataSchema;
import rsp.compositions.schema.FieldType;
import rsp.compositions.schema.TextAlign;
import rsp.compositions.schema.Widget;
/** Shared field metadata for the posts/comments grids and create/edit forms. */
public final class CrudSchemas {
private CrudSchemas() {
}
public static final DataSchema POSTS = DataSchema.builder()
.field("id", FieldType.ID).label("ID")
.field("title", FieldType.STRING)
.label("Title")
.required()
.maxLength(200)
.placeholder("Enter post title…")
.field("content", FieldType.TEXT)
.label("Content")
.widget(Widget.TEXTAREA)
.maxLength(10_000)
.placeholder("Write your post content here…")
.column("id").sortable().width("6rem").align(TextAlign.RIGHT)
.column("title").sortable().filterable().width("30%")
.column("content").filterable().width("auto")
.build()
.withSelectable(true);
public static final DataSchema COMMENTS = DataSchema.builder()
.field("id", FieldType.ID).label("ID")
.field("text", FieldType.TEXT)
.label("Comment")
.required()
.maxLength(1_000)
.widget(Widget.TEXTAREA)
.placeholder("Enter comment…")
.field("postId", FieldType.STRING)
.label("Post")
.required()
.references("posts")
.placeholder("Select a post…")
.column("id").sortable().width("6rem").align(TextAlign.RIGHT)
.column("text").sortable().filterable().width("auto")
.column("postId").sortable().filterable().width("8rem").align(TextAlign.RIGHT)
.build()
.withSelectable(true);
}