mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
Subnav (#391)
* begin subnav implementation * implement subnav AND angular forms for comparison * unions working-ish, list of enums working * new form approach almost complete * finish new forms approach for action inputs and config * expandable list items and handlebars display * Config animation (#394) * config cammel * config animation Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com> * improve server settings inputs, still needs work * delete all notifications, styling, and bugs * contracted by default Co-authored-by: Drew Ansbacher <drew.ansbacher@gmail.com> Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
This commit is contained in:
committed by
Aiden McClelland
parent
a43ff976a2
commit
5741cf084f
33
ui/src/app/services/sub-nav.service.ts
Normal file
33
ui/src/app/services/sub-nav.service.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Inject, Injectable, InjectionToken } from '@angular/core'
|
||||
import { IonNav } from '@ionic/angular'
|
||||
import { AppConfigComponentMapping } from '../modals/app-config-injectable'
|
||||
import { ConfigCursor } from '../pkg-config/config-cursor'
|
||||
|
||||
export const APP_CONFIG_COMPONENT_MAPPING = new InjectionToken<string>('APP_CONFIG_COMPONENTS')
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SubNavService {
|
||||
path: string[]
|
||||
|
||||
constructor (
|
||||
@Inject(APP_CONFIG_COMPONENT_MAPPING) private readonly appConfigComponentMapping: AppConfigComponentMapping,
|
||||
) { }
|
||||
|
||||
async push (key: string, cursor: ConfigCursor<any>, nav: IonNav) {
|
||||
const component = this.appConfigComponentMapping[cursor.spec().type]
|
||||
this.path.push(key)
|
||||
nav.push(component, { cursor }, { mode: 'ios' })
|
||||
}
|
||||
|
||||
async pop (nav: IonNav) {
|
||||
this.path.pop()
|
||||
nav.pop({ mode: 'ios' })
|
||||
}
|
||||
|
||||
async popTo (index: number, nav: IonNav) {
|
||||
this.path = this.path.slice(0, index + 1)
|
||||
nav.popTo(index, { mode: 'ios' })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user