File tree 6 files changed +40
-3
lines changed
6 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 1
1
import boot from "./boot.js" ;
2
- import { getNoConflict } from "./config/NoConflict.js" ;
2
+ import { skipOriginalEvent } from "./config/NoConflict.js" ;
3
3
import { getCompactSize } from "./config/CompactSize.js" ;
4
4
import DOMObserver from "./compatibility/DOMObserver.js" ;
5
5
import UI5ElementMetadata from "./UI5ElementMetadata.js" ;
@@ -522,7 +522,6 @@ class UI5Element extends HTMLElement {
522
522
*/
523
523
fireEvent ( name , data , cancelable ) {
524
524
let compatEventResult = true ; // Initialized to true, because if the event is not fired at all, it should be considered "not-prevented"
525
- const noConflict = getNoConflict ( ) ;
526
525
527
526
const noConflictEvent = new CustomEvent ( `ui5-${ name } ` , {
528
527
detail : data ,
@@ -534,7 +533,7 @@ class UI5Element extends HTMLElement {
534
533
// This will be false if the compat event is prevented
535
534
compatEventResult = this . dispatchEvent ( noConflictEvent ) ;
536
535
537
- if ( noConflict === true || ( noConflict . events && noConflict . events . includes && noConflict . events . includes ( name ) ) ) {
536
+ if ( skipOriginalEvent ( name ) ) {
538
537
return compatEventResult ;
539
538
}
540
539
Original file line number Diff line number Diff line change 1
1
import { getNoConflict as getConfiguredNoConflict } from "../InitialConfiguration.js" ;
2
2
3
+ // Fire these events even with noConflict: true
4
+ const excludeList = [
5
+ "value-changed" ,
6
+ ] ;
7
+
8
+ const shouldFireOriginalEvent = eventName => {
9
+ return excludeList . includes ( eventName ) ;
10
+ } ;
11
+
3
12
let noConflict = getConfiguredNoConflict ( ) ;
4
13
14
+ const shouldNotFireOriginalEvent = eventName => {
15
+ return ! ( noConflict . events && noConflict . events . includes && noConflict . events . includes ( eventName ) ) ;
16
+ } ;
17
+
5
18
const getNoConflict = ( ) => {
6
19
return noConflict ;
7
20
} ;
8
21
22
+ const skipOriginalEvent = eventName => {
23
+ // Always fire these events
24
+ if ( shouldFireOriginalEvent ( eventName ) ) {
25
+ return false ;
26
+ }
27
+
28
+ // Read from the configuration
29
+ if ( noConflict === true ) {
30
+ return true ;
31
+ }
32
+
33
+ return ! shouldNotFireOriginalEvent ( eventName ) ;
34
+ } ;
35
+
9
36
const setNoConflict = noConflictData => {
10
37
noConflict = noConflictData ;
11
38
} ;
12
39
13
40
export {
14
41
getNoConflict ,
15
42
setNoConflict ,
43
+ skipOriginalEvent ,
16
44
} ;
Original file line number Diff line number Diff line change @@ -245,6 +245,8 @@ class CheckBox extends UI5Element {
245
245
if ( this . canToggle ( ) ) {
246
246
this . checked = ! this . checked ;
247
247
this . fireEvent ( "change" ) ;
248
+ // Angular two way data binding
249
+ this . fireEvent ( "value-changed" ) ;
248
250
}
249
251
return this ;
250
252
}
Original file line number Diff line number Diff line change @@ -327,6 +327,8 @@ class DatePicker extends UI5Element {
327
327
328
328
this . value = nextValue ;
329
329
this . fireEvent ( "change" , { value : nextValue , valid : isValid } ) ;
330
+ // Angular two way data binding
331
+ this . fireEvent ( "value-changed" , { value : nextValue , valid : isValid } ) ;
330
332
}
331
333
332
334
_handleInputLiveChange ( ) {
@@ -425,6 +427,8 @@ class DatePicker extends UI5Element {
425
427
this . closePicker ( ) ;
426
428
427
429
this . fireEvent ( "change" , { value : this . value , valid : true } ) ;
430
+ // Angular two way data binding
431
+ this . fireEvent ( "value-changed" , { value : this . value , valid : true } ) ;
428
432
}
429
433
430
434
/**
Original file line number Diff line number Diff line change @@ -483,6 +483,8 @@ class Input extends UI5Element {
483
483
484
484
if ( isUserInput ) { // input
485
485
this . fireEvent ( this . EVENT_INPUT ) ;
486
+ // Angular two way data binding
487
+ this . fireEvent ( "value-changed" ) ;
486
488
return ;
487
489
}
488
490
Original file line number Diff line number Diff line change @@ -182,6 +182,8 @@ class Switch extends UI5Element {
182
182
if ( ! this . disabled ) {
183
183
this . checked = ! this . checked ;
184
184
this . fireEvent ( "change" ) ;
185
+ // Angular two way data binding;
186
+ this . fireEvent ( "value-changed" ) ;
185
187
}
186
188
}
187
189
You can’t perform that action at this time.
0 commit comments