sapenlinea-components 0.0.4 → 0.0.5

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.
@@ -0,0 +1,82 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, EventEmitter, signal, computed, Output, Input } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+
6
+ class MyComponent {
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: MyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.13", type: MyComponent, isStandalone: true, selector: "lib-my-component", ngImport: i0, template: "<p>my-component works!</p>\r\n", styles: [""] });
9
+ }
10
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: MyComponent, decorators: [{
11
+ type: Component,
12
+ args: [{ selector: 'lib-my-component', imports: [], template: "<p>my-component works!</p>\r\n" }]
13
+ }] });
14
+
15
+ class PaginationComponent {
16
+ page = 1;
17
+ pageSize = 10;
18
+ totalItems = 0;
19
+ showPageSizeSelector = false;
20
+ pageSizeOptions = [5, 10, 20, 50];
21
+ pageChange = new EventEmitter();
22
+ pageSizeChange = new EventEmitter();
23
+ pageSizeValue = signal(this.pageSize, ...(ngDevMode ? [{ debugName: "pageSizeValue" }] : []));
24
+ isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
25
+ isDisabled = signal(false, ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
26
+ showPageSizeMenu = signal(false, ...(ngDevMode ? [{ debugName: "showPageSizeMenu" }] : []));
27
+ totalPages = computed(() => {
28
+ const size = this.pageSizeValue();
29
+ const total = this.totalItems;
30
+ return size > 0 ? Math.ceil(total / size) : 1;
31
+ }, ...(ngDevMode ? [{ debugName: "totalPages" }] : []));
32
+ pages = computed(() => {
33
+ const tp = this.totalPages();
34
+ return Array.from({ length: tp }, (_, i) => i + 1);
35
+ }, ...(ngDevMode ? [{ debugName: "pages" }] : []));
36
+ selectedPageSize = computed(() => this.pageSizeValue(), ...(ngDevMode ? [{ debugName: "selectedPageSize" }] : []));
37
+ goToPage(p) {
38
+ if (p < 1 || p > this.totalPages())
39
+ return;
40
+ this.pageChange.emit(p);
41
+ }
42
+ togglePageSizeMenu() {
43
+ this.isOpen.update(v => !v);
44
+ this.showPageSizeMenu.update(v => !v);
45
+ }
46
+ selectPageSize(size) {
47
+ this.pageSizeValue.set(size);
48
+ this.pageSizeChange.emit(size);
49
+ this.showPageSizeMenu.set(false);
50
+ this.isOpen.set(false);
51
+ }
52
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
53
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.13", type: PaginationComponent, isStandalone: true, selector: "app-pagination", inputs: { page: "page", pageSize: "pageSize", totalItems: "totalItems", showPageSizeSelector: "showPageSizeSelector", pageSizeOptions: "pageSizeOptions" }, outputs: { pageChange: "pageChange", pageSizeChange: "pageSizeChange" }, ngImport: i0, template: "<div class=\"pagination-container\">\r\n <div class=\"pagination\">\r\n <!-- Bot\u00F3n doble atr\u00E1s -->\r\n <button class=\"icon-button\" (click)=\"goToPage(1)\" [disabled]=\"page === 1\">\r\n \u00AB\u00AB\r\n </button>\r\n\r\n <!-- Bot\u00F3n atr\u00E1s -->\r\n <button class=\"icon-button\" (click)=\"goToPage(page - 1)\" [disabled]=\"page === 1\">\r\n \u00AB\r\n </button>\r\n\r\n <!-- N\u00FAmeros de p\u00E1gina -->\r\n <div class=\"pages\">\r\n <button\r\n class=\"page-btn\"\r\n *ngFor=\"let p of pages(); let idx = index\"\r\n [class.active]=\"page === idx + 1\"\r\n (click)=\"goToPage(idx + 1)\"\r\n >\r\n {{ idx + 1 }}\r\n </button>\r\n </div>\r\n\r\n <!-- Bot\u00F3n siguiente -->\r\n <button class=\"icon-button\" (click)=\"goToPage(page + 1)\" [disabled]=\"page === totalPages()\">\r\n \u00BB\r\n </button>\r\n\r\n <!-- Bot\u00F3n doble adelante -->\r\n <button class=\"icon-button\" (click)=\"goToPage(totalPages())\" [disabled]=\"page === totalPages()\">\r\n \u00BB\u00BB\r\n </button>\r\n </div>\r\n\r\n <!-- Selector Items por p\u00E1gina -->\r\n <div *ngIf=\"showPageSizeSelector\">\r\n <div class=\"pagination-v-4\">\r\n <div class=\"label-pagination\">Items por p\u00E1gina</div>\r\n <div class=\"elements-pagination\">\r\n <div class=\"split-button\" (click)=\"togglePageSizeMenu()\">\r\n <div class=\"leading-button\">\r\n <div class=\"state-layer\">\r\n <div class=\"label\">{{ pageSizeValue() }}</div>\r\n </div>\r\n </div>\r\n <div class=\"trailing-button\">\r\n <div class=\"arrow\" [class.open]=\"isOpen()\">\r\n <svg class=\"arrow\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\">\r\n <polyline points=\"6 9 12 15 18 9\"></polyline>\r\n </svg>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Men\u00FA desplegable -->\r\n <div class=\"page-size-menu\" *ngIf=\"showPageSizeMenu()\">\r\n <div\r\n class=\"menu-option\"\r\n *ngFor=\"let opt of pageSizeOptions\"\r\n [class.active]=\"opt === pageSizeValue()\"\r\n (click)=\"selectPageSize(opt)\"\r\n >\r\n {{ opt }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".pagination-container{display:flex;flex-direction:row;justify-content:center;width:100%;padding:8px 0;position:relative}.pagination{display:flex;align-items:center;gap:12px;padding:12px;justify-content:center;flex:1}.icon-button{width:40px;height:40px;border-radius:50%;background:var(--primary, #596300);color:var(--surface, #ffffff);border:none;cursor:pointer;font-size:16px;font-weight:700;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 2px #00000026;transition:background .2s ease,transform .1s ease}.icon-button:disabled{background:#969696;color:var(--on-surface, #171c1f);opacity:.45;cursor:not-allowed}.pages{display:flex;gap:4px;overflow:hidden;border-radius:20px}.page-btn{background:var(--secondary-container, #dee58f);width:40px;height:40px;border:none;cursor:pointer;padding:8px 14px;font-size:14px;color:var(--schemes-on-surface, #3a3a3a);font-family:Roboto,sans-serif;border-radius:8px;transition:background .2s ease}.page-btn:hover:not(.active){background:var(--schemes-on-secondary-container, #61661f);color:var(--schemes-secondary-container, #dee58f)}.page-btn.active{background:var(--schemes-primary, #596300);color:var(--schemes-on-primary, #ffffff);font-weight:600;border-radius:20px}.pagination-v-4{display:flex;gap:10px;align-items:center;margin-left:auto}.label-pagination{font-size:14px;font-weight:600;color:var(--schemes-on-surface)}.elements-pagination{position:relative;display:flex;gap:4px;border-radius:20px}.split-button{display:flex;cursor:pointer;border-radius:20px;overflow:hidden}.leading-button{background:var(--schemes-secondary-container);border-radius:20px 4px 4px 20px;display:flex;align-items:center;height:40px}.state-layer{padding:10px 16px;background-color:#dee58f;margin-right:4px;border-radius:8px}.state-layer:open{color:#f5f5e0;background-color:#596300}.label{font-size:14px;font-weight:500;color:var(--schemes-on-secondary-container)}.trailing-button{background:var(--secondary-container, #dee58f);padding-left:12px;padding-right:12px;border:none;cursor:pointer;font-size:14px;color:var(--schemes-on-surface, #3a3a3a);font-family:Roboto,sans-serif;border-radius:8px;transition:background .2s ease;align-items:center;align-content:center}.arrow{width:20px;height:20px;color:#171c1f;transition:transform .25s ease}.arrow.open{transform:rotate(180deg)}.page-size-menu{background:#f5f5e0;position:absolute;min-width:100px;border-radius:4px;box-shadow:0 2px 8px #0003;overflow:hidden;z-index:999;bottom:50px;right:0;transform-origin:top right}.menu-option{padding:8px 12px;cursor:pointer}.menu-option:hover{background:#dee58f5b}.menu-option.active{background:#dee58f;color:#61661f}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
54
+ }
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: PaginationComponent, decorators: [{
56
+ type: Component,
57
+ args: [{ selector: 'app-pagination', standalone: true, imports: [CommonModule], template: "<div class=\"pagination-container\">\r\n <div class=\"pagination\">\r\n <!-- Bot\u00F3n doble atr\u00E1s -->\r\n <button class=\"icon-button\" (click)=\"goToPage(1)\" [disabled]=\"page === 1\">\r\n \u00AB\u00AB\r\n </button>\r\n\r\n <!-- Bot\u00F3n atr\u00E1s -->\r\n <button class=\"icon-button\" (click)=\"goToPage(page - 1)\" [disabled]=\"page === 1\">\r\n \u00AB\r\n </button>\r\n\r\n <!-- N\u00FAmeros de p\u00E1gina -->\r\n <div class=\"pages\">\r\n <button\r\n class=\"page-btn\"\r\n *ngFor=\"let p of pages(); let idx = index\"\r\n [class.active]=\"page === idx + 1\"\r\n (click)=\"goToPage(idx + 1)\"\r\n >\r\n {{ idx + 1 }}\r\n </button>\r\n </div>\r\n\r\n <!-- Bot\u00F3n siguiente -->\r\n <button class=\"icon-button\" (click)=\"goToPage(page + 1)\" [disabled]=\"page === totalPages()\">\r\n \u00BB\r\n </button>\r\n\r\n <!-- Bot\u00F3n doble adelante -->\r\n <button class=\"icon-button\" (click)=\"goToPage(totalPages())\" [disabled]=\"page === totalPages()\">\r\n \u00BB\u00BB\r\n </button>\r\n </div>\r\n\r\n <!-- Selector Items por p\u00E1gina -->\r\n <div *ngIf=\"showPageSizeSelector\">\r\n <div class=\"pagination-v-4\">\r\n <div class=\"label-pagination\">Items por p\u00E1gina</div>\r\n <div class=\"elements-pagination\">\r\n <div class=\"split-button\" (click)=\"togglePageSizeMenu()\">\r\n <div class=\"leading-button\">\r\n <div class=\"state-layer\">\r\n <div class=\"label\">{{ pageSizeValue() }}</div>\r\n </div>\r\n </div>\r\n <div class=\"trailing-button\">\r\n <div class=\"arrow\" [class.open]=\"isOpen()\">\r\n <svg class=\"arrow\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\">\r\n <polyline points=\"6 9 12 15 18 9\"></polyline>\r\n </svg>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Men\u00FA desplegable -->\r\n <div class=\"page-size-menu\" *ngIf=\"showPageSizeMenu()\">\r\n <div\r\n class=\"menu-option\"\r\n *ngFor=\"let opt of pageSizeOptions\"\r\n [class.active]=\"opt === pageSizeValue()\"\r\n (click)=\"selectPageSize(opt)\"\r\n >\r\n {{ opt }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".pagination-container{display:flex;flex-direction:row;justify-content:center;width:100%;padding:8px 0;position:relative}.pagination{display:flex;align-items:center;gap:12px;padding:12px;justify-content:center;flex:1}.icon-button{width:40px;height:40px;border-radius:50%;background:var(--primary, #596300);color:var(--surface, #ffffff);border:none;cursor:pointer;font-size:16px;font-weight:700;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 2px #00000026;transition:background .2s ease,transform .1s ease}.icon-button:disabled{background:#969696;color:var(--on-surface, #171c1f);opacity:.45;cursor:not-allowed}.pages{display:flex;gap:4px;overflow:hidden;border-radius:20px}.page-btn{background:var(--secondary-container, #dee58f);width:40px;height:40px;border:none;cursor:pointer;padding:8px 14px;font-size:14px;color:var(--schemes-on-surface, #3a3a3a);font-family:Roboto,sans-serif;border-radius:8px;transition:background .2s ease}.page-btn:hover:not(.active){background:var(--schemes-on-secondary-container, #61661f);color:var(--schemes-secondary-container, #dee58f)}.page-btn.active{background:var(--schemes-primary, #596300);color:var(--schemes-on-primary, #ffffff);font-weight:600;border-radius:20px}.pagination-v-4{display:flex;gap:10px;align-items:center;margin-left:auto}.label-pagination{font-size:14px;font-weight:600;color:var(--schemes-on-surface)}.elements-pagination{position:relative;display:flex;gap:4px;border-radius:20px}.split-button{display:flex;cursor:pointer;border-radius:20px;overflow:hidden}.leading-button{background:var(--schemes-secondary-container);border-radius:20px 4px 4px 20px;display:flex;align-items:center;height:40px}.state-layer{padding:10px 16px;background-color:#dee58f;margin-right:4px;border-radius:8px}.state-layer:open{color:#f5f5e0;background-color:#596300}.label{font-size:14px;font-weight:500;color:var(--schemes-on-secondary-container)}.trailing-button{background:var(--secondary-container, #dee58f);padding-left:12px;padding-right:12px;border:none;cursor:pointer;font-size:14px;color:var(--schemes-on-surface, #3a3a3a);font-family:Roboto,sans-serif;border-radius:8px;transition:background .2s ease;align-items:center;align-content:center}.arrow{width:20px;height:20px;color:#171c1f;transition:transform .25s ease}.arrow.open{transform:rotate(180deg)}.page-size-menu{background:#f5f5e0;position:absolute;min-width:100px;border-radius:4px;box-shadow:0 2px 8px #0003;overflow:hidden;z-index:999;bottom:50px;right:0;transform-origin:top right}.menu-option{padding:8px 12px;cursor:pointer}.menu-option:hover{background:#dee58f5b}.menu-option.active{background:#dee58f;color:#61661f}\n"] }]
58
+ }], propDecorators: { page: [{
59
+ type: Input
60
+ }], pageSize: [{
61
+ type: Input
62
+ }], totalItems: [{
63
+ type: Input
64
+ }], showPageSizeSelector: [{
65
+ type: Input
66
+ }], pageSizeOptions: [{
67
+ type: Input
68
+ }], pageChange: [{
69
+ type: Output
70
+ }], pageSizeChange: [{
71
+ type: Output
72
+ }] } });
73
+
74
+ // src/app/components/public-api.ts
75
+ // Exportar el componente
76
+
77
+ /**
78
+ * Generated bundle index. Do not edit.
79
+ */
80
+
81
+ export { MyComponent, PaginationComponent };
82
+ //# sourceMappingURL=sapenlinea-components.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sapenlinea-components.mjs","sources":["../../../projects/sapenlinea-components/src/lib/components/my-component/my-component.ts","../../../projects/sapenlinea-components/src/lib/components/my-component/my-component.html","../../../projects/sapenlinea-components/src/lib/components/pagination/pagination.ts","../../../projects/sapenlinea-components/src/lib/components/pagination/pagination.html","../../../projects/sapenlinea-components/src/public-api.ts","../../../projects/sapenlinea-components/src/sapenlinea-components.ts"],"sourcesContent":["import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-my-component',\r\n imports: [],\r\n templateUrl: './my-component.html',\r\n styleUrl: './my-component.css',\r\n})\r\nexport class MyComponent {\r\n\r\n}\r\n","<p>my-component works!</p>\r\n","import { Component, Input, Output, EventEmitter, computed, signal } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\n@Component({\r\n selector: 'app-pagination',\r\n standalone: true,\r\n imports: [CommonModule],\r\n templateUrl: './pagination.html',\r\n styleUrls: ['./pagination.css']\r\n})\r\nexport class PaginationComponent {\r\n @Input() page = 1;\r\n @Input() pageSize = 10;\r\n @Input() totalItems = 0;\r\n\r\n @Input() showPageSizeSelector = false;\r\n @Input() pageSizeOptions: number[] = [5, 10, 20, 50];\r\n\r\n @Output() pageChange = new EventEmitter<number>();\r\n @Output() pageSizeChange = new EventEmitter<number>();\r\n\r\n pageSizeValue = signal(this.pageSize);\r\n isOpen = signal(false);\r\n isDisabled = signal(false);\r\n showPageSizeMenu = signal(false);\r\n\r\n totalPages = computed(() => {\r\n const size = this.pageSizeValue();\r\n const total = this.totalItems;\r\n return size > 0 ? Math.ceil(total / size) : 1;\r\n });\r\n\r\n pages = computed(() => {\r\n const tp = this.totalPages();\r\n return Array.from({ length: tp }, (_, i) => i + 1);\r\n });\r\n\r\n selectedPageSize = computed(() => this.pageSizeValue());\r\n\r\n goToPage(p: number) {\r\n if (p < 1 || p > this.totalPages()) return;\r\n this.pageChange.emit(p);\r\n }\r\n\r\n togglePageSizeMenu() {\r\n this.isOpen.update(v => !v);\r\n this.showPageSizeMenu.update(v => !v);\r\n }\r\n\r\n selectPageSize(size: number) {\r\n this.pageSizeValue.set(size);\r\n this.pageSizeChange.emit(size);\r\n this.showPageSizeMenu.set(false);\r\n this.isOpen.set(false);\r\n }\r\n}\r\n","<div class=\"pagination-container\">\r\n <div class=\"pagination\">\r\n <!-- Botón doble atrás -->\r\n <button class=\"icon-button\" (click)=\"goToPage(1)\" [disabled]=\"page === 1\">\r\n ««\r\n </button>\r\n\r\n <!-- Botón atrás -->\r\n <button class=\"icon-button\" (click)=\"goToPage(page - 1)\" [disabled]=\"page === 1\">\r\n «\r\n </button>\r\n\r\n <!-- Números de página -->\r\n <div class=\"pages\">\r\n <button\r\n class=\"page-btn\"\r\n *ngFor=\"let p of pages(); let idx = index\"\r\n [class.active]=\"page === idx + 1\"\r\n (click)=\"goToPage(idx + 1)\"\r\n >\r\n {{ idx + 1 }}\r\n </button>\r\n </div>\r\n\r\n <!-- Botón siguiente -->\r\n <button class=\"icon-button\" (click)=\"goToPage(page + 1)\" [disabled]=\"page === totalPages()\">\r\n »\r\n </button>\r\n\r\n <!-- Botón doble adelante -->\r\n <button class=\"icon-button\" (click)=\"goToPage(totalPages())\" [disabled]=\"page === totalPages()\">\r\n »»\r\n </button>\r\n </div>\r\n\r\n <!-- Selector Items por página -->\r\n <div *ngIf=\"showPageSizeSelector\">\r\n <div class=\"pagination-v-4\">\r\n <div class=\"label-pagination\">Items por página</div>\r\n <div class=\"elements-pagination\">\r\n <div class=\"split-button\" (click)=\"togglePageSizeMenu()\">\r\n <div class=\"leading-button\">\r\n <div class=\"state-layer\">\r\n <div class=\"label\">{{ pageSizeValue() }}</div>\r\n </div>\r\n </div>\r\n <div class=\"trailing-button\">\r\n <div class=\"arrow\" [class.open]=\"isOpen()\">\r\n <svg class=\"arrow\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\">\r\n <polyline points=\"6 9 12 15 18 9\"></polyline>\r\n </svg>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Menú desplegable -->\r\n <div class=\"page-size-menu\" *ngIf=\"showPageSizeMenu()\">\r\n <div\r\n class=\"menu-option\"\r\n *ngFor=\"let opt of pageSizeOptions\"\r\n [class.active]=\"opt === pageSizeValue()\"\r\n (click)=\"selectPageSize(opt)\"\r\n >\r\n {{ opt }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n","// src/app/components/public-api.ts\r\n\r\n// Exportar el componente\r\nexport * from './lib/components/my-component/my-component';\r\nexport * from './lib/components/pagination/pagination';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAQa,WAAW,CAAA;wGAAX,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,WAAW,4ECRxB,gCACA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FDOa,WAAW,EAAA,UAAA,EAAA,CAAA;kBANvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,WACnB,EAAE,EAAA,QAAA,EAAA,gCAAA,EAAA;;;MEMA,mBAAmB,CAAA;IACrB,IAAI,GAAG,CAAC;IACR,QAAQ,GAAG,EAAE;IACb,UAAU,GAAG,CAAC;IAEd,oBAAoB,GAAG,KAAK;IAC5B,eAAe,GAAa,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAE1C,IAAA,UAAU,GAAG,IAAI,YAAY,EAAU;AACvC,IAAA,cAAc,GAAG,IAAI,YAAY,EAAU;AAErD,IAAA,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,yDAAC;AACrC,IAAA,MAAM,GAAG,MAAM,CAAC,KAAK,kDAAC;AACtB,IAAA,UAAU,GAAG,MAAM,CAAC,KAAK,sDAAC;AAC1B,IAAA,gBAAgB,GAAG,MAAM,CAAC,KAAK,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,CAAA,EAAA;;sBAKtB;;sBACA;;sBACA;;sBAEA;;sBACA;;sBAEA;;sBACA;;;AEnBH;AAEA;;ACFA;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { EventEmitter } from '@angular/core';
3
+
4
+ declare class MyComponent {
5
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MyComponent, never>;
6
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MyComponent, "lib-my-component", never, {}, {}, never, never, true, never>;
7
+ }
8
+
9
+ declare class PaginationComponent {
10
+ page: number;
11
+ pageSize: number;
12
+ totalItems: number;
13
+ showPageSizeSelector: boolean;
14
+ pageSizeOptions: number[];
15
+ pageChange: EventEmitter<number>;
16
+ pageSizeChange: EventEmitter<number>;
17
+ pageSizeValue: _angular_core.WritableSignal<number>;
18
+ isOpen: _angular_core.WritableSignal<boolean>;
19
+ isDisabled: _angular_core.WritableSignal<boolean>;
20
+ showPageSizeMenu: _angular_core.WritableSignal<boolean>;
21
+ totalPages: _angular_core.Signal<number>;
22
+ pages: _angular_core.Signal<number[]>;
23
+ selectedPageSize: _angular_core.Signal<number>;
24
+ goToPage(p: number): void;
25
+ togglePageSizeMenu(): void;
26
+ selectPageSize(size: number): void;
27
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PaginationComponent, never>;
28
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PaginationComponent, "app-pagination", never, { "page": { "alias": "page"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "totalItems": { "alias": "totalItems"; "required": false; }; "showPageSizeSelector": { "alias": "showPageSizeSelector"; "required": false; }; "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; }; }, { "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; }, never, never, true, never>;
29
+ }
30
+
31
+ export { MyComponent, PaginationComponent };
package/package.json CHANGED
@@ -1,12 +1,23 @@
1
- {
2
- "name": "sapenlinea-components",
3
- "version": "0.0.4",
4
- "peerDependencies": {
5
- "@angular/common": "^20.3.0",
6
- "@angular/core": "^20.3.0"
7
- },
8
- "dependencies": {
9
- "tslib": "^2.3.0"
10
- },
11
- "sideEffects": false
12
- }
1
+ {
2
+ "name": "sapenlinea-components",
3
+ "version": "0.0.5",
4
+ "peerDependencies": {
5
+ "@angular/common": "^20.3.0",
6
+ "@angular/core": "^20.3.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false,
12
+ "module": "fesm2022/sapenlinea-components.mjs",
13
+ "typings": "index.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./index.d.ts",
20
+ "default": "./fesm2022/sapenlinea-components.mjs"
21
+ }
22
+ }
23
+ }
package/ng-package.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/sapenlinea-components",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- },
7
- "allowedNonPeerDependencies": [
8
- "@angular/common",
9
- "@angular/core",
10
- "@angular/forms",
11
- "@angular/platform-browser",
12
- "@angular/platform-browser-dynamic",
13
- "@angular/router"
14
- ]
15
- }
File without changes
@@ -1 +0,0 @@
1
- <p>my-component works!</p>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { MyComponent } from './my-component';
4
-
5
- describe('MyComponent', () => {
6
- let component: MyComponent;
7
- let fixture: ComponentFixture<MyComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [MyComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(MyComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,11 +0,0 @@
1
- import { Component } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'lib-my-component',
5
- imports: [],
6
- templateUrl: './my-component.html',
7
- styleUrl: './my-component.css',
8
- })
9
- export class MyComponent {
10
-
11
- }
@@ -1,181 +0,0 @@
1
- .pagination-container {
2
- display: flex;
3
- flex-direction: row;
4
- justify-content: center;
5
- width: 100%;
6
- padding: 8px 0;
7
- position: relative;
8
- }
9
-
10
- .pagination {
11
- display: flex;
12
- align-items: center;
13
- gap: 12px;
14
- padding: 12px;
15
- justify-content: center;
16
- flex: 1;
17
- }
18
-
19
- .icon-button {
20
- width: 40px;
21
- height: 40px;
22
- border-radius: 50%;
23
- background: var(--primary, #596300);
24
- color: var(--surface, #ffffff);
25
- border: none;
26
- cursor: pointer;
27
- font-size: 16px;
28
- font-weight: bold;
29
- display: flex;
30
- align-items: center;
31
- justify-content: center;
32
-
33
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
34
- transition: background 0.2s ease, transform 0.1s ease;
35
- }
36
-
37
- .icon-button:disabled {
38
- background: #969696;
39
- color: var(--on-surface, #171c1f);
40
- opacity: 0.45;
41
- cursor: not-allowed;
42
- }
43
-
44
- .pages {
45
- display: flex;
46
- gap: 4px;
47
- overflow: hidden;
48
- border-radius: 20px;
49
- }
50
-
51
- .page-btn {
52
- background: var(--secondary-container, #dee58f);
53
- width: 40px;
54
- height: 40px;
55
- border: none;
56
- cursor: pointer;
57
- padding: 8px 14px;
58
- font-size: 14px;
59
- color: var(--schemes-on-surface, #3a3a3a);
60
- font-family: "Roboto", sans-serif;
61
- border-radius: 8px;
62
- transition: background 0.2s ease;
63
- }
64
-
65
- .page-btn:hover:not(.active) {
66
- background: var(--schemes-on-secondary-container, #61661f);
67
- color: var(--schemes-secondary-container, #dee58f);
68
- }
69
-
70
- .page-btn.active {
71
- background: var(--schemes-primary, #596300);
72
- color: var(--schemes-on-primary, #ffffff);
73
- font-weight: 600;
74
- border-radius: 20px;
75
- }
76
-
77
- .pagination-v-4 {
78
- display: flex;
79
- gap: 10px;
80
- align-items: center;
81
- margin-left: auto;
82
- }
83
-
84
- .label-pagination {
85
- font-size: 14px;
86
- font-weight: 600;
87
- color: var(--schemes-on-surface);
88
- }
89
-
90
- .elements-pagination {
91
- position: relative;
92
- display: flex;
93
- gap: 4px;
94
- border-radius: 20px;
95
- }
96
-
97
- .split-button {
98
- display: flex;
99
- cursor: pointer;
100
- border-radius: 20px;
101
- overflow: hidden;
102
- }
103
-
104
- .leading-button {
105
- background: var(--schemes-secondary-container);
106
- border-radius: 20px 4px 4px 20px;
107
- display: flex;
108
- align-items: center;
109
- height: 40px;
110
- }
111
-
112
- .state-layer {
113
- padding: 10px 16px;
114
- background-color: #dee58f;
115
- margin-right: 4px;
116
- border-radius: 8px;
117
- }
118
-
119
- .state-layer:open {
120
- color: #f5f5e0;
121
- background-color: #596300;
122
- }
123
-
124
- .label {
125
- font-size: 14px;
126
- font-weight: 500;
127
- color: var(--schemes-on-secondary-container);
128
- }
129
-
130
- .trailing-button {
131
- background: var(--secondary-container, #dee58f);
132
- padding-left: 12px;
133
- padding-right: 12px;
134
- border: none;
135
- cursor: pointer;
136
- font-size: 14px;
137
- color: var(--schemes-on-surface, #3a3a3a);
138
- font-family: "Roboto", sans-serif;
139
- border-radius: 8px;
140
- transition: background 0.2s ease;
141
- align-items: center;
142
- align-content: center;
143
- }
144
-
145
- .arrow {
146
- width: 20px;
147
- height: 20px;
148
- color: #171c1f;
149
- transition: transform 0.25s ease;
150
- }
151
-
152
- .arrow.open {
153
- transform: rotate(180deg);
154
- }
155
-
156
- .page-size-menu {
157
- background: #f5f5e0;
158
- position: absolute;
159
- min-width: 100px;
160
- border-radius: 4px;
161
- box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
162
- overflow: hidden;
163
- z-index: 999;
164
- bottom: 50px;
165
- right: 0;
166
- transform-origin: top right;
167
- }
168
-
169
- .menu-option {
170
- padding: 8px 12px;
171
- cursor: pointer;
172
- }
173
-
174
- .menu-option:hover {
175
- background: #dee58f5b;
176
- }
177
-
178
- .menu-option.active {
179
- background: #dee58f;
180
- color: #61661f;
181
- }
@@ -1,70 +0,0 @@
1
- <div class="pagination-container">
2
- <div class="pagination">
3
- <!-- Botón doble atrás -->
4
- <button class="icon-button" (click)="goToPage(1)" [disabled]="page === 1">
5
- ««
6
- </button>
7
-
8
- <!-- Botón atrás -->
9
- <button class="icon-button" (click)="goToPage(page - 1)" [disabled]="page === 1">
10
- «
11
- </button>
12
-
13
- <!-- Números de página -->
14
- <div class="pages">
15
- <button
16
- class="page-btn"
17
- *ngFor="let p of pages(); let idx = index"
18
- [class.active]="page === idx + 1"
19
- (click)="goToPage(idx + 1)"
20
- >
21
- {{ idx + 1 }}
22
- </button>
23
- </div>
24
-
25
- <!-- Botón siguiente -->
26
- <button class="icon-button" (click)="goToPage(page + 1)" [disabled]="page === totalPages()">
27
- »
28
- </button>
29
-
30
- <!-- Botón doble adelante -->
31
- <button class="icon-button" (click)="goToPage(totalPages())" [disabled]="page === totalPages()">
32
- »»
33
- </button>
34
- </div>
35
-
36
- <!-- Selector Items por página -->
37
- <div *ngIf="showPageSizeSelector">
38
- <div class="pagination-v-4">
39
- <div class="label-pagination">Items por página</div>
40
- <div class="elements-pagination">
41
- <div class="split-button" (click)="togglePageSizeMenu()">
42
- <div class="leading-button">
43
- <div class="state-layer">
44
- <div class="label">{{ pageSizeValue() }}</div>
45
- </div>
46
- </div>
47
- <div class="trailing-button">
48
- <div class="arrow" [class.open]="isOpen()">
49
- <svg class="arrow" viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2">
50
- <polyline points="6 9 12 15 18 9"></polyline>
51
- </svg>
52
- </div>
53
- </div>
54
- </div>
55
-
56
- <!-- Menú desplegable -->
57
- <div class="page-size-menu" *ngIf="showPageSizeMenu()">
58
- <div
59
- class="menu-option"
60
- *ngFor="let opt of pageSizeOptions"
61
- [class.active]="opt === pageSizeValue()"
62
- (click)="selectPageSize(opt)"
63
- >
64
- {{ opt }}
65
- </div>
66
- </div>
67
- </div>
68
- </div>
69
- </div>
70
- </div>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { Pagination } from './pagination';
4
-
5
- describe('Pagination', () => {
6
- let component: Pagination;
7
- let fixture: ComponentFixture<Pagination>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [Pagination]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(Pagination);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,56 +0,0 @@
1
- import { Component, Input, Output, EventEmitter, computed, signal } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
-
4
- @Component({
5
- selector: 'app-pagination',
6
- standalone: true,
7
- imports: [CommonModule],
8
- templateUrl: './pagination.html',
9
- styleUrls: ['./pagination.css']
10
- })
11
- export class PaginationComponent {
12
- @Input() page = 1;
13
- @Input() pageSize = 10;
14
- @Input() totalItems = 0;
15
-
16
- @Input() showPageSizeSelector = false;
17
- @Input() pageSizeOptions: number[] = [5, 10, 20, 50];
18
-
19
- @Output() pageChange = new EventEmitter<number>();
20
- @Output() pageSizeChange = new EventEmitter<number>();
21
-
22
- pageSizeValue = signal(this.pageSize);
23
- isOpen = signal(false);
24
- isDisabled = signal(false);
25
- showPageSizeMenu = signal(false);
26
-
27
- totalPages = computed(() => {
28
- const size = this.pageSizeValue();
29
- const total = this.totalItems;
30
- return size > 0 ? Math.ceil(total / size) : 1;
31
- });
32
-
33
- pages = computed(() => {
34
- const tp = this.totalPages();
35
- return Array.from({ length: tp }, (_, i) => i + 1);
36
- });
37
-
38
- selectedPageSize = computed(() => this.pageSizeValue());
39
-
40
- goToPage(p: number) {
41
- if (p < 1 || p > this.totalPages()) return;
42
- this.pageChange.emit(p);
43
- }
44
-
45
- togglePageSizeMenu() {
46
- this.isOpen.update(v => !v);
47
- this.showPageSizeMenu.update(v => !v);
48
- }
49
-
50
- selectPageSize(size: number) {
51
- this.pageSizeValue.set(size);
52
- this.pageSizeChange.emit(size);
53
- this.showPageSizeMenu.set(false);
54
- this.isOpen.set(false);
55
- }
56
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { SapenlineaComponents } from './sapenlinea-components';
4
-
5
- describe('SapenlineaComponents', () => {
6
- let component: SapenlineaComponents;
7
- let fixture: ComponentFixture<SapenlineaComponents>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [SapenlineaComponents]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(SapenlineaComponents);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,15 +0,0 @@
1
- import { Component } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'lib-sapenlinea-components',
5
- imports: [],
6
- template: `
7
- <p>
8
- sapenlinea-components works!
9
- </p>
10
- `,
11
- styles: ``,
12
- })
13
- export class SapenlineaComponents {
14
-
15
- }
package/src/public-api.ts DELETED
@@ -1,6 +0,0 @@
1
- // src/app/components/public-api.ts
2
-
3
- // Exportar el componente
4
- export * from './lib/components/my-component/my-component';
5
- export * from './lib/components/pagination/pagination';
6
-
package/tsconfig.lib.json DELETED
@@ -1,18 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "../../tsconfig.json",
5
- "compilerOptions": {
6
- "outDir": "../../out-tsc/lib",
7
- "declaration": true,
8
- "declarationMap": true,
9
- "inlineSources": true,
10
- "types": []
11
- },
12
- "include": [
13
- "src/**/*.ts"
14
- ],
15
- "exclude": [
16
- "**/*.spec.ts"
17
- ]
18
- }
@@ -1,11 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "./tsconfig.lib.json",
5
- "compilerOptions": {
6
- "declarationMap": false
7
- },
8
- "angularCompilerOptions": {
9
- "compilationMode": "partial"
10
- }
11
- }
@@ -1,15 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "../../tsconfig.json",
5
- "compilerOptions": {
6
- "outDir": "../../out-tsc/spec",
7
- "types": [
8
- "jasmine"
9
- ]
10
- },
11
- "include": [
12
- "src/**/*.d.ts",
13
- "src/**/*.spec.ts"
14
- ]
15
- }