mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +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 "./badge";
|
||||
|
||||
|
||||
// iOS Badge
|
||||
// --------------------------------------------------
|
||||
|
@ -1,4 +1,6 @@
|
||||
@import "../../themes/ionic.globals.md";
|
||||
@import "./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";
|
||||
|
||||
|
||||
// Badge
|
||||
// --------------------------------------------------
|
||||
|
||||
@ -10,9 +11,14 @@ $badge-font-size: 1.3rem !default;
|
||||
$badge-font-weight: bold !default;
|
||||
|
||||
|
||||
ion-badge {
|
||||
ion-badge,
|
||||
:host {
|
||||
display: inline-block;
|
||||
visibility: inherit !important;
|
||||
contain: layout content;
|
||||
}
|
||||
|
||||
.badge {
|
||||
padding: 3px 8px;
|
||||
|
||||
min-width: 10px;
|
||||
@ -26,6 +32,7 @@ ion-badge {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
ion-badge:empty {
|
||||
ion-badge:empty,
|
||||
:host(:empty) {
|
||||
display: none;
|
||||
}
|
||||
|
@ -1,23 +1,12 @@
|
||||
import { Directive, ElementRef, Renderer } from '@angular/core';
|
||||
|
||||
import { Config } from '../../config/config';
|
||||
import { Ion } from '../ion';
|
||||
import { Component } from '../../util/decorators';
|
||||
|
||||
|
||||
/**
|
||||
* @name Badge
|
||||
* @module ionic
|
||||
* @description
|
||||
* 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.
|
||||
* @see {@link /docs/components/#badges Badges Component Docs}
|
||||
*/
|
||||
@Directive({
|
||||
selector: 'ion-badge'
|
||||
})
|
||||
export class Badge extends Ion {
|
||||
|
||||
constructor(config: Config, elementRef: ElementRef, renderer: Renderer) {
|
||||
super(config, elementRef, renderer, 'badge');
|
||||
@Component({
|
||||
tag: 'ion-badge',
|
||||
styleUrls: {
|
||||
ios: 'badge.ios.scss',
|
||||
md: 'badge.md.scss',
|
||||
wp: 'badge.wp.scss'
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
export class Badge {}
|
||||
|
@ -1,4 +1,6 @@
|
||||
@import "../../themes/ionic.globals.wp";
|
||||
@import "./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 { IonicApp, IonicModule } from '../../../../..';
|
||||
|
||||
@ -14,6 +14,7 @@ import { PageOneModule } from '../pages/page-one/page-one.module';
|
||||
IonicModule.forRoot(AppComponent),
|
||||
PageOneModule
|
||||
],
|
||||
bootstrap: [IonicApp]
|
||||
bootstrap: [IonicApp],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class AppModule {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { IonicPageModule } from '../../../../../..';
|
||||
|
||||
import { PageOne } from './page-one';
|
||||
@ -12,6 +12,9 @@ import { PageOne } from './page-one';
|
||||
],
|
||||
entryComponents: [
|
||||
PageOne,
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
})
|
||||
export class PageOneModule {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
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 { Tab } from './tab';
|
||||
@ -12,7 +11,6 @@ import { Tabs } from './tabs';
|
||||
/** @hidden */
|
||||
@NgModule({
|
||||
imports: [
|
||||
BadgeModule,
|
||||
CommonModule,
|
||||
IconModule
|
||||
],
|
||||
@ -27,7 +25,8 @@ import { Tabs } from './tabs';
|
||||
TabButton,
|
||||
TabHighlight,
|
||||
Tabs
|
||||
]
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class TabsModule {
|
||||
public static forRoot(): ModuleWithProviders {
|
||||
|
13
src/index.ts
13
src/index.ts
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* 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 { DOCUMENT } from '@angular/platform-browser';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
@ -38,6 +38,7 @@ import { PickerController } from './components/picker/picker-controller';
|
||||
import { Platform, setupPlatform } from './platform/platform';
|
||||
import { PlatformConfigToken, providePlatformConfigs } from './platform/platform-registry';
|
||||
import { PopoverController } from './components/popover/popover-controller';
|
||||
import { setupCore } from './util/ionic-core';
|
||||
import { TapClick, setupTapClick } from './tap-click/tap-click';
|
||||
import { ToastController } from './components/toast/toast-controller';
|
||||
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 { AvatarModule } from './components/avatar/avatar.module';
|
||||
import { BackdropModule } from './components/backdrop/backdrop.module';
|
||||
import { BadgeModule } from './components/badge/badge.module';
|
||||
import { ButtonModule } from './components/button/button.module';
|
||||
import { CardModule } from './components/card/card.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 { AvatarModule } from './components/avatar/avatar.module';
|
||||
export { BackdropModule } from './components/backdrop/backdrop.module';
|
||||
export { BadgeModule } from './components/badge/badge.module';
|
||||
export { ButtonModule } from './components/button/button.module';
|
||||
export { CardModule } from './components/card/card.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 { Avatar } from './components/avatar/avatar';
|
||||
export { Backdrop } from './components/backdrop/backdrop';
|
||||
export { Badge } from './components/badge/badge';
|
||||
export { Button } from './components/button/button';
|
||||
export { Card } from './components/card/card';
|
||||
export { CardContent } from './components/card/card-content';
|
||||
@ -248,6 +246,7 @@ export { Slide } from './components/slides/slide';
|
||||
export { Slides } from './components/slides/slides';
|
||||
export { Spinner } from './components/spinner/spinner';
|
||||
export { SplitPane, RootNode } from './components/split-pane/split-pane';
|
||||
export { setupCore } from './util/ionic-core';
|
||||
export { Tab } from './components/tabs/tab';
|
||||
export { TabButton } from './components/tabs/tab-button';
|
||||
export { TabHighlight } from './components/tabs/tab-highlight';
|
||||
@ -378,7 +377,6 @@ export { IonicGestureConfig } from './gestures/gesture-config';
|
||||
AppModule.forRoot(),
|
||||
AvatarModule.forRoot(),
|
||||
BackdropModule.forRoot(),
|
||||
BadgeModule.forRoot(),
|
||||
ButtonModule.forRoot(),
|
||||
CardModule.forRoot(),
|
||||
CheckboxModule.forRoot(),
|
||||
@ -433,7 +431,6 @@ export { IonicGestureConfig } from './gestures/gesture-config';
|
||||
AppModule,
|
||||
AvatarModule,
|
||||
BackdropModule,
|
||||
BadgeModule,
|
||||
ButtonModule,
|
||||
CardModule,
|
||||
CheckboxModule,
|
||||
@ -477,6 +474,9 @@ export { IonicGestureConfig } from './gestures/gesture-config';
|
||||
ToolbarModule,
|
||||
TypographyModule,
|
||||
VirtualScrollModule
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
})
|
||||
export class IonicModule {
|
||||
@ -509,6 +509,7 @@ export class IonicModule {
|
||||
{ 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: setupPreloading, deps: [ Config, DeepLinkConfigToken, ModuleLoader, NgZone ], multi: true },
|
||||
{ provide: APP_INITIALIZER, useFactory: setupCore, deps: [ Config, Platform, DomController, NgZone ], multi: true },
|
||||
|
||||
// useClass
|
||||
// { provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig },
|
||||
|
@ -17,6 +17,9 @@
|
||||
"src/**/*.ts",
|
||||
"demos/src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"src/badge/**/*"
|
||||
],
|
||||
"compileOnSave": false,
|
||||
"buildOnSave": false,
|
||||
"atom": {
|
||||
|
Reference in New Issue
Block a user