Skip to content

Commit

Permalink
refactor(module:input-number-legacy): rename selector to nz-input-num…
Browse files Browse the repository at this point in the history
…ber (#8909)
  • Loading branch information
HyperLife1119 authored Dec 5, 2024
1 parent e5dfb49 commit 4fa4658
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 108 deletions.
8 changes: 4 additions & 4 deletions components/input-number-legacy/demo/addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
template: `
<nz-space nzDirection="vertical" style="width: 100%">
<nz-input-number-group *nzSpaceItem nzAddOnBefore="+" nzAddOnAfter="$">
<nz-input-number-legacy [(ngModel)]="value" [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [(ngModel)]="value" [nzStep]="1"></nz-input-number>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem [nzAddOnBefore]="addOnBeforeTemplate" [nzAddOnAfter]="addOnAfterTemplate">
<nz-input-number-legacy [(ngModel)]="value" [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [(ngModel)]="value" [nzStep]="1"></nz-input-number>
</nz-input-number-group>
<ng-template #addOnBeforeTemplate>
<nz-select [ngModel]="'add'" style="width: 60px">
Expand All @@ -33,10 +33,10 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
</nz-select>
</ng-template>
<nz-input-number-group *nzSpaceItem nzAddOnAfterIcon="setting">
<nz-input-number-legacy [(ngModel)]="value" [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [(ngModel)]="value" [nzStep]="1"></nz-input-number>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem [nzAddOnBefore]="addOnBeforeCascaderTemplate">
<nz-input-number-legacy [(ngModel)]="value" [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [(ngModel)]="value" [nzStep]="1"></nz-input-number>
</nz-input-number-group>
<ng-template #addOnBeforeCascaderTemplate>
<nz-cascader [nzOptions]="[]" nzPlaceHolder="cascader" style="width: 150px"></nz-cascader>
Expand Down
7 changes: 1 addition & 6 deletions components/input-number-legacy/demo/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';
selector: 'nz-demo-input-number-legacy-basic',
standalone: true,
imports: [FormsModule, NzInputNumberLegacyModule],
template: `<nz-input-number-legacy
[(ngModel)]="value"
[nzMin]="1"
[nzMax]="10"
[nzStep]="1"
></nz-input-number-legacy>`
template: `<nz-input-number [(ngModel)]="value" [nzMin]="1" [nzMax]="10" [nzStep]="1"></nz-input-number>`
})
export class NzDemoInputNumberLegacyBasicComponent {
value = 3;
Expand Down
2 changes: 1 addition & 1 deletion components/input-number-legacy/demo/borderless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';
selector: 'nz-demo-input-number-legacy-borderless',
standalone: true,
imports: [FormsModule, NzInputNumberLegacyModule],
template: `<nz-input-number-legacy nzBorderless [(ngModel)]="value"></nz-input-number-legacy>`
template: `<nz-input-number nzBorderless [(ngModel)]="value"></nz-input-number>`
})
export class NzDemoInputNumberLegacyBorderlessComponent {
value = 3;
Expand Down
4 changes: 2 additions & 2 deletions components/input-number-legacy/demo/digit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';
standalone: true,
imports: [FormsModule, NzInputNumberLegacyModule],
template: `
<nz-input-number-legacy
<nz-input-number
[(ngModel)]="value"
[nzMin]="1"
[nzMax]="10"
[nzStep]="0.1"
[nzPlaceHolder]="'Digital'"
></nz-input-number-legacy>
></nz-input-number>
`
})
export class NzDemoInputNumberLegacyDigitComponent {
Expand Down
4 changes: 2 additions & 2 deletions components/input-number-legacy/demo/disabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';
standalone: true,
imports: [FormsModule, NzButtonModule, NzInputNumberLegacyModule],
template: `
<nz-input-number-legacy
<nz-input-number
[(ngModel)]="value"
[nzMin]="1"
[nzMax]="10"
[nzStep]="1"
[nzDisabled]="isDisabled"
></nz-input-number-legacy>
></nz-input-number>
<br />
<br />
<button nz-button [nzType]="'primary'" (click)="toggleDisabled()">
Expand Down
8 changes: 4 additions & 4 deletions components/input-number-legacy/demo/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';
standalone: true,
imports: [FormsModule, NzInputNumberLegacyModule],
template: `
<nz-input-number-legacy
<nz-input-number
[(ngModel)]="demoValue"
[nzMin]="1"
[nzMax]="100"
[nzStep]="1"
[nzFormatter]="formatterDollar"
[nzParser]="parserDollar"
></nz-input-number-legacy>
<nz-input-number-legacy
></nz-input-number>
<nz-input-number
[(ngModel)]="demoValue"
[nzMin]="1"
[nzMax]="100"
[nzStep]="1"
[nzFormatter]="formatterPercent"
[nzParser]="parserPercent"
></nz-input-number-legacy>
></nz-input-number>
`,
styles: [
`
Expand Down
26 changes: 9 additions & 17 deletions components/input-number-legacy/demo/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,22 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
<nz-space nzDirection="vertical" style="width: 100%">
<nz-input-number-group nz-row [nzGutter]="8" nzSize="large" *nzSpaceItem>
<div nz-col nzSpan="8">
<nz-input-number-legacy [ngModel]="1234" [nzStep]="1" style="width: 100%"></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1" style="width: 100%"></nz-input-number>
</div>
<div nz-col nzSpan="8">
<nz-input-number-legacy [ngModel]="56789" [nzStep]="1" style="width: 100%"></nz-input-number-legacy>
<nz-input-number [ngModel]="56789" [nzStep]="1" style="width: 100%"></nz-input-number>
</div>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzCompact>
<nz-input-number-legacy [ngModel]="1234" [nzStep]="1" style="width: 33%"></nz-input-number-legacy>
<nz-input-number-legacy [ngModel]="56789" [nzStep]="1" style="width: 33%"></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1" style="width: 33%"></nz-input-number>
<nz-input-number [ngModel]="56789" [nzStep]="1" style="width: 33%"></nz-input-number>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzCompact>
<nz-input-number-legacy
[ngModel]="1234"
[nzStep]="1"
style="width: calc(100% - 200px)"
></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1" style="width: calc(100% - 200px)"></nz-input-number>
<button nz-button nzType="primary">Submit</button>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzCompact>
<nz-input-number-legacy
[ngModel]="1234"
[nzStep]="1"
style="width: calc(100% - 200px)"
></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1" style="width: calc(100% - 200px)"></nz-input-number>
<button nz-button>
<span nz-icon nzType="copy" nzTheme="outline"></span>
</button>
Expand All @@ -59,14 +51,14 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
<nz-option nzValue="Zhejiang" nzLabel="Zhejiang"></nz-option>
<nz-option nzValue="Jiangsu" nzLabel="Jiangsu"></nz-option>
</nz-select>
<nz-input-number-legacy [ngModel]="1234" [nzStep]="1" style="width: 50%"></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1" style="width: 50%"></nz-input-number>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzCompact>
<nz-input-number-legacy [ngModel]="1234" [nzStep]="1" style="width: 50%"></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1" style="width: 50%"></nz-input-number>
<nz-date-picker></nz-date-picker>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzCompact>
<nz-input-number-legacy [ngModel]="1234" [nzStep]="1" style="width: 30%"></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1" style="width: 30%"></nz-input-number>
<nz-range-picker></nz-range-picker>
</nz-input-number-group>
</nz-space>
Expand Down
16 changes: 6 additions & 10 deletions components/input-number-legacy/demo/precision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,23 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';
standalone: true,
imports: [FormsModule, NzInputNumberLegacyModule],
template: `
<nz-input-number-legacy
[(ngModel)]="toFixedValue"
[nzPrecision]="precision"
nzPlaceHolder="toFixed"
></nz-input-number-legacy>
<nz-input-number-legacy
<nz-input-number [(ngModel)]="toFixedValue" [nzPrecision]="precision" nzPlaceHolder="toFixed"></nz-input-number>
<nz-input-number
[(ngModel)]="cutValue"
[nzPrecision]="precision"
nzPrecisionMode="cut"
nzPlaceHolder="cut off"
></nz-input-number-legacy>
<nz-input-number-legacy
></nz-input-number>
<nz-input-number
[(ngModel)]="customFnValue"
[nzPrecision]="precision"
[nzPrecisionMode]="customPrecisionFn"
nzPlaceHolder="cut off"
></nz-input-number-legacy>
></nz-input-number>
`,
styles: [
`
nz-input-number-legacy {
nz-input-number {
margin-right: 8px;
}
`
Expand Down
6 changes: 3 additions & 3 deletions components/input-number-legacy/demo/prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
template: `
<nz-space nzDirection="vertical" style="width: 100%">
<nz-input-number-group *nzSpaceItem nzPrefix="¥" style="width: 100%">
<nz-input-number-legacy [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [nzStep]="1"></nz-input-number>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzAddOnBeforeIcon="user" nzPrefix="¥" style="width: 100%">
<nz-input-number-legacy [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [nzStep]="1"></nz-input-number>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzPrefix="¥" style="width: 100%">
<nz-input-number-legacy nzDisabled [nzStep]="1"></nz-input-number-legacy>
<nz-input-number nzDisabled [nzStep]="1"></nz-input-number>
</nz-input-number-group>
</nz-space>
`
Expand Down
20 changes: 4 additions & 16 deletions components/input-number-legacy/demo/size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,13 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';
standalone: true,
imports: [FormsModule, NzInputNumberLegacyModule],
template: `
<nz-input-number-legacy
[(ngModel)]="value"
[nzSize]="'large'"
[nzMin]="1"
[nzMax]="10"
[nzStep]="1"
></nz-input-number-legacy>
<nz-input-number-legacy [(ngModel)]="value" [nzMin]="1" [nzMax]="10" [nzStep]="1"></nz-input-number-legacy>
<nz-input-number-legacy
[(ngModel)]="value"
[nzSize]="'small'"
[nzMin]="1"
[nzMax]="10"
[nzStep]="1"
></nz-input-number-legacy>
<nz-input-number [(ngModel)]="value" [nzSize]="'large'" [nzMin]="1" [nzMax]="10" [nzStep]="1"></nz-input-number>
<nz-input-number [(ngModel)]="value" [nzMin]="1" [nzMax]="10" [nzStep]="1"></nz-input-number>
<nz-input-number [(ngModel)]="value" [nzSize]="'small'" [nzMin]="1" [nzMax]="10" [nzStep]="1"></nz-input-number>
`,
styles: [
`
nz-input-number-legacy {
nz-input-number {
margin-right: 8px;
}
`
Expand Down
8 changes: 4 additions & 4 deletions components/input-number-legacy/demo/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
imports: [FormsModule, NzInputNumberLegacyModule, NzSpaceModule],
template: `
<nz-space nzDirection="vertical" style="width: 100%">
<nz-input-number-legacy *nzSpaceItem [nzStep]="1" nzStatus="error" style="width: 100%"></nz-input-number-legacy>
<nz-input-number-legacy *nzSpaceItem [nzStep]="1" nzStatus="warning" style="width: 100%"></nz-input-number-legacy>
<nz-input-number *nzSpaceItem [nzStep]="1" nzStatus="error" style="width: 100%"></nz-input-number>
<nz-input-number *nzSpaceItem [nzStep]="1" nzStatus="warning" style="width: 100%"></nz-input-number>
<nz-input-number-group *nzSpaceItem nzPrefixIcon="clock-circle" nzStatus="error" style="width: 100%">
<nz-input-number-legacy [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [nzStep]="1"></nz-input-number>
</nz-input-number-group>
<nz-input-number-group *nzSpaceItem nzPrefixIcon="clock-circle" nzStatus="warning" style="width: 100%">
<nz-input-number-legacy [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [nzStep]="1"></nz-input-number>
</nz-input-number-group>
</nz-space>
`
Expand Down
2 changes: 1 addition & 1 deletion components/input-number-legacy/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';

## API

### nz-input-number-legacy
### nz-input-number

| property | description | type | default |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
Expand Down
2 changes: 1 addition & 1 deletion components/input-number-legacy/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { NzInputNumberLegacyModule } from 'ng-zorro-antd/input-number-legacy';

## API

### nz-input-number-legacy
### nz-input-number

| 成员 | 说明 | 类型 | 默认值 |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
Expand Down
26 changes: 12 additions & 14 deletions components/input-number-legacy/input-number-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ describe('input-number-group', () => {
inputNumberGroupElement = fixture.debugElement.query(By.directive(NzInputNumberGroupComponent)).nativeElement;
});
it('should size work', () => {
expect(inputNumberGroupElement.querySelector('nz-input-number-legacy')!.classList).toContain(
'ant-input-number-lg'
);
expect(inputNumberGroupElement.querySelector('nz-input-number')!.classList).toContain('ant-input-number-lg');
});
});
describe('mix', () => {
Expand Down Expand Up @@ -342,7 +340,7 @@ describe('input-number-group', () => {
imports: [NzInputNumberLegacyModule],
template: `
<nz-input-number-group [nzAddOnBefore]="beforeContent" [nzAddOnAfter]="afterContent" [nzSize]="size">
<nz-input-number-legacy></nz-input-number-legacy>
<nz-input-number></nz-input-number>
</nz-input-number-group>
<ng-template #beforeTemplate>beforeTemplate</ng-template>
<ng-template #afterTemplate>afterTemplate</ng-template>
Expand All @@ -361,7 +359,7 @@ export class NzTestInputNumberGroupAddonComponent {
imports: [NzInputNumberLegacyModule],
template: `
<nz-input-number-group [nzPrefix]="beforeContent" [nzSuffix]="afterContent" [nzSize]="size">
<nz-input-number-legacy [nzDisabled]="disabled"></nz-input-number-legacy>
<nz-input-number [nzDisabled]="disabled"></nz-input-number>
</nz-input-number-group>
<ng-template #beforeTemplate>beforeTemplate</ng-template>
<ng-template #afterTemplate>afterTemplate</ng-template>
Expand All @@ -381,8 +379,8 @@ export class NzTestInputNumberGroupAffixComponent {
imports: [NzInputNumberLegacyModule],
template: `
<nz-input-number-group [nzCompact]="compact" [nzSize]="size">
<nz-input-number-legacy></nz-input-number-legacy>
<nz-input-number-legacy></nz-input-number-legacy>
<nz-input-number></nz-input-number>
<nz-input-number></nz-input-number>
</nz-input-number-group>
`
})
Expand All @@ -397,10 +395,10 @@ export class NzTestInputNumberGroupMultipleComponent {
template: `
<nz-input-number-group nz-row nzSize="large">
<div nz-col nzSpan="8">
<nz-input-number-legacy [ngModel]="1234" [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [ngModel]="1234" [nzStep]="1"></nz-input-number>
</div>
<div nz-col nzSpan="8">
<nz-input-number-legacy [ngModel]="5678" [nzStep]="1"></nz-input-number-legacy>
<nz-input-number [ngModel]="5678" [nzStep]="1"></nz-input-number>
</div>
</nz-input-number-group>
`
Expand All @@ -412,7 +410,7 @@ export class NzTestInputNumberGroupColComponent {}
imports: [NzInputNumberLegacyModule],
template: `
<nz-input-number-group nzPrefixIcon="user" nzAddOnAfter="@example.com">
<nz-input-number-legacy></nz-input-number-legacy>
<nz-input-number></nz-input-number>
</nz-input-number-group>
`
})
Expand All @@ -424,14 +422,14 @@ export class NzTestInputNumberGroupMixComponent {}
template: `
@if (!isAddon) {
<nz-input-number-group [nzPrefix]="prefixTemplateClock" [nzStatus]="status">
<nz-input-number-legacy />
<nz-input-number />
</nz-input-number-group>
<ng-template #prefixTemplateClock>
<span nz-icon nzType="clock-circle" nzTheme="outline"></span>
</ng-template>
} @else {
<nz-input-number-group nzAddOnAfterIcon="setting" [nzStatus]="status">
<nz-input-number-legacy />
<nz-input-number />
</nz-input-number-group>
}
`
Expand All @@ -447,7 +445,7 @@ export class NzTestInputNumberGroupWithStatusComponent {
template: `
<div [dir]="dir">
<nz-input-number-group nzAddOnAfterIcon="setting">
<nz-input-number-legacy></nz-input-number-legacy>
<nz-input-number></nz-input-number>
</nz-input-number-group>
</div>
`
Expand All @@ -464,7 +462,7 @@ export class NzTestInputNumberGroupWithDirComponent {
<nz-form-item>
<nz-form-control [nzHasFeedback]="feedback" [nzValidateStatus]="status">
<nz-input-number-group [nzAddOnBefore]="addon">
<nz-input-number-legacy></nz-input-number-legacy>
<nz-input-number></nz-input-number>
</nz-input-number-group>
</nz-form-control>
</nz-form-item>
Expand Down
4 changes: 2 additions & 2 deletions components/input-number-legacy/input-number.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ import { NZ_SPACE_COMPACT_ITEM_TYPE, NZ_SPACE_COMPACT_SIZE, NzSpaceCompactItemDi
* @deprecated Deprecated in v19.0.0. It is recommended to use the new version `<nz-input-number>`.
*/
@Component({
selector: 'nz-input-number-legacy',
exportAs: 'nzInputNumberLegacy',
selector: 'nz-input-number',
exportAs: 'nzInputNumber',
template: `
<div class="ant-input-number-handler-wrap">
<span
Expand Down
Loading

0 comments on commit 4fa4658

Please sign in to comment.