Skip to content

Commit 2d3a30b

Browse files
committed
Merge branch 'grid/DTHFUI-12113' of https://github.com/po-ui/po-angular into feat/DTHFUI-8799
2 parents 8894bff + b3c7f9a commit 2d3a30b

File tree

6 files changed

+90
-12
lines changed

6 files changed

+90
-12
lines changed

projects/ui/src/lib/components/po-button/po-button-base.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ export class PoButtonBaseComponent {
9595
* @description
9696
* Ícone exibido ao lado esquerdo do label do botão.
9797
*
98-
* É possível usar qualquer um dos ícones da [Biblioteca de ícones](https://po-ui.io/icons). conforme exemplo abaixo:
98+
* É possível usar qualquer um dos ícones da [Biblioteca de ícones](https://po-ui.io/icons), conforme exemplo:
9999
* ```
100100
* <po-button p-icon="an an-user" p-label="PO button"></po-button>
101101
* ```
102-
* Também é possível utilizar outras fontes de ícones, por exemplo a biblioteca *Font Awesome*, da seguinte forma:
102+
* Também é possível utilizar outras fontes de ícones, por exemplo a biblioteca *Font Awesome*, desde que a biblioteca
103+
* esteja carregada no projeto:
103104
* ```
104105
* <po-button p-icon="fa fa-podcast" p-label="PO button"></po-button>
105106
* ```

projects/ui/src/lib/components/po-icon/po-icon-dictionary.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export const AnimaliaIconDictionary: { [key: string]: string } = {
187187
ICON_ALIGN_JUSTIFY: 'an an-text-align-justify',
188188
ICON_ALIGN_LEFT: 'an an-text-align-left',
189189
ICON_ALIGN_RIGHT: 'an an-text-align-right',
190+
ICON_ARROW_ARC_LEFT: 'an an-arrow-arc-left',
190191
ICON_ARROW_DOWN: 'an an-caret-down',
191192
ICON_OTHER_ARROW_DOWN: 'an an-arrow-down',
192193
ICON_ARROW_LEFT: 'an an-caret-left',
@@ -226,14 +227,16 @@ export const AnimaliaIconDictionary: { [key: string]: string } = {
226227
ICON_PARAMETERS: 'an an-sliders-horizontal',
227228
ICON_PICTURE: 'an an-image',
228229
ICON_PICTURE_BROKEN: 'an an-image-broken',
230+
ICON_PLUS: 'an an-plus',
231+
ICON_PROHIBIT: 'an an-prohibit',
229232
ICON_PUSH_PIN: 'an an-push-pin',
230233
ICON_PUSH_PIN_SLASH: 'an an-push-pin-slash',
231234
ICON_REFRESH: 'an an-arrow-clockwise',
232235
ICON_SEARCH: 'an an-magnifying-glass',
233236
ICON_SETTINGS: 'an an-gear-six',
234-
ICON_SORT: 'an an-caret-up-down ',
235-
ICON_SORT_ASC: 'an an-caret-up',
236-
ICON_SORT_DESC: 'an an-caret-down',
237+
ICON_SORT: 'an an-arrows-down-up',
238+
ICON_SORT_ASC: 'an an-arrow-up',
239+
ICON_SORT_DESC: 'an an-arrow-down',
237240
ICON_STAR: 'an an-star',
238241
ICON_TELEPHONE: 'an an-phone',
239242
ICON_TEXT_BOLD: 'an an-text-b',

projects/ui/src/lib/components/po-modal/po-modal-action.interface.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { TemplateRef } from '@angular/core';
2+
13
/**
24
* @usedBy PoModalComponent
35
*
@@ -19,6 +21,50 @@ export interface PoModalAction {
1921
/** Desabilita o botão impossibilitando que sua ação seja executada. */
2022
disabled?: boolean;
2123

24+
/**
25+
* Ícone exibido ao lado esquerdo do label do botão.
26+
*
27+
* É possível usar qualquer um dos ícones da [Biblioteca de ícones](https://po-ui.io/icons), conforme exemplo:
28+
* ```
29+
* modalAction: PoModalAction = {
30+
* action: () => {},
31+
* label: 'Botão com ícone PO',
32+
* icon: 'an an-user'
33+
* };
34+
* ```
35+
* Também é possível utilizar outras fontes de ícones, por exemplo a biblioteca *Font Awesome*, desde que a biblioteca
36+
* esteja carregada no projeto:
37+
* ```
38+
* modalAction: PoModalAction = {
39+
* action: () => {},
40+
* label: 'Botão com ícone Font Awesome',
41+
* icon: 'fa fa-user'
42+
* };
43+
* ```
44+
* Outra opção seria a customização do ícone através do `TemplateRef`, conforme exemplo abaixo:
45+
* ```
46+
* // Template HTML
47+
* <ng-template #customIcon>
48+
* <span class="fa fa-user"></span>
49+
* </ng-template>
50+
*
51+
* // Componente TypeScript
52+
* @ViewChild('customIcon', { static: true }) customIcon: TemplateRef<void>;
53+
*
54+
* modalAction: PoModalAction = {
55+
* action: () => {},
56+
* label: 'Botão com ícone customizado',
57+
* };
58+
*
59+
* // Atribuição do TemplateRef à propriedade icon após a inicialização da view
60+
* ngAfterViewInit() {
61+
* this.modalAction.icon = this.customIcon;
62+
* }
63+
* ```
64+
* > Para o ícone enquadrar corretamente, deve-se utilizar `font-size: inherit` caso o ícone utilizado não aplique-o.
65+
*/
66+
icon?: string | TemplateRef<void>;
67+
2268
/** Rótulo do botão. */
2369
label: string;
2470

projects/ui/src/lib/components/po-modal/po-modal.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<po-button
3737
[p-danger]="getSecondaryActionButtonDanger()"
3838
[p-disabled]="secondaryAction.disabled"
39+
[p-icon]="secondaryAction.icon"
3940
[p-label]="secondaryAction.label"
4041
[p-loading]="secondaryAction.loading"
4142
p-kind="secondary"
@@ -48,6 +49,7 @@
4849
class="po-button-modal-first-action"
4950
[p-danger]="primaryAction.danger"
5051
[p-disabled]="primaryAction.disabled"
52+
[p-icon]="primaryAction.icon"
5153
[p-label]="primaryAction.label"
5254
[p-loading]="primaryAction.loading"
5355
p-kind="primary"

projects/ui/src/lib/components/po-modal/samples/sample-po-modal-labs/sample-po-modal-labs.component.html

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
[p-options]="iconOptions"
2828
></po-select>
2929

30-
<po-input class="po-md-6" name="Content" [(ngModel)]="content" p-clean p-label="Content" p-maxlength="200">
30+
<po-input class="po-md-12 po-lg-6" name="Content" [(ngModel)]="content" p-clean p-label="Content" p-maxlength="200">
3131
</po-input>
3232

3333
<po-input
@@ -36,12 +36,22 @@
3636
[(ngModel)]="primaryActionLabel"
3737
p-clean
3838
p-label="Primary action label"
39-
p-maxlength="30"
39+
p-maxlength="50"
40+
>
41+
</po-input>
42+
43+
<po-input
44+
class="po-md-6 po-lg-3"
45+
name="primaryActionIcon"
46+
[(ngModel)]="primaryActionIcon"
47+
p-clean
48+
p-label="Primary action icon"
49+
p-maxlength="50"
4050
>
4151
</po-input>
4252

4353
<po-checkbox-group
44-
class="po-md-12 po-lg-9"
54+
class="po-md-12 po-lg-6"
4555
name="primaryActionProperties"
4656
[(ngModel)]="primaryActionProperties"
4757
p-columns="3"
@@ -56,12 +66,22 @@
5666
[(ngModel)]="secondaryActionLabel"
5767
p-clean
5868
p-label="Secondary action label"
59-
p-maxlength="100"
69+
p-maxlength="50"
70+
>
71+
</po-input>
72+
73+
<po-input
74+
class="po-md-6 po-lg-3"
75+
name="secondaryActionIcon"
76+
[(ngModel)]="secondaryActionIcon"
77+
p-clean
78+
p-label="Secondary action icon"
79+
p-maxlength="50"
6080
>
6181
</po-input>
6282

6383
<po-checkbox-group
64-
class="po-md-12 po-lg-9"
84+
class="po-md-12 po-lg-6"
6585
name="secondaryActionProperties"
6686
[(ngModel)]="secondaryActionProperties"
6787
p-columns="3"

projects/ui/src/lib/components/po-modal/samples/sample-po-modal-labs/sample-po-modal-labs.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class SamplePoModalLabsComponent implements OnInit {
3030
};
3131

3232
primaryActionLabel: string;
33+
primaryActionIcon: string;
3334
primaryActionProperties: Array<string>;
3435
primaryActionOptions: Array<PoCheckboxGroupOption> = [
3536
{ value: 'danger', label: 'Danger' },
@@ -56,11 +57,12 @@ export class SamplePoModalLabsComponent implements OnInit {
5657
};
5758

5859
secondaryActionLabel: string;
60+
secondaryActionIcon: string;
5961
secondaryActionProperties: Array<string>;
6062
secondaryActionOptions: Array<PoCheckboxGroupOption> = [
63+
{ value: 'danger', label: 'Danger' },
6164
{ value: 'disabled', label: 'Disabled' },
62-
{ value: 'loading', label: 'Loading' },
63-
{ value: 'danger', label: 'Danger' }
65+
{ value: 'loading', label: 'Loading' }
6466
];
6567

6668
propertiesOptions: Array<PoCheckboxGroupOption> = [
@@ -81,11 +83,13 @@ export class SamplePoModalLabsComponent implements OnInit {
8183
openModal() {
8284
this.primaryAction.disabled = this.primaryActionProperties.includes('disabled');
8385
this.primaryAction.label = this.primaryActionLabel;
86+
this.primaryAction.icon = this.primaryActionIcon;
8487
this.primaryAction.loading = this.primaryActionProperties.includes('loading');
8588
this.primaryAction.danger = this.primaryActionProperties.includes('danger');
8689

8790
this.secondaryAction.disabled = this.secondaryActionProperties.includes('disabled');
8891
this.secondaryAction.label = this.secondaryActionLabel;
92+
this.secondaryAction.icon = this.secondaryActionIcon;
8993
this.secondaryAction.loading = this.secondaryActionProperties.includes('loading');
9094
this.secondaryAction.danger = this.secondaryActionProperties.includes('danger');
9195

@@ -102,8 +106,10 @@ export class SamplePoModalLabsComponent implements OnInit {
102106
this.title = 'PO Modal';
103107
this.properties = [];
104108
this.primaryActionLabel = undefined;
109+
this.primaryActionIcon = undefined;
105110
this.primaryActionProperties = [];
106111
this.secondaryActionLabel = undefined;
112+
this.secondaryActionIcon = undefined;
107113
this.secondaryActionProperties = [];
108114
this.componentsSize = 'medium';
109115
this.icon = undefined;

0 commit comments

Comments
 (0)