ng-zorro-antd-input-number-legacy.mjs 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013
  1. import { UP_ARROW, DOWN_ARROW, ENTER } from '@angular/cdk/keycodes';
  2. import * as i0 from '@angular/core';
  3. import { EventEmitter, computed, signal, inject, forwardRef, booleanAttribute, numberAttribute, Input, ViewChild, Output, ViewEncapsulation, ChangeDetectionStrategy, Component, Directive, ContentChildren, NgModule } from '@angular/core';
  4. import * as i6 from '@angular/forms';
  5. import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
  6. import { Subject, merge } from 'rxjs';
  7. import { distinctUntilChanged, takeUntil, startWith, switchMap, mergeMap, map } from 'rxjs/operators';
  8. import { NzFormStatusService, NzFormNoStatusService, NzFormItemFeedbackIconComponent } from 'ng-zorro-antd/core/form';
  9. import * as i3 from 'ng-zorro-antd/core/services';
  10. import { NzDestroyService } from 'ng-zorro-antd/core/services';
  11. import { isNotNil, fromEventOutsideAngular, getStatusClassNames } from 'ng-zorro-antd/core/util';
  12. import * as i5 from 'ng-zorro-antd/icon';
  13. import { NzIconModule } from 'ng-zorro-antd/icon';
  14. import * as i4 from 'ng-zorro-antd/space';
  15. import { NZ_SPACE_COMPACT_SIZE, NZ_SPACE_COMPACT_ITEM_TYPE, NzSpaceCompactItemDirective } from 'ng-zorro-antd/space';
  16. import * as i1 from '@angular/cdk/a11y';
  17. import * as i2 from '@angular/cdk/bidi';
  18. import * as i2$1 from 'ng-zorro-antd/core/outlet';
  19. import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
  20. import { NgTemplateOutlet } from '@angular/common';
  21. /**
  22. * @deprecated Deprecated in v19.0.0. It is recommended to use the new version `<nz-input-number>`.
  23. */
  24. class NzInputNumberLegacyComponent {
  25. ngZone;
  26. elementRef;
  27. cdr;
  28. focusMonitor;
  29. renderer;
  30. directionality;
  31. destroy$;
  32. displayValue;
  33. isFocused = false;
  34. disabled$ = new Subject();
  35. disabledUp = false;
  36. disabledDown = false;
  37. dir = 'ltr';
  38. // status
  39. prefixCls = 'ant-input-number';
  40. status = '';
  41. statusCls = {};
  42. hasFeedback = false;
  43. onChange = () => { };
  44. onTouched = () => { };
  45. nzBlur = new EventEmitter();
  46. nzFocus = new EventEmitter();
  47. /** The native `<span class="ant-input-number-handler-up"></span>` element. */
  48. upHandler;
  49. /** The native `<span class="ant-input-number-handler-down"></span>` element. */
  50. downHandler;
  51. /** The native `<input class="ant-input-number-input" />` element. */
  52. inputElement;
  53. nzSize = 'default';
  54. nzMin = -Infinity;
  55. nzMax = Infinity;
  56. nzParser = (value) => value
  57. .trim()
  58. .replace(/。/g, '.')
  59. .replace(/[^\w.-]+/g, '');
  60. nzPrecision;
  61. nzPrecisionMode = 'toFixed';
  62. nzPlaceHolder = '';
  63. nzStatus = '';
  64. nzStep = 1;
  65. nzInputMode = 'decimal';
  66. nzId = null;
  67. nzDisabled = false;
  68. nzReadOnly = false;
  69. nzAutoFocus = false;
  70. nzBorderless = false;
  71. nzFormatter = value => value;
  72. finalSize = computed(() => {
  73. if (this.compactSize) {
  74. return this.compactSize();
  75. }
  76. return this.size();
  77. });
  78. size = signal(this.nzSize);
  79. compactSize = inject(NZ_SPACE_COMPACT_SIZE, { optional: true });
  80. autoStepTimer;
  81. parsedValue;
  82. value;
  83. isNzDisableFirstChange = true;
  84. onModelChange(value) {
  85. this.parsedValue = this.nzParser(value);
  86. this.inputElement.nativeElement.value = `${this.parsedValue}`;
  87. const validValue = this.getCurrentValidValue(this.parsedValue);
  88. this.setValue(validValue);
  89. }
  90. getCurrentValidValue(value) {
  91. let val = value;
  92. if (val === '') {
  93. val = '';
  94. }
  95. else if (!this.isNotCompleteNumber(val)) {
  96. val = `${this.getValidValue(val)}`;
  97. }
  98. else {
  99. val = this.value;
  100. }
  101. return this.toNumber(val);
  102. }
  103. // '1.' '1x' 'xx' '' => are not complete numbers
  104. isNotCompleteNumber(num) {
  105. return (isNaN(num) ||
  106. num === '' ||
  107. num === null ||
  108. !!(num && num.toString().indexOf('.') === num.toString().length - 1));
  109. }
  110. getValidValue(value) {
  111. let val = parseFloat(value);
  112. // https://github.com/ant-design/ant-design/issues/7358
  113. if (isNaN(val)) {
  114. return value;
  115. }
  116. if (val < this.nzMin) {
  117. val = this.nzMin;
  118. }
  119. if (val > this.nzMax) {
  120. val = this.nzMax;
  121. }
  122. return val;
  123. }
  124. toNumber(num) {
  125. if (this.isNotCompleteNumber(num)) {
  126. return num;
  127. }
  128. const numStr = String(num);
  129. if (numStr.indexOf('.') >= 0 && isNotNil(this.nzPrecision)) {
  130. if (typeof this.nzPrecisionMode === 'function') {
  131. return this.nzPrecisionMode(num, this.nzPrecision);
  132. }
  133. else if (this.nzPrecisionMode === 'cut') {
  134. const numSplit = numStr.split('.');
  135. numSplit[1] = numSplit[1].slice(0, this.nzPrecision);
  136. return Number(numSplit.join('.'));
  137. }
  138. return Number(Number(num).toFixed(this.nzPrecision));
  139. }
  140. return Number(num);
  141. }
  142. getRatio(e) {
  143. let ratio = 1;
  144. if (e.metaKey || e.ctrlKey) {
  145. ratio = 0.1;
  146. }
  147. else if (e.shiftKey) {
  148. ratio = 10;
  149. }
  150. return ratio;
  151. }
  152. down(e, ratio) {
  153. if (!this.isFocused) {
  154. this.focus();
  155. }
  156. this.step('down', e, ratio);
  157. }
  158. up(e, ratio) {
  159. if (!this.isFocused) {
  160. this.focus();
  161. }
  162. this.step('up', e, ratio);
  163. }
  164. getPrecision(value) {
  165. const valueString = value.toString();
  166. if (valueString.indexOf('e-') >= 0) {
  167. return parseInt(valueString.slice(valueString.indexOf('e-') + 2), 10);
  168. }
  169. let precision = 0;
  170. if (valueString.indexOf('.') >= 0) {
  171. precision = valueString.length - valueString.indexOf('.') - 1;
  172. }
  173. return precision;
  174. }
  175. // step={1.0} value={1.51}
  176. // press +
  177. // then value should be 2.51, rather than 2.5
  178. // if this.props.precision is undefined
  179. // https://github.com/react-component/input-number/issues/39
  180. getMaxPrecision(currentValue, ratio) {
  181. if (isNotNil(this.nzPrecision)) {
  182. return this.nzPrecision;
  183. }
  184. const ratioPrecision = this.getPrecision(ratio);
  185. const stepPrecision = this.getPrecision(this.nzStep);
  186. const currentValuePrecision = this.getPrecision(currentValue);
  187. if (!currentValue) {
  188. return ratioPrecision + stepPrecision;
  189. }
  190. return Math.max(currentValuePrecision, ratioPrecision + stepPrecision);
  191. }
  192. getPrecisionFactor(currentValue, ratio) {
  193. const precision = this.getMaxPrecision(currentValue, ratio);
  194. return Math.pow(10, precision);
  195. }
  196. upStep(val, rat) {
  197. const precisionFactor = this.getPrecisionFactor(val, rat);
  198. const precision = Math.abs(this.getMaxPrecision(val, rat));
  199. let result;
  200. if (typeof val === 'number') {
  201. result = ((precisionFactor * val + precisionFactor * this.nzStep * rat) / precisionFactor).toFixed(precision);
  202. }
  203. else {
  204. result = this.nzMin === -Infinity ? this.nzStep : this.nzMin;
  205. }
  206. return this.toNumber(result);
  207. }
  208. downStep(val, rat) {
  209. const precisionFactor = this.getPrecisionFactor(val, rat);
  210. const precision = Math.abs(this.getMaxPrecision(val, rat));
  211. let result;
  212. if (typeof val === 'number') {
  213. result = ((precisionFactor * val - precisionFactor * this.nzStep * rat) / precisionFactor).toFixed(precision);
  214. }
  215. else {
  216. result = this.nzMin === -Infinity ? -this.nzStep : this.nzMin;
  217. }
  218. return this.toNumber(result);
  219. }
  220. step(type, e, ratio = 1) {
  221. this.stop();
  222. e.preventDefault();
  223. if (this.nzDisabled) {
  224. return;
  225. }
  226. const value = this.getCurrentValidValue(this.parsedValue) || 0;
  227. let val = 0;
  228. if (type === 'up') {
  229. val = this.upStep(value, ratio);
  230. }
  231. else if (type === 'down') {
  232. val = this.downStep(value, ratio);
  233. }
  234. const outOfRange = val > this.nzMax || val < this.nzMin;
  235. if (val > this.nzMax) {
  236. val = this.nzMax;
  237. }
  238. else if (val < this.nzMin) {
  239. val = this.nzMin;
  240. }
  241. this.setValue(val);
  242. this.updateDisplayValue(val);
  243. this.isFocused = true;
  244. if (outOfRange) {
  245. return;
  246. }
  247. this.autoStepTimer = setTimeout(() => {
  248. this[type](e, ratio);
  249. }, 300);
  250. }
  251. stop() {
  252. if (this.autoStepTimer) {
  253. clearTimeout(this.autoStepTimer);
  254. }
  255. }
  256. setValue(value) {
  257. if (`${this.value}` !== `${value}`) {
  258. this.onChange(value);
  259. }
  260. this.value = value;
  261. this.parsedValue = value;
  262. this.disabledUp = this.disabledDown = false;
  263. if (value || value === 0) {
  264. const val = Number(value);
  265. if (val >= this.nzMax) {
  266. this.disabledUp = true;
  267. }
  268. if (val <= this.nzMin) {
  269. this.disabledDown = true;
  270. }
  271. }
  272. }
  273. updateDisplayValue(value) {
  274. const displayValue = isNotNil(this.nzFormatter(value)) ? this.nzFormatter(value) : '';
  275. this.displayValue = displayValue;
  276. this.inputElement.nativeElement.value = `${displayValue}`;
  277. }
  278. writeValue(value) {
  279. this.value = value;
  280. this.setValue(value);
  281. this.updateDisplayValue(value);
  282. this.cdr.markForCheck();
  283. }
  284. registerOnChange(fn) {
  285. this.onChange = fn;
  286. }
  287. registerOnTouched(fn) {
  288. this.onTouched = fn;
  289. }
  290. setDisabledState(disabled) {
  291. this.nzDisabled = (this.isNzDisableFirstChange && this.nzDisabled) || disabled;
  292. this.isNzDisableFirstChange = false;
  293. this.disabled$.next(this.nzDisabled);
  294. this.cdr.markForCheck();
  295. }
  296. focus() {
  297. this.focusMonitor.focusVia(this.inputElement, 'keyboard');
  298. }
  299. blur() {
  300. this.inputElement.nativeElement.blur();
  301. }
  302. nzFormStatusService = inject(NzFormStatusService, { optional: true });
  303. nzFormNoStatusService = inject(NzFormNoStatusService, { optional: true });
  304. constructor(ngZone, elementRef, cdr, focusMonitor, renderer, directionality, destroy$) {
  305. this.ngZone = ngZone;
  306. this.elementRef = elementRef;
  307. this.cdr = cdr;
  308. this.focusMonitor = focusMonitor;
  309. this.renderer = renderer;
  310. this.directionality = directionality;
  311. this.destroy$ = destroy$;
  312. }
  313. ngOnInit() {
  314. this.nzFormStatusService?.formStatusChanges
  315. .pipe(distinctUntilChanged((pre, cur) => {
  316. return pre.status === cur.status && pre.hasFeedback === cur.hasFeedback;
  317. }), takeUntil(this.destroy$))
  318. .subscribe(({ status, hasFeedback }) => {
  319. this.setStatusStyles(status, hasFeedback);
  320. });
  321. this.focusMonitor
  322. .monitor(this.elementRef, true)
  323. .pipe(takeUntil(this.destroy$))
  324. .subscribe(focusOrigin => {
  325. if (!focusOrigin) {
  326. this.isFocused = false;
  327. this.updateDisplayValue(this.value);
  328. this.nzBlur.emit();
  329. Promise.resolve().then(() => this.onTouched());
  330. }
  331. else {
  332. this.isFocused = true;
  333. this.nzFocus.emit();
  334. }
  335. });
  336. this.dir = this.directionality.value;
  337. this.directionality.change.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  338. this.dir = direction;
  339. });
  340. this.setupHandlersListeners();
  341. fromEventOutsideAngular(this.inputElement.nativeElement, 'keyup')
  342. .pipe(takeUntil(this.destroy$))
  343. .subscribe(() => this.stop());
  344. fromEventOutsideAngular(this.inputElement.nativeElement, 'keydown')
  345. .pipe(takeUntil(this.destroy$))
  346. .subscribe(event => {
  347. const { keyCode } = event;
  348. if (keyCode !== UP_ARROW && keyCode !== DOWN_ARROW && keyCode !== ENTER) {
  349. return;
  350. }
  351. this.ngZone.run(() => {
  352. if (keyCode === UP_ARROW) {
  353. const ratio = this.getRatio(event);
  354. this.up(event, ratio);
  355. this.stop();
  356. }
  357. else if (keyCode === DOWN_ARROW) {
  358. const ratio = this.getRatio(event);
  359. this.down(event, ratio);
  360. this.stop();
  361. }
  362. else {
  363. this.updateDisplayValue(this.value);
  364. }
  365. this.cdr.markForCheck();
  366. });
  367. });
  368. }
  369. ngOnChanges({ nzStatus, nzDisabled, nzFormatter, nzSize }) {
  370. if (nzFormatter && !nzFormatter.isFirstChange()) {
  371. const validValue = this.getCurrentValidValue(this.parsedValue);
  372. this.setValue(validValue);
  373. this.updateDisplayValue(validValue);
  374. }
  375. if (nzDisabled) {
  376. this.disabled$.next(this.nzDisabled);
  377. }
  378. if (nzStatus) {
  379. this.setStatusStyles(this.nzStatus, this.hasFeedback);
  380. }
  381. if (nzSize) {
  382. this.size.set(nzSize.currentValue);
  383. }
  384. }
  385. ngAfterViewInit() {
  386. if (this.nzAutoFocus) {
  387. this.focus();
  388. }
  389. }
  390. ngOnDestroy() {
  391. this.focusMonitor.stopMonitoring(this.elementRef);
  392. }
  393. setupHandlersListeners() {
  394. merge(fromEventOutsideAngular(this.upHandler.nativeElement, 'mouseup'), fromEventOutsideAngular(this.upHandler.nativeElement, 'mouseleave'), fromEventOutsideAngular(this.downHandler.nativeElement, 'mouseup'), fromEventOutsideAngular(this.downHandler.nativeElement, 'mouseleave'))
  395. .pipe(takeUntil(this.destroy$))
  396. .subscribe(() => this.stop());
  397. }
  398. setStatusStyles(status, hasFeedback) {
  399. // set inner status
  400. this.status = status;
  401. this.hasFeedback = hasFeedback;
  402. this.cdr.markForCheck();
  403. // render status if nzStatus is set
  404. this.statusCls = getStatusClassNames(this.prefixCls, status, hasFeedback);
  405. Object.keys(this.statusCls).forEach(status => {
  406. if (this.statusCls[status]) {
  407. this.renderer.addClass(this.elementRef.nativeElement, status);
  408. }
  409. else {
  410. this.renderer.removeClass(this.elementRef.nativeElement, status);
  411. }
  412. });
  413. }
  414. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberLegacyComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.FocusMonitor }, { token: i0.Renderer2 }, { token: i2.Directionality }, { token: i3.NzDestroyService }], target: i0.ɵɵFactoryTarget.Component });
  415. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzInputNumberLegacyComponent, isStandalone: true, selector: "nz-input-number", inputs: { nzSize: "nzSize", nzMin: ["nzMin", "nzMin", numberAttribute], nzMax: ["nzMax", "nzMax", numberAttribute], nzParser: "nzParser", nzPrecision: "nzPrecision", nzPrecisionMode: "nzPrecisionMode", nzPlaceHolder: "nzPlaceHolder", nzStatus: "nzStatus", nzStep: ["nzStep", "nzStep", numberAttribute], nzInputMode: "nzInputMode", nzId: "nzId", nzDisabled: ["nzDisabled", "nzDisabled", booleanAttribute], nzReadOnly: ["nzReadOnly", "nzReadOnly", booleanAttribute], nzAutoFocus: ["nzAutoFocus", "nzAutoFocus", booleanAttribute], nzBorderless: ["nzBorderless", "nzBorderless", booleanAttribute], nzFormatter: "nzFormatter" }, outputs: { nzBlur: "nzBlur", nzFocus: "nzFocus" }, host: { properties: { "class.ant-input-number-in-form-item": "!!nzFormStatusService", "class.ant-input-number-focused": "isFocused", "class.ant-input-number-lg": "finalSize() === 'large'", "class.ant-input-number-sm": "finalSize() === 'small'", "class.ant-input-number-disabled": "nzDisabled", "class.ant-input-number-readonly": "nzReadOnly", "class.ant-input-number-rtl": "dir === 'rtl'", "class.ant-input-number-borderless": "nzBorderless" }, classAttribute: "ant-input-number" }, providers: [
  416. {
  417. provide: NG_VALUE_ACCESSOR,
  418. useExisting: forwardRef(() => NzInputNumberLegacyComponent),
  419. multi: true
  420. },
  421. { provide: NZ_SPACE_COMPACT_ITEM_TYPE, useValue: 'input-number' },
  422. NzDestroyService
  423. ], viewQueries: [{ propertyName: "upHandler", first: true, predicate: ["upHandler"], descendants: true, static: true }, { propertyName: "downHandler", first: true, predicate: ["downHandler"], descendants: true, static: true }, { propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], exportAs: ["nzInputNumber"], usesOnChanges: true, hostDirectives: [{ directive: i4.NzSpaceCompactItemDirective }], ngImport: i0, template: `
  424. <div class="ant-input-number-handler-wrap">
  425. <span
  426. #upHandler
  427. unselectable="unselectable"
  428. class="ant-input-number-handler ant-input-number-handler-up"
  429. (mousedown)="up($event)"
  430. [class.ant-input-number-handler-up-disabled]="disabledUp"
  431. >
  432. <nz-icon nzType="up" class="ant-input-number-handler-up-inner" />
  433. </span>
  434. <span
  435. #downHandler
  436. unselectable="unselectable"
  437. class="ant-input-number-handler ant-input-number-handler-down"
  438. (mousedown)="down($event)"
  439. [class.ant-input-number-handler-down-disabled]="disabledDown"
  440. >
  441. <nz-icon nzType="down" class="ant-input-number-handler-down-inner" />
  442. </span>
  443. </div>
  444. <div class="ant-input-number-input-wrap">
  445. <input
  446. #inputElement
  447. autocomplete="off"
  448. class="ant-input-number-input"
  449. [attr.id]="nzId"
  450. [attr.autofocus]="nzAutoFocus ? 'autofocus' : null"
  451. [disabled]="nzDisabled"
  452. [attr.min]="nzMin"
  453. [attr.max]="nzMax"
  454. [placeholder]="nzPlaceHolder"
  455. [attr.step]="nzStep"
  456. [readOnly]="nzReadOnly"
  457. [attr.inputmode]="nzInputMode"
  458. [ngModel]="displayValue"
  459. (ngModelChange)="onModelChange($event)"
  460. />
  461. </div>
  462. @if (hasFeedback && !!status && !nzFormNoStatusService) {
  463. <nz-form-item-feedback-icon class="ant-input-number-suffix" [status]="status" />
  464. }
  465. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i5.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NzFormItemFeedbackIconComponent, selector: "nz-form-item-feedback-icon", inputs: ["status"], exportAs: ["nzFormFeedbackIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  466. }
  467. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberLegacyComponent, decorators: [{
  468. type: Component,
  469. args: [{
  470. selector: 'nz-input-number',
  471. exportAs: 'nzInputNumber',
  472. template: `
  473. <div class="ant-input-number-handler-wrap">
  474. <span
  475. #upHandler
  476. unselectable="unselectable"
  477. class="ant-input-number-handler ant-input-number-handler-up"
  478. (mousedown)="up($event)"
  479. [class.ant-input-number-handler-up-disabled]="disabledUp"
  480. >
  481. <nz-icon nzType="up" class="ant-input-number-handler-up-inner" />
  482. </span>
  483. <span
  484. #downHandler
  485. unselectable="unselectable"
  486. class="ant-input-number-handler ant-input-number-handler-down"
  487. (mousedown)="down($event)"
  488. [class.ant-input-number-handler-down-disabled]="disabledDown"
  489. >
  490. <nz-icon nzType="down" class="ant-input-number-handler-down-inner" />
  491. </span>
  492. </div>
  493. <div class="ant-input-number-input-wrap">
  494. <input
  495. #inputElement
  496. autocomplete="off"
  497. class="ant-input-number-input"
  498. [attr.id]="nzId"
  499. [attr.autofocus]="nzAutoFocus ? 'autofocus' : null"
  500. [disabled]="nzDisabled"
  501. [attr.min]="nzMin"
  502. [attr.max]="nzMax"
  503. [placeholder]="nzPlaceHolder"
  504. [attr.step]="nzStep"
  505. [readOnly]="nzReadOnly"
  506. [attr.inputmode]="nzInputMode"
  507. [ngModel]="displayValue"
  508. (ngModelChange)="onModelChange($event)"
  509. />
  510. </div>
  511. @if (hasFeedback && !!status && !nzFormNoStatusService) {
  512. <nz-form-item-feedback-icon class="ant-input-number-suffix" [status]="status" />
  513. }
  514. `,
  515. providers: [
  516. {
  517. provide: NG_VALUE_ACCESSOR,
  518. useExisting: forwardRef(() => NzInputNumberLegacyComponent),
  519. multi: true
  520. },
  521. { provide: NZ_SPACE_COMPACT_ITEM_TYPE, useValue: 'input-number' },
  522. NzDestroyService
  523. ],
  524. changeDetection: ChangeDetectionStrategy.OnPush,
  525. encapsulation: ViewEncapsulation.None,
  526. host: {
  527. class: 'ant-input-number',
  528. '[class.ant-input-number-in-form-item]': '!!nzFormStatusService',
  529. '[class.ant-input-number-focused]': 'isFocused',
  530. '[class.ant-input-number-lg]': `finalSize() === 'large'`,
  531. '[class.ant-input-number-sm]': `finalSize() === 'small'`,
  532. '[class.ant-input-number-disabled]': 'nzDisabled',
  533. '[class.ant-input-number-readonly]': 'nzReadOnly',
  534. '[class.ant-input-number-rtl]': `dir === 'rtl'`,
  535. '[class.ant-input-number-borderless]': `nzBorderless`
  536. },
  537. imports: [NzIconModule, FormsModule, NzFormItemFeedbackIconComponent],
  538. hostDirectives: [NzSpaceCompactItemDirective]
  539. }]
  540. }], ctorParameters: () => [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.FocusMonitor }, { type: i0.Renderer2 }, { type: i2.Directionality }, { type: i3.NzDestroyService }], propDecorators: { nzBlur: [{
  541. type: Output
  542. }], nzFocus: [{
  543. type: Output
  544. }], upHandler: [{
  545. type: ViewChild,
  546. args: ['upHandler', { static: true }]
  547. }], downHandler: [{
  548. type: ViewChild,
  549. args: ['downHandler', { static: true }]
  550. }], inputElement: [{
  551. type: ViewChild,
  552. args: ['inputElement', { static: true }]
  553. }], nzSize: [{
  554. type: Input
  555. }], nzMin: [{
  556. type: Input,
  557. args: [{ transform: numberAttribute }]
  558. }], nzMax: [{
  559. type: Input,
  560. args: [{ transform: numberAttribute }]
  561. }], nzParser: [{
  562. type: Input
  563. }], nzPrecision: [{
  564. type: Input
  565. }], nzPrecisionMode: [{
  566. type: Input
  567. }], nzPlaceHolder: [{
  568. type: Input
  569. }], nzStatus: [{
  570. type: Input
  571. }], nzStep: [{
  572. type: Input,
  573. args: [{ transform: numberAttribute }]
  574. }], nzInputMode: [{
  575. type: Input
  576. }], nzId: [{
  577. type: Input
  578. }], nzDisabled: [{
  579. type: Input,
  580. args: [{ transform: booleanAttribute }]
  581. }], nzReadOnly: [{
  582. type: Input,
  583. args: [{ transform: booleanAttribute }]
  584. }], nzAutoFocus: [{
  585. type: Input,
  586. args: [{ transform: booleanAttribute }]
  587. }], nzBorderless: [{
  588. type: Input,
  589. args: [{ transform: booleanAttribute }]
  590. }], nzFormatter: [{
  591. type: Input
  592. }] } });
  593. /**
  594. * Use of this source code is governed by an MIT-style license that can be
  595. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  596. */
  597. /**
  598. * @deprecated Deprecated in v19.0.0. It is recommended to use the new version `<nz-input-number>`.
  599. */
  600. class NzInputNumberGroupSlotComponent {
  601. icon = null;
  602. type = null;
  603. template = null;
  604. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberGroupSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  605. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzInputNumberGroupSlotComponent, isStandalone: true, selector: "[nz-input-number-group-slot]", inputs: { icon: "icon", type: "type", template: "template" }, host: { properties: { "class.ant-input-number-group-addon": "type === 'addon'", "class.ant-input-number-prefix": "type === 'prefix'", "class.ant-input-number-suffix": "type === 'suffix'" } }, ngImport: i0, template: `
  606. @if (icon) {
  607. <nz-icon [nzType]="icon" />
  608. }
  609. <ng-container *nzStringTemplateOutlet="template">{{ template }}</ng-container>
  610. <ng-content></ng-content>
  611. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i5.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i2$1.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  612. }
  613. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberGroupSlotComponent, decorators: [{
  614. type: Component,
  615. args: [{
  616. selector: '[nz-input-number-group-slot]',
  617. preserveWhitespaces: false,
  618. encapsulation: ViewEncapsulation.None,
  619. changeDetection: ChangeDetectionStrategy.OnPush,
  620. template: `
  621. @if (icon) {
  622. <nz-icon [nzType]="icon" />
  623. }
  624. <ng-container *nzStringTemplateOutlet="template">{{ template }}</ng-container>
  625. <ng-content></ng-content>
  626. `,
  627. host: {
  628. '[class.ant-input-number-group-addon]': `type === 'addon'`,
  629. '[class.ant-input-number-prefix]': `type === 'prefix'`,
  630. '[class.ant-input-number-suffix]': `type === 'suffix'`
  631. },
  632. imports: [NzIconModule, NzOutletModule]
  633. }]
  634. }], propDecorators: { icon: [{
  635. type: Input
  636. }], type: [{
  637. type: Input
  638. }], template: [{
  639. type: Input
  640. }] } });
  641. /**
  642. * @deprecated Deprecated in v19.0.0. It is recommended to use the new version `<nz-input-number>`.
  643. */
  644. class NzInputNumberGroupWhitSuffixOrPrefixDirective {
  645. elementRef;
  646. constructor(elementRef) {
  647. this.elementRef = elementRef;
  648. }
  649. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberGroupWhitSuffixOrPrefixDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
  650. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzInputNumberGroupWhitSuffixOrPrefixDirective, isStandalone: true, selector: "nz-input-number-group[nzSuffix], nz-input-number-group[nzPrefix]", ngImport: i0 });
  651. }
  652. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberGroupWhitSuffixOrPrefixDirective, decorators: [{
  653. type: Directive,
  654. args: [{
  655. selector: `nz-input-number-group[nzSuffix], nz-input-number-group[nzPrefix]`
  656. }]
  657. }], ctorParameters: () => [{ type: i0.ElementRef }] });
  658. /**
  659. * @deprecated Deprecated in v19.0.0. It is recommended to use the new version `<nz-input-number>`.
  660. */
  661. class NzInputNumberGroupComponent {
  662. focusMonitor;
  663. elementRef;
  664. renderer;
  665. cdr;
  666. directionality;
  667. listOfNzInputNumberComponent;
  668. nzAddOnBeforeIcon = null;
  669. nzAddOnAfterIcon = null;
  670. nzPrefixIcon = null;
  671. nzSuffixIcon = null;
  672. nzAddOnBefore;
  673. nzAddOnAfter;
  674. nzPrefix;
  675. nzStatus = '';
  676. nzSuffix;
  677. nzSize = 'default';
  678. /**
  679. * @deprecated Will be removed in v20. Use `NzSpaceCompactComponent` instead.
  680. */
  681. nzCompact = false;
  682. isLarge = false;
  683. isSmall = false;
  684. isAffix = false;
  685. isAddOn = false;
  686. isFeedback = false;
  687. focused = false;
  688. disabled = false;
  689. dir = 'ltr';
  690. // status
  691. prefixCls = 'ant-input-number';
  692. affixStatusCls = {};
  693. groupStatusCls = {};
  694. affixInGroupStatusCls = {};
  695. status = '';
  696. hasFeedback = false;
  697. destroy$ = new Subject();
  698. nzFormStatusService = inject(NzFormStatusService, { optional: true });
  699. nzFormNoStatusService = inject(NzFormNoStatusService, { optional: true });
  700. constructor(focusMonitor, elementRef, renderer, cdr, directionality) {
  701. this.focusMonitor = focusMonitor;
  702. this.elementRef = elementRef;
  703. this.renderer = renderer;
  704. this.cdr = cdr;
  705. this.directionality = directionality;
  706. }
  707. updateChildrenInputSize() {
  708. if (this.listOfNzInputNumberComponent) {
  709. this.listOfNzInputNumberComponent.forEach(item => item['size'].set(this.nzSize));
  710. }
  711. }
  712. ngOnInit() {
  713. this.nzFormStatusService?.formStatusChanges
  714. .pipe(distinctUntilChanged((pre, cur) => {
  715. return pre.status === cur.status && pre.hasFeedback === cur.hasFeedback;
  716. }), takeUntil(this.destroy$))
  717. .subscribe(({ status, hasFeedback }) => {
  718. this.setStatusStyles(status, hasFeedback);
  719. });
  720. this.focusMonitor
  721. .monitor(this.elementRef, true)
  722. .pipe(takeUntil(this.destroy$))
  723. .subscribe(focusOrigin => {
  724. this.focused = !!focusOrigin;
  725. this.cdr.markForCheck();
  726. });
  727. this.dir = this.directionality.value;
  728. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  729. this.dir = direction;
  730. });
  731. }
  732. ngAfterContentInit() {
  733. this.updateChildrenInputSize();
  734. const listOfInputChange$ = this.listOfNzInputNumberComponent.changes.pipe(startWith(this.listOfNzInputNumberComponent));
  735. listOfInputChange$
  736. .pipe(switchMap(list => merge(...[listOfInputChange$, ...list.map((input) => input.disabled$)])), mergeMap(() => listOfInputChange$), map(list => list.some((input) => input.nzDisabled)), takeUntil(this.destroy$))
  737. .subscribe(disabled => {
  738. this.disabled = disabled;
  739. this.cdr.markForCheck();
  740. });
  741. }
  742. ngOnChanges(changes) {
  743. const { nzSize, nzSuffix, nzPrefix, nzPrefixIcon, nzSuffixIcon, nzAddOnAfter, nzAddOnBefore, nzAddOnAfterIcon, nzAddOnBeforeIcon, nzStatus } = changes;
  744. if (nzSize) {
  745. this.updateChildrenInputSize();
  746. this.isLarge = this.nzSize === 'large';
  747. this.isSmall = this.nzSize === 'small';
  748. }
  749. if (nzSuffix || nzPrefix || nzPrefixIcon || nzSuffixIcon) {
  750. this.isAffix = !!(this.nzSuffix || this.nzPrefix || this.nzPrefixIcon || this.nzSuffixIcon);
  751. }
  752. if (nzAddOnAfter || nzAddOnBefore || nzAddOnAfterIcon || nzAddOnBeforeIcon) {
  753. this.isAddOn = !!(this.nzAddOnAfter || this.nzAddOnBefore || this.nzAddOnAfterIcon || this.nzAddOnBeforeIcon);
  754. this.nzFormNoStatusService?.noFormStatus?.next(this.isAddOn);
  755. }
  756. if (nzStatus) {
  757. this.setStatusStyles(this.nzStatus, this.hasFeedback);
  758. }
  759. }
  760. ngOnDestroy() {
  761. this.focusMonitor.stopMonitoring(this.elementRef);
  762. this.destroy$.next();
  763. this.destroy$.complete();
  764. }
  765. setStatusStyles(status, hasFeedback) {
  766. // set inner status
  767. this.status = status;
  768. this.hasFeedback = hasFeedback;
  769. this.isFeedback = !!status && hasFeedback;
  770. const baseAffix = !!(this.nzSuffix || this.nzPrefix || this.nzPrefixIcon || this.nzSuffixIcon);
  771. this.isAffix = baseAffix || (!this.isAddOn && hasFeedback);
  772. this.affixInGroupStatusCls =
  773. this.isAffix || this.isFeedback
  774. ? (this.affixStatusCls = getStatusClassNames(`${this.prefixCls}-affix-wrapper`, status, hasFeedback))
  775. : {};
  776. this.cdr.markForCheck();
  777. // render status if nzStatus is set
  778. this.affixStatusCls = getStatusClassNames(`${this.prefixCls}-affix-wrapper`, this.isAddOn ? '' : status, this.isAddOn ? false : hasFeedback);
  779. this.groupStatusCls = getStatusClassNames(`${this.prefixCls}-group-wrapper`, this.isAddOn ? status : '', this.isAddOn ? hasFeedback : false);
  780. const statusCls = {
  781. ...this.affixStatusCls,
  782. ...this.groupStatusCls
  783. };
  784. Object.keys(statusCls).forEach(status => {
  785. if (statusCls[status]) {
  786. this.renderer.addClass(this.elementRef.nativeElement, status);
  787. }
  788. else {
  789. this.renderer.removeClass(this.elementRef.nativeElement, status);
  790. }
  791. });
  792. }
  793. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberGroupComponent, deps: [{ token: i1.FocusMonitor }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i2.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  794. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzInputNumberGroupComponent, isStandalone: true, selector: "nz-input-number-group", inputs: { nzAddOnBeforeIcon: "nzAddOnBeforeIcon", nzAddOnAfterIcon: "nzAddOnAfterIcon", nzPrefixIcon: "nzPrefixIcon", nzSuffixIcon: "nzSuffixIcon", nzAddOnBefore: "nzAddOnBefore", nzAddOnAfter: "nzAddOnAfter", nzPrefix: "nzPrefix", nzStatus: "nzStatus", nzSuffix: "nzSuffix", nzSize: "nzSize", nzCompact: ["nzCompact", "nzCompact", booleanAttribute] }, host: { properties: { "class.ant-input-number-group": "nzCompact", "class.ant-input-number-group-compact": "nzCompact", "class.ant-input-number-group-wrapper": "isAddOn", "class.ant-input-number-group-wrapper-rtl": "isAddOn && dir === 'rtl'", "class.ant-input-number-group-wrapper-lg": "isAddOn && isLarge", "class.ant-input-number-group-wrapper-sm": "isAddOn && isSmall", "class.ant-input-number-affix-wrapper": "!isAddOn && isAffix", "class.ant-input-number-affix-wrapper-rtl": "!isAddOn && dir === 'rtl'", "class.ant-input-number-affix-wrapper-focused": "!isAddOn && isAffix && focused", "class.ant-input-number-affix-wrapper-disabled": "!isAddOn && isAffix && disabled", "class.ant-input-number-affix-wrapper-lg": "!isAddOn && isAffix && isLarge", "class.ant-input-number-affix-wrapper-sm": "!isAddOn && isAffix && isSmall" } }, providers: [NzFormNoStatusService, { provide: NZ_SPACE_COMPACT_ITEM_TYPE, useValue: 'input-number' }], queries: [{ propertyName: "listOfNzInputNumberComponent", predicate: NzInputNumberLegacyComponent, descendants: true }], exportAs: ["nzInputNumberGroup"], usesOnChanges: true, hostDirectives: [{ directive: i4.NzSpaceCompactItemDirective }], ngImport: i0, template: `
  795. @if (isAddOn) {
  796. <span class="ant-input-number-wrapper ant-input-number-group">
  797. @if (nzAddOnBefore || nzAddOnBeforeIcon) {
  798. <div nz-input-number-group-slot type="addon" [icon]="nzAddOnBeforeIcon" [template]="nzAddOnBefore"></div>
  799. }
  800. @if (isAffix || hasFeedback) {
  801. <div
  802. class="ant-input-number-affix-wrapper"
  803. [class.ant-input-number-affix-wrapper-disabled]="disabled"
  804. [class.ant-input-number-affix-wrapper-sm]="isSmall"
  805. [class.ant-input-number-affix-wrapper-lg]="isLarge"
  806. [class.ant-input-number-affix-wrapper-focused]="focused"
  807. [class]="affixInGroupStatusCls"
  808. >
  809. <ng-template [ngTemplateOutlet]="affixTemplate"></ng-template>
  810. </div>
  811. } @else {
  812. <ng-template [ngTemplateOutlet]="contentTemplate" />
  813. }
  814. @if (nzAddOnAfter || nzAddOnAfterIcon) {
  815. <span nz-input-number-group-slot type="addon" [icon]="nzAddOnAfterIcon" [template]="nzAddOnAfter"></span>
  816. }
  817. </span>
  818. } @else {
  819. @if (isAffix) {
  820. <ng-template [ngTemplateOutlet]="affixTemplate" />
  821. } @else {
  822. <ng-template [ngTemplateOutlet]="contentTemplate" />
  823. }
  824. }
  825. <!-- Affix Template -->
  826. <ng-template #affixTemplate>
  827. @if (nzPrefix || nzPrefixIcon) {
  828. <span nz-input-number-group-slot type="prefix" [icon]="nzPrefixIcon" [template]="nzPrefix"></span>
  829. }
  830. <ng-template [ngTemplateOutlet]="contentTemplate" />
  831. @if (nzSuffix || nzSuffixIcon || isFeedback) {
  832. <span nz-input-number-group-slot type="suffix" [icon]="nzSuffixIcon" [template]="nzSuffix">
  833. @if (isFeedback) {
  834. <nz-form-item-feedback-icon [status]="status" />
  835. }
  836. </span>
  837. }
  838. </ng-template>
  839. <!-- Content Template -->
  840. <ng-template #contentTemplate>
  841. <ng-content />
  842. @if (!isAddOn && !isAffix && isFeedback) {
  843. <span nz-input-number-group-slot type="suffix">
  844. @if (isFeedback) {
  845. <nz-form-item-feedback-icon [status]="status" />
  846. }
  847. </span>
  848. }
  849. </ng-template>
  850. `, isInline: true, dependencies: [{ kind: "component", type: NzInputNumberGroupSlotComponent, selector: "[nz-input-number-group-slot]", inputs: ["icon", "type", "template"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NzFormItemFeedbackIconComponent, selector: "nz-form-item-feedback-icon", inputs: ["status"], exportAs: ["nzFormFeedbackIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  851. }
  852. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberGroupComponent, decorators: [{
  853. type: Component,
  854. args: [{
  855. selector: 'nz-input-number-group',
  856. exportAs: 'nzInputNumberGroup',
  857. imports: [NzInputNumberGroupSlotComponent, NgTemplateOutlet, NzFormItemFeedbackIconComponent],
  858. template: `
  859. @if (isAddOn) {
  860. <span class="ant-input-number-wrapper ant-input-number-group">
  861. @if (nzAddOnBefore || nzAddOnBeforeIcon) {
  862. <div nz-input-number-group-slot type="addon" [icon]="nzAddOnBeforeIcon" [template]="nzAddOnBefore"></div>
  863. }
  864. @if (isAffix || hasFeedback) {
  865. <div
  866. class="ant-input-number-affix-wrapper"
  867. [class.ant-input-number-affix-wrapper-disabled]="disabled"
  868. [class.ant-input-number-affix-wrapper-sm]="isSmall"
  869. [class.ant-input-number-affix-wrapper-lg]="isLarge"
  870. [class.ant-input-number-affix-wrapper-focused]="focused"
  871. [class]="affixInGroupStatusCls"
  872. >
  873. <ng-template [ngTemplateOutlet]="affixTemplate"></ng-template>
  874. </div>
  875. } @else {
  876. <ng-template [ngTemplateOutlet]="contentTemplate" />
  877. }
  878. @if (nzAddOnAfter || nzAddOnAfterIcon) {
  879. <span nz-input-number-group-slot type="addon" [icon]="nzAddOnAfterIcon" [template]="nzAddOnAfter"></span>
  880. }
  881. </span>
  882. } @else {
  883. @if (isAffix) {
  884. <ng-template [ngTemplateOutlet]="affixTemplate" />
  885. } @else {
  886. <ng-template [ngTemplateOutlet]="contentTemplate" />
  887. }
  888. }
  889. <!-- Affix Template -->
  890. <ng-template #affixTemplate>
  891. @if (nzPrefix || nzPrefixIcon) {
  892. <span nz-input-number-group-slot type="prefix" [icon]="nzPrefixIcon" [template]="nzPrefix"></span>
  893. }
  894. <ng-template [ngTemplateOutlet]="contentTemplate" />
  895. @if (nzSuffix || nzSuffixIcon || isFeedback) {
  896. <span nz-input-number-group-slot type="suffix" [icon]="nzSuffixIcon" [template]="nzSuffix">
  897. @if (isFeedback) {
  898. <nz-form-item-feedback-icon [status]="status" />
  899. }
  900. </span>
  901. }
  902. </ng-template>
  903. <!-- Content Template -->
  904. <ng-template #contentTemplate>
  905. <ng-content />
  906. @if (!isAddOn && !isAffix && isFeedback) {
  907. <span nz-input-number-group-slot type="suffix">
  908. @if (isFeedback) {
  909. <nz-form-item-feedback-icon [status]="status" />
  910. }
  911. </span>
  912. }
  913. </ng-template>
  914. `,
  915. encapsulation: ViewEncapsulation.None,
  916. changeDetection: ChangeDetectionStrategy.OnPush,
  917. providers: [NzFormNoStatusService, { provide: NZ_SPACE_COMPACT_ITEM_TYPE, useValue: 'input-number' }],
  918. host: {
  919. '[class.ant-input-number-group]': 'nzCompact',
  920. '[class.ant-input-number-group-compact]': 'nzCompact',
  921. '[class.ant-input-number-group-wrapper]': `isAddOn`,
  922. '[class.ant-input-number-group-wrapper-rtl]': `isAddOn && dir === 'rtl'`,
  923. '[class.ant-input-number-group-wrapper-lg]': `isAddOn && isLarge`,
  924. '[class.ant-input-number-group-wrapper-sm]': `isAddOn && isSmall`,
  925. '[class.ant-input-number-affix-wrapper]': `!isAddOn && isAffix`,
  926. '[class.ant-input-number-affix-wrapper-rtl]': `!isAddOn && dir === 'rtl'`,
  927. '[class.ant-input-number-affix-wrapper-focused]': `!isAddOn && isAffix && focused`,
  928. '[class.ant-input-number-affix-wrapper-disabled]': `!isAddOn && isAffix && disabled`,
  929. '[class.ant-input-number-affix-wrapper-lg]': `!isAddOn && isAffix && isLarge`,
  930. '[class.ant-input-number-affix-wrapper-sm]': `!isAddOn && isAffix && isSmall`
  931. },
  932. hostDirectives: [NzSpaceCompactItemDirective]
  933. }]
  934. }], ctorParameters: () => [{ type: i1.FocusMonitor }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i2.Directionality }], propDecorators: { listOfNzInputNumberComponent: [{
  935. type: ContentChildren,
  936. args: [NzInputNumberLegacyComponent, { descendants: true }]
  937. }], nzAddOnBeforeIcon: [{
  938. type: Input
  939. }], nzAddOnAfterIcon: [{
  940. type: Input
  941. }], nzPrefixIcon: [{
  942. type: Input
  943. }], nzSuffixIcon: [{
  944. type: Input
  945. }], nzAddOnBefore: [{
  946. type: Input
  947. }], nzAddOnAfter: [{
  948. type: Input
  949. }], nzPrefix: [{
  950. type: Input
  951. }], nzStatus: [{
  952. type: Input
  953. }], nzSuffix: [{
  954. type: Input
  955. }], nzSize: [{
  956. type: Input
  957. }], nzCompact: [{
  958. type: Input,
  959. args: [{ transform: booleanAttribute }]
  960. }] } });
  961. /**
  962. * Use of this source code is governed by an MIT-style license that can be
  963. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  964. */
  965. /**
  966. * @deprecated Deprecated in v19.0.0. It is recommended to use the new version `<nz-input-number>`.
  967. */
  968. class NzInputNumberLegacyModule {
  969. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberLegacyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  970. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberLegacyModule, imports: [NzInputNumberLegacyComponent,
  971. NzInputNumberGroupComponent,
  972. NzInputNumberGroupWhitSuffixOrPrefixDirective,
  973. NzInputNumberGroupSlotComponent], exports: [NzInputNumberLegacyComponent, NzInputNumberGroupComponent, NzInputNumberGroupWhitSuffixOrPrefixDirective] });
  974. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberLegacyModule, imports: [NzInputNumberLegacyComponent,
  975. NzInputNumberGroupComponent,
  976. NzInputNumberGroupSlotComponent] });
  977. }
  978. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzInputNumberLegacyModule, decorators: [{
  979. type: NgModule,
  980. args: [{
  981. imports: [
  982. NzInputNumberLegacyComponent,
  983. NzInputNumberGroupComponent,
  984. NzInputNumberGroupWhitSuffixOrPrefixDirective,
  985. NzInputNumberGroupSlotComponent
  986. ],
  987. exports: [NzInputNumberLegacyComponent, NzInputNumberGroupComponent, NzInputNumberGroupWhitSuffixOrPrefixDirective]
  988. }]
  989. }] });
  990. /**
  991. * Use of this source code is governed by an MIT-style license that can be
  992. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  993. */
  994. /**
  995. * Generated bundle index. Do not edit.
  996. */
  997. export { NzInputNumberGroupComponent, NzInputNumberGroupSlotComponent, NzInputNumberGroupWhitSuffixOrPrefixDirective, NzInputNumberLegacyComponent, NzInputNumberLegacyModule };
  998. //# sourceMappingURL=ng-zorro-antd-input-number-legacy.mjs.map