Skip to content

Commit

Permalink
feat(module: all): export components API publicly (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisherspy committed Apr 23, 2019
1 parent 0c3ad0f commit dd9af23
Show file tree
Hide file tree
Showing 145 changed files with 446 additions and 216 deletions.
1 change: 1 addition & 0 deletions components/accordion/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public-api';
4 changes: 4 additions & 0 deletions components/accordion/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './accordion.module';
export * from './accordion.service';
export * from './accordion.component';
export * from './accordion-group/accordion-group.component';
1 change: 1 addition & 0 deletions components/action-sheet/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public-api';
File renamed without changes.
5 changes: 5 additions & 0 deletions components/action-sheet/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './action-sheet.module';
export * from './action-sheet.service';
export * from './action-sheet.component';
export * from './action-sheet-subject.service';
export * from './action-sheet-options.provider';
1 change: 1 addition & 0 deletions components/activity-indicator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public-api';
2 changes: 2 additions & 0 deletions components/activity-indicator/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './activity-indicator.module';
export * from './activity-indicator.component';
1 change: 1 addition & 0 deletions components/badge/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public-api';
2 changes: 2 additions & 0 deletions components/badge/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './badge.module';
export * from './badge.component';
1 change: 1 addition & 0 deletions components/button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public-api';
2 changes: 2 additions & 0 deletions components/button/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './button.module';
export * from './button.component';
46 changes: 23 additions & 23 deletions components/calendar/calendar.module.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IconModule } from '../icon/icon.module';
import { CalendarComponent } from './calendar.component';
import { HeaderComponent } from './header/header.component';
import { DatePickerComponent } from './datepicker/datepicker.component';
import { TimePickerComponent } from './timepicker/timepicker.component';
import { WeekPanelComponent } from './week-panel/week-panel.component';
import { ConfirmPanelComponent } from './confirm-panel/confirm-panel.component';
import { SingleMonthComponent } from './single-month/single-month.component';
import { ShortcutPanelComponent } from './shortcut-panel/shortcut-panel.component';
import { DatePickerViewModule } from '../date-picker-view/date-picker-view.module';
import { CalendarHeaderComponent } from './header/header.component';
import { CalendarWeekPanelComponent } from './week-panel/week-panel.component';
import { CalendarDatePickerComponent } from './datepicker/datepicker.component';
import { CalendarTimePickerComponent } from './timepicker/timepicker.component';
import { LocaleProviderModule } from '../locale-provider/locale-provider.module';
import { IconModule } from '../icon/icon.module';
import { DatePickerViewModule } from '../date-picker-view/date-picker-view.module';
import { CalendarSingleMonthComponent } from './single-month/single-month.component';
import { CalendarConfirmPanelComponent } from './confirm-panel/confirm-panel.component';
import { CalendarShortcutPanelComponent } from './shortcut-panel/shortcut-panel.component';

@NgModule({
imports: [CommonModule, IconModule, DatePickerViewModule, LocaleProviderModule],
declarations: [
CalendarComponent,
HeaderComponent,
DatePickerComponent,
WeekPanelComponent,
SingleMonthComponent,
ConfirmPanelComponent,
TimePickerComponent,
ShortcutPanelComponent
CalendarHeaderComponent,
CalendarWeekPanelComponent,
CalendarDatePickerComponent,
CalendarTimePickerComponent,
CalendarSingleMonthComponent,
CalendarConfirmPanelComponent,
CalendarShortcutPanelComponent
],
exports: [
CalendarComponent,
HeaderComponent,
DatePickerComponent,
WeekPanelComponent,
SingleMonthComponent,
ConfirmPanelComponent,
TimePickerComponent,
ShortcutPanelComponent
CalendarHeaderComponent,
CalendarWeekPanelComponent,
CalendarDatePickerComponent,
CalendarTimePickerComponent,
CalendarSingleMonthComponent,
CalendarConfirmPanelComponent,
CalendarShortcutPanelComponent
],
providers: [LocaleProviderModule]
})
Expand Down
12 changes: 12 additions & 0 deletions components/calendar/confirm-panel/PropsType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Models } from '../date/DataTypes';

export interface CalendarConfirmPanelPropsType {
type?: 'one' | 'range';
locale: Models.Locale;
onlyConfirm?: boolean;
disableBtn?: boolean;
startDateTime?: Date;
endDateTime?: Date;
formatStr?: string;
onConfirm: () => void;
}
19 changes: 4 additions & 15 deletions components/calendar/confirm-panel/confirm-panel.component.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
import { Component, ViewEncapsulation, Input, HostBinding } from '@angular/core';
import { formatDate } from '../util/index';
import { Models } from '../date/DataTypes';

export interface ConfirmPanelPropsType {
type?: 'one' | 'range';
locale: Models.Locale;
onlyConfirm?: boolean;
disableBtn?: boolean;
startDateTime?: Date;
endDateTime?: Date;
formatStr?: string;
onConfirm: () => void;
}
import { CalendarConfirmPanelPropsType } from './PropsType';

@Component({
selector: 'CalendarConfirmPanel, nzm-calendar-confirm-panel',
templateUrl: './confirm-panel.component.html',
encapsulation: ViewEncapsulation.None
})

export class ConfirmPanelComponent {
export class CalendarConfirmPanelComponent {
props = {
formatStr: 'yyyy-MM-dd hh:mm'
} as ConfirmPanelPropsType;
} as CalendarConfirmPanelPropsType;
startTimeStr: string;
endTimeStr: string;
btnCls: string;
Expand Down Expand Up @@ -59,7 +48,7 @@ export class ConfirmPanelComponent {

@HostBinding('class.confirm-panel') confirmPane: boolean = true;

constructor() {}
constructor() { }

formatTime() {
const { type, locale, disableBtn } = this.props;
Expand Down
4 changes: 2 additions & 2 deletions components/calendar/datepicker/datepicker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<div #panel [ngStyle]="{transform: transform}">
<div *ngIf="canLoadPrev()" class="load-tip">{{props.locale.loadPrevMonth}}</div>
<div class="months">
<SingleMonth *ngFor="let item of visibleMonth;let i = index;"
<CalendarSingleMonth *ngFor="let item of visibleMonth;let i = index;"
style="display: block;"
[data]="item.component"
></SingleMonth>
></CalendarSingleMonth>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion components/calendar/datepicker/datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import DatePicker from './datepicker.base.component';
templateUrl: './datepicker.component.html',
encapsulation: ViewEncapsulation.None
})
export class DatePickerComponent extends DatePicker implements OnInit {
export class CalendarDatePickerComponent extends DatePicker implements OnInit {
constructor() {
super();
}
Expand Down
2 changes: 1 addition & 1 deletion components/calendar/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Models } from '../date/DataTypes';
templateUrl: './header.component.html',
encapsulation: ViewEncapsulation.None
})
export class HeaderComponent {
export class CalendarHeaderComponent {
title: string;
closeIcon_component: boolean = false;
clearIcon: any;
Expand Down
1 change: 1 addition & 0 deletions components/calendar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public-api';
4 changes: 4 additions & 0 deletions components/calendar/locale/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as en_US } from './en_US';
export { default as sv_SE } from './pt_BR';
export { default as zh_CN } from './zh_CN';
export { default as da_DK } from './da_DK';
17 changes: 17 additions & 0 deletions components/calendar/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export * from './util/index';
export * from './date/DataTypes';
export * from './calendar.module';
export * from './calendar.component';
export * from './header/header.component';
export * from './calendar.props.component';
export * from './datepicker/datepicker.component';
export * from './week-panel/week-panel.component';
export * from './timepicker/PropsType';
export * from './timepicker/timepicker.component';
export * from './single-month/PropsType';
export * from './single-month/single-month.component';
export * from './datepicker/datepicker.props.component';
export * from './confirm-panel/PropsType';
export * from './confirm-panel/confirm-panel.component';
export * from './shortcut-panel/PropsType';
export * from './shortcut-panel/shortcut-panel.component';
6 changes: 6 additions & 0 deletions components/calendar/shortcut-panel/PropsType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Models } from '../date/DataTypes';

export interface CalendarShortcutPanelPropsType {
locale: Models.Locale;
onSelect: (startDate?: Date, endDate?: Date) => void;
}
13 changes: 4 additions & 9 deletions components/calendar/shortcut-panel/shortcut-panel.component.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { Component, ViewEncapsulation, HostBinding, Input } from '@angular/core';
import { Models } from '../date/DataTypes';

export interface PropsType {
locale: Models.Locale;
onSelect: (startDate?: Date, endDate?: Date) => void;
}
import { CalendarShortcutPanelPropsType } from './PropsType';

@Component({
selector: 'CalendarShortcutPanel, nzm-calendar-shortcut-panel',
templateUrl: './shortcut-panel.component.html',
encapsulation: ViewEncapsulation.None
})
export class ShortcutPanelComponent {
props = {} as PropsType;
export class CalendarShortcutPanelComponent {
props = {} as CalendarShortcutPanelPropsType;

@Input()
set locale(value) {
Expand All @@ -25,7 +20,7 @@ export class ShortcutPanelComponent {

@HostBinding('class.shortcut-panel') shortcutPanel: boolean = true;

constructor() {}
constructor() { }

onClick = (type: string) => {
const { onSelect } = this.props;
Expand Down
10 changes: 10 additions & 0 deletions components/calendar/single-month/PropsType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Models } from '../date/DataTypes';

export interface CalendarSingleMonthPropsType {
locale: Models.Locale;
monthData: Models.MonthData;
rowSize?: 'normal' | 'xl';
getDateExtra?: (date: Date) => Models.ExtraData;
onCellClick?: (data: Models.CellData, monthData: Models.MonthData) => void;
ref: any;
}
18 changes: 5 additions & 13 deletions components/calendar/single-month/single-month.component.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
import { Component, OnInit, ViewEncapsulation, HostBinding, Input, ElementRef, AfterViewInit } from '@angular/core';
import { Models } from '../date/DataTypes';

export interface PropsType {
locale: Models.Locale;
monthData: Models.MonthData;
rowSize?: 'normal' | 'xl';
getDateExtra?: (date: Date) => Models.ExtraData;
onCellClick?: (data: Models.CellData, monthData: Models.MonthData) => void;
ref: any;
}
import { CalendarSingleMonthPropsType } from './PropsType';

@Component({
selector: 'SingleMonth, nzm-single-month',
selector: 'CalendarSingleMonth, nzm-single-month',
templateUrl: './single-month.component.html',
encapsulation: ViewEncapsulation.None
})
export class SingleMonthComponent implements OnInit, AfterViewInit {
export class CalendarSingleMonthComponent implements OnInit, AfterViewInit {
props = {
rowSize: 'normal'
} as PropsType;
} as CalendarSingleMonthPropsType;

state = {
weekComponents: []
Expand All @@ -36,7 +28,7 @@ export class SingleMonthComponent implements OnInit, AfterViewInit {

@HostBinding('class.single-month') singleMonth: boolean = true;

constructor(private _elementRef: ElementRef) {}
constructor(private _elementRef: ElementRef) { }

genWeek = (weeksData: Models.CellData[], index: number) => {
const { getDateExtra, monthData, onCellClick, locale, rowSize } = this.props;
Expand Down
16 changes: 16 additions & 0 deletions components/calendar/timepicker/PropsType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Models } from '../date/DataTypes';

export interface CalendarTimePickerPropsType {
locale: Models.Locale;
prefixCls?: string;
pickerPrefixCls?: string;
title?: string;
defaultValue?: Date;
value?: Date;
onValueChange?: (time: Date) => void;
mode?: string;
minDate?: Date;
maxDate?: Date;
clientHeight?: number;
datePickerViewLocale?: any;
}
29 changes: 7 additions & 22 deletions components/calendar/timepicker/timepicker.component.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,28 @@
import { Component, ViewEncapsulation, Input, HostBinding } from '@angular/core';
import { Models } from '../date/DataTypes';
import { zh_CN, en_US } from '../../locale-provider/languages';

export interface PropsType {
locale: Models.Locale;
prefixCls?: string;
pickerPrefixCls?: string;
title?: string;
defaultValue?: Date;
value?: Date;
onValueChange?: (time: Date) => void;
mode?: string;
minDate?: Date;
maxDate?: Date;
clientHeight?: number;
datePickerViewLocale?: any;
}
import { zh_CN, en_US } from '../../locale-provider/locale';
import { CalendarTimePickerPropsType } from './PropsType';

@Component({
selector: 'CalendarTimePicker, nzm-calendar-time-picker',
templateUrl: './timepicker.component.html',
encapsulation: ViewEncapsulation.None
})
export class TimePickerComponent {
export class CalendarTimePickerComponent {
defaultProps = {
minDate: new Date(0, 0, 0, 0, 0),
maxDate: new Date(9999, 11, 31, 23, 59, 59),
defaultValue: new Date(2000, 1, 1, 8),
mode: 'time',
datePickerViewLocale: zh_CN
} as PropsType;
} as CalendarTimePickerPropsType;

props = {
minDate: new Date(0, 0, 0, 0, 0),
maxDate: new Date(9999, 11, 31, 23, 59, 59),
defaultValue: new Date(2000, 1, 1, 8),
mode: 'time',
datePickerViewLocale: zh_CN
} as PropsType;
} as CalendarTimePickerPropsType;

selfHeight: string;

Expand Down Expand Up @@ -88,9 +73,9 @@ export class TimePickerComponent {
@HostBinding('class.time-picker')
timePicker: boolean = true;

constructor() {}
constructor() { }

onDateChange = (date: {date: Date, index: number}) => {
onDateChange = (date: { date: Date, index: number }) => {
const { onValueChange } = this.props;
onValueChange && onValueChange(date.date);
}
Expand Down
2 changes: 1 addition & 1 deletion components/calendar/week-panel/week-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Models } from '../date/DataTypes';
templateUrl: './week-panel.component.html',
encapsulation: ViewEncapsulation.None
})
export class WeekPanelComponent implements OnInit {
export class CalendarWeekPanelComponent implements OnInit {
constructor() {}

week: string[] = ['日', '一', '二', '三', '四', '五', '六'];
Expand Down
1 change: 1 addition & 0 deletions components/card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public-api';
Loading

0 comments on commit dd9af23

Please sign in to comment.