Skip to content

Commit 8c1467f

Browse files
committed
feat: demo wip
1 parent f934fec commit 8c1467f

File tree

8 files changed

+51
-35
lines changed

8 files changed

+51
-35
lines changed
Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
<ActionBar title="SplitView Demo"></ActionBar>
2-
3-
<GridLayout rows="*, *" columns="*">
4-
<SplitView
5-
row="0"
6-
displayMode="twoBesideSecondary"
7-
splitBehavior="tile"
8-
preferredPrimaryColumnWidthFraction="0.25"
9-
preferredSupplementaryColumnWidthFraction="0.33"
10-
preferredInspectorColumnWidthFraction="0.2"
11-
>
12-
<page-router-outlet name="primary"></page-router-outlet>
13-
<page-router-outlet name="secondary"></page-router-outlet>
14-
<page-router-outlet name="supplementary"></page-router-outlet>
15-
<page-router-outlet name="inspector"></page-router-outlet>
16-
</SplitView>
17-
</GridLayout>
1+
<SplitView
2+
displayMode="twoBesideSecondary"
3+
splitBehavior="tile"
4+
preferredPrimaryColumnWidthFraction="0.25"
5+
preferredSupplementaryColumnWidthFraction="0.33"
6+
preferredInspectorColumnWidthFraction="0.2"
7+
>
8+
<page-router-outlet name="primary"></page-router-outlet>
9+
<page-router-outlet name="secondary"></page-router-outlet>
10+
<page-router-outlet name="supplementary"></page-router-outlet>
11+
<page-router-outlet name="inspector"></page-router-outlet>
12+
</SplitView>
Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
1-
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
2-
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
1+
import { Component, inject, NO_ERRORS_SCHEMA, OnInit } from '@angular/core';
2+
import {
3+
NativeScriptCommonModule,
4+
NativeScriptRouterModule,
5+
PageRouterOutlet,
6+
RouterExtensions,
7+
} from '@nativescript/angular';
38

49
@Component({
510
selector: 'ns-split-view-demo',
611
templateUrl: './split-view-demo.component.html',
7-
imports: [NativeScriptCommonModule, NativeScriptRouterModule],
8-
standalone: true,
12+
imports: [NativeScriptCommonModule, NativeScriptRouterModule, PageRouterOutlet],
913
schemas: [NO_ERRORS_SCHEMA],
1014
})
11-
export class SplitViewDemoComponent {}
15+
export class SplitViewDemoComponent implements OnInit {
16+
router = inject(RouterExtensions);
17+
18+
ngOnInit() {
19+
this.router.navigate(
20+
[
21+
'/',
22+
{
23+
outlets: {
24+
primary: ['primary'],
25+
secondary: ['secondary'],
26+
supplementary: ['supplementary'],
27+
inspector: ['inspector'],
28+
},
29+
},
30+
],
31+
{ animated: false },
32+
);
33+
}
34+
}

apps/nativescript-demo-ng/src/app/split-view-demo/split-view-inspector.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { NativeScriptCommonModule } from '@nativescript/angular';
77
<Label row="0" text="Inspector" class="h2 mb-8"></Label>
88
<Label row="1" text="This is the inspector column." class="text-center"></Label>
99
</GridLayout>`,
10-
standalone: true,
1110
imports: [NativeScriptCommonModule],
1211
schemas: [NO_ERRORS_SCHEMA],
1312
})

apps/nativescript-demo-ng/src/app/split-view-demo/split-view-primary.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { NativeScriptCommonModule } from '@nativescript/angular';
77
<Label row="0" text="Primary" class="h2 mb-8"></Label>
88
<Label row="1" text="This is the primary column." class="text-center"></Label>
99
</GridLayout>`,
10-
standalone: true,
1110
imports: [NativeScriptCommonModule],
1211
schemas: [NO_ERRORS_SCHEMA],
1312
})

apps/nativescript-demo-ng/src/app/split-view-demo/split-view-secondary.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { NativeScriptCommonModule } from '@nativescript/angular';
77
<Label row="0" text="Secondary" class="h2 mb-8"></Label>
88
<Label row="1" text="This is the secondary column." class="text-center"></Label>
99
</GridLayout>`,
10-
standalone: true,
1110
imports: [NativeScriptCommonModule],
1211
schemas: [NO_ERRORS_SCHEMA],
1312
})

apps/nativescript-demo-ng/src/app/split-view-demo/split-view-supplementary.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { NativeScriptCommonModule } from '@nativescript/angular';
77
<Label row="0" text="Supplementary" class="h2 mb-8"></Label>
88
<Label row="1" text="This is the supplementary column." class="text-center"></Label>
99
</GridLayout>`,
10-
standalone: true,
1110
imports: [NativeScriptCommonModule],
1211
schemas: [NO_ERRORS_SCHEMA],
1312
})

apps/nativescript-demo-ng/src/app/split-view-demo/split-view.routes.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export const SPLIT_VIEW_ROUTES: Routes = [
1010
path: '',
1111
component: SplitViewDemoComponent,
1212
children: [
13-
{
14-
path: '',
15-
redirectTo: '/split-view-demo/(primary:primary//secondary:secondary//supplementary:supplementary//inspector:inspector)',
16-
pathMatch: 'full',
17-
},
13+
// {
14+
// path: '',
15+
// redirectTo: '/(primary:primary//secondary:secondary//supplementary:supplementary//inspector:inspector)',
16+
// pathMatch: 'full',
17+
// },
1818
{
1919
path: 'primary',
2020
component: SplitViewPrimaryComponent,

apps/nativescript-demo-ng/src/main.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import { Trace, Utils } from '@nativescript/core';
99

1010
// import { AppModule } from './app/app.module';
1111
import { withInterceptorsFromDi } from '@angular/common/http';
12-
import { AppComponent } from './app/app.component';
13-
import { routes } from './app/app.routes';
12+
// import { AppComponent } from './app/app.component';
13+
// import { routes } from './app/app.routes';
1414
import { provideZonelessChangeDetection } from '@angular/core';
15+
import { SPLIT_VIEW_ROUTES } from './app/split-view-demo/split-view.routes';
16+
import { SplitViewDemoComponent } from './app/split-view-demo/split-view-demo.component';
1517

1618
const ZONELESS = true;
1719

@@ -23,10 +25,10 @@ runNativeScriptAngularApp({
2325
if (__APPLE__) {
2426
Utils.ios.setWindowBackgroundColor('#a6120d');
2527
}
26-
return bootstrapApplication(AppComponent, {
28+
return bootstrapApplication(SplitViewDemoComponent, {
2729
providers: [
2830
provideNativeScriptHttpClient(withInterceptorsFromDi()),
29-
provideNativeScriptRouter(routes),
31+
provideNativeScriptRouter(SPLIT_VIEW_ROUTES),
3032
ZONELESS ? provideZonelessChangeDetection() : provideNativeScriptNgZone(),
3133
],
3234
});

0 commit comments

Comments
 (0)