Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
@dynamic-forms:registry=https://registry.npmjs.org

legacy-peer-deps=true
@dynamic-forms:registry=https://registry.npmjs.org
22 changes: 0 additions & 22 deletions apps/demo/src/app/app-state.module.ts

This file was deleted.

21 changes: 21 additions & 0 deletions apps/demo/src/app/app-states.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { withNgxsStoragePlugin } from '@ngxs/storage-plugin';
import { NgxsModuleOptions } from '@ngxs/store';
import { environment } from '../environments/environment';
import { ConfigState } from './state/config/config.state';
import { ExamplesState } from './state/examples/examples.state';
import { LayoutState } from './state/layout/layout.state';
import { NotificationsState } from './state/notifications/notifications.state';
import { PreferencesState } from './state/preferences/preferences.state';
import { ProgressState } from './state/progress/progress.state';

export const appStates = [ConfigState, ExamplesState, LayoutState, NotificationsState, PreferencesState, ProgressState];

export const appStateOptions: NgxsModuleOptions = {
developmentMode: !environment.production,
};

export const appStateFeatures = [
withNgxsStoragePlugin({
keys: [PreferencesState],
}),
];
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class PreferencesMenuComponent {
dynamicForm: MaterialFormComponent;

constructor(private store: Store) {
this.model$ = this.store.select(PreferencesState).pipe(
this.model$ = this.store.select(PreferencesState.preferences).pipe(
filter(preferences => preferences !== this.dynamicForm?.form?.value),
map((preferences: Preferences) => {
if (preferences) {
Expand Down
5 changes: 5 additions & 0 deletions apps/demo/src/app/state/preferences/preferences.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import { FormEditorPreferences, PREFERENCES, Preferences, ThemePreferences, defa
})
@Injectable()
export class PreferencesState {
@Selector()
static preferences(state: Preferences): Preferences {
return state;
}

@Selector()
static theme(state: Preferences): ThemePreferences {
return state?.theme;
Expand Down
7 changes: 4 additions & 3 deletions apps/demo/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { HTTP_INTERCEPTORS, provideHttpClient } from '@angular/common/http';
import { APP_INITIALIZER, enableProdMode, importProvidersFrom } from '@angular/core';
import { APP_INITIALIZER, enableProdMode } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideRouter, withComponentInputBinding } from '@angular/router';
import { AppStateModule } from './app/app-state.module';
import { provideStore } from '@ngxs/store';
import { appStateFeatures, appStateOptions, appStates } from './app/app-states';
import { AppComponent } from './app/app.component';
import { appRoutes } from './app/app.routes';
import { AppService, appInitializer } from './app/app.service';
Expand All @@ -19,7 +20,7 @@ bootstrapApplication(AppComponent, {
provideAnimations(),
provideHttpClient(),
provideRouter(appRoutes, withComponentInputBinding()),
importProvidersFrom(AppStateModule),
provideStore(appStates, appStateOptions, ...appStateFeatures),
{
provide: APP_INITIALIZER,
useFactory: appInitializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
'max-width': maximized ? maxWidth || '100%' : maxWidth,
'min-height': maximized ? '100%' : undefined,
'max-height': maximized ? '100%' : undefined,
margin: maximized ? '0px auto' : undefined
margin: maximized ? '0px auto' : undefined,
}"
>
<div
class="modal-content"
[ngStyle]="{
height: maximized ? maxHeight || '100%' : height,
'min-height': maximized ? maxHeight || '100%' : minHeight,
'max-height': maxHeight || '100%'
'max-height': maxHeight || '100%',
}"
>
<div *ngIf="title || titleHtml || headerActions?.length" class="modal-header" [ngClass]="classNameHeader">
Expand Down
Loading