From c31ed441482185262182d478d0f7eca67655bb03 Mon Sep 17 00:00:00 2001 From: Dylan Young <104391407+dylansyoung@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:36:02 +0000 Subject: [PATCH 1/4] initial commit --- src/app/components/inputnumber/inputnumber.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/components/inputnumber/inputnumber.ts b/src/app/components/inputnumber/inputnumber.ts index e287272cc17..59590f8397f 100644 --- a/src/app/components/inputnumber/inputnumber.ts +++ b/src/app/components/inputnumber/inputnumber.ts @@ -31,6 +31,7 @@ import { AngleUpIcon } from 'primeng/icons/angleup'; import { AngleDownIcon } from 'primeng/icons/angledown'; import { Nullable } from 'primeng/ts-helpers'; import { InputNumberInputEvent } from './inputnumber.interface'; +import { stringify } from 'querystring'; export const INPUTNUMBER_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, @@ -935,6 +936,10 @@ export class InputNumber implements OnInit, AfterContentInit, OnChanges, Control event.preventDefault(); let data = (event.clipboardData || (this.document as any).defaultView['clipboardData']).getData('Text'); if (data) { + if(this.maxlength) { + data.toString().substring(0, this.maxlength); + } + let filteredData = this.parseValue(data); if (filteredData != null) { this.insert(event, filteredData.toString()); From c77aa439eec5b9b8157a45d5419881f45f99a7ad Mon Sep 17 00:00:00 2001 From: Dylan Young <104391407+dylansyoung@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:37:14 +0000 Subject: [PATCH 2/4] remove import --- src/app/components/inputnumber/inputnumber.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/components/inputnumber/inputnumber.ts b/src/app/components/inputnumber/inputnumber.ts index 59590f8397f..2ea31b0c4b3 100644 --- a/src/app/components/inputnumber/inputnumber.ts +++ b/src/app/components/inputnumber/inputnumber.ts @@ -31,7 +31,6 @@ import { AngleUpIcon } from 'primeng/icons/angleup'; import { AngleDownIcon } from 'primeng/icons/angledown'; import { Nullable } from 'primeng/ts-helpers'; import { InputNumberInputEvent } from './inputnumber.interface'; -import { stringify } from 'querystring'; export const INPUTNUMBER_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, From ab6a64203e3b6bfbfd1c2fe2bf84b286f12dc3c2 Mon Sep 17 00:00:00 2001 From: Dylan Young <104391407+dylansyoung@users.noreply.github.com> Date: Thu, 31 Aug 2023 15:21:32 +0000 Subject: [PATCH 3/4] set data variable equal to --- src/app/components/inputnumber/inputnumber.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/inputnumber/inputnumber.ts b/src/app/components/inputnumber/inputnumber.ts index 2ea31b0c4b3..1993257405b 100644 --- a/src/app/components/inputnumber/inputnumber.ts +++ b/src/app/components/inputnumber/inputnumber.ts @@ -936,7 +936,7 @@ export class InputNumber implements OnInit, AfterContentInit, OnChanges, Control let data = (event.clipboardData || (this.document as any).defaultView['clipboardData']).getData('Text'); if (data) { if(this.maxlength) { - data.toString().substring(0, this.maxlength); + data = data.toString().substring(0, this.maxlength); } let filteredData = this.parseValue(data); From 9efff769fb20b791b241a0ca8528de71ffb0f9ff Mon Sep 17 00:00:00 2001 From: Dylan Young <104391407+dylansyoung@users.noreply.github.com> Date: Thu, 31 Aug 2023 15:31:26 +0000 Subject: [PATCH 4/4] format fix --- src/app/components/inputnumber/inputnumber.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/inputnumber/inputnumber.ts b/src/app/components/inputnumber/inputnumber.ts index 1993257405b..f058d0e9808 100644 --- a/src/app/components/inputnumber/inputnumber.ts +++ b/src/app/components/inputnumber/inputnumber.ts @@ -935,10 +935,10 @@ export class InputNumber implements OnInit, AfterContentInit, OnChanges, Control event.preventDefault(); let data = (event.clipboardData || (this.document as any).defaultView['clipboardData']).getData('Text'); if (data) { - if(this.maxlength) { + if (this.maxlength) { data = data.toString().substring(0, this.maxlength); } - + let filteredData = this.parseValue(data); if (filteredData != null) { this.insert(event, filteredData.toString());