Skip to content

Commit 27cb1a2

Browse files
IlyaSurmayvalorkin
authored andcommitted
fix(progressbar): fix bs4, animation, add striped option, remove bs4 demos (#3500)
* fix(progressbar): fix empty bs4 bar, add striped option, remove unnecessary DOM nesting * fix(progressbar): fix animation, remove ProgressDirective, remove bs4 demos, simplify html
1 parent 7b43295 commit 27cb1a2

31 files changed

+126
-352
lines changed

demo/src/app/components/+progressbar/demos/bs3/static/static.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

demo/src/app/components/+progressbar/demos/bs4/dynamic/dynamic.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

demo/src/app/components/+progressbar/demos/bs4/dynamic/dynamic.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

demo/src/app/components/+progressbar/demos/bs4/stacked/stacked.html

Lines changed: 0 additions & 7 deletions
This file was deleted.

demo/src/app/components/+progressbar/demos/bs4/stacked/stacked.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

demo/src/app/components/+progressbar/demos/bs4/static/static.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

demo/src/app/components/+progressbar/demos/bs4/static/static.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

demo/src/app/components/+progressbar/demos/bs3/config/config.ts renamed to demo/src/app/components/+progressbar/demos/config/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ProgressbarConfig } from 'ngx-bootstrap/progressbar';
44
// such override allows to keep some initial values
55

66
export function getProgressbarConfig(): ProgressbarConfig {
7-
return Object.assign(new ProgressbarConfig(), { animate: false, max: 150 });
7+
return Object.assign(new ProgressbarConfig(), { animate: true, striped: true, max: 150 });
88
}
99

1010
@Component({

demo/src/app/components/+progressbar/demos/bs3/dynamic/dynamic.html renamed to demo/src/app/components/+progressbar/demos/dynamic/dynamic.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
<progressbar [animate]="false" [value]="dynamic" type="success"><b>{{dynamic}}%</b></progressbar>
77

88
<small><em>Object (changes type based on value)</em></small>
9-
<progressbar class="progress-striped active" [value]="dynamic" [type]="type">
10-
{{type}} <i *ngIf="showWarning">!!!Watch out !!!</i>
11-
</progressbar>
9+
<progressbar class="progress-striped active" [value]="dynamic" [type]="type">{{type}}</progressbar>
1210

1311
<button type="button" class="btn btn-sm btn-primary" (click)="random()">Randomize</button>

demo/src/app/components/+progressbar/demos/bs3/dynamic/dynamic.ts renamed to demo/src/app/components/+progressbar/demos/dynamic/dynamic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export class DemoProgressbarDynamicComponent {
2828
type = 'danger';
2929
}
3030

31-
this.showWarning = type === 'danger' || type === 'warning';
3231
this.dynamic = value;
3332
this.type = type;
3433
}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { DemoProgressbarStaticComponent } from './bs3/static/static';
2-
import { DemoProgressbarDynamicComponent } from './bs3/dynamic/dynamic';
3-
import { DemoProgressbarStackedComponent } from './bs3/stacked/stacked';
4-
import { DemoProgressbarDynamicBs4Component } from './bs4/dynamic/dynamic';
5-
import { DemoProgressbarStackedBs4Component } from './bs4/stacked/stacked';
6-
import { DemoProgressbarStaticBs4Component } from './bs4/static/static';
7-
import { DemoProgressbarConfigComponent } from './bs3/config/config';
1+
import { DemoProgressbarStaticComponent } from './static/static';
2+
import { DemoProgressbarDynamicComponent } from './dynamic/dynamic';
3+
import { DemoProgressbarStackedComponent } from './stacked/stacked';
4+
import { DemoProgressbarConfigComponent } from './config/config';
85

96
export const DEMO_COMPONENTS = [
107
DemoProgressbarStaticComponent,
118
DemoProgressbarDynamicComponent,
129
DemoProgressbarStackedComponent,
13-
DemoProgressbarDynamicBs4Component,
14-
DemoProgressbarStackedBs4Component,
15-
DemoProgressbarStaticBs4Component,
1610
DemoProgressbarConfigComponent
1711
];
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<div class="row">
2+
<div class="col-sm-4">
3+
<progressbar [value]="55"></progressbar>
4+
</div>
5+
<div class="col-sm-4">
6+
<progressbar [value]="22" type="warning" [striped]="true">22%</progressbar>
7+
</div>
8+
<div class="col-sm-4">
9+
<progressbar max="200" [value]="166" type="danger" [striped]="true" [animate]="true"><i>166 / 200</i></progressbar>
10+
</div>
11+
</div>
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
<demo-section [name]="name" [src]="src" [componentContent]="isBs3 ? componentContentBs3 : componentContentBs4">
1+
<demo-section [name]="name" [src]="src" [componentContent]="componentContent">
22
<p>Provide up-to-date feedback on the progress of a workflow or action with simple yet flexible progress bars.</p>
33

4-
<docs-section *ngIf="isBs3" [content]="componentContentBs3"></docs-section>
5-
<docs-section *ngIf="!isBs3" [content]="componentContentBs4"></docs-section>
4+
<docs-section [content]="componentContent"></docs-section>
65
</demo-section>

demo/src/app/components/+progressbar/progressbar-section.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ChangeDetectionStrategy, Component, Injector, ReflectiveInjector } from '@angular/core';
22
import { isBs3 } from 'ngx-bootstrap/utils';
33

4-
import { demoComponentContentBs3, demoComponentContentBs4 } from './progressbar-section.list';
4+
import { demoComponentContent } from './progressbar-section.list';
55
import { ContentSection } from '../../docs/models/content-section.model';
66

77
@Component({
@@ -12,8 +12,7 @@ import { ContentSection } from '../../docs/models/content-section.model';
1212
export class ProgressbarSectionComponent {
1313
name = 'Progressbar';
1414
src = 'https://github.com/valor-software/ngx-bootstrap/tree/development/src/progressbar';
15-
componentContentBs3: ContentSection[] = demoComponentContentBs3;
16-
componentContentBs4: ContentSection[] = demoComponentContentBs4;
15+
componentContent: ContentSection[] = demoComponentContent;
1716
content: any;
1817

1918
_injectors = new Map<ContentSection, ReflectiveInjector>();

demo/src/app/components/+progressbar/progressbar-section.list.ts

Lines changed: 13 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import { DemoProgressbarStaticComponent } from './demos/bs3/static/static';
2-
import { DemoProgressbarDynamicComponent } from './demos/bs3/dynamic/dynamic';
3-
import { DemoProgressbarStackedComponent } from './demos/bs3/stacked/stacked';
4-
import { DemoProgressbarConfigComponent } from './demos/bs3/config/config';
5-
6-
import { DemoProgressbarStaticBs4Component } from './demos/bs4/static/static';
7-
import { DemoProgressbarDynamicBs4Component } from './demos/bs4/dynamic/dynamic';
8-
import { DemoProgressbarStackedBs4Component } from './demos/bs4/stacked/stacked';
1+
import { DemoProgressbarStaticComponent } from './demos/static/static';
2+
import { DemoProgressbarDynamicComponent } from './demos/dynamic/dynamic';
3+
import { DemoProgressbarStackedComponent } from './demos/stacked/stacked';
4+
import { DemoProgressbarConfigComponent } from './demos/config/config';
95

106
import { ContentSection } from '../../docs/models/content-section.model';
117
import { DemoTopSectionComponent } from '../../docs/demo-section-components/demo-top-section/index';
@@ -17,7 +13,7 @@ import {
1713
NgApiDocConfigComponent
1814
} from '../../docs/api-docs';
1915

20-
export const demoComponentContentBs3: ContentSection[] = [
16+
export const demoComponentContent: ContentSection[] = [
2117
{
2218
name: 'Usage',
2319
anchor: 'usage',
@@ -34,29 +30,29 @@ export const demoComponentContentBs3: ContentSection[] = [
3430
{
3531
title: 'Static',
3632
anchor: 'bs3-static',
37-
component: require('!!raw-loader?lang=typescript!./demos/bs3/static/static'),
38-
html: require('!!raw-loader?lang=markup!./demos/bs3/static/static.html'),
33+
component: require('!!raw-loader?lang=typescript!./demos/static/static'),
34+
html: require('!!raw-loader?lang=markup!./demos/static/static.html'),
3935
outlet: DemoProgressbarStaticComponent
4036
},
4137
{
4238
title: 'Dynamic',
4339
anchor: 'bs3-dynamic',
44-
component: require('!!raw-loader?lang=typescript!./demos/bs3/dynamic/dynamic'),
45-
html: require('!!raw-loader?lang=markup!./demos/bs3/dynamic/dynamic.html'),
40+
component: require('!!raw-loader?lang=typescript!./demos/dynamic/dynamic'),
41+
html: require('!!raw-loader?lang=markup!./demos/dynamic/dynamic.html'),
4642
outlet: DemoProgressbarDynamicComponent
4743
},
4844
{
4945
title: 'Stacked',
5046
anchor: 'bs3-stacked',
51-
component: require('!!raw-loader?lang=typescript!./demos/bs3/stacked/stacked'),
52-
html: require('!!raw-loader?lang=markup!./demos/bs3/stacked/stacked.html'),
47+
component: require('!!raw-loader?lang=typescript!./demos/stacked/stacked'),
48+
html: require('!!raw-loader?lang=markup!./demos/stacked/stacked.html'),
5349
outlet: DemoProgressbarStackedComponent
5450
},
5551
{
5652
title: 'Configuring defaults',
5753
anchor: 'bs3-config',
58-
component: require('!!raw-loader?lang=typescript!./demos/bs3/config/config'),
59-
html: require('!!raw-loader?lang=markup!./demos/bs3/config/config.html'),
54+
component: require('!!raw-loader?lang=typescript!./demos/config/config'),
55+
html: require('!!raw-loader?lang=markup!./demos/config/config.html'),
6056
outlet: DemoProgressbarConfigComponent
6157
}
6258
]
@@ -71,82 +67,6 @@ export const demoComponentContentBs3: ContentSection[] = [
7167
anchor: 'progressbar-component',
7268
outlet: NgApiDocComponent
7369
},
74-
{
75-
title: 'ProgressDirective',
76-
anchor: 'progress-directive',
77-
outlet: NgApiDocComponent
78-
},
79-
{
80-
title: 'BarComponent',
81-
anchor: 'bar-component',
82-
outlet: NgApiDocComponent
83-
},
84-
{
85-
title: 'ProgressbarConfig',
86-
anchor: 'progress-config',
87-
outlet: NgApiDocConfigComponent
88-
}
89-
]
90-
}
91-
];
92-
93-
export const demoComponentContentBs4: ContentSection[] = [
94-
{
95-
name: 'Usage',
96-
anchor: 'usage',
97-
outlet: DemoTopSectionComponent,
98-
content: {
99-
doc: require('!!raw-loader?lang=typescript!./docs/usage.md')
100-
}
101-
},
102-
{
103-
name: 'Examples',
104-
anchor: 'examples',
105-
outlet: ExamplesComponent,
106-
content: [
107-
{
108-
title: 'Static',
109-
anchor: 'bs4-static',
110-
component: require('!!raw-loader?lang=typescript!./demos/bs4/static/static'),
111-
html: require('!!raw-loader?lang=markup!./demos/bs4/static/static.html'),
112-
outlet: DemoProgressbarStaticBs4Component
113-
},
114-
{
115-
title: 'Dynamic',
116-
anchor: 'bs4-dynamic',
117-
component: require('!!raw-loader?lang=typescript!./demos/bs4/dynamic/dynamic'),
118-
html: require('!!raw-loader?lang=markup!./demos/bs4/dynamic/dynamic.html'),
119-
outlet: DemoProgressbarDynamicBs4Component
120-
},
121-
{
122-
title: 'Stacked',
123-
anchor: 'bs4-stacked',
124-
component: require('!!raw-loader?lang=typescript!./demos/bs4/stacked/stacked'),
125-
html: require('!!raw-loader?lang=markup!./demos/bs4/stacked/stacked.html'),
126-
outlet: DemoProgressbarStackedBs4Component
127-
}
128-
]
129-
},
130-
{
131-
name: 'API Reference',
132-
anchor: 'api-reference',
133-
outlet: ApiSectionsComponent,
134-
content: [
135-
{
136-
title: 'ProgressbarComponent',
137-
anchor: 'progressbar-component',
138-
outlet: NgApiDocComponent
139-
},
140-
{
141-
title: 'ProgressDirective',
142-
anchor: 'progress-directive',
143-
outlet: NgApiDocComponent
144-
},
145-
{
146-
title: 'BarComponent',
147-
anchor: 'bar-component',
148-
outlet: NgApiDocComponent
149-
},
15070
{
15171
title: 'ProgressbarConfig',
15272
anchor: 'progress-config',

demo/src/assets/css/style.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ h1, h2, h3, h4 {
2121
}
2222
}
2323

24+
code {
25+
word-break: normal;
26+
}
27+
2428
a:hover {
2529
text-decoration: none;
2630
}

0 commit comments

Comments
 (0)