Skip to content

Commit 47bbafd

Browse files
committed
[UPDATE] additional work
1 parent d3573cb commit 47bbafd

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

projects/wml-angular-components-base/src/lib/models.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ import { WMLMotionUIProperty,WMLMotionUIPropertyState } from "@windmillcode/wml-
55

66

77
export class WMLAngularMotionUIProperty<V=any,T=any> extends WMLMotionUIProperty<V,T>{
8-
override motionEndEvent = new Subject<WMLMotionUIPropertyState>();
9-
override motionKeyFrameEvent = new Subject<string>()
8+
9+
constructor(props:Partial<WMLAngularMotionUIProperty> = {}) {
10+
super({
11+
motionEndEvent: new Subject<WMLMotionUIPropertyState>(),
12+
motionKeyFrameEvent: new Subject<string>(),
13+
...props
14+
});
15+
}
16+
1017
}
1118

1219

projects/wml-components-base/src/lib/models.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ export class WMLUIProperty<V=any,T=any>{
4444
...props
4545
}
4646
)
47-
48-
4947
}
5048

5149

@@ -131,15 +129,11 @@ export class WMLView<V=any,T=any> extends WMLUIProperty<V,T>{
131129
)
132130
}
133131

134-
/**
135-
* @deprecated use angular.cdref instead
136-
*/
132+
137133
get cdref(){
138134
return this.angular.cdref
139135
}
140-
/**
141-
* @deprecated use angular.cdref instead
142-
*/
136+
143137
set cdref(val){
144138
this.angular.cdref = val
145139
}
@@ -222,6 +216,12 @@ export class WMLMotionUIProperty<V=any,T="animation" | "transition"> extends WML
222216
}
223217

224218
autoOpen = false
219+
eventType : "subject" | "callback" =(()=>{
220+
if(["Angular"].includes(getGlobalObject().WINDMILLCODE.framework.name )){
221+
return "subject"
222+
}
223+
return "callback"
224+
})()
225225
/**
226226
* Necessary for animations to work properly.
227227
* Modify only if you know what you are doing.
@@ -255,7 +255,7 @@ export class WMLMotionUIProperty<V=any,T="animation" | "transition"> extends WML
255255
}
256256
triggerMotionEndEvent=(motionState?:WMLMotionUIPropertyState)=>{
257257
motionState ??= this.motionState
258-
if(["Angular"].includes(getGlobalObject().WINDMILLCODE.framework.name )){
258+
if(this.eventType === "subject"){
259259
// @ts-ignore
260260
this.motionEndEvent.next?.(motionState)
261261
}
@@ -267,7 +267,7 @@ export class WMLMotionUIProperty<V=any,T="animation" | "transition"> extends WML
267267
}
268268
triggerMotionKeyFrameEvent=(keyFrame?:string)=>{
269269
keyFrame ??= this.currentTransitionInfo.keyframe
270-
if(["Angular"].includes(getGlobalObject().WINDMILLCODE.framework.name )){
270+
if(this.eventType === "subject"){
271271
// @ts-ignore
272272
this.motionKeyFrameEvent.next?.(keyFrame)
273273
}
@@ -293,12 +293,11 @@ export class WMLMotionUIProperty<V=any,T="animation" | "transition"> extends WML
293293
})
294294

295295
this.triggerMotionEndEvent()
296-
if(["Angular"].includes(getGlobalObject().WINDMILLCODE.framework.name )){
296+
if(this.eventType === "subject"){
297297
this.angular.cdref?.detectChanges()
298298
}
299299

300300
}
301-
302301
readonly transitionEnd:(evt?:TransitionEvent)=> void =(evt)=>{
303302
let state = this.getGroupMotionState()
304303
this.currentTransitionInfo.transitionEndStyles.push(evt?.propertyName.replace(/-./g, (match) => match.charAt(1).toUpperCase()))
@@ -634,6 +633,8 @@ export class WMLMotionUIProperty<V=any,T="animation" | "transition"> extends WML
634633
}
635634

636635

636+
637+
637638
export class WMLWrapper<V=any,T=any> {
638639
constructor(props:Partial<WMLWrapper> = {}){
639640
Object.assign(

0 commit comments

Comments
 (0)