-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new properties to page component and update page state with…
… NgxsDataEntityCollectionsRepository
- Loading branch information
1 parent
119ffd2
commit e9f130b
Showing
6 changed files
with
697 additions
and
635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { InputBoolean } from '@angular-ru/cdk/typings'; | ||
|
||
export interface SioCorePageComponentInterface { | ||
toolbar?: boolean; | ||
toolbar?: InputBoolean; | ||
title?: string; | ||
back?: boolean; | ||
menu?: boolean; | ||
search?: boolean; | ||
back?: InputBoolean; | ||
menu?: InputBoolean; | ||
search?: InputBoolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,15 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { StateToken } from '@ngxs/store'; | ||
import { NgxsDataEntityCollectionsRepository } from '@angular-ru/ngxs/repositories'; | ||
import { createEntityCollections } from '@angular-ru/cdk/entity'; | ||
import { SioCorePageComponentInterface } from './page.model'; | ||
|
||
import { State } from '@ngxs/store'; | ||
import { | ||
Computed, | ||
DataAction, | ||
StateRepository, | ||
} from '@angular-ru/ngxs/decorators'; | ||
import { NgxsDataRepository } from '@angular-ru/ngxs/repositories'; | ||
|
||
const PAGE_STATE_TOKEN = new StateToken<SioCorePageComponentInterface>('page'); | ||
import { StateRepository } from '@angular-ru/ngxs/decorators'; | ||
|
||
@StateRepository() | ||
@State<SioCorePageComponentInterface>({ | ||
name: PAGE_STATE_TOKEN, | ||
defaults: { | ||
'toolbar': true, | ||
'title': 'T_PAGE', | ||
'menu': false, | ||
'back': false, | ||
'search': false, | ||
} as SioCorePageComponentInterface, | ||
@State({ | ||
name: 'pages', | ||
defaults: createEntityCollections(), | ||
}) | ||
@Injectable() | ||
export class SioCorePageComponentState extends NgxsDataRepository<SioCorePageComponentInterface> { | ||
|
||
@Computed() | ||
public get title(): string | undefined { | ||
return this.snapshot.title; | ||
} | ||
|
||
@DataAction() | ||
public setTitle(value: string) { | ||
this.patchState({ 'title': value }); | ||
} | ||
|
||
@DataAction() | ||
public setMenu(value: boolean) { | ||
this.patchState({ 'menu': value }); | ||
} | ||
|
||
@Computed() | ||
public get menu(): boolean | undefined { | ||
return this.snapshot.menu; | ||
} | ||
|
||
@DataAction() | ||
public setBack(value: boolean) { | ||
this.patchState({ 'back': value }); | ||
} | ||
|
||
@Computed() | ||
public get back(): boolean | undefined { | ||
return this.snapshot.back; | ||
} | ||
|
||
@DataAction() | ||
public setSearch(value: boolean) { | ||
this.patchState({ 'search': value }); | ||
} | ||
|
||
@Computed() | ||
public get search(): boolean | undefined { | ||
return this.snapshot.search; | ||
} | ||
|
||
@DataAction() | ||
public setToolbar(value: boolean | undefined) { | ||
this.patchState({ 'toolbar': value }); | ||
} | ||
|
||
@Computed() | ||
public get toolbar(): boolean | undefined { | ||
return this.snapshot.toolbar; | ||
} | ||
|
||
|
||
|
||
} | ||
export class SioCorePagesComponentState extends NgxsDataEntityCollectionsRepository<SioCorePageComponentInterface> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.