Skip to content

Commit

Permalink
feat(module: all): support-import-by-module (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
aijunhao committed Feb 14, 2023
1 parent 3210fa7 commit 7fa1e17
Show file tree
Hide file tree
Showing 184 changed files with 1,045 additions and 329 deletions.
Expand Up @@ -10,7 +10,8 @@ import {
} from '@angular/core';
import { animate, state, style, transition, trigger } from '@angular/animations';
import { AccordionService } from '../accordion.service';
import { isTemplateRef } from '../../core/util/check';
import { isTemplateRef } from 'ng-zorro-antd-mobile/core';

@Component({
selector: 'AccordionPanel, nzm-accordion-panel',
templateUrl: './accordion-group.component.html',
Expand Down
2 changes: 1 addition & 1 deletion components/accordion/accordion.module.ts
Expand Up @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AccordionComponent } from './accordion.component';
import { AccordionGroupComponent } from './accordion-group/accordion-group.component';
import { WhiteSpaceModule } from '../white-space/white-space.module';
import { WhiteSpaceModule } from 'ng-zorro-antd-mobile/white-space';

@NgModule({
imports: [CommonModule, WhiteSpaceModule],
Expand Down
5 changes: 5 additions & 0 deletions components/accordion/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
5 changes: 3 additions & 2 deletions components/action-sheet/action-sheet.component.ts
@@ -1,8 +1,9 @@
import { OnInit, Component, OnDestroy, ElementRef, TemplateRef, ViewEncapsulation } from '@angular/core';
import { Subject, Observable } from 'rxjs';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { LocaleProviderService } from '../locale-provider/locale-provider.service';
import { LocaleProviderService } from 'ng-zorro-antd-mobile/locale-provider';
import { ActionSheetRef } from './action-sheet-ref.class';

@Component({
selector: 'ActionSheet',
templateUrl: './action-sheet.component.html',
Expand Down
14 changes: 7 additions & 7 deletions components/action-sheet/action-sheet.module.ts
@@ -1,14 +1,14 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { OverlayModule } from '@angular/cdk/overlay';
import { ListModule } from '../list/list.module';
import { NgZorroAntdMobilePipesModule } from '../pipes/ng-zorro-antd-mobile.pipes.module';
import { ListModule } from 'ng-zorro-antd-mobile/list';
import { NgZorroAntdMobilePipesModule } from 'ng-zorro-antd-mobile/pipes';
import { ActionSheetComponent } from './action-sheet.component';
import { WingBlankModule } from '../wing-blank/wing-blank.module';
import { WhiteSpaceModule } from '../white-space/white-space.module';
import { LocaleProviderModule } from '../locale-provider/locale-provider.module';
import { TouchFeedbackModule } from '../core/directive/touch-feedback.module';
import { PopupService } from '../core/services/popup.service';
import { WingBlankModule } from 'ng-zorro-antd-mobile/wing-blank';
import { WhiteSpaceModule } from 'ng-zorro-antd-mobile/white-space';
import { LocaleProviderModule } from 'ng-zorro-antd-mobile/locale-provider';
import { TouchFeedbackModule } from 'ng-zorro-antd-mobile/core';
import { PopupService } from 'ng-zorro-antd-mobile/core';
import { ActionSheetService } from './action-sheet.service';

@NgModule({
Expand Down
2 changes: 1 addition & 1 deletion components/action-sheet/action-sheet.service.ts
Expand Up @@ -6,7 +6,7 @@ import {
ActionSheetWithOptions,
ShareActionSheetWithOptions
} from './action-sheet-options.provider';
import { PopupService } from '../core/services/popup.service';
import { PopupService } from 'ng-zorro-antd-mobile/core';

const NORMAL = 'NORMAL';
const SHARE = 'SHARE';
Expand Down
5 changes: 5 additions & 0 deletions components/action-sheet/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
5 changes: 5 additions & 0 deletions components/activity-indicator/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
5 changes: 5 additions & 0 deletions components/badge/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
8 changes: 4 additions & 4 deletions components/button/button.module.ts
@@ -1,10 +1,10 @@
import { NgModule } from '@angular/core';
import { ButtonComponent } from './button.component';
import { CommonModule } from '@angular/common';
import { IconModule } from '../icon/icon.module';
import { WingBlankModule } from '../wing-blank/wing-blank.module';
import { WhiteSpaceModule } from '../white-space/white-space.module';
import { ListModule } from '../list/list.module';
import { IconModule } from 'ng-zorro-antd-mobile/icon';
import { WingBlankModule } from 'ng-zorro-antd-mobile/wing-blank';
import { WhiteSpaceModule } from 'ng-zorro-antd-mobile/white-space';
import { ListModule } from 'ng-zorro-antd-mobile/list';
export const NZ_BUTTON_DIRECTIVES: Array<any> = [ButtonComponent];

@NgModule({
Expand Down
5 changes: 5 additions & 0 deletions components/button/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
29 changes: 14 additions & 15 deletions components/calendar/calendar.component.ts
Expand Up @@ -12,10 +12,9 @@ import {
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { DateModels } from './date/DataTypes';
import zhCN from './locale/zh_CN';
import enUS from './locale/en_US';
import { zh_CN, en_US } from 'ng-zorro-antd-mobile/locale-provider';
import { CalendarPropsType } from './calendar.props.component';
import { LocaleProviderService } from '../locale-provider/locale-provider.service';
import { LocaleProviderService } from 'ng-zorro-antd-mobile/locale-provider';
import { mergeDateTime, isSameDate } from './util/index';
import { takeUntil } from 'rxjs/operators';
import { CalendarDatePickerComponent } from './datepicker/datepicker.component';
Expand Down Expand Up @@ -48,7 +47,7 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
props = {
visible: false,
showHeader: true,
locale: zhCN,
locale: zh_CN.Calendar,
pickTime: false,
showShortcut: false,
prefixCls: 'rmc-calendar',
Expand Down Expand Up @@ -77,9 +76,9 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
@Input()
set locale(value) {
if (value === 'enUS') {
this.props.locale = enUS;
this.props.locale = en_US.Calendar;
} else if (value === 'zhCN') {
this.props.locale = zhCN;
this.props.locale = zh_CN.Calendar;
}

this._unsubscribe$.next();
Expand Down Expand Up @@ -299,7 +298,7 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro

this.writeModelData(date);
return newState;
}
};

writeModelData(date) {
if (this._dateModelValue instanceof Array) {
Expand Down Expand Up @@ -353,14 +352,14 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
};

this.showClear = !!this.state.startDate;
}
};

triggerSelectHasDisableDate = (date: Date[]) => {
this.triggerClear();
if (this.onSelectHasDisableDate) {
this.onSelectHasDisableDate.emit(date);
}
}
};

onClose = () => {
this.state = {
Expand All @@ -372,7 +371,7 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
clientHight: 0
} as CalendarStateType;
this.showClear = !!this.state.startDate;
}
};

triggerConfirm = () => {
const { startDate, endDate } = this.state;
Expand All @@ -384,7 +383,7 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
this.onConfirm.emit({ startDate, endDate });
}
this.onClose();
}
};

triggerCancel() {
if (this.props.onCancel) {
Expand All @@ -408,7 +407,7 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
}
this.showClear = !!this.state.startDate;
}, 0);
}
};

onTimeChange = (date: Date) => {
const { startDate, endDate } = this.state;
Expand All @@ -417,7 +416,7 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
} else if (startDate) {
this.state.startDate = date;
}
}
};

shortcutSelect = (startDate: Date, endDate: Date, props = this.props) => {
this.state = {
Expand All @@ -426,11 +425,11 @@ export class CalendarComponent implements ControlValueAccessor, OnInit, OnDestro
...this.selectDate(endDate, true, { startDate }, props)
};
this.showClear = !!this.state.startDate;
}
};

setClientHeight = (height: number) => {
this.state.clientHight = height;
}
};

ngOnInit() {
const defaultValue = this.props.defaultValue;
Expand Down
6 changes: 3 additions & 3 deletions components/calendar/calendar.module.ts
@@ -1,13 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IconModule } from '../icon/icon.module';
import { IconModule } from 'ng-zorro-antd-mobile/icon';
import { CalendarComponent } from './calendar.component';
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 { DatePickerViewModule } from '../date-picker-view/date-picker-view.module';
import { LocaleProviderModule } from 'ng-zorro-antd-mobile/locale-provider';
import { DatePickerViewModule } from 'ng-zorro-antd-mobile/date-picker-view';
import { CalendarSingleMonthComponent } from './single-month/single-month.component';
import { CalendarConfirmPanelComponent } from './confirm-panel/confirm-panel.component';
import { CalendarShortcutPanelComponent } from './shortcut-panel/shortcut-panel.component';
Expand Down
19 changes: 10 additions & 9 deletions components/calendar/datepicker/datepicker.base.component.ts
@@ -1,7 +1,7 @@
import { DateModels } from '../date/DataTypes';
import { DatepickerPropsType } from './datepicker.props.component';
import { formatDate } from '../util';
import defaultLocale from '../locale/zh_CN';
import { zh_CN } from 'ng-zorro-antd-mobile/locale-provider';

export interface DatepickerStateType {
months: DateModels.MonthData[];
Expand All @@ -14,7 +14,7 @@ export class CalendarDatePickerBaseComponent {
infiniteOpt: false,
defaultDate: new Date(),
initalMonths: 6,
locale: defaultLocale
locale: zh_CN.Calendar
} as DatepickerPropsType;

state: any = {
Expand Down Expand Up @@ -81,7 +81,7 @@ export class CalendarDatePickerBaseComponent {
return 0;
}
return +new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
};

genWeekData = (firstDate: Date) => {
const minDateTime = this.getDateWithoutTime(this.props.minDate);
Expand Down Expand Up @@ -121,7 +121,7 @@ export class CalendarDatePickerBaseComponent {
}
currentWeek[currentWeek.length - 1].isLastOfMonth = true;
return weeks;
}
};

genMonthData(date?: Date, addMonth: number = 0) {
if (!date) {
Expand Down Expand Up @@ -225,7 +225,7 @@ export class CalendarDatePickerBaseComponent {
console.warn('Unusable date. You can handle by onSelectHasDisableDate.', unuseable);
}
}
}
};

computeVisible = (clientHeight: number, scrollTop: number) => {
let needUpdate = false;
Expand All @@ -236,7 +236,8 @@ export class CalendarDatePickerBaseComponent {
const filterFunc = (vm: DateModels.MonthData) =>
vm.y &&
vm.height &&
(vm.y + vm.height > scrollTop - MAX_VIEW_PORT && vm.y < scrollTop + clientHeight + MAX_VIEW_PORT);
vm.y + vm.height > scrollTop - MAX_VIEW_PORT &&
vm.y < scrollTop + clientHeight + MAX_VIEW_PORT;

if (this.props.infiniteOpt && this.visibleMonth.length > 12) {
this.visibleMonth = this.visibleMonth.filter(filterFunc).sort((a, b) => +a.firstDate - +b.firstDate);
Expand Down Expand Up @@ -277,7 +278,7 @@ export class CalendarDatePickerBaseComponent {
}

return needUpdate;
}
};

createOnScroll = () => {
// let timer: any;
Expand Down Expand Up @@ -305,7 +306,7 @@ export class CalendarDatePickerBaseComponent {
// }
// }, 50);
};
}
};

baseOnCellClick = (day: DateModels.CellData) => {
if (!day.tick) {
Expand All @@ -314,5 +315,5 @@ export class CalendarDatePickerBaseComponent {
if (this.props.onCellClick) {
this.props.onCellClick(new Date(day.tick));
}
}
};
}
5 changes: 5 additions & 0 deletions components/calendar/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
2 changes: 1 addition & 1 deletion components/calendar/timepicker/timepicker.component.ts
@@ -1,5 +1,5 @@
import { Component, ViewEncapsulation, Input, HostBinding } from '@angular/core';
import { zh_CN, en_US } from '../../locale-provider/locale';
import { zh_CN, en_US } from 'ng-zorro-antd-mobile/locale-provider';
import { CalendarTimePickerPropsType } from './PropsType';

@Component({
Expand Down
5 changes: 5 additions & 0 deletions components/card/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
18 changes: 9 additions & 9 deletions components/carousel/carousel.component.ts
Expand Up @@ -13,7 +13,7 @@ import {
ViewEncapsulation
} from '@angular/core';
import { CarouselSlideComponent } from './carousel-slide/carousel-slide.component';
import * as touchEvent from '../core/util/touch-event';
import { getEventTarget } from 'ng-zorro-antd-mobile/core';

@Component({
selector: 'Carousel, nzm-carousel',
Expand Down Expand Up @@ -108,8 +108,8 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
this.stopTimer();
this._isMouseDown = true;
this.touchObject = {
startX: touchEvent.getEventTarget(event).pageX,
startY: touchEvent.getEventTarget(event).pageY,
startX: getEventTarget(event).pageX,
startY: getEventTarget(event).pageY,
direction: this.touchObject.direction
};
}
Expand All @@ -124,22 +124,22 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
}
const { direction } = this.swipeDirection(
this.touchObject.startX,
touchEvent.getEventTarget(event).pageX,
getEventTarget(event).pageX,
this.touchObject.startY,
touchEvent.getEventTarget(event).pageY
getEventTarget(event).pageY
);
if (direction === 0) {
return;
}
const length = this.vertical
? Math.abs(touchEvent.getEventTarget(event).pageY - this.touchObject.startY)
: Math.abs(touchEvent.getEventTarget(event).pageX - this.touchObject.startX);
? Math.abs(getEventTarget(event).pageY - this.touchObject.startY)
: Math.abs(getEventTarget(event).pageX - this.touchObject.startX);
const offset = -this.touchObject.direction * length - this.currentSelectedIndex * this._rationWidth;
this.touchObject = {
startX: this.touchObject.startX,
startY: this.touchObject.startY,
endX: touchEvent.getEventTarget(event).pageX,
endY: touchEvent.getEventTarget(event).pageY,
endX: getEventTarget(event).pageX,
endY: getEventTarget(event).pageY,
length,
direction,
offset
Expand Down
5 changes: 5 additions & 0 deletions components/carousel/ng-package.json
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "public-api.ts"
}
}
2 changes: 1 addition & 1 deletion components/checkbox/checkbox.module.ts
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { ListModule } from '../list/list.module';
import { ListModule } from 'ng-zorro-antd-mobile/list';
import { CheckboxComponent } from './checkbox.component';
import { AgreeItemComponent } from './agree-item.component';
import { CheckboxItemComponent } from './checkbox-item.component';
Expand Down

0 comments on commit 7fa1e17

Please sign in to comment.