Skip to content

Commit 173710e

Browse files
committed
chore(virtual-table-demo): form layout improvements and some other minor fixes
1 parent 08b8b45 commit 173710e

File tree

14 files changed

+111
-79
lines changed

14 files changed

+111
-79
lines changed

apps/ngxs-demo/src/app.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
provideBrowserGlobalErrorListeners,
55
provideZonelessChangeDetection,
66
} from '@angular/core';
7+
import {MAT_FORM_FIELD_DEFAULT_OPTIONS} from '@angular/material/form-field';
78
import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
89
import {
910
provideRouter,
@@ -46,5 +47,12 @@ export const appConfig: ApplicationConfig = {
4647
withNgxsNoopExecutionStrategy(),
4748
),
4849
provideNgxsDataPlugin(withNgxsDataStorage()),
50+
{
51+
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
52+
useValue: {
53+
subscriptSizing: 'dynamic',
54+
appearance: 'outline',
55+
},
56+
},
4957
],
5058
};
Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
1-
<h1 mat-dialog-title>Article</h1>
1+
<h2 mat-dialog-title>Article</h2>
22

3-
<div
4-
mat-dialog-content
3+
<mat-dialog-content
4+
class="content"
55
[formGroup]="form"
66
>
7-
<div>
8-
<mat-form-field>
9-
<mat-label>Article title</mat-label>
10-
<input
11-
formControlName="title"
12-
matInput
13-
placeholder="title"
14-
/>
15-
</mat-form-field>
16-
</div>
7+
<mat-form-field>
8+
<mat-label>Article title</mat-label>
9+
<input
10+
formControlName="title"
11+
matInput
12+
/>
13+
</mat-form-field>
1714

18-
<div>
19-
<mat-form-field>
20-
<mat-label>Article category</mat-label>
21-
<input
22-
formControlName="category"
23-
matInput
24-
placeholder="category"
25-
/>
26-
</mat-form-field>
27-
</div>
28-
</div>
15+
<mat-form-field>
16+
<mat-label>Article category</mat-label>
17+
<input
18+
formControlName="category"
19+
matInput
20+
/>
21+
</mat-form-field>
22+
</mat-dialog-content>
2923

30-
<div mat-dialog-actions>
24+
<mat-dialog-actions align="end">
3125
<button
3226
mat-button
3327
type="button"
@@ -43,4 +37,4 @@ <h1 mat-dialog-title>Article</h1>
4337
>
4438
Save
4539
</button>
46-
</div>
40+
</mat-dialog-actions>

apps/ngxs-demo/src/article/dialog/article-dialog.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ import {Article} from '../article';
3232
ReactiveFormsModule,
3333
],
3434
templateUrl: './article-dialog.component.html',
35+
styles: `
36+
.content {
37+
display: flex;
38+
flex-direction: column;
39+
gap: 1rem;
40+
}
41+
42+
mat-form-field {
43+
padding-top: 0.25rem;
44+
}
45+
`,
3546
changeDetection: ChangeDetectionStrategy.OnPush,
3647
})
3748
export class ArticleDialogComponent {

apps/virtual-table-demo/src/app.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const appConfig: ApplicationConfig = {
4545
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
4646
useValue: {
4747
subscriptSizing: 'dynamic',
48+
appearance: 'outline',
4849
},
4950
},
5051
provideNativeDateAdapter(),

apps/virtual-table-demo/src/samples/sample-first/sample-first.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
</mat-toolbar>
1212

13-
<form>
13+
<form class="filter-form">
1414
<mat-form-field>
1515
<mat-label>Data size</mat-label>
1616
<mat-select

apps/virtual-table-demo/src/samples/sample-first/sample-first.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ import {CodeDialogComponent} from '../../shared/dialog/code-dialog.component';
3737
VirtualTable,
3838
],
3939
templateUrl: './sample-first.component.html',
40+
styles: `
41+
.filter-form {
42+
margin-bottom: 1rem;
43+
display: flex;
44+
gap: 1rem;
45+
flex-wrap: wrap;
46+
}
47+
`,
4048
changeDetection: ChangeDetectionStrategy.OnPush,
4149
})
4250
export default class SampleFirstComponent implements OnInit, OnDestroy {

apps/virtual-table-demo/src/samples/sample-fourteen/context-menu-sample/context-menu-sample.component.html

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="my-filter">
2-
<mat-form-field appearance="outline">
2+
<mat-form-field>
33
<mat-label>Find options</mat-label>
44
<mat-select
55
[value]="$any(table().filterable.filterTypeDefinition)[state().key!]"
@@ -24,10 +24,7 @@
2424
</mat-button-toggle-group>
2525
}
2626
@case (TableFilterType.INTERVAL) {
27-
<mat-form-field
28-
appearance="outline"
29-
type="daterange"
30-
>
27+
<mat-form-field type="daterange">
3128
<mat-date-range-input [rangePicker]="rangePicker">
3229
<input
3330
matStartDate
@@ -50,10 +47,7 @@
5047
</mat-form-field>
5148
}
5249
@case (TableFilterType.EQUALS_DATES_WITHOUT_TIME) {
53-
<mat-form-field
54-
appearance="outline"
55-
class="date-picker"
56-
>
50+
<mat-form-field class="date-picker">
5751
<input
5852
matInput
5953
[matDatepicker]="picker"
@@ -68,7 +62,7 @@
6862
</mat-form-field>
6963
}
7064
@default {
71-
<mat-form-field appearance="outline">
65+
<mat-form-field>
7266
<mat-label>Filter by {{ state().key! | uppercase }}</mat-label>
7367
<input
7468
autocomplete="off"

apps/virtual-table-demo/src/samples/sample-fourteen/sample-fourteen.component.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
[css-class]="['my-filter']"
4848
>
4949
<div class="filter-form">
50-
<mat-form-field appearance="outline">
50+
<mat-form-field>
5151
<mat-label>Filter</mat-label>
5252
<input
5353
autocomplete="off"
@@ -59,10 +59,7 @@
5959
<mat-icon matSuffix>search</mat-icon>
6060
</mat-form-field>
6161

62-
<mat-form-field
63-
appearance="outline"
64-
class="filter-options"
65-
>
62+
<mat-form-field class="filter-options">
6663
<mat-label>Find options</mat-label>
6764
<mat-select
6865
[(value)]="table.filterable.filterType"

apps/virtual-table-demo/src/samples/sample-fourteen/sample-fourteen.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default class SampleFourteenComponent implements OnInit, AfterViewInit {
115115
code: `
116116
<ngx-filter #filter>
117117
<div class="my-filter">
118-
<mat-form-field appearance="outline">
118+
<mat-form-field>
119119
<mat-label>Find options</mat-label>
120120
<mat-select
121121
[value]="table.filterable.filterTypeDefinition[filter.state.key!]"
@@ -129,7 +129,7 @@ export default class SampleFourteenComponent implements OnInit, AfterViewInit {
129129
</mat-select>
130130
</mat-form-field>
131131
132-
<mat-form-field appearance="outline">
132+
<mat-form-field>
133133
<mat-label>Filter by {{ filter.state.key! | uppercase }}</mat-label>
134134
<input
135135
matInput

apps/virtual-table-demo/src/samples/sample-night/sample-night.component.html

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
[css-class]="['my-filter']"
3232
>
3333
<div class="filter-form">
34-
<mat-form-field appearance="outline">
34+
<mat-form-field>
3535
<mat-label>Filter</mat-label>
3636
<input
3737
autocomplete="off"
@@ -43,10 +43,7 @@
4343
<mat-icon matSuffix>search</mat-icon>
4444
</mat-form-field>
4545

46-
<mat-form-field
47-
appearance="outline"
48-
class="filter-options"
49-
>
46+
<mat-form-field class="filter-options">
5047
<mat-label>Find options</mat-label>
5148
<mat-select
5249
[(value)]="table1.filterable.filterType"
@@ -89,7 +86,7 @@
8986
[css-class]="['my-filter']"
9087
>
9188
<div class="filter-form">
92-
<mat-form-field appearance="outline">
89+
<mat-form-field>
9390
<mat-label>Filter</mat-label>
9491
<input
9592
autocomplete="off"
@@ -101,10 +98,7 @@
10198
<mat-icon matSuffix>search</mat-icon>
10299
</mat-form-field>
103100

104-
<mat-form-field
105-
appearance="outline"
106-
class="filter-options"
107-
>
101+
<mat-form-field class="filter-options">
108102
<mat-label>Find options</mat-label>
109103
<mat-select
110104
[(value)]="table2.filterable.filterType"

0 commit comments

Comments
 (0)