mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
@ -136,8 +136,10 @@ function initApp(window, document, config) {
|
||||
Platform.navigatorPlatform(window.navigator.platform);
|
||||
Platform.load(config);
|
||||
|
||||
// on resize be sure to clear out existing window dimensions
|
||||
setTimeout(() => {
|
||||
// start listening for resizes XXms after the app starts
|
||||
window.addEventListener('resize', Platform.winResize);
|
||||
}, 2000);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ import {dom} from 'ionic/util'
|
||||
})
|
||||
export class Aside extends Ion {
|
||||
|
||||
constructor(elementRef: ElementRef, ionicConfig: IonicConfig) {
|
||||
super(elementRef, ionicConfig);
|
||||
constructor(elementRef: ElementRef, config: IonicConfig) {
|
||||
super(elementRef, config);
|
||||
|
||||
this.opening = new EventEmitter('opening');
|
||||
|
||||
@ -133,8 +133,8 @@ export class Aside extends Ion {
|
||||
template: ''
|
||||
})
|
||||
export class AsideBackdrop extends Ion {
|
||||
constructor(elementRef: ElementRef, ionicConfig: IonicConfig, @Host() aside: Aside) {
|
||||
super(elementRef, ionicConfig);
|
||||
constructor(elementRef: ElementRef, config: IonicConfig, @Host() aside: Aside) {
|
||||
super(elementRef, config);
|
||||
|
||||
aside.backdrop = this;
|
||||
|
||||
|
@ -77,7 +77,7 @@ export class IconDirective {
|
||||
this.ariaHidden = true;
|
||||
|
||||
if (forward !== null) {
|
||||
this.fwdIcon = config.setting('forwardIcon');
|
||||
this.iconFwd = config.setting('iconForward');
|
||||
}
|
||||
|
||||
if (hostButton) {
|
||||
@ -103,8 +103,8 @@ export class IconDirective {
|
||||
}
|
||||
|
||||
onInit() {
|
||||
if (this.fwdIcon) {
|
||||
this.name = this.fwdIcon;
|
||||
if (this.iconFwd) {
|
||||
this.name = this.iconFwd;
|
||||
}
|
||||
if (!this.name) return;
|
||||
|
||||
|
@ -65,10 +65,22 @@ export class IonicConfig {
|
||||
let platformValue = undefined;
|
||||
for (let i = 0; i < activePlatformKeys.length; i++) {
|
||||
platformObj = platformSettings[ activePlatformKeys[i] ];
|
||||
if (platformObj && isDefined(platformObj[arg0])) {
|
||||
|
||||
if (platformObj) {
|
||||
if (isDefined(platformObj[arg0])) {
|
||||
// check assigned platform settings
|
||||
platformValue = platformObj[arg0];
|
||||
|
||||
} else if (platformObj.mode) {
|
||||
// check the platform default mode settings
|
||||
platformObj = IonicConfig.modeConfig(platformObj.mode);
|
||||
if (platformObj) {
|
||||
platformValue = platformObj[arg0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (isDefined(platformValue)) {
|
||||
settings[arg0] = platformValue;
|
||||
}
|
||||
@ -132,14 +144,20 @@ export class IonicConfig {
|
||||
this._settings.platforms = extend(platform.settings(), this._settings.platforms || {});
|
||||
}
|
||||
|
||||
static set global(config) {
|
||||
globalConfig = config;
|
||||
}
|
||||
static modeConfig(mode, config) {
|
||||
const args = arguments;
|
||||
|
||||
static get global() {
|
||||
return globalConfig;
|
||||
if (args.length === 2) {
|
||||
// modeConfig('ios', {...})
|
||||
modeConfigs[mode] = extend(modeConfigs[mode] || {}, config);
|
||||
|
||||
} else {
|
||||
// modeConfig('ios')
|
||||
return modeConfigs[mode];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let globalConfig = null;
|
||||
}
|
||||
|
||||
let modeConfigs = {};
|
||||
|
52
ionic/config/modes.ts
Normal file
52
ionic/config/modes.ts
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
import {IonicConfig} from './config';
|
||||
|
||||
|
||||
// iOS Mode Settings
|
||||
IonicConfig.modeConfig('ios', {
|
||||
|
||||
actionMenuEnter: 'action-menu-slide-in',
|
||||
actionMenuLeave: 'action-menu-slide-out',
|
||||
actionMenuCancelIcon: 'ion-close',
|
||||
actionMenuDestructiveIcon: 'ion-trash-a',
|
||||
|
||||
backButtonText: 'Back',
|
||||
backButtonIcon: 'ion-ios-arrow-back',
|
||||
|
||||
iconForward: 'ion-ios-arrow-forward',
|
||||
iconMode: 'ios',
|
||||
|
||||
keyboardScrollAssist: true,
|
||||
tapPolyfill: false,
|
||||
|
||||
navTitleAlign: 'center',
|
||||
tabBarPlacement: 'bottom',
|
||||
viewTransition: 'ios',
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Material Design Mode Settings
|
||||
IonicConfig.modeConfig('md', {
|
||||
|
||||
actionMenuEnter: 'action-menu-md-slide-in',
|
||||
actionMenuLeave: 'action-menu-md-slide-out',
|
||||
actionMenuCancelIcon: 'ion-close',
|
||||
actionMenuDestructiveIcon: 'ion-trash-a',
|
||||
|
||||
backButtonText: '',
|
||||
backButtonIcon: 'ion-android-arrow-back',
|
||||
|
||||
iconForward: '',
|
||||
iconMode: 'md',
|
||||
|
||||
keyboardScrollAssist: true,
|
||||
tapPolyfill: false,
|
||||
|
||||
navTitleAlign: 'left',
|
||||
tabBarPlacement: 'top',
|
||||
viewTransition: 'md'
|
||||
|
||||
type: 'overlay',
|
||||
mdRipple: true,
|
||||
});
|
@ -1,5 +1,6 @@
|
||||
|
||||
export * from './config/config'
|
||||
export * from './config/modes'
|
||||
export * from './config/annotations'
|
||||
|
||||
export * from './net/http'
|
||||
|
@ -4,15 +4,7 @@ import {Platform} from './platform';
|
||||
Platform.register({
|
||||
name: 'core',
|
||||
settings: {
|
||||
actionMenuEnter: 'action-menu-slide-in',
|
||||
actionMenuLeave: 'action-menu-slide-out',
|
||||
backButtonText: 'Back',
|
||||
backButtonIcon: 'ion-ios-arrow-back',
|
||||
forwardIcon: 'ion-ios-arrow-forward',
|
||||
mode: 'ios',
|
||||
iconMode: 'ios',
|
||||
navTitleAlign: 'center',
|
||||
viewTransition: 'ios'
|
||||
}
|
||||
});
|
||||
Platform.setDefault('core');
|
||||
@ -55,21 +47,7 @@ Platform.register({
|
||||
'tablet'
|
||||
],
|
||||
settings: {
|
||||
actionMenuEnter: 'action-menu-md-slide-in',
|
||||
actionMenuLeave: 'action-menu-md-slide-out',
|
||||
actionMenuCancelIcon: 'ion-close',
|
||||
actionMenuDestructiveIcon: 'ion-trash-a',
|
||||
backButtonText: '',
|
||||
backButtonIcon: 'ion-android-arrow-back',
|
||||
forwardIcon: '',
|
||||
mode: 'md',
|
||||
iconMode: 'md',
|
||||
type: 'overlay',
|
||||
keyboardScrollAssist: true,
|
||||
mdRipple: true,
|
||||
tabBarPlacement: 'top',
|
||||
navTitleAlign: 'left',
|
||||
viewTransition: 'md'
|
||||
},
|
||||
isMatch(p) {
|
||||
// "silk" is kindle fire
|
||||
@ -90,24 +68,12 @@ Platform.register({
|
||||
'iphone'
|
||||
],
|
||||
settings: {
|
||||
actionMenuEnter: 'action-menu-slide-in',
|
||||
actionMenuLeave: 'action-menu-slide-out',
|
||||
actionMenuCancelIcon: 'ion-close',
|
||||
actionMenuDestructiveIcon: 'ion-trash-a',
|
||||
backButtonText: 'Back',
|
||||
backButtonIcon: 'ion-ios-arrow-back',
|
||||
forwardIcon: 'ion-ios-arrow-forward',
|
||||
mode: 'ios',
|
||||
iconMode: 'ios',
|
||||
tapPolyfill: function() {
|
||||
// this ensures it's actually a physical iOS device
|
||||
// and not just an a spoofed user-agent string
|
||||
return /iphone|ipad|ipod/i.test(Platform.navigatorPlatform());
|
||||
},
|
||||
keyboardScrollAssist: true,
|
||||
viewTransition: 'ios',
|
||||
navTitleAlign: 'center',
|
||||
mdRipple: false
|
||||
},
|
||||
isMatch(p) {
|
||||
return p.isPlatform('ios', 'iphone|ipad|ipod');
|
||||
@ -147,8 +113,6 @@ Platform.register({
|
||||
],
|
||||
settings: {
|
||||
mode: 'wp',
|
||||
iconMode: 'md',
|
||||
viewTransition: 'md',
|
||||
},
|
||||
isMatch(p) {
|
||||
return p.isPlatform('windowsphone', 'windows phone');
|
||||
|
@ -86,7 +86,6 @@ export class Transition extends Animation {
|
||||
STATIC CLASSES
|
||||
*/
|
||||
static create(nav, opts = {}) {
|
||||
//const name = opts.animation || IonicConfig.global.setting('viewTransition') || 'ios';
|
||||
const name = opts.animation || 'ios';
|
||||
|
||||
let TransitionClass = TransitionRegistry[name];
|
||||
|
Reference in New Issue
Block a user