Skip to content

Commit 23f2a98

Browse files
committed
[UPDATE] additional work
1 parent d467d2b commit 23f2a98

File tree

10 files changed

+167
-81
lines changed

10 files changed

+167
-81
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Type } from "@angular/core";
22
import { TranslateLoader } from "@ngx-translate/core";
33
import { Subject, of } from "rxjs";
4-
import {WMLMotionUIProperty,WMLMotionUIPropertyState} from "@windmillcode/wml-components-base";
4+
import { WMLMotionUIProperty,WMLMotionUIPropertyState } from "@windmillcode/wml-components-base";
55

66

77
export class WMLAngularMotionUIProperty<V=any,T=any> extends WMLMotionUIProperty<V,T>{

projects/wml-carousel/src/lib/wml-carousel-one/wml-carousel-one-slide-example/wml-carousel-one-slide-example.component.scss

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11

2-
3-
4-
5-
@import '../../../../styles';
6-
2+
@import '../../../../styles';
73

84

95

106

117
.WMLCarouselOneSlideExampleView{
128
display: block;
139
height:100%;
10+
border:calc(1/10.6 * 1em) solid green;
1411
.WMLCarouselOneSlideExample{
1512
&Main{
1613
&Pod{
17-
18-
14+
15+
1916
height:100%;
2017
}
2118
}

projects/wml-carousel/src/lib/wml-carousel-one/wml-carousel-one-slide-example/wml-carousel-one-slide-example.component.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
// angular
22
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, OnInit, Input , ViewEncapsulation } from '@angular/core';
33

4-
5-
64
// rxjs
75
import { Subject } from 'rxjs';
86
import { takeUntil,tap } from 'rxjs/operators';
97

108
// wml-components
11-
import { WMLConstructorDecorator, generateClassPrefix, generateIdPrefix } from '@windmillcode/wml-components-base';
9+
import { WMLConstructorDecorator, generateClassPrefix } from '@windmillcode/wml-components-base';
1210

1311

1412
// misc
@@ -20,29 +18,18 @@ import { WMLConstructorDecorator, generateClassPrefix, generateIdPrefix } from '
2018
templateUrl: './wml-carousel-one-slide-example.component.html',
2119
styleUrls: ['./wml-carousel-one-slide-example.component.scss'],
2220
changeDetection:ChangeDetectionStrategy.OnPush,
23-
2421
encapsulation:ViewEncapsulation.None
25-
26-
2722
})
2823
export class WMLCarouselOneSlideExampleComponent {
2924

3025
constructor(
31-
public cdref:ChangeDetectorRef,
32-
26+
public cdref:ChangeDetectorRef
3327
) { }
3428

3529
classPrefix = generateClassPrefix('WMLCarouselOneSlideExample')
36-
37-
3830
@Input('props') props: WMLCarouselOneSlideExampleProps = new WMLCarouselOneSlideExampleProps()
39-
40-
4131
@HostBinding('class') myClass: string = this.classPrefix(`View`);
42-
43-
4432
@HostBinding('attr.id') myId?:string
45-
4633
ngUnsub= new Subject<void>()
4734

4835

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<div [class]="classPrefix('MainPod')">
2-
<section [class]="classPrefix('Pod0')">
3-
4-
</section>
2+
<ng-template #customSlide></ng-template>
53
</div>

projects/wml-carousel/src/lib/wml-carousel-one/wml-carousel-one-slide/wml-carousel-one-slide.component.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// angular
2-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, OnInit, Input , ViewEncapsulation } from '@angular/core';
2+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, OnInit, Input , ViewEncapsulation, ViewChild, ViewContainerRef } from '@angular/core';
33

44
// rxjs
55
import { Subject } from 'rxjs';
66
import { takeUntil,tap } from 'rxjs/operators';
77

88
// wml-components
9-
import { WMLConstructorDecorator, generateClassPrefix, generateIdPrefix } from '@windmillcode/wml-components-base';
9+
import { WMLConstructorDecorator, WMLCustomComponent, WMLUIProperty, generateClassPrefix, generateIdPrefix } from '@windmillcode/wml-components-base';
10+
import { WMLCarouselOneSlideExampleComponent, WMLCarouselOneSlideExampleProps } from '../wml-carousel-one-slide-example/wml-carousel-one-slide-example.component';
11+
import { addCustomComponent } from '@windmillcode/angular-wml-components-base';
1012

1113

1214
// misc
@@ -32,6 +34,7 @@ export class WMLCarouselOneSlideComponent {
3234
@HostBinding('class') myClass: string = this.classPrefix(`View`);
3335
@HostBinding('attr.id') myId?:string
3436
ngUnsub= new Subject<void>()
37+
@ViewChild("customSlide",{read:ViewContainerRef}) customSlide;
3538

3639

3740
listenForUpdate = ()=>{
@@ -56,9 +59,14 @@ export class WMLCarouselOneSlideComponent {
5659
}
5760

5861
this.listenForUpdate().subscribe()
62+
}
5963

64+
ngAfterViewInit(){
65+
this.props.slideViewContainerRef = this.customSlide
66+
this.props.init()
6067
}
6168

69+
6270
ngOnDestroy(){
6371
this.ngUnsub.next();
6472
this.ngUnsub.complete()
@@ -73,11 +81,29 @@ export class WMLCarouselOneSlideProps {
7381
constructor(props:Partial<WMLCarouselOneSlideProps>={}){ }
7482

7583
id = ""
76-
84+
custom = new WMLCustomComponent({
85+
cpnt:WMLCarouselOneSlideExampleComponent,
86+
props:new WMLCarouselOneSlideExampleProps()
87+
})
7788
setStateSubj = new Subject<WMLCarouselOneSlideProps>()
7889
setState = (value)=>{
7990
this.setStateSubj.next(value)
8091
}
92+
view = new WMLUIProperty({
93+
94+
})
95+
96+
// component properties
97+
slideViewContainerRef!:ViewContainerRef
98+
//
99+
100+
init=()=>{
101+
addCustomComponent(
102+
this.slideViewContainerRef,
103+
this.custom.cpnt,
104+
this.custom.props
105+
)
106+
}
81107
}
82108

83109

projects/wml-carousel/src/lib/wml-carousel-one/wml-carousel-one/wml-carousel-one.component.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22
<section [class]="classPrefix('Pod0')">
33

44
</section>
5-
<section [class]="classPrefix('Pod1')">
5+
<section
6+
7+
[style]="props.slideContainer.style"
8+
[class]="classPrefix('Pod1')">
69
<div
7-
[ngStyle]="props.controller"
8-
(animationend)="props.controller.animationEnd($event)"
10+
#slideContainer
11+
[ngStyle]="props.controller.style"
12+
(transitionend)="props.controller.transitionEnd($event)"
913
[class]="classPrefix('Pod1Item0')">
1014
<wml-carousel-one-slide
11-
[class]="classPrefix('Pod1Item1')"
15+
[ngStyle]="slide.view.style"
16+
[class]="classPrefix('Pod1Item1') + slide.view.class"
1217
[props]="slide"
1318
*ngFor="let slide of props.slides"
1419
></wml-carousel-one-slide>
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1+
@import '../../../../styles';
12

3+
.WMLCarouselOneView{
4+
display: block;
5+
height:100%;
6+
.WMLCarouselOne{
7+
&Main{
8+
&Pod{
29

310

11+
height:100%;
12+
}
13+
}
14+
&Pod{
15+
16+
&0{}
17+
&1{
18+
&Item {
19+
&0 {
20+
border:calc(1/10.6 * 1em) solid red;
21+
height: calc(200/10.6 * 1em);
22+
position: relative;
23+
display: flex;
24+
justify-content: center;
25+
align-items: center;
26+
transform-style: preserve-3d;
27+
}
28+
&1{
429

5-
@import '../../../../styles';
6-
7-
8-
9-
10-
11-
.WMLCarouselOneView{
12-
display: block;
13-
height:100%;
14-
.WMLCarouselOne{
15-
&Main{
16-
&Pod{
1730

1831

19-
height:100%;
20-
}
21-
}
22-
&Pod{
32+
position: absolute;
2333

24-
&0{}
25-
&1{
26-
&Item {
27-
&0 {
28-
border:calc(1/10.6 * 1em) solid red;
29-
30-
}
31-
&1{
32-
border:calc(1/10.6 * 1em) solid green;
33-
width: 50%;
34-
}
3534
}
3635
}
3736
}
3837
}
3938
}
39+
}
4040

4141

4242

0 commit comments

Comments
 (0)