mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
@ -136,8 +136,10 @@ function initApp(window, document, config) {
|
|||||||
Platform.navigatorPlatform(window.navigator.platform);
|
Platform.navigatorPlatform(window.navigator.platform);
|
||||||
Platform.load(config);
|
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);
|
window.addEventListener('resize', Platform.winResize);
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ import {dom} from 'ionic/util'
|
|||||||
})
|
})
|
||||||
export class Aside extends Ion {
|
export class Aside extends Ion {
|
||||||
|
|
||||||
constructor(elementRef: ElementRef, ionicConfig: IonicConfig) {
|
constructor(elementRef: ElementRef, config: IonicConfig) {
|
||||||
super(elementRef, ionicConfig);
|
super(elementRef, config);
|
||||||
|
|
||||||
this.opening = new EventEmitter('opening');
|
this.opening = new EventEmitter('opening');
|
||||||
|
|
||||||
@ -133,8 +133,8 @@ export class Aside extends Ion {
|
|||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class AsideBackdrop extends Ion {
|
export class AsideBackdrop extends Ion {
|
||||||
constructor(elementRef: ElementRef, ionicConfig: IonicConfig, @Host() aside: Aside) {
|
constructor(elementRef: ElementRef, config: IonicConfig, @Host() aside: Aside) {
|
||||||
super(elementRef, ionicConfig);
|
super(elementRef, config);
|
||||||
|
|
||||||
aside.backdrop = this;
|
aside.backdrop = this;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ export class IconDirective {
|
|||||||
this.ariaHidden = true;
|
this.ariaHidden = true;
|
||||||
|
|
||||||
if (forward !== null) {
|
if (forward !== null) {
|
||||||
this.fwdIcon = config.setting('forwardIcon');
|
this.iconFwd = config.setting('iconForward');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hostButton) {
|
if (hostButton) {
|
||||||
@ -103,8 +103,8 @@ export class IconDirective {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onInit() {
|
onInit() {
|
||||||
if (this.fwdIcon) {
|
if (this.iconFwd) {
|
||||||
this.name = this.fwdIcon;
|
this.name = this.iconFwd;
|
||||||
}
|
}
|
||||||
if (!this.name) return;
|
if (!this.name) return;
|
||||||
|
|
||||||
|
@ -65,10 +65,22 @@ export class IonicConfig {
|
|||||||
let platformValue = undefined;
|
let platformValue = undefined;
|
||||||
for (let i = 0; i < activePlatformKeys.length; i++) {
|
for (let i = 0; i < activePlatformKeys.length; i++) {
|
||||||
platformObj = platformSettings[ activePlatformKeys[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];
|
platformValue = platformObj[arg0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if (isDefined(platformValue)) {
|
if (isDefined(platformValue)) {
|
||||||
settings[arg0] = platformValue;
|
settings[arg0] = platformValue;
|
||||||
}
|
}
|
||||||
@ -132,14 +144,20 @@ export class IonicConfig {
|
|||||||
this._settings.platforms = extend(platform.settings(), this._settings.platforms || {});
|
this._settings.platforms = extend(platform.settings(), this._settings.platforms || {});
|
||||||
}
|
}
|
||||||
|
|
||||||
static set global(config) {
|
static modeConfig(mode, config) {
|
||||||
globalConfig = config;
|
const args = arguments;
|
||||||
|
|
||||||
|
if (args.length === 2) {
|
||||||
|
// modeConfig('ios', {...})
|
||||||
|
modeConfigs[mode] = extend(modeConfigs[mode] || {}, config);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// modeConfig('ios')
|
||||||
|
return modeConfigs[mode];
|
||||||
}
|
}
|
||||||
|
|
||||||
static get global() {
|
|
||||||
return globalConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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/config'
|
||||||
|
export * from './config/modes'
|
||||||
export * from './config/annotations'
|
export * from './config/annotations'
|
||||||
|
|
||||||
export * from './net/http'
|
export * from './net/http'
|
||||||
|
@ -4,15 +4,7 @@ import {Platform} from './platform';
|
|||||||
Platform.register({
|
Platform.register({
|
||||||
name: 'core',
|
name: 'core',
|
||||||
settings: {
|
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',
|
mode: 'ios',
|
||||||
iconMode: 'ios',
|
|
||||||
navTitleAlign: 'center',
|
|
||||||
viewTransition: 'ios'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Platform.setDefault('core');
|
Platform.setDefault('core');
|
||||||
@ -55,21 +47,7 @@ Platform.register({
|
|||||||
'tablet'
|
'tablet'
|
||||||
],
|
],
|
||||||
settings: {
|
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',
|
mode: 'md',
|
||||||
iconMode: 'md',
|
|
||||||
type: 'overlay',
|
|
||||||
keyboardScrollAssist: true,
|
|
||||||
mdRipple: true,
|
|
||||||
tabBarPlacement: 'top',
|
|
||||||
navTitleAlign: 'left',
|
|
||||||
viewTransition: 'md'
|
|
||||||
},
|
},
|
||||||
isMatch(p) {
|
isMatch(p) {
|
||||||
// "silk" is kindle fire
|
// "silk" is kindle fire
|
||||||
@ -90,24 +68,12 @@ Platform.register({
|
|||||||
'iphone'
|
'iphone'
|
||||||
],
|
],
|
||||||
settings: {
|
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',
|
mode: 'ios',
|
||||||
iconMode: 'ios',
|
|
||||||
tapPolyfill: function() {
|
tapPolyfill: function() {
|
||||||
// this ensures it's actually a physical iOS device
|
// this ensures it's actually a physical iOS device
|
||||||
// and not just an a spoofed user-agent string
|
// and not just an a spoofed user-agent string
|
||||||
return /iphone|ipad|ipod/i.test(Platform.navigatorPlatform());
|
return /iphone|ipad|ipod/i.test(Platform.navigatorPlatform());
|
||||||
},
|
},
|
||||||
keyboardScrollAssist: true,
|
|
||||||
viewTransition: 'ios',
|
|
||||||
navTitleAlign: 'center',
|
|
||||||
mdRipple: false
|
|
||||||
},
|
},
|
||||||
isMatch(p) {
|
isMatch(p) {
|
||||||
return p.isPlatform('ios', 'iphone|ipad|ipod');
|
return p.isPlatform('ios', 'iphone|ipad|ipod');
|
||||||
@ -147,8 +113,6 @@ Platform.register({
|
|||||||
],
|
],
|
||||||
settings: {
|
settings: {
|
||||||
mode: 'wp',
|
mode: 'wp',
|
||||||
iconMode: 'md',
|
|
||||||
viewTransition: 'md',
|
|
||||||
},
|
},
|
||||||
isMatch(p) {
|
isMatch(p) {
|
||||||
return p.isPlatform('windowsphone', 'windows phone');
|
return p.isPlatform('windowsphone', 'windows phone');
|
||||||
|
@ -86,7 +86,6 @@ export class Transition extends Animation {
|
|||||||
STATIC CLASSES
|
STATIC CLASSES
|
||||||
*/
|
*/
|
||||||
static create(nav, opts = {}) {
|
static create(nav, opts = {}) {
|
||||||
//const name = opts.animation || IonicConfig.global.setting('viewTransition') || 'ios';
|
|
||||||
const name = opts.animation || 'ios';
|
const name = opts.animation || 'ios';
|
||||||
|
|
||||||
let TransitionClass = TransitionRegistry[name];
|
let TransitionClass = TransitionRegistry[name];
|
||||||
|
Reference in New Issue
Block a user