p-calendar onInput not getting data for insertFromPaste

UI Components for Angular
Post Reply
notclevermail
Posts: 2
Joined: 04 Dec 2014, 18:20

08 Jul 2020, 00:22

Hi all, I'm using primeng 9.1.0 and found a weird behavior using p-calendar in chrome.

Code: Select all

 <p-calendar
            formControlName="soatExpiration"
            [locale]="es"
            dateFormat="MM d 'de' yy"
            [showIcon]="true"
            [monthNavigator]="true"
            [yearNavigator]="true"
            (onInput)="calendarPreformattedInput($event)"
            pTooltip="Puedes pegar una fecha en formato 31/12/2020"
          ></p-calendar>
the calendarPreformattedInput method is called with an event insertFromPaste when user paste content in the field. In firefox I'm able to get the pasted value while in chrome it appears null.


This is the content of the $event var received by calendarPreformattedInput
Firefox

Code: Select all

bubbles: true
cancelBubble: false
cancelable: false
composed: true
currentTarget: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
data: "16/12/2020"  -----------------------------> Paste Value
dataTransfer: null
defaultPrevented: false
detail: 0
eventPhase: 2
explicitOriginalTarget: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
inputType: "insertFromPaste"           -----------------------------> EVENT
isComposing: false
isTrusted: true
layerX: 0
layerY: 0
originalTarget: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
rangeOffset: 10
rangeParent: null
returnValue: true
srcElement: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
target: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
timeStamp: 973626
type: "input"
view: Window
which: 0
Chrome

Code: Select all

isTrusted: true
data: null                      -----------------------------> Paste Value
isComposing: false
inputType: "insertFromPaste"  -----------------------------> EVENT
dataTransfer: null
view: null
detail: 0
sourceCapabilities: null
which: 0
type: "input"
target: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
currentTarget: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
eventPhase: 2
bubbles: true
cancelable: false
defaultPrevented: false
composed: true
timeStamp: 1409550.3150000004
srcElement: input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted
returnValue: true
cancelBubble: false
path: (16) [input.ng-tns-c301-2.ui-inputtext.ui-widget.ui-state-default.ui-corner-all.ng-star-inserted, span.ng-tns-c301-2.ui-calendar.ui-calendar-w-btn, p-calendar.ng-tns-c301-2.ng-valid.ng-touched.ng-dirty.ui-inputwrapper-focus, div.p-field.p-col-12.ng-star-inserted, div.ui-fluid.p-formgrid.p-grid.ng-tns-c297-1, div.ui-panel-content.ui-widget-content.ng-tns-c297-1, div#ui-panel-0-content.ui-panel-content-wrapper.ng-tns-c297-1.ng-trigger.ng-trigger-panelContent, div#ui-panel-0.ng-tns-c297-1.ui-panel.ui-widget.ui-widget-content.ui-corner-all, p-panel#renewal-panel.ng-tns-c297-1, form.ng-invalid.ng-dirty.ng-touched, cang-renewal.ng-star-inserted, cang-app, body, html, document, Window]
__proto__: InputEvent
Any idea why it could happen?


Found this page and it looks like chrome returns the paste data in a diferent moment
https://d-toybox.com/studio/lib/input_event_viewer.html

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests