@tacdaed/fragments 1.0.0-beta.2 → 1.0.0-beta.3
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/README.md +3 -3
- package/fesm2022/tacdaed-fragments.mjs +8928 -0
- package/fesm2022/tacdaed-fragments.mjs.map +1 -0
- package/index.d.ts +3929 -0
- package/package.json +29 -22
- package/ng-package.json +0 -25
- package/src/lib/components/accordion/accordion.component.html +0 -103
- package/src/lib/components/accordion/accordion.component.scss +0 -382
- package/src/lib/components/accordion/accordion.component.spec.ts +0 -147
- package/src/lib/components/accordion/accordion.component.ts +0 -211
- package/src/lib/components/accordion/accordion.type.ts +0 -82
- package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -43
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -112
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -33
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -103
- package/src/lib/components/breadcrumb/breadcrumb.interface.ts +0 -7
- package/src/lib/components/button/button.component.html +0 -57
- package/src/lib/components/button/button.component.scss +0 -445
- package/src/lib/components/button/button.component.spec.ts +0 -99
- package/src/lib/components/button/button.component.ts +0 -143
- package/src/lib/components/button/button.type.ts +0 -7
- package/src/lib/components/card/card.component.html +0 -44
- package/src/lib/components/card/card.component.scss +0 -114
- package/src/lib/components/card/card.component.spec.ts +0 -65
- package/src/lib/components/card/card.component.ts +0 -21
- package/src/lib/components/card/card.type.ts +0 -3
- package/src/lib/components/code-block/code-block.component.html +0 -55
- package/src/lib/components/code-block/code-block.component.scss +0 -122
- package/src/lib/components/code-block/code-block.component.spec.ts +0 -81
- package/src/lib/components/code-block/code-block.component.ts +0 -302
- package/src/lib/components/code-block/code-block.interface.ts +0 -28
- package/src/lib/components/code-block/code-block.type.ts +0 -73
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +0 -14
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +0 -20
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +0 -38
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +0 -181
- package/src/lib/components/input/input-base.ts +0 -187
- package/src/lib/components/input/input-calendar/input-calendar.component.html +0 -76
- package/src/lib/components/input/input-calendar/input-calendar.component.scss +0 -179
- package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +0 -44
- package/src/lib/components/input/input-calendar/input-calendar.component.ts +0 -299
- package/src/lib/components/input/input-checkbox/input-checkbox.component.html +0 -37
- package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +0 -128
- package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +0 -43
- package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +0 -112
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +0 -43
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +0 -140
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +0 -62
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +0 -136
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +0 -81
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +0 -228
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +0 -62
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +0 -178
- package/src/lib/components/input/input-consts.ts +0 -132
- package/src/lib/components/input/input-date/input-date-validators.ts +0 -41
- package/src/lib/components/input/input-date/input-date.component.html +0 -41
- package/src/lib/components/input/input-date/input-date.component.scss +0 -95
- package/src/lib/components/input/input-date/input-date.component.spec.ts +0 -43
- package/src/lib/components/input/input-date/input-date.component.ts +0 -359
- package/src/lib/components/input/input-date-time/input-date-time.component.html +0 -70
- package/src/lib/components/input/input-date-time/input-date-time.component.scss +0 -133
- package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +0 -36
- package/src/lib/components/input/input-date-time/input-date-time.component.ts +0 -387
- package/src/lib/components/input/input-file-upload/input-file-upload.component.html +0 -89
- package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +0 -171
- package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +0 -43
- package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +0 -351
- package/src/lib/components/input/input-interface.ts +0 -8
- package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
- package/src/lib/components/input/input-number/input-number.component.html +0 -51
- package/src/lib/components/input/input-number/input-number.component.scss +0 -140
- package/src/lib/components/input/input-number/input-number.component.spec.ts +0 -44
- package/src/lib/components/input/input-number/input-number.component.ts +0 -343
- package/src/lib/components/input/input-radio-group/input-radio-group.component.html +0 -44
- package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +0 -139
- package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +0 -58
- package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +0 -132
- package/src/lib/components/input/input-slider/input-slider.component.html +0 -111
- package/src/lib/components/input/input-slider/input-slider.component.scss +0 -203
- package/src/lib/components/input/input-slider/input-slider.component.spec.ts +0 -46
- package/src/lib/components/input/input-slider/input-slider.component.ts +0 -410
- package/src/lib/components/input/input-text/input-text-validators.ts +0 -67
- package/src/lib/components/input/input-text/input-text.component.html +0 -71
- package/src/lib/components/input/input-text/input-text.component.scss +0 -118
- package/src/lib/components/input/input-text/input-text.component.spec.ts +0 -55
- package/src/lib/components/input/input-text/input-text.component.ts +0 -215
- package/src/lib/components/input/input-time/input-time-validators.ts +0 -42
- package/src/lib/components/input/input-time/input-time.component.html +0 -92
- package/src/lib/components/input/input-time/input-time.component.scss +0 -191
- package/src/lib/components/input/input-time/input-time.component.spec.ts +0 -39
- package/src/lib/components/input/input-time/input-time.component.ts +0 -691
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +0 -36
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +0 -121
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +0 -54
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +0 -117
- package/src/lib/components/input/input-type.ts +0 -18
- package/src/lib/components/input/input-validation/input-validation.component.html +0 -19
- package/src/lib/components/input/input-validation/input-validation.component.scss +0 -39
- package/src/lib/components/input/input-validation/input-validation.component.spec.ts +0 -45
- package/src/lib/components/input/input-validation/input-validation.component.ts +0 -13
- package/src/lib/components/input/input.pipe.ts +0 -14
- package/src/lib/components/layout/container/container.component.html +0 -1
- package/src/lib/components/layout/container/container.component.scss +0 -33
- package/src/lib/components/layout/container/container.component.ts +0 -32
- package/src/lib/components/layout/container/container.type.ts +0 -1
- package/src/lib/components/layout/divider/divider.component.html +0 -1
- package/src/lib/components/layout/divider/divider.component.scss +0 -60
- package/src/lib/components/layout/divider/divider.component.ts +0 -38
- package/src/lib/components/layout/divider/divider.type.ts +0 -2
- package/src/lib/components/layout/section/section.component.html +0 -21
- package/src/lib/components/layout/section/section.component.scss +0 -43
- package/src/lib/components/layout/section/section.component.ts +0 -33
- package/src/lib/components/layout/section/section.type.ts +0 -2
- package/src/lib/components/layout/separator/separator.component.html +0 -9
- package/src/lib/components/layout/separator/separator.component.scss +0 -52
- package/src/lib/components/layout/separator/separator.component.ts +0 -25
- package/src/lib/components/layout/separator/separator.type.ts +0 -1
- package/src/lib/components/loader/content-blur/content-blur.component.html +0 -13
- package/src/lib/components/loader/content-blur/content-blur.component.scss +0 -43
- package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +0 -42
- package/src/lib/components/loader/content-blur/content-blur.component.ts +0 -34
- package/src/lib/components/loader/loader.type.ts +0 -2
- package/src/lib/components/loader/progress-bar/progress-bar.component.html +0 -26
- package/src/lib/components/loader/progress-bar/progress-bar.component.scss +0 -151
- package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +0 -47
- package/src/lib/components/loader/progress-bar/progress-bar.component.ts +0 -28
- package/src/lib/components/loader/progress-bar/progress-bar.type.ts +0 -8
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +0 -12
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +0 -202
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +0 -55
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +0 -73
- package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +0 -6
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +0 -13
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +0 -113
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +0 -37
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +0 -51
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +0 -6
- package/src/lib/components/loader/spinner/spinner.component.html +0 -20
- package/src/lib/components/loader/spinner/spinner.component.scss +0 -137
- package/src/lib/components/loader/spinner/spinner.component.spec.ts +0 -43
- package/src/lib/components/loader/spinner/spinner.component.ts +0 -32
- package/src/lib/components/loader/spinner/spinner.type.ts +0 -6
- package/src/lib/components/modal/modal.component.html +0 -47
- package/src/lib/components/modal/modal.component.scss +0 -139
- package/src/lib/components/modal/modal.component.spec.ts +0 -60
- package/src/lib/components/modal/modal.component.ts +0 -83
- package/src/lib/components/modal/modal.type.ts +0 -9
- package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +0 -79
- package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +0 -96
- package/src/lib/components/morph/blob-moph/blob-morph.component.html +0 -34
- package/src/lib/components/morph/blob-moph/blob-morph.component.scss +0 -7
- package/src/lib/components/morph/morph.abstract.ts +0 -13
- package/src/lib/components/pagination/pagination.interface.ts +0 -4
- package/src/lib/components/pagination/small-pagination/small-pagination.component.html +0 -61
- package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +0 -187
- package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +0 -88
- package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +0 -177
- package/src/lib/components/selection-lists/multi-select/multi-select.component.html +0 -170
- package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +0 -312
- package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +0 -61
- package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +0 -372
- package/src/lib/components/selection-lists/selection-list/selection-list.component.html +0 -125
- package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +0 -267
- package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +0 -66
- package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +0 -315
- package/src/lib/components/selection-lists/selection-lists-base.ts +0 -35
- package/src/lib/components/selection-lists/selection-lists-const.ts +0 -17
- package/src/lib/components/selection-lists/selection-lists-interface.ts +0 -7
- package/src/lib/components/selection-lists/selection-lists.type.ts +0 -1
- package/src/lib/components/side-nav/side-nav.component.html +0 -101
- package/src/lib/components/side-nav/side-nav.component.scss +0 -295
- package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
- package/src/lib/components/side-nav/side-nav.component.ts +0 -18
- package/src/lib/components/side-nav/side-nav.type.ts +0 -28
- package/src/lib/components/snackbar/snackbar.component.html +0 -33
- package/src/lib/components/snackbar/snackbar.component.scss +0 -195
- package/src/lib/components/snackbar/snackbar.component.ts +0 -112
- package/src/lib/components/snackbar/snackbar.type.ts +0 -27
- package/src/lib/components/status/chip/chip.component.html +0 -51
- package/src/lib/components/status/chip/chip.component.scss +0 -149
- package/src/lib/components/status/chip/chip.component.spec.ts +0 -62
- package/src/lib/components/status/chip/chip.component.ts +0 -83
- package/src/lib/components/status/chip/chip.type.ts +0 -42
- package/src/lib/components/status/directives/badge/badge.directive.spec.ts +0 -60
- package/src/lib/components/status/directives/badge/badge.directive.ts +0 -190
- package/src/lib/components/status/directives/badge/badge.interface.ts +0 -19
- package/src/lib/components/status/pill/pill.component.html +0 -40
- package/src/lib/components/status/pill/pill.component.scss +0 -113
- package/src/lib/components/status/pill/pill.component.spec.ts +0 -47
- package/src/lib/components/status/pill/pill.component.ts +0 -83
- package/src/lib/components/status/pill/pill.type.ts +0 -42
- package/src/lib/components/status/status.interface.ts +0 -57
- package/src/lib/components/status/status.type.ts +0 -62
- package/src/lib/components/status/tag/tag.component.html +0 -39
- package/src/lib/components/status/tag/tag.component.scss +0 -140
- package/src/lib/components/status/tag/tag.component.spec.ts +0 -47
- package/src/lib/components/status/tag/tag.component.ts +0 -83
- package/src/lib/components/status/tag/tag.type.ts +0 -42
- package/src/lib/components/stepper/stepper.component.html +0 -83
- package/src/lib/components/stepper/stepper.component.scss +0 -196
- package/src/lib/components/stepper/stepper.component.ts +0 -482
- package/src/lib/components/stepper/stepper.type.ts +0 -60
- package/src/lib/components/table/table.component.html +0 -438
- package/src/lib/components/table/table.component.scss +0 -259
- package/src/lib/components/table/table.component.spec.ts +0 -117
- package/src/lib/components/table/table.component.ts +0 -215
- package/src/lib/components/table/table.enum.ts +0 -4
- package/src/lib/components/table/table.function.ts +0 -47
- package/src/lib/components/table/table.interface.ts +0 -143
- package/src/lib/components/table/table.pipe.ts +0 -62
- package/src/lib/components/table/table.type.ts +0 -15
- package/src/lib/components/tabs/tabs.component.html +0 -88
- package/src/lib/components/tabs/tabs.component.scss +0 -305
- package/src/lib/components/tabs/tabs.component.spec.ts +0 -94
- package/src/lib/components/tabs/tabs.component.ts +0 -282
- package/src/lib/components/tabs/tabs.type.ts +0 -81
- package/src/lib/components/title-bar/title-bar.component.html +0 -21
- package/src/lib/components/title-bar/title-bar.component.scss +0 -139
- package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -44
- package/src/lib/components/title-bar/title-bar.component.ts +0 -13
- package/src/lib/components/toast/toast.component.html +0 -36
- package/src/lib/components/toast/toast.component.scss +0 -241
- package/src/lib/components/toast/toast.component.ts +0 -165
- package/src/lib/components/toast/toast.type.ts +0 -37
- package/src/lib/components/toast-stack/toast-stack.component.html +0 -30
- package/src/lib/components/toast-stack/toast-stack.component.scss +0 -35
- package/src/lib/components/toast-stack/toast-stack.component.ts +0 -51
- package/src/lib/consts/country-prefix.ts +0 -244
- package/src/lib/directives/tooltip/popover.directive.ts +0 -274
- package/src/lib/directives/tooltip/tooltip.directive.spec.ts +0 -86
- package/src/lib/directives/tooltip/tooltip.directive.ts +0 -234
- package/src/lib/directives/tooltip/tooltip.interface.ts +0 -29
- package/src/lib/directives/tooltip/tooltip.type.ts +0 -9
- package/src/lib/interfaces/common.interfaces.ts +0 -4
- package/src/lib/pipes/chunk.pipe.ts +0 -16
- package/src/lib/pipes/safe-html.pipe.ts +0 -14
- package/src/lib/pipes/sanitize-html.pipe.ts +0 -23
- package/src/lib/types/base.types.ts +0 -23
- package/src/lib/types/common.types.ts +0 -98
- package/src/lib/types/form.types.ts +0 -5
- package/src/lib/utils/common.utils.ts +0 -53
- package/src/lib/utils/date.utils.ts +0 -474
- package/src/lib/utils/number.utils.ts +0 -16
- package/src/lib/utils/uuid.utils.ts +0 -39
- package/src/public-api.ts +0 -114
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -9
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AfterViewInit,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
Input,
|
|
7
|
-
Output,
|
|
8
|
-
ViewChild,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { animate, svg } from 'animejs';
|
|
11
|
-
import { MorphBase } from '../morph.abstract';
|
|
12
|
-
import { SpinnerComponent } from '../../loader/spinner/spinner.component';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'app-blob-morph',
|
|
16
|
-
templateUrl: './blob-morph.component.html',
|
|
17
|
-
imports: [SpinnerComponent],
|
|
18
|
-
styleUrls: ['./blob-morph.component.scss'],
|
|
19
|
-
})
|
|
20
|
-
export class BlobMorphComponent extends MorphBase implements AfterViewInit {
|
|
21
|
-
@Input() override imageUrl: string | null = null;
|
|
22
|
-
@Input() override fillColor: string | null = null;
|
|
23
|
-
@Input() override pathStart: string = this.generateRandomPath();
|
|
24
|
-
@Input() override pathEnd: string = this.generateRandomPath();
|
|
25
|
-
@Input() override duration: number = 4000;
|
|
26
|
-
|
|
27
|
-
@Output() loadEvent: EventEmitter<void> = new EventEmitter<void>();
|
|
28
|
-
|
|
29
|
-
@ViewChild('morphPath', { static: false })
|
|
30
|
-
morphPathRef!: ElementRef<SVGPathElement>;
|
|
31
|
-
clipId = `clip-${Math.random().toString(36).substring(2, 10)}`;
|
|
32
|
-
|
|
33
|
-
protected isLoaded: boolean = false;
|
|
34
|
-
|
|
35
|
-
ngAfterViewInit(): void {
|
|
36
|
-
const startPath = this.morphPathRef.nativeElement;
|
|
37
|
-
const endPath = document.getElementById(
|
|
38
|
-
`morph-path-end-${this.clipId}`
|
|
39
|
-
) as SVGPathElement | null;
|
|
40
|
-
|
|
41
|
-
if (startPath && endPath) {
|
|
42
|
-
animate(startPath, {
|
|
43
|
-
d: svg.morphTo(endPath),
|
|
44
|
-
direction: 'alternate-reverse',
|
|
45
|
-
duration: this.duration,
|
|
46
|
-
ease: 'inOut',
|
|
47
|
-
loop: true,
|
|
48
|
-
alternate: true,
|
|
49
|
-
});
|
|
50
|
-
} else {
|
|
51
|
-
console.error('Path elements not found');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
protected override generateRandomPath(
|
|
56
|
-
points = 8,
|
|
57
|
-
radius = 60,
|
|
58
|
-
variability = 20
|
|
59
|
-
): string {
|
|
60
|
-
const angleStep = (Math.PI * 2) / points;
|
|
61
|
-
const coords: { x: number; y: number }[] = [];
|
|
62
|
-
|
|
63
|
-
for (let i = 0; i < points; i++) {
|
|
64
|
-
const angle = i * angleStep;
|
|
65
|
-
const randRadius = radius + (Math.random() - 0.5) * 2 * variability;
|
|
66
|
-
const x = Math.cos(angle) * randRadius;
|
|
67
|
-
const y = Math.sin(angle) * randRadius;
|
|
68
|
-
coords.push({ x, y });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
let path = `M${coords[0].x.toFixed(1)},${coords[0].y.toFixed(1)}`;
|
|
72
|
-
|
|
73
|
-
for (let i = 0; i < coords.length; i++) {
|
|
74
|
-
const p0 = coords[i];
|
|
75
|
-
const p1 = coords[(i + 1) % coords.length];
|
|
76
|
-
const pPrev = coords[(i - 1 + coords.length) % coords.length];
|
|
77
|
-
const pNext = coords[(i + 2) % coords.length];
|
|
78
|
-
|
|
79
|
-
const control1X = p0.x + (p1.x - pPrev.x) * 0.2;
|
|
80
|
-
const control1Y = p0.y + (p1.y - pPrev.y) * 0.2;
|
|
81
|
-
|
|
82
|
-
const control2X = p1.x - (pNext.x - p0.x) * 0.2;
|
|
83
|
-
const control2Y = p1.y - (pNext.y - p0.y) * 0.2;
|
|
84
|
-
|
|
85
|
-
path += ` C${control1X.toFixed(1)},${control1Y.toFixed(1)} ${control2X.toFixed(1)},${control2Y.toFixed(1)} ${p1.x.toFixed(1)},${p1.y.toFixed(1)}`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
path += ' Z';
|
|
89
|
-
return path;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
onLoadEvent(): void {
|
|
93
|
-
this.isLoaded = true;
|
|
94
|
-
this.loadEvent.emit();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<div class="blob-container">
|
|
2
|
-
<svg
|
|
3
|
-
viewBox="0 0 200 200"
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
class="blob-svg"
|
|
6
|
-
[class.hidden]="!isLoaded"
|
|
7
|
-
>
|
|
8
|
-
<defs>
|
|
9
|
-
<clipPath [attr.id]="clipId" transform="translate(100 100)">
|
|
10
|
-
<path #morphPath [attr.d]="pathStart" />
|
|
11
|
-
</clipPath>
|
|
12
|
-
<path [attr.id]="'morph-path-end-' + clipId" [attr.d]="pathEnd" />
|
|
13
|
-
</defs>
|
|
14
|
-
|
|
15
|
-
@if (imageUrl) {
|
|
16
|
-
<image
|
|
17
|
-
[attr.href]="imageUrl"
|
|
18
|
-
width="100%"
|
|
19
|
-
height="100%"
|
|
20
|
-
preserveAspectRatio="xMidYMid slice"
|
|
21
|
-
[attr.clip-path]="'url(#' + clipId + ')'"
|
|
22
|
-
(load)="onLoadEvent()"
|
|
23
|
-
/>
|
|
24
|
-
} @else {
|
|
25
|
-
<g [attr.clip-path]="'url(#' + clipId + ')'">
|
|
26
|
-
<rect width="100%" height="100%" [attr.fill]="fillColor || '#ccc'" />
|
|
27
|
-
</g>
|
|
28
|
-
}
|
|
29
|
-
</svg>
|
|
30
|
-
|
|
31
|
-
@if (!isLoaded) {
|
|
32
|
-
<frg-spinner [isOverlayItem]="true"></frg-spinner>
|
|
33
|
-
}
|
|
34
|
-
</div>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export abstract class MorphBase {
|
|
2
|
-
protected imageUrl: string | null = null;
|
|
3
|
-
protected fillColor: string | null = null;
|
|
4
|
-
protected pathStart: string = '';
|
|
5
|
-
protected pathEnd: string = '';
|
|
6
|
-
protected duration: number = 4000;
|
|
7
|
-
|
|
8
|
-
protected abstract generateRandomPath(
|
|
9
|
-
points: number,
|
|
10
|
-
radius: number,
|
|
11
|
-
variability: number
|
|
12
|
-
): string;
|
|
13
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
@if (totalItems > pageSize) {
|
|
2
|
-
<nav
|
|
3
|
-
class="frg-pagination-small"
|
|
4
|
-
aria-label="Paginazione nome lista"
|
|
5
|
-
[ngClass]="{
|
|
6
|
-
'frg-pagination-small__primary': styleType === 'primary',
|
|
7
|
-
'frg-pagination-small__secondary': styleType === 'secondary',
|
|
8
|
-
'frg-pagination-small__tertiary': styleType === 'tertiary',
|
|
9
|
-
'frg-pagination-small__dark': styleType === 'dark',
|
|
10
|
-
'frg-pagination-small__light': styleType === 'light'
|
|
11
|
-
}"
|
|
12
|
-
>
|
|
13
|
-
<ul class="frg-pagination-small__list">
|
|
14
|
-
<li class="frg-pagination-small__paging frg-pagination-small__prev">
|
|
15
|
-
<a
|
|
16
|
-
href="javascript:void(0);"
|
|
17
|
-
[class.disabled]="page === 1"
|
|
18
|
-
(click)="changePage(page - 1)"
|
|
19
|
-
>
|
|
20
|
-
<span class="visually-hidden">Pagina precedente</span>
|
|
21
|
-
<span class="fas fa-angle-left" aria-hidden="true"></span>
|
|
22
|
-
</a>
|
|
23
|
-
</li>
|
|
24
|
-
@for (pageNum of pagesArray; track pageNum; let i = $index) {
|
|
25
|
-
@if (showStartEllipsis && i === 1) {
|
|
26
|
-
<li class="frg-pagination-small__paging frg-pagination-small__ellipsis">
|
|
27
|
-
<span class="ellipsis">...</span>
|
|
28
|
-
</li>
|
|
29
|
-
}
|
|
30
|
-
<li
|
|
31
|
-
class="frg-pagination-small__paging frg-pagination-small__page-number"
|
|
32
|
-
>
|
|
33
|
-
<a
|
|
34
|
-
href="javascript:void(0);"
|
|
35
|
-
[attr.aria-current]="page === pageNum ? 'page' : null"
|
|
36
|
-
(click)="changePage(pageNum)"
|
|
37
|
-
>
|
|
38
|
-
<span class="visually-hidden">Pagina</span>
|
|
39
|
-
{{ pageNum }}
|
|
40
|
-
</a>
|
|
41
|
-
</li>
|
|
42
|
-
@if (showEndEllipsis && i === pagesArray.length - 2) {
|
|
43
|
-
<li class="frg-pagination-small__paging frg-pagination-small__ellipsis">
|
|
44
|
-
<span class="ellipsis">...</span>
|
|
45
|
-
</li>
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
<li class="frg-pagination-small__paging frg-pagination-small__next">
|
|
50
|
-
<a
|
|
51
|
-
href="javascript:void(0);"
|
|
52
|
-
[class.disabled]="page === totalPages"
|
|
53
|
-
(click)="changePage(page + 1)"
|
|
54
|
-
>
|
|
55
|
-
<span class="visually-hidden">Pagina successiva</span>
|
|
56
|
-
<span class="fas fa-angle-right" aria-hidden="true"></span>
|
|
57
|
-
</a>
|
|
58
|
-
</li>
|
|
59
|
-
</ul>
|
|
60
|
-
</nav>
|
|
61
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
@use "sass:color";
|
|
2
|
-
@use './../../../../../assets/styles/scss/variables' as *;
|
|
3
|
-
|
|
4
|
-
.frg-pagination-small {
|
|
5
|
-
display: flex;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
align-items: center;
|
|
8
|
-
margin: 12px 0;
|
|
9
|
-
gap: 0.2rem;
|
|
10
|
-
|
|
11
|
-
&__list {
|
|
12
|
-
list-style: none;
|
|
13
|
-
padding: 0;
|
|
14
|
-
margin: 0;
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
align-items: center;
|
|
18
|
-
|
|
19
|
-
li:first-child {
|
|
20
|
-
margin-right: 0.5rem;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
li:last-child {
|
|
24
|
-
margin-left: 0.5rem;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
& a {
|
|
29
|
-
display: flex;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
align-items: center;
|
|
32
|
-
border-radius: 999px;
|
|
33
|
-
min-width: 1.9rem;
|
|
34
|
-
height: 1.9rem;
|
|
35
|
-
font-weight: 500;
|
|
36
|
-
border: 1px solid transparent;
|
|
37
|
-
text-decoration: none;
|
|
38
|
-
text-align: center;
|
|
39
|
-
transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
background-color: transparent;
|
|
42
|
-
color: $color-dark-soft;
|
|
43
|
-
|
|
44
|
-
&.disabled {
|
|
45
|
-
cursor: default;
|
|
46
|
-
color: $color-disabled;
|
|
47
|
-
background-color: transparent;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&:focus-visible {
|
|
51
|
-
outline: 2px solid color.scale($color-primary, $lightness: 35%);
|
|
52
|
-
outline-offset: 2px;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&__primary {
|
|
57
|
-
a {
|
|
58
|
-
margin: 0 2px;
|
|
59
|
-
|
|
60
|
-
&[aria-current='page'] {
|
|
61
|
-
background-color: $color-primary;
|
|
62
|
-
color: $color-light;
|
|
63
|
-
border-color: transparent;
|
|
64
|
-
pointer-events: none;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&:hover:not([aria-current='page']) {
|
|
68
|
-
background-color: color.scale($color-primary, $lightness: 40%);
|
|
69
|
-
color: $color-light;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&.disabled {
|
|
73
|
-
&:hover {
|
|
74
|
-
background-color: #f1f2f5;
|
|
75
|
-
color: $color-disabled;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&__secondary {
|
|
82
|
-
a {
|
|
83
|
-
margin: 0 2px;
|
|
84
|
-
|
|
85
|
-
&[aria-current='page'] {
|
|
86
|
-
background-color: $color-secondary;
|
|
87
|
-
color: $color-light;
|
|
88
|
-
border-color: transparent;
|
|
89
|
-
pointer-events: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&:hover:not([aria-current='page']) {
|
|
93
|
-
background-color: color.scale($color-secondary, $lightness: 40%);
|
|
94
|
-
color: $color-light;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&.disabled {
|
|
98
|
-
&:hover {
|
|
99
|
-
background-color: #f1f2f5;
|
|
100
|
-
color: $color-disabled;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&__tertiary {
|
|
107
|
-
a {
|
|
108
|
-
margin: 0 2px;
|
|
109
|
-
|
|
110
|
-
&[aria-current='page'] {
|
|
111
|
-
background-color: $color-tertiary;
|
|
112
|
-
color: $color-light;
|
|
113
|
-
border-color: transparent;
|
|
114
|
-
pointer-events: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&:hover:not([aria-current='page']) {
|
|
118
|
-
background-color: color.scale($color-tertiary, $lightness: 40%);
|
|
119
|
-
color: $color-light;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&.disabled {
|
|
123
|
-
&:hover {
|
|
124
|
-
background-color: #f1f2f5;
|
|
125
|
-
color: $color-disabled;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&__dark {
|
|
132
|
-
a {
|
|
133
|
-
margin: 0 2px;
|
|
134
|
-
background-color: $color-light;
|
|
135
|
-
border: 1px solid rgba($color-light, 0.12);
|
|
136
|
-
color: $color-dark-soft;
|
|
137
|
-
|
|
138
|
-
&[aria-current='page'] {
|
|
139
|
-
background-color: rgba($color-dark, 0.9);
|
|
140
|
-
border-color: rgba($color-dark, 0.85);
|
|
141
|
-
color: $color-light-soft;
|
|
142
|
-
pointer-events: none;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&:hover:not([aria-current='page']) {
|
|
146
|
-
background-color: color.scale($color-dark-neutral, $lightness: 45%);
|
|
147
|
-
color: $color-light;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
&.disabled {
|
|
151
|
-
border-color: rgba($color-light, 0.08);
|
|
152
|
-
color: $color-disabled;
|
|
153
|
-
|
|
154
|
-
&:hover {
|
|
155
|
-
background-color: $color-dark-neutral;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
&__light {
|
|
162
|
-
a {
|
|
163
|
-
margin: 0 2px;
|
|
164
|
-
color: $color-light-neutral;
|
|
165
|
-
|
|
166
|
-
&[aria-current='page'] {
|
|
167
|
-
background-color: $color-light;
|
|
168
|
-
color: $color-dark-neutral;
|
|
169
|
-
pointer-events: none;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
&:hover:not([aria-current='page']) {
|
|
173
|
-
background-color: $color-light-soft;
|
|
174
|
-
color: $color-dark-neutral;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&.disabled {
|
|
178
|
-
color: $color-dark-soft;
|
|
179
|
-
&:hover {
|
|
180
|
-
background-color: transparent;
|
|
181
|
-
color: $color-dark-soft;
|
|
182
|
-
pointer-events: none;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { By } from '@angular/platform-browser';
|
|
3
|
-
import { SmallPaginationComponent } from './small-pagination.component';
|
|
4
|
-
import { IPaginationOutput } from '../pagination.interface';
|
|
5
|
-
|
|
6
|
-
type DemoItem = { id: number };
|
|
7
|
-
|
|
8
|
-
describe('SmallPaginationComponent', () => {
|
|
9
|
-
let fixture: ComponentFixture<SmallPaginationComponent<DemoItem>>;
|
|
10
|
-
let component: SmallPaginationComponent<DemoItem>;
|
|
11
|
-
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
await TestBed.configureTestingModule({
|
|
14
|
-
imports: [SmallPaginationComponent]
|
|
15
|
-
}).compileComponents();
|
|
16
|
-
|
|
17
|
-
fixture = TestBed.createComponent(SmallPaginationComponent<DemoItem>);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('builds simple pages when ellipsis disabled', () => {
|
|
22
|
-
component.totalItems = 20;
|
|
23
|
-
component.pageSize = 5;
|
|
24
|
-
component.fullData = Array.from({ length: 20 }, (_, i) => ({ id: i + 1 }));
|
|
25
|
-
component.hasElipsisPages = false;
|
|
26
|
-
|
|
27
|
-
fixture.detectChanges();
|
|
28
|
-
|
|
29
|
-
expect(component.pagesArray).toEqual([1, 2, 3, 4]);
|
|
30
|
-
expect(component.showStartEllipsis).toBeFalse();
|
|
31
|
-
expect(component.showEndEllipsis).toBeFalse();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('builds ellipsis pages for large datasets', () => {
|
|
35
|
-
component.totalItems = 48;
|
|
36
|
-
component.pageSize = 4;
|
|
37
|
-
component.fullData = Array.from({ length: 48 }, (_, i) => ({ id: i + 1 }));
|
|
38
|
-
component.page = 3;
|
|
39
|
-
component.hasElipsisPages = true;
|
|
40
|
-
|
|
41
|
-
fixture.detectChanges();
|
|
42
|
-
|
|
43
|
-
expect(component.pagesArray).toEqual([1, 2, 3, 4, 12]);
|
|
44
|
-
expect(component.showStartEllipsis).toBeFalse();
|
|
45
|
-
expect(component.showEndEllipsis).toBeTrue();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('emits pageChange with paged data', () => {
|
|
49
|
-
const emitSpy = spyOn(component.pageChange, 'emit');
|
|
50
|
-
|
|
51
|
-
component.totalItems = 10;
|
|
52
|
-
component.pageSize = 2;
|
|
53
|
-
component.fullData = Array.from({ length: 10 }, (_, i) => ({ id: i + 1 }));
|
|
54
|
-
|
|
55
|
-
fixture.detectChanges();
|
|
56
|
-
|
|
57
|
-
component.changePage(2);
|
|
58
|
-
|
|
59
|
-
const expected: IPaginationOutput<DemoItem> = {
|
|
60
|
-
page: 2,
|
|
61
|
-
pagedData: [{ id: 3 }, { id: 4 }]
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
expect(emitSpy).toHaveBeenCalledWith(expected);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('clamps page to 1 on init', () => {
|
|
68
|
-
component.totalItems = 5;
|
|
69
|
-
component.pageSize = 5;
|
|
70
|
-
component.fullData = [{ id: 1 }];
|
|
71
|
-
component.page = 0;
|
|
72
|
-
|
|
73
|
-
fixture.detectChanges();
|
|
74
|
-
|
|
75
|
-
expect(component.page).toBe(1);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('does not render pagination when only one page', () => {
|
|
79
|
-
component.totalItems = 4;
|
|
80
|
-
component.pageSize = 4;
|
|
81
|
-
component.fullData = Array.from({ length: 4 }, (_, i) => ({ id: i + 1 }));
|
|
82
|
-
|
|
83
|
-
fixture.detectChanges();
|
|
84
|
-
|
|
85
|
-
const nav = fixture.debugElement.query(By.css('nav'));
|
|
86
|
-
expect(nav).toBeNull();
|
|
87
|
-
});
|
|
88
|
-
});
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
Component,
|
|
4
|
-
EventEmitter,
|
|
5
|
-
Input,
|
|
6
|
-
OnChanges,
|
|
7
|
-
OnInit,
|
|
8
|
-
Output,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { TBaseStyle } from '../../../types/base.types';
|
|
11
|
-
import { IPaginationOutput } from '../pagination.interface';
|
|
12
|
-
|
|
13
|
-
@Component({
|
|
14
|
-
selector: 'frg-small-pagination',
|
|
15
|
-
imports: [CommonModule],
|
|
16
|
-
templateUrl: './small-pagination.component.html',
|
|
17
|
-
styleUrls: ['./small-pagination.component.scss']
|
|
18
|
-
})
|
|
19
|
-
export class SmallPaginationComponent<T> implements OnInit, OnChanges {
|
|
20
|
-
@Input() totalItems = 0;
|
|
21
|
-
@Input() fullData = [] as T[];
|
|
22
|
-
@Input() page = 0;
|
|
23
|
-
@Input() pageSize = 0;
|
|
24
|
-
@Input() hasElipsisPages = false;
|
|
25
|
-
@Input() styleType: TBaseStyle = 'primary';
|
|
26
|
-
|
|
27
|
-
@Output() pageChange = new EventEmitter<IPaginationOutput<T>>();
|
|
28
|
-
|
|
29
|
-
pagesArray: number[] = [];
|
|
30
|
-
pagedData: T[] = [];
|
|
31
|
-
totalPages = 0;
|
|
32
|
-
showStartEllipsis = false;
|
|
33
|
-
showEndEllipsis = false;
|
|
34
|
-
maxVisiblePages = 4;
|
|
35
|
-
|
|
36
|
-
ngOnInit() {
|
|
37
|
-
this.calculateTotalPages();
|
|
38
|
-
this.setCurrentPage();
|
|
39
|
-
this.generatePagesArray();
|
|
40
|
-
this.changePage(this.page);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
ngOnChanges() {
|
|
44
|
-
this.calculateTotalPages();
|
|
45
|
-
this.setCurrentPage();
|
|
46
|
-
this.generatePagesArray();
|
|
47
|
-
this.changePage(this.page);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private calculateTotalPages() {
|
|
51
|
-
this.totalPages = Math.ceil(this.totalItems / this.pageSize);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private generatePagesArray() {
|
|
55
|
-
this.pagesArray = [];
|
|
56
|
-
|
|
57
|
-
if (this.totalPages <= 0) {
|
|
58
|
-
this.resetEllipsis();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const currentPage = this.clampPage(this.page);
|
|
63
|
-
|
|
64
|
-
if (!this.hasElipsisPages || this.isSimplePagination()) {
|
|
65
|
-
this.buildSimplePages();
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
this.buildEllipsisPages(currentPage);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private buildSimplePages() {
|
|
73
|
-
this.pagesArray = this.range(1, this.totalPages);
|
|
74
|
-
this.resetEllipsis();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private buildEllipsisPages(currentPage: number) {
|
|
78
|
-
const startPage = 1;
|
|
79
|
-
const endPage = this.totalPages;
|
|
80
|
-
const visibleMiddle = this.getVisibleMiddleCount();
|
|
81
|
-
|
|
82
|
-
if (visibleMiddle === 0) {
|
|
83
|
-
this.pagesArray = endPage === 1 ? [startPage] : [startPage, endPage];
|
|
84
|
-
this.showStartEllipsis = currentPage > startPage + 1;
|
|
85
|
-
this.showEndEllipsis = currentPage < endPage - 1;
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const { middleStart, middleEnd } = this.getMiddleRange(
|
|
90
|
-
currentPage,
|
|
91
|
-
visibleMiddle,
|
|
92
|
-
startPage,
|
|
93
|
-
endPage
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
const pagesToAdd = [
|
|
97
|
-
startPage,
|
|
98
|
-
...this.range(middleStart, middleEnd),
|
|
99
|
-
endPage,
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
this.pagesArray = this.uniquePages(pagesToAdd);
|
|
103
|
-
this.showStartEllipsis = middleStart > startPage + 1;
|
|
104
|
-
this.showEndEllipsis = middleEnd < endPage - 1;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private getVisibleMiddleCount(): number {
|
|
108
|
-
return Math.max(this.maxVisiblePages - 1, 0);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
private getMiddleRange(
|
|
112
|
-
currentPage: number,
|
|
113
|
-
visibleMiddle: number,
|
|
114
|
-
startPage: number,
|
|
115
|
-
endPage: number
|
|
116
|
-
): { middleStart: number; middleEnd: number } {
|
|
117
|
-
let middleStart = currentPage - Math.floor(visibleMiddle / 2);
|
|
118
|
-
let middleEnd = middleStart + visibleMiddle - 1;
|
|
119
|
-
|
|
120
|
-
if (middleStart < startPage + 1) {
|
|
121
|
-
middleStart = startPage + 1;
|
|
122
|
-
middleEnd = middleStart + visibleMiddle - 1;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (middleEnd > endPage - 1) {
|
|
126
|
-
middleEnd = endPage - 1;
|
|
127
|
-
middleStart = Math.max(startPage + 1, middleEnd - visibleMiddle + 1);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return { middleStart, middleEnd };
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
private uniquePages(pages: number[]): number[] {
|
|
134
|
-
return pages.filter((value, index, array) => array.indexOf(value) === index);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
private resetEllipsis() {
|
|
138
|
-
this.showStartEllipsis = false;
|
|
139
|
-
this.showEndEllipsis = false;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private clampPage(page: number): number {
|
|
143
|
-
return Math.min(Math.max(page, 1), this.totalPages);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
changePage(newPage: number) {
|
|
147
|
-
if (newPage >= 1 && newPage <= this.totalPages) {
|
|
148
|
-
this.page = newPage;
|
|
149
|
-
const startIndex = (this.page - 1) * this.pageSize;
|
|
150
|
-
const endIndex = startIndex + this.pageSize;
|
|
151
|
-
const pagedData = this.fullData.slice(startIndex, endIndex);
|
|
152
|
-
this.pagedData = pagedData;
|
|
153
|
-
this.pageChange.emit({
|
|
154
|
-
page: this.page,
|
|
155
|
-
pagedData: this.pagedData,
|
|
156
|
-
});
|
|
157
|
-
this.generatePagesArray();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
setCurrentPage() {
|
|
162
|
-
this.page = Math.max(this.page, 1);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
private isSimplePagination(): boolean {
|
|
166
|
-
return (
|
|
167
|
-
!!this.maxVisiblePages &&
|
|
168
|
-
(this.totalPages <= this.maxVisiblePages || this.maxVisiblePages <= 2)
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
private range(start: number, end: number): number[] {
|
|
173
|
-
const result = [];
|
|
174
|
-
for (let i = start; i <= end; i++) result.push(i);
|
|
175
|
-
return result;
|
|
176
|
-
}
|
|
177
|
-
}
|