mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
feat(badge): update badge to ionic core
This commit is contained in:
@ -449,3 +449,11 @@ ion-footer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Core Components
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
ion-badge {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
@import "../../themes/ionic.globals.ios";
|
@import "../../themes/ionic.globals.ios";
|
||||||
|
@import "./badge";
|
||||||
|
|
||||||
|
|
||||||
// iOS Badge
|
// iOS Badge
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
@import "../../themes/ionic.globals.md";
|
@import "../../themes/ionic.globals.md";
|
||||||
|
@import "./badge";
|
||||||
|
|
||||||
|
|
||||||
// Material Design Badge
|
// Material Design Badge
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
|
||||||
|
|
||||||
import { Badge } from './badge';
|
|
||||||
|
|
||||||
/** @hidden */
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
Badge
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
Badge
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class BadgeModule {
|
|
||||||
public static forRoot(): ModuleWithProviders {
|
|
||||||
return {
|
|
||||||
ngModule: BadgeModule, providers: []
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
@import "../../themes/ionic.globals";
|
@import "../../themes/ionic.globals";
|
||||||
|
|
||||||
|
|
||||||
// Badge
|
// Badge
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
@ -10,9 +11,14 @@ $badge-font-size: 1.3rem !default;
|
|||||||
$badge-font-weight: bold !default;
|
$badge-font-weight: bold !default;
|
||||||
|
|
||||||
|
|
||||||
ion-badge {
|
ion-badge,
|
||||||
|
:host {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
visibility: inherit !important;
|
||||||
|
contain: layout content;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
padding: 3px 8px;
|
padding: 3px 8px;
|
||||||
|
|
||||||
min-width: 10px;
|
min-width: 10px;
|
||||||
@ -26,6 +32,7 @@ ion-badge {
|
|||||||
vertical-align: baseline;
|
vertical-align: baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
ion-badge:empty {
|
ion-badge:empty,
|
||||||
|
:host(:empty) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,12 @@
|
|||||||
import { Directive, ElementRef, Renderer } from '@angular/core';
|
import { Component } from '../../util/decorators';
|
||||||
|
|
||||||
import { Config } from '../../config/config';
|
|
||||||
import { Ion } from '../ion';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
@Component({
|
||||||
* @name Badge
|
tag: 'ion-badge',
|
||||||
* @module ionic
|
styleUrls: {
|
||||||
* @description
|
ios: 'badge.ios.scss',
|
||||||
* Badges are simple components in Ionic containing numbers or text. You can display a badge to indicate that there is new information associated with the item it is on.
|
md: 'badge.md.scss',
|
||||||
* @see {@link /docs/components/#badges Badges Component Docs}
|
wp: 'badge.wp.scss'
|
||||||
*/
|
|
||||||
@Directive({
|
|
||||||
selector: 'ion-badge'
|
|
||||||
})
|
|
||||||
export class Badge extends Ion {
|
|
||||||
|
|
||||||
constructor(config: Config, elementRef: ElementRef, renderer: Renderer) {
|
|
||||||
super(config, elementRef, renderer, 'badge');
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
export class Badge {}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
@import "../../themes/ionic.globals.wp";
|
@import "../../themes/ionic.globals.wp";
|
||||||
|
@import "./badge";
|
||||||
|
|
||||||
|
|
||||||
// Windows Badge
|
// Windows Badge
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { IonicApp, IonicModule } from '../../../../..';
|
import { IonicApp, IonicModule } from '../../../../..';
|
||||||
|
|
||||||
@ -14,6 +14,7 @@ import { PageOneModule } from '../pages/page-one/page-one.module';
|
|||||||
IonicModule.forRoot(AppComponent),
|
IonicModule.forRoot(AppComponent),
|
||||||
PageOneModule
|
PageOneModule
|
||||||
],
|
],
|
||||||
bootstrap: [IonicApp]
|
bootstrap: [IonicApp],
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { IonicPageModule } from '../../../../../..';
|
import { IonicPageModule } from '../../../../../..';
|
||||||
|
|
||||||
import { PageOne } from './page-one';
|
import { PageOne } from './page-one';
|
||||||
@ -12,6 +12,9 @@ import { PageOne } from './page-one';
|
|||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
PageOne,
|
PageOne,
|
||||||
|
],
|
||||||
|
schemas: [
|
||||||
|
CUSTOM_ELEMENTS_SCHEMA
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class PageOneModule {}
|
export class PageOneModule {}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
import { NgModule, ModuleWithProviders, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
|
|
||||||
import { BadgeModule } from '../badge/badge.module';
|
|
||||||
import { IconModule } from '../icon/icon.module';
|
import { IconModule } from '../icon/icon.module';
|
||||||
|
|
||||||
import { Tab } from './tab';
|
import { Tab } from './tab';
|
||||||
@ -12,7 +11,6 @@ import { Tabs } from './tabs';
|
|||||||
/** @hidden */
|
/** @hidden */
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
BadgeModule,
|
|
||||||
CommonModule,
|
CommonModule,
|
||||||
IconModule
|
IconModule
|
||||||
],
|
],
|
||||||
@ -27,7 +25,8 @@ import { Tabs } from './tabs';
|
|||||||
TabButton,
|
TabButton,
|
||||||
TabHighlight,
|
TabHighlight,
|
||||||
Tabs
|
Tabs
|
||||||
]
|
],
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
})
|
})
|
||||||
export class TabsModule {
|
export class TabsModule {
|
||||||
public static forRoot(): ModuleWithProviders {
|
public static forRoot(): ModuleWithProviders {
|
||||||
|
13
src/index.ts
13
src/index.ts
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Import Angular
|
* Import Angular
|
||||||
*/
|
*/
|
||||||
import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_INITIALIZER, ComponentFactoryResolver, Inject, Injector, ModuleWithProviders, NgModule, NgZone, Optional } from '@angular/core';
|
import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_INITIALIZER, ComponentFactoryResolver, CUSTOM_ELEMENTS_SCHEMA, Inject, Injector, ModuleWithProviders, NgModule, NgZone, Optional } from '@angular/core';
|
||||||
import { APP_BASE_HREF, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, PlatformLocation } from '@angular/common';
|
import { APP_BASE_HREF, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, PlatformLocation } from '@angular/common';
|
||||||
import { DOCUMENT } from '@angular/platform-browser';
|
import { DOCUMENT } from '@angular/platform-browser';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
@ -38,6 +38,7 @@ import { PickerController } from './components/picker/picker-controller';
|
|||||||
import { Platform, setupPlatform } from './platform/platform';
|
import { Platform, setupPlatform } from './platform/platform';
|
||||||
import { PlatformConfigToken, providePlatformConfigs } from './platform/platform-registry';
|
import { PlatformConfigToken, providePlatformConfigs } from './platform/platform-registry';
|
||||||
import { PopoverController } from './components/popover/popover-controller';
|
import { PopoverController } from './components/popover/popover-controller';
|
||||||
|
import { setupCore } from './util/ionic-core';
|
||||||
import { TapClick, setupTapClick } from './tap-click/tap-click';
|
import { TapClick, setupTapClick } from './tap-click/tap-click';
|
||||||
import { ToastController } from './components/toast/toast-controller';
|
import { ToastController } from './components/toast/toast-controller';
|
||||||
import { registerModeConfigs } from './config/mode-registry';
|
import { registerModeConfigs } from './config/mode-registry';
|
||||||
@ -53,7 +54,6 @@ import { AlertModule } from './components/alert/alert.module';
|
|||||||
import { AppModule } from './components/app/app.module';
|
import { AppModule } from './components/app/app.module';
|
||||||
import { AvatarModule } from './components/avatar/avatar.module';
|
import { AvatarModule } from './components/avatar/avatar.module';
|
||||||
import { BackdropModule } from './components/backdrop/backdrop.module';
|
import { BackdropModule } from './components/backdrop/backdrop.module';
|
||||||
import { BadgeModule } from './components/badge/badge.module';
|
|
||||||
import { ButtonModule } from './components/button/button.module';
|
import { ButtonModule } from './components/button/button.module';
|
||||||
import { CardModule } from './components/card/card.module';
|
import { CardModule } from './components/card/card.module';
|
||||||
import { CheckboxModule } from './components/checkbox/checkbox.module';
|
import { CheckboxModule } from './components/checkbox/checkbox.module';
|
||||||
@ -107,7 +107,6 @@ export { AlertModule } from './components/alert/alert.module';
|
|||||||
export { AppModule } from './components/app/app.module';
|
export { AppModule } from './components/app/app.module';
|
||||||
export { AvatarModule } from './components/avatar/avatar.module';
|
export { AvatarModule } from './components/avatar/avatar.module';
|
||||||
export { BackdropModule } from './components/backdrop/backdrop.module';
|
export { BackdropModule } from './components/backdrop/backdrop.module';
|
||||||
export { BadgeModule } from './components/badge/badge.module';
|
|
||||||
export { ButtonModule } from './components/button/button.module';
|
export { ButtonModule } from './components/button/button.module';
|
||||||
export { CardModule } from './components/card/card.module';
|
export { CardModule } from './components/card/card.module';
|
||||||
export { CheckboxModule } from './components/checkbox/checkbox.module';
|
export { CheckboxModule } from './components/checkbox/checkbox.module';
|
||||||
@ -164,7 +163,6 @@ export { AlertOptions, AlertInputOptions } from './components/alert/alert-option
|
|||||||
export { App } from './components/app/app';
|
export { App } from './components/app/app';
|
||||||
export { Avatar } from './components/avatar/avatar';
|
export { Avatar } from './components/avatar/avatar';
|
||||||
export { Backdrop } from './components/backdrop/backdrop';
|
export { Backdrop } from './components/backdrop/backdrop';
|
||||||
export { Badge } from './components/badge/badge';
|
|
||||||
export { Button } from './components/button/button';
|
export { Button } from './components/button/button';
|
||||||
export { Card } from './components/card/card';
|
export { Card } from './components/card/card';
|
||||||
export { CardContent } from './components/card/card-content';
|
export { CardContent } from './components/card/card-content';
|
||||||
@ -248,6 +246,7 @@ export { Slide } from './components/slides/slide';
|
|||||||
export { Slides } from './components/slides/slides';
|
export { Slides } from './components/slides/slides';
|
||||||
export { Spinner } from './components/spinner/spinner';
|
export { Spinner } from './components/spinner/spinner';
|
||||||
export { SplitPane, RootNode } from './components/split-pane/split-pane';
|
export { SplitPane, RootNode } from './components/split-pane/split-pane';
|
||||||
|
export { setupCore } from './util/ionic-core';
|
||||||
export { Tab } from './components/tabs/tab';
|
export { Tab } from './components/tabs/tab';
|
||||||
export { TabButton } from './components/tabs/tab-button';
|
export { TabButton } from './components/tabs/tab-button';
|
||||||
export { TabHighlight } from './components/tabs/tab-highlight';
|
export { TabHighlight } from './components/tabs/tab-highlight';
|
||||||
@ -378,7 +377,6 @@ export { IonicGestureConfig } from './gestures/gesture-config';
|
|||||||
AppModule.forRoot(),
|
AppModule.forRoot(),
|
||||||
AvatarModule.forRoot(),
|
AvatarModule.forRoot(),
|
||||||
BackdropModule.forRoot(),
|
BackdropModule.forRoot(),
|
||||||
BadgeModule.forRoot(),
|
|
||||||
ButtonModule.forRoot(),
|
ButtonModule.forRoot(),
|
||||||
CardModule.forRoot(),
|
CardModule.forRoot(),
|
||||||
CheckboxModule.forRoot(),
|
CheckboxModule.forRoot(),
|
||||||
@ -433,7 +431,6 @@ export { IonicGestureConfig } from './gestures/gesture-config';
|
|||||||
AppModule,
|
AppModule,
|
||||||
AvatarModule,
|
AvatarModule,
|
||||||
BackdropModule,
|
BackdropModule,
|
||||||
BadgeModule,
|
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
CardModule,
|
CardModule,
|
||||||
CheckboxModule,
|
CheckboxModule,
|
||||||
@ -477,6 +474,9 @@ export { IonicGestureConfig } from './gestures/gesture-config';
|
|||||||
ToolbarModule,
|
ToolbarModule,
|
||||||
TypographyModule,
|
TypographyModule,
|
||||||
VirtualScrollModule
|
VirtualScrollModule
|
||||||
|
],
|
||||||
|
schemas: [
|
||||||
|
CUSTOM_ELEMENTS_SCHEMA
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class IonicModule {
|
export class IonicModule {
|
||||||
@ -509,6 +509,7 @@ export class IonicModule {
|
|||||||
{ provide: APP_INITIALIZER, useFactory: setupProvideEvents, deps: [ Platform, DomController ], multi: true },
|
{ provide: APP_INITIALIZER, useFactory: setupProvideEvents, deps: [ Platform, DomController ], multi: true },
|
||||||
{ provide: APP_INITIALIZER, useFactory: setupTapClick, deps: [ Config, Platform, DomController, App, NgZone, GestureController ], multi: true },
|
{ provide: APP_INITIALIZER, useFactory: setupTapClick, deps: [ Config, Platform, DomController, App, NgZone, GestureController ], multi: true },
|
||||||
{ provide: APP_INITIALIZER, useFactory: setupPreloading, deps: [ Config, DeepLinkConfigToken, ModuleLoader, NgZone ], multi: true },
|
{ provide: APP_INITIALIZER, useFactory: setupPreloading, deps: [ Config, DeepLinkConfigToken, ModuleLoader, NgZone ], multi: true },
|
||||||
|
{ provide: APP_INITIALIZER, useFactory: setupCore, deps: [ Config, Platform, DomController, NgZone ], multi: true },
|
||||||
|
|
||||||
// useClass
|
// useClass
|
||||||
// { provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig },
|
// { provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig },
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"demos/src/**/*.ts"
|
"demos/src/**/*.ts"
|
||||||
],
|
],
|
||||||
|
"exclude": [
|
||||||
|
"src/badge/**/*"
|
||||||
|
],
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"buildOnSave": false,
|
"buildOnSave": false,
|
||||||
"atom": {
|
"atom": {
|
||||||
|
Reference in New Issue
Block a user