@pumpkin-tech/pumpkin-tech-ng 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/badge/badge.component.mjs +1 -1
- package/esm2022/lib/components/select-enum/select-enum.component.mjs +7 -4
- package/esm2022/lib/components/table/index.mjs +2 -0
- package/esm2022/lib/components/table/table.component.mjs +678 -0
- package/esm2022/lib/modules/pumpkin-tech.module.mjs +10 -4
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/pumpkin-tech-pumpkin-tech-ng.mjs +686 -9
- package/fesm2022/pumpkin-tech-pumpkin-tech-ng.mjs.map +1 -1
- package/lib/components/badge/badge.component.d.ts +4 -5
- package/lib/components/select-enum/select-enum.component.d.ts +2 -1
- package/lib/components/table/index.d.ts +1 -0
- package/lib/components/table/table.component.d.ts +100 -0
- package/lib/modules/pumpkin-tech.module.d.ts +2 -1
- package/package.json +8 -8
- package/public-api.d.ts +1 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
type BadgeVariant = 'filled' | 'outline' | 'soft';
|
|
5
|
-
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
6
|
-
type
|
|
4
|
+
export type BadgeVariant = 'filled' | 'outline' | 'soft';
|
|
5
|
+
export type BadgeSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
export type BadgePreset = 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'purple' | 'primary' | 'accent' | 'warn';
|
|
7
7
|
export declare class BadgeComponent {
|
|
8
8
|
/** Texto do badge (ou use <ng-content>) */
|
|
9
9
|
label: string;
|
|
@@ -33,7 +33,7 @@ export declare class BadgeComponent {
|
|
|
33
33
|
size: BadgeSize;
|
|
34
34
|
variant: BadgeVariant;
|
|
35
35
|
/** Cor: preset (success, warning, …) ou qualquer CSS color (#hex, rgb, hsl, var(...)) */
|
|
36
|
-
color:
|
|
36
|
+
color: BadgePreset | string;
|
|
37
37
|
badgeClick: EventEmitter<MouseEvent>;
|
|
38
38
|
badgeKey: EventEmitter<KeyboardEvent>;
|
|
39
39
|
/** papel ARIA: se clicável, vira “button” */
|
|
@@ -59,4 +59,3 @@ export declare class BadgeComponent {
|
|
|
59
59
|
static ɵfac: i0.ɵɵFactoryDeclaration<BadgeComponent, never>;
|
|
60
60
|
static ɵcmp: i0.ɵɵComponentDeclaration<BadgeComponent, "ptech-badge", never, { "label": { "alias": "label"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "tooltip": { "alias": "tooltip"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "clickable": { "alias": "clickable"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "pill": { "alias": "pill"; "required": false; }; "uppercase": { "alias": "uppercase"; "required": false; }; "size": { "alias": "size"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "col": { "alias": "col"; "required": false; }; }, { "badgeClick": "badgeClick"; "badgeKey": "badgeKey"; }, never, ["*"], true, never>;
|
|
61
61
|
}
|
|
62
|
-
export {};
|
|
@@ -8,6 +8,7 @@ export declare class SelectEnumComponent extends BaseField implements ControlVal
|
|
|
8
8
|
enum: Record<string, any>;
|
|
9
9
|
disabledOptions: string[];
|
|
10
10
|
sort: (a: any, b: any) => number;
|
|
11
|
+
labelMap: Record<string, string>;
|
|
11
12
|
selectionChange: EventEmitter<any>;
|
|
12
13
|
enumList: Array<{
|
|
13
14
|
key: string;
|
|
@@ -24,5 +25,5 @@ export declare class SelectEnumComponent extends BaseField implements ControlVal
|
|
|
24
25
|
registerOnChange(fn: any): void;
|
|
25
26
|
registerOnTouched(fn: any): void;
|
|
26
27
|
static ɵfac: i0.ɵɵFactoryDeclaration<SelectEnumComponent, never>;
|
|
27
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SelectEnumComponent, "ptech-select-enum", never, { "multiple": { "alias": "multiple"; "required": false; }; "enum": { "alias": "enum"; "required": false; }; "disabledOptions": { "alias": "disabledOptions"; "required": false; }; "sort": { "alias": "sort"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
|
|
28
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SelectEnumComponent, "ptech-select-enum", never, { "multiple": { "alias": "multiple"; "required": false; }; "enum": { "alias": "enum"; "required": false; }; "disabledOptions": { "alias": "disabledOptions"; "required": false; }; "sort": { "alias": "sort"; "required": false; }; "labelMap": { "alias": "labelMap"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
|
|
28
29
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './table.component';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
2
|
+
import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
3
|
+
import { BadgeVariant, BadgeSize, BadgePreset } from '../badge';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export type TableAlign = 'left' | 'center' | 'right';
|
|
6
|
+
export type TableColType = 'text' | 'number' | 'date' | 'image' | 'badge';
|
|
7
|
+
export interface TableBadgeConfig<T> {
|
|
8
|
+
label: string | ((row: T) => string);
|
|
9
|
+
/** Preset da lib ou qualquer CSS color (#hex, rgb, var(...)) */
|
|
10
|
+
color?: BadgePreset | string | ((row: T) => BadgePreset | string);
|
|
11
|
+
/** filled | outline | soft */
|
|
12
|
+
variant?: BadgeVariant | ((row: T) => BadgeVariant);
|
|
13
|
+
/** sm | md | lg */
|
|
14
|
+
size?: BadgeSize | ((row: T) => BadgeSize);
|
|
15
|
+
/** controla se o badge aparece para a linha */
|
|
16
|
+
visible?: (row: T) => boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface TableColumn<T> {
|
|
19
|
+
key: string;
|
|
20
|
+
header: string;
|
|
21
|
+
type?: TableColType;
|
|
22
|
+
align?: TableAlign;
|
|
23
|
+
width?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Para 'image': de onde tirar a URL/alt
|
|
26
|
+
*/
|
|
27
|
+
imageKey?: keyof T | string;
|
|
28
|
+
altKey?: keyof T | string;
|
|
29
|
+
/**
|
|
30
|
+
* Para text/number/date, permite customizar a célula
|
|
31
|
+
*/
|
|
32
|
+
cell?: (row: T) => string | number | null | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Para colunas do tipo 'badge'
|
|
35
|
+
* - pode ser um array fixo de configs
|
|
36
|
+
* - ou uma função que recebe a linha e retorna os badges
|
|
37
|
+
*/
|
|
38
|
+
badges?: TableBadgeConfig<T>[] | ((row: T) => TableBadgeConfig<T>[]);
|
|
39
|
+
}
|
|
40
|
+
export interface TableAction<T> {
|
|
41
|
+
icon: string;
|
|
42
|
+
tooltip?: string;
|
|
43
|
+
color?: string;
|
|
44
|
+
handler: (row: T) => void;
|
|
45
|
+
/** controla se a ação aparece para a linha */
|
|
46
|
+
visible?: (row: T) => boolean;
|
|
47
|
+
}
|
|
48
|
+
export declare class TableComponent<T> implements OnChanges {
|
|
49
|
+
title: string;
|
|
50
|
+
loading: boolean;
|
|
51
|
+
data: T[];
|
|
52
|
+
total: number;
|
|
53
|
+
pageIndex: number;
|
|
54
|
+
pageSize: number;
|
|
55
|
+
pageSizeOptions: number[];
|
|
56
|
+
columns: TableColumn<T>[];
|
|
57
|
+
actions: TableAction<T>[];
|
|
58
|
+
selectRow: boolean;
|
|
59
|
+
selectMultipleRow: boolean;
|
|
60
|
+
getRowId: (row: T) => string | number;
|
|
61
|
+
/** imagem de fallback para <img> quebrada ou ausente */
|
|
62
|
+
imageFallback: string;
|
|
63
|
+
/** ativa visualização em cards no mobile */
|
|
64
|
+
responsiveCards: boolean;
|
|
65
|
+
selectedRows: EventEmitter<T[]>;
|
|
66
|
+
selectedIds: EventEmitter<(string | number)[]>;
|
|
67
|
+
page: EventEmitter<{
|
|
68
|
+
pageIndex: number;
|
|
69
|
+
pageSize: number;
|
|
70
|
+
}>;
|
|
71
|
+
displayedColumns: string[];
|
|
72
|
+
selection: SelectionModel<T>;
|
|
73
|
+
private selectedIdSet;
|
|
74
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
75
|
+
toggleAllRows(): void;
|
|
76
|
+
/** Verifica se todas estão selecionadas */
|
|
77
|
+
isAllSelected(): boolean;
|
|
78
|
+
clearSelection(): void;
|
|
79
|
+
/** Marca/desmarca uma linha */
|
|
80
|
+
toggleRow(row: T): void;
|
|
81
|
+
/** Emite o estado atual */
|
|
82
|
+
private emitSelected;
|
|
83
|
+
/** Verifica se uma linha está selecionada */
|
|
84
|
+
isSelected(row: T): boolean;
|
|
85
|
+
onPage(ev: any): void;
|
|
86
|
+
renderCell(row: T, col: TableColumn<T>): any;
|
|
87
|
+
resolveImage(row: T, col: TableColumn<T>): string | null;
|
|
88
|
+
resolveAlt(row: T, col: TableColumn<T>): string | null;
|
|
89
|
+
read(obj: any, path: string): any;
|
|
90
|
+
onImgError(ev: Event): void;
|
|
91
|
+
/** BADGES: resolve a lista de badges para a linha+coluna */
|
|
92
|
+
getBadges(row: T, col: TableColumn<T>): Array<{
|
|
93
|
+
label: string;
|
|
94
|
+
color: BadgePreset | string;
|
|
95
|
+
variant: BadgeVariant;
|
|
96
|
+
size: BadgeSize;
|
|
97
|
+
}>;
|
|
98
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TableComponent<any>, never>;
|
|
99
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent<any>, "ptech-table", never, { "title": { "alias": "title"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "data": { "alias": "data"; "required": false; }; "total": { "alias": "total"; "required": false; }; "pageIndex": { "alias": "pageIndex"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "selectRow": { "alias": "selectRow"; "required": false; }; "selectMultipleRow": { "alias": "selectMultipleRow"; "required": false; }; "getRowId": { "alias": "getRowId"; "required": false; }; "imageFallback": { "alias": "imageFallback"; "required": false; }; "responsiveCards": { "alias": "responsiveCards"; "required": false; }; }, { "selectedRows": "selectedRows"; "selectedIds": "selectedIds"; "page": "page"; }, never, never, true, never>;
|
|
100
|
+
}
|
|
@@ -33,8 +33,9 @@ import * as i31 from "../components/check-box/check-box.component";
|
|
|
33
33
|
import * as i32 from "../components/progress-bar/progress-bar.component";
|
|
34
34
|
import * as i33 from "../components/progress-bar-multiple/progress-bar-multiple.component";
|
|
35
35
|
import * as i34 from "../components/flag/flag.component";
|
|
36
|
+
import * as i35 from "../components/table/table.component";
|
|
36
37
|
export declare class PumpkinTechModule {
|
|
37
38
|
static ɵfac: i0.ɵɵFactoryDeclaration<PumpkinTechModule, never>;
|
|
38
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<PumpkinTechModule, never, [typeof i1.CommonModule, typeof i2.CoreMaterialModule, typeof i3.InputComponent, typeof i4.TextareaComponent, typeof i5.InputDateComponent, typeof i6.InputDateRangeComponent, typeof i7.InputTimeComponent, typeof i8.InputCurrencyComponent, typeof i9.InfoDetailComponent, typeof i10.InfoDetailDialogComponent, typeof i11.ActionDialogComponent, typeof i12.ActionResultDialogComponent, typeof i13.ButtonComponent, typeof i14.BadgeComponent, typeof i15.BadgeStackComponent, typeof i16.BreadcrumbComponent, typeof i17.TitleComponent, typeof i18.ActionRowComponent, typeof i19.HeaderComponent, typeof i20.NavComponent, typeof i21.FooterComponent, typeof i22.IconComponent, typeof i23.SelectEntityComponent, typeof i24.SelectEnumComponent, typeof i25.RadioGroupEnumComponent, typeof i26.RadioGroupEntityComponent, typeof i27.SlideToggleComponent, typeof i28.QuantityItemsComponent, typeof i29.LoadingOverlayComponent, typeof i30.ProfileMenuComponent, typeof i31.CheckBoxComponent, typeof i32.ProgressBarComponent, typeof i33.ProgressBarMultipleComponent, typeof i34.FlagComponent], [typeof i3.InputComponent, typeof i4.TextareaComponent, typeof i5.InputDateComponent, typeof i6.InputDateRangeComponent, typeof i7.InputTimeComponent, typeof i8.InputCurrencyComponent, typeof i9.InfoDetailComponent, typeof i10.InfoDetailDialogComponent, typeof i11.ActionDialogComponent, typeof i12.ActionResultDialogComponent, typeof i13.ButtonComponent, typeof i14.BadgeComponent, typeof i15.BadgeStackComponent, typeof i16.BreadcrumbComponent, typeof i17.TitleComponent, typeof i18.ActionRowComponent, typeof i19.HeaderComponent, typeof i20.NavComponent, typeof i21.FooterComponent, typeof i22.IconComponent, typeof i23.SelectEntityComponent, typeof i24.SelectEnumComponent, typeof i25.RadioGroupEnumComponent, typeof i26.RadioGroupEntityComponent, typeof i27.SlideToggleComponent, typeof i28.QuantityItemsComponent, typeof i29.LoadingOverlayComponent, typeof i30.ProfileMenuComponent, typeof i31.CheckBoxComponent, typeof i32.ProgressBarComponent, typeof i33.ProgressBarMultipleComponent, typeof i34.FlagComponent, typeof i2.CoreMaterialModule]>;
|
|
39
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<PumpkinTechModule, never, [typeof i1.CommonModule, typeof i2.CoreMaterialModule, typeof i3.InputComponent, typeof i4.TextareaComponent, typeof i5.InputDateComponent, typeof i6.InputDateRangeComponent, typeof i7.InputTimeComponent, typeof i8.InputCurrencyComponent, typeof i9.InfoDetailComponent, typeof i10.InfoDetailDialogComponent, typeof i11.ActionDialogComponent, typeof i12.ActionResultDialogComponent, typeof i13.ButtonComponent, typeof i14.BadgeComponent, typeof i15.BadgeStackComponent, typeof i16.BreadcrumbComponent, typeof i17.TitleComponent, typeof i18.ActionRowComponent, typeof i19.HeaderComponent, typeof i20.NavComponent, typeof i21.FooterComponent, typeof i22.IconComponent, typeof i23.SelectEntityComponent, typeof i24.SelectEnumComponent, typeof i25.RadioGroupEnumComponent, typeof i26.RadioGroupEntityComponent, typeof i27.SlideToggleComponent, typeof i28.QuantityItemsComponent, typeof i29.LoadingOverlayComponent, typeof i30.ProfileMenuComponent, typeof i31.CheckBoxComponent, typeof i32.ProgressBarComponent, typeof i33.ProgressBarMultipleComponent, typeof i34.FlagComponent, typeof i35.TableComponent], [typeof i3.InputComponent, typeof i4.TextareaComponent, typeof i5.InputDateComponent, typeof i6.InputDateRangeComponent, typeof i7.InputTimeComponent, typeof i8.InputCurrencyComponent, typeof i9.InfoDetailComponent, typeof i10.InfoDetailDialogComponent, typeof i11.ActionDialogComponent, typeof i12.ActionResultDialogComponent, typeof i13.ButtonComponent, typeof i14.BadgeComponent, typeof i15.BadgeStackComponent, typeof i16.BreadcrumbComponent, typeof i17.TitleComponent, typeof i18.ActionRowComponent, typeof i19.HeaderComponent, typeof i20.NavComponent, typeof i21.FooterComponent, typeof i22.IconComponent, typeof i23.SelectEntityComponent, typeof i24.SelectEnumComponent, typeof i25.RadioGroupEnumComponent, typeof i26.RadioGroupEntityComponent, typeof i27.SlideToggleComponent, typeof i28.QuantityItemsComponent, typeof i29.LoadingOverlayComponent, typeof i30.ProfileMenuComponent, typeof i31.CheckBoxComponent, typeof i32.ProgressBarComponent, typeof i33.ProgressBarMultipleComponent, typeof i34.FlagComponent, typeof i35.TableComponent, typeof i2.CoreMaterialModule]>;
|
|
39
40
|
static ɵinj: i0.ɵɵInjectorDeclaration<PumpkinTechModule>;
|
|
40
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pumpkin-tech/pumpkin-tech-ng",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Biblioteca Angular com utilitários e componentes Pumpkin Tech",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"url": "git+https://github.com/legendbr94/pumpkin-tech-ng.git"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@angular/animations": "18.
|
|
20
|
-
"@angular/common": "18.
|
|
21
|
-
"@angular/core": "18.
|
|
22
|
-
"@angular/forms": "18.
|
|
23
|
-
"@angular/material": "18.
|
|
24
|
-
"@angular/cdk": "18.
|
|
25
|
-
"@angular/material-moment-adapter": "18.
|
|
19
|
+
"@angular/animations": "^18.0.0",
|
|
20
|
+
"@angular/common": "^18.0.0",
|
|
21
|
+
"@angular/core": "^18.0.0",
|
|
22
|
+
"@angular/forms": "^18.0.0",
|
|
23
|
+
"@angular/material": "^18.0.0",
|
|
24
|
+
"@angular/cdk": "^18.0.0",
|
|
25
|
+
"@angular/material-moment-adapter": "^18.0.0",
|
|
26
26
|
"moment": "^2.29.4",
|
|
27
27
|
"@faker-js/faker": "^9.0.3",
|
|
28
28
|
"@ngx-translate/core": "^17.0.0",
|
package/public-api.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from './lib/components/input-time';
|
|
|
35
35
|
export * from './lib/components/input-currency';
|
|
36
36
|
export * from './lib/components/title';
|
|
37
37
|
export * from './lib/components/flag';
|
|
38
|
+
export * from './lib/components/table';
|
|
38
39
|
export * from './lib/modules/pumpkin-tech.module';
|
|
39
40
|
export * from './lib/modules/directives.module';
|
|
40
41
|
export * from './lib/modules/pipes.module';
|