Skip to content

Commit a19f61b

Browse files
author
Erwin Okken
committed
hidePrevious option. Defaults to false
1 parent 7faa839 commit a19f61b

5 files changed

+37
-20
lines changed

README.md

+20-18
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ All attributes are optional.
3939

4040
- `focusElementSelector`: CSS selector for focus a HTML element. If the selector detect more that one, the only the first will be chosen.
4141
- `focusElementCSSClass`: Add a class on focusElement
42-
- `focusHighlightAnimation`: `true` for show highlight animation on the focus element. By defaut `false`.
43-
- `focusBackdrop`: `true` for show a dark backdrop around the focus element. By defaut `false`.
44-
- `focusGlow`: `true` for show a glow on the focus element. By defaut `false`.
42+
- `focusHighlightAnimation`: `true` for show highlight animation on the focus element. By default `false`.
43+
- `focusBackdrop`: `true` for show a dark backdrop around the focus element. By default `false`.
44+
- `focusGlow`: `true` for show a glow on the focus element. By default `false`.
4545
- `focusAction`: add an action `click` on the highlight zone.
46-
- `typeSelector`: type of selection. Two modes possible: `element` (one unique HMLT element), `zone` (a zone with contains the first and last element). By defaut : `element`.
47-
- `radius`: apply a “borderRadius” on highlight zone. If `number` the value as change in percent. If `auto` use the focused element borderRadius. If it's a simple `string`, use it without changes. By defaut, no radius.
46+
- `typeSelector`: type of selection. Two modes possible: `element` (one unique HMLT element), `zone` (a zone with contains the first and last element). By default : `element`.
47+
- `radius`: apply a “borderRadius” on highlight zone. If `number` the value as change in percent. If `auto` use the focused element borderRadius. If it's a simple `string`, use it without changes. By default, no radius.
4848
- `marginZone`: add a maring of focus zone in px. (e.g. `12 15 12 13` for CSS `12px 15px 12px 13px`, `12 15` for `12px 15px 12px 15px`, `12` for `12px 12px 12px 12px`.)
4949
- `scrollOnTarget`: if the walkthrough detects that `focusElementSelector` is outside of the current view, scrolls automatically. By default : `true`
5050
- `visibilityCallback`: callback to check if `focusElementSelector` is hidden, only if the walkthrough needs specific verification. By default : `optional`
@@ -54,27 +54,28 @@ All attributes are optional.
5454

5555
- `contentTemplate`: add a `ng-template` with your description.
5656
- `contentText`: show a simple description without formating in content.
57-
- `contentStyle`: background style for content container. Possible values: `none`, `darken`. By defaut : `darken`.
58-
- `alignContent`: align the `contentTemplate` horizontally. Possible values: `left`, `center` or `right`. By defaut : `left`.
59-
- `verticalAlignContent`: align the `contentTemplate` vertically. Possible values: `above`, `top`, `center`, `bottom` or `below`. By defaut : `top`.
57+
- `contentStyle`: background style for content container. Possible values: `none`, `darken`. By default : `darken`.
58+
- `alignContent`: align the `contentTemplate` horizontally. Possible values: `left`, `center` or `right`. By default : `left`.
59+
- `verticalAlignContent`: align the `contentTemplate` vertically. Possible values: `above`, `top`, `center`, `bottom` or `below`. By default : `top`.
6060
- `contentSpacing`: The max space which separates the content to the focus zone horizontally, default is 0 (opposite of the focusZone)
6161
- `verticalContentSpacing`: The max space which separates the content to the focus zone vertically, default is 50
6262
- `rootElement`: root element on which walkthrough will scroll to after each positioning, as to avoid hidden zones
6363

6464
**Navigation**:
6565

66+
- `hidePrevious`: `true` to hide the previous button. By default `false`
6667
- `previousStep`: add a ling to go to the previous `ng-walkthrough`.
6768
- `nextStep`: add a ling to go to the next `ng-walkthrough`.
68-
- `closeButton`: `true` for show the button. By defaut `false`.
69-
- `closeAnywhere`: `false` for click anywhere to close. By defaut `true`.
70-
- `finishButton`: `true` for show a link to exit. By defaut `false`.
71-
- `disabled`: `true` for ignoring the walkthrough based on a boolean flag. By defaut `false`.
72-
- `texts`: change texts. It's a overlay of `WalkthroughText`.
69+
- `closeButton`: `true` for show the button. By default `false`.
70+
- `closeAnywhere`: `false` for click anywhere to close. By default `true`.
71+
- `finishButton`: `true` for show a link to exit. By default `false`.
72+
- `disabled`: `true` for ignoring the walkthrough based on a boolean flag. By default `false`.
73+
- `texts`: change texts. It's an overlay of `WalkthroughText`.
7374

7475
**Arrow**:
7576

76-
- `showArrow`: `true` for show the arrow. By defaut `false`.
77-
- `arrowColor`: change the arrow color. By defaut `#FFF`.
77+
- `showArrow`: `true` for show the arrow. By default `false`.
78+
- `arrowColor`: change the arrow color. By default `#FFF`.
7879

7980
### `ng-walkthrough-flow` attributes
8081

@@ -103,15 +104,16 @@ All attributes are optional and not overriding the subcomponents attributes exce
103104

104105
**Navigation**:
105106

107+
- `hidePrevious`: `true` to hide the previous button. By default `false`
106108
- `closeButton`: `true` for show the button.
107109
- `closeAnywhere`: `false` for for click anywhere to close.
108110
- `texts`: change texts. It's a overlay of `WalkthroughText`.
109-
- `finishButton`: `true` for show a link to exit. By defaut `false`. Always `true` on the last step.
111+
- `finishButton`: `true` for show a link to exit. By default `false`. Always `true` on the last step.
110112

111113
**Arrow**:
112114

113-
- `showArrow`: `true` for show the arrow. By defaut `false`.
114-
- `arrowColor`: change the arrow color. By defaut `#FFF`.
115+
- `showArrow`: `true` for show the arrow. By default `false`.
116+
- `arrowColor`: change the arrow color. By default `#FFF`.
115117

116118
### Change texts
117119

projects/angular-walkthrough/src/lib/walkthrough-container.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<p *ngIf="contentText">{{ contentText }}</p>
1717
<ng-template cdkPortalHost></ng-template>
1818
</div>
19-
<div class="wkt-navigate" *ngIf="hasPrevious || hasNext || hasFinish">
20-
<button type="button" class="wkt-previous-link" *ngIf="hasPrevious" (click)="previous()">
19+
<div class="wkt-navigate" *ngIf="(hasPrevious && !hidePrevious) || hasNext || hasFinish">
20+
<button type="button" class="wkt-previous-link" *ngIf="hasPrevious && !hidePrevious" (click)="previous()">
2121
{{ text.previous }}
2222
</button>
2323
<button type="button" class="wkt-next-link" *ngIf="hasNext" (click)="next()">{{ text.next }}</button>

projects/angular-walkthrough/src/lib/walkthrough-container.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export class WalkthroughContainerComponent extends BasePortalOutlet {
4949

5050
// navigate
5151

52+
hidePrevious = false;
5253
hasPrevious = false;
5354
hasNext = false;
5455
hasFinish = false;

projects/angular-walkthrough/src/lib/walkthrough-flow.component.ts

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class WalkthroughFlowComponent implements AfterViewInit {
3434
@Input() closeButton: string | boolean;
3535
@Input() closeAnywhere: string | boolean;
3636
@Input() finishButton: string | boolean;
37+
@Input() hidePrevious: string | boolean;
3738

3839
@Input() focusBackdrop: string | boolean;
3940
@Input() focusGlow: string | boolean;
@@ -97,6 +98,9 @@ export class WalkthroughFlowComponent implements AfterViewInit {
9798
if (!walkthrough.finishButton && booleanValue(this.finishButton)) {
9899
walkthrough.finishButton = this.finishButton;
99100
}
101+
if (!walkthrough.hidePrevious && booleanValue(this.hidePrevious)) {
102+
walkthrough.hidePrevious = this.hidePrevious;
103+
}
100104
if (!walkthrough.focusBackdrop && booleanValue(this.focusBackdrop)) {
101105
walkthrough.focusBackdrop = this.focusBackdrop;
102106
}

projects/angular-walkthrough/src/lib/walkthrough.component.ts

+10
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ export class WalkthroughComponent implements AfterViewInit {
251251
}
252252
}
253253

254+
@Input()
255+
get hidePrevious() {
256+
return this._hidePrevious;
257+
}
258+
set hidePrevious(value: string | boolean) {
259+
this._hidePrevious = booleanValue(value);
260+
}
261+
254262
@Input() scrollOnTarget = true;
255263
@Input() visibilityCallback: Function;
256264

@@ -266,6 +274,7 @@ export class WalkthroughComponent implements AfterViewInit {
266274
private _hasCloseButton = false;
267275
private _hasCloseAnywhere = true;
268276
private _disabled = false;
277+
private _hidePrevious = false;
269278
private _arrowColor: string;
270279
private _marginZone: string;
271280
private _marginZonePx = new WalkthroughMargin();
@@ -779,6 +788,7 @@ export class WalkthroughComponent implements AfterViewInit {
779788
instance.contentText = this.contentText;
780789
instance.contentStyle = this.contentStyle;
781790
instance.text = this.texts ? { ...new WalkthroughText(), ...this.texts } : new WalkthroughText();
791+
instance.hidePrevious = this._hidePrevious;
782792

783793
this._show();
784794
}

0 commit comments

Comments
 (0)