platformcommons-web-lib 1.0.0
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/commons-shared-web-ui-1.0.0.tgz +0 -0
- package/documentation/alert.md +123 -0
- package/documentation/button-dropdown.md +126 -0
- package/documentation/button.md +184 -0
- package/documentation/cards-usage-guidelines.md +131 -0
- package/documentation/configurable-form.md +605 -0
- package/documentation/confirmation-modal.md +250 -0
- package/documentation/filter-sidebar.md +178 -0
- package/documentation/filter-table-selector.md +228 -0
- package/documentation/form-builder.md +597 -0
- package/documentation/form-components.md +384 -0
- package/documentation/nav.md +427 -0
- package/documentation/pagination.md +181 -0
- package/documentation/side-nav-documentation.md +169 -0
- package/documentation/smart-form.md +2177 -0
- package/documentation/smart-table.md +1198 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/ng-package.json +28 -0
- package/package.json +54 -0
- package/src/lib/modules/alert/alert.models.ts +6 -0
- package/src/lib/modules/alert/alert.module.ts +16 -0
- package/src/lib/modules/alert/alert.theme.scss +85 -0
- package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
- package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
- package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
- package/src/lib/modules/button/button.models.ts +13 -0
- package/src/lib/modules/button/button.module.ts +16 -0
- package/src/lib/modules/button/button.theme.scss +121 -0
- package/src/lib/modules/button/components/button/button.component.html +22 -0
- package/src/lib/modules/button/components/button/button.component.scss +88 -0
- package/src/lib/modules/button/components/button/button.component.ts +67 -0
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
- package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
- package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
- package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
- package/src/lib/modules/configurable-form/configurable-form.theme.scss +78 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.theme.scss +87 -0
- package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
- package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
- package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
- package/src/lib/modules/filter/filter.models.ts +88 -0
- package/src/lib/modules/filter/filter.module.ts +24 -0
- package/src/lib/modules/filter/filter.theme.scss +92 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +38 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
- package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
- package/src/lib/modules/form-builder/form-builder.theme.scss +212 -0
- package/src/lib/modules/form-builder/index.ts +9 -0
- package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
- package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
- package/src/lib/modules/form-builder/services/field-selection.service.ts +300 -0
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +652 -0
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
- package/src/lib/modules/form-builder/utils/constants.ts +43 -0
- package/src/lib/modules/form-components/components/checkbox/_theme.scss +63 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
- package/src/lib/modules/form-components/components/datepicker/_theme.scss +82 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
- package/src/lib/modules/form-components/components/dropdown/_theme.scss +91 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
- package/src/lib/modules/form-components/components/input/_theme.scss +77 -0
- package/src/lib/modules/form-components/components/input/input.component.html +51 -0
- package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
- package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
- package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
- package/src/lib/modules/form-components/components/radio/_theme.scss +61 -0
- package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
- package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
- package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
- package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
- package/src/lib/modules/form-components/components/search/_theme.scss +73 -0
- package/src/lib/modules/form-components/components/search/search.component.html +15 -0
- package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
- package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
- package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
- package/src/lib/modules/form-components/components/toggle/_theme.scss +45 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
- package/src/lib/modules/form-components/form-components.module.ts +41 -0
- package/src/lib/modules/form-components/form-components.theme.scss +25 -0
- package/src/lib/modules/material/material.module.ts +94 -0
- package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
- package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
- package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
- package/src/lib/modules/nav/nav.models.ts +31 -0
- package/src/lib/modules/nav/nav.module.ts +17 -0
- package/src/lib/modules/nav/nav.theme.scss +86 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
- package/src/lib/modules/pagination/pagination.module.ts +17 -0
- package/src/lib/modules/pagination/pagination.theme.scss +66 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
- package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
- package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
- package/src/lib/modules/side-nav/side-nav.theme.scss +111 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1109 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +1860 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2232 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +64 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +119 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1087 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +700 -0
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
- package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
- package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
- package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
- package/src/lib/modules/smart-form/smart-form.theme.scss +890 -0
- package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
- package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1118 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +202 -0
- package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
- package/src/lib/modules/smart-table/smart-table.theme.scss +335 -0
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +22 -0
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
- package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
- package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
- package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
- package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
- package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
- package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
- package/src/lib/modules/snackbar/snackbar.theme.scss +93 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
- package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
- package/src/lib/modules/summary-card/summary-card.theme.scss +176 -0
- package/src/lib/shared-ui.module.ts +44 -0
- package/src/lib/styles/global.scss +152 -0
- package/src/lib/styles/utilities.scss +250 -0
- package/src/lib/utils/constants.ts +11 -0
- package/src/lib/utils/storage.utils.ts +37 -0
- package/src/lib/utils/string.utils.ts +23 -0
- package/src/lib/utils/translation.utils.ts +87 -0
- package/src/public-api.ts +104 -0
- package/tsconfig.lib.json +15 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
.cc-pagination {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: 1rem;
|
|
6
|
+
font-family: var(--cc-pagination-font-family);
|
|
7
|
+
color: var(--cc-pagination-text-color);
|
|
8
|
+
font-size: var(--cc-pagination-font-size);
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
gap: 1rem;
|
|
11
|
+
width: 100%;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
|
|
14
|
+
/* Left Side: Items Info & Per Page */
|
|
15
|
+
.pagination-left {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: 1.5rem;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
|
|
21
|
+
.items-info {
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.per-page-selector {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 0.5rem;
|
|
29
|
+
|
|
30
|
+
.select-wrapper {
|
|
31
|
+
position: relative;
|
|
32
|
+
display: inline-block;
|
|
33
|
+
|
|
34
|
+
select {
|
|
35
|
+
appearance: none;
|
|
36
|
+
background-color: var(--cc-pagination-select-bg);
|
|
37
|
+
border: var(--cc-pagination-select-border);
|
|
38
|
+
border-radius: var(--cc-pagination-select-radius);
|
|
39
|
+
padding: var(--cc-pagination-select-padding);
|
|
40
|
+
padding-right: 2rem; /* Space for arrow */
|
|
41
|
+
color: var(--cc-pagination-select-text-color);
|
|
42
|
+
font-family: inherit;
|
|
43
|
+
font-size: inherit;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
min-width: 60px;
|
|
46
|
+
|
|
47
|
+
&:focus {
|
|
48
|
+
outline: none;
|
|
49
|
+
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Custom Arrow */
|
|
54
|
+
&::after {
|
|
55
|
+
content: '▼';
|
|
56
|
+
position: absolute;
|
|
57
|
+
right: 10px;
|
|
58
|
+
top: 50%;
|
|
59
|
+
transform: translateY(-50%);
|
|
60
|
+
font-size: 0.7em;
|
|
61
|
+
color: var(--cc-pagination-select-arrow-color);
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.per-page-label {
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Right Side: Page Controls */
|
|
73
|
+
.pagination-right {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 0.5rem;
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
|
|
79
|
+
.page-btn {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
min-width: var(--cc-pagination-btn-size);
|
|
84
|
+
height: var(--cc-pagination-btn-size);
|
|
85
|
+
background-color: var(--cc-pagination-btn-bg);
|
|
86
|
+
border: var(--cc-pagination-btn-border);
|
|
87
|
+
border-radius: var(--cc-pagination-btn-radius);
|
|
88
|
+
color: var(--cc-pagination-btn-text-color);
|
|
89
|
+
font-family: inherit;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
transition: all 0.2s ease;
|
|
92
|
+
padding: 0 0.5rem;
|
|
93
|
+
user-select: none;
|
|
94
|
+
|
|
95
|
+
&:hover:not(:disabled) {
|
|
96
|
+
background-color: var(--cc-pagination-btn-hover-bg);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:disabled {
|
|
100
|
+
opacity: var(--cc-pagination-disabled-opacity);
|
|
101
|
+
background-color: var(--cc-pagination-disabled-bg);
|
|
102
|
+
cursor: not-allowed;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.active {
|
|
106
|
+
background-color: var(--cc-pagination-btn-active-bg);
|
|
107
|
+
border: var(--cc-pagination-btn-active-border);
|
|
108
|
+
color: var(--cc-pagination-btn-active-text);
|
|
109
|
+
font-weight: bold;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.icon {
|
|
113
|
+
font-size: 1.2em;
|
|
114
|
+
line-height: 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.page-numbers {
|
|
119
|
+
display: flex;
|
|
120
|
+
gap: 0.5rem;
|
|
121
|
+
flex-wrap: wrap; // Allow numbers to wrap on very small screens if needed
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.ellipsis {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
color: var(--cc-pagination-text-color);
|
|
129
|
+
width: 20px;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Mobile Responsiveness */
|
|
134
|
+
@media (max-width: 600px) {
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
align-items: center;
|
|
137
|
+
gap: 1.5rem;
|
|
138
|
+
|
|
139
|
+
.pagination-left {
|
|
140
|
+
width: 100%;
|
|
141
|
+
justify-content: space-between;
|
|
142
|
+
order: 2; // Move controls below numbers on mobile if desired, or keep generic flow
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.pagination-right {
|
|
146
|
+
width: 100%;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
order: 1; // Show page numbers first on mobile? Usually keep order or stack.
|
|
149
|
+
|
|
150
|
+
.page-numbers {
|
|
151
|
+
justify-content: center;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, PAGINATION_THEME_DEFAULT } from '../../../../utils/constants';
|
|
3
|
+
|
|
4
|
+
export interface PaginationLabels {
|
|
5
|
+
items: string;
|
|
6
|
+
of: string;
|
|
7
|
+
perPage: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'lib-pagination',
|
|
12
|
+
templateUrl: './pagination.component.html',
|
|
13
|
+
styleUrls: ['./pagination.component.scss'],
|
|
14
|
+
standalone: false
|
|
15
|
+
})
|
|
16
|
+
export class PaginationComponent implements OnInit, OnChanges {
|
|
17
|
+
@Input() totalItems: number = 0;
|
|
18
|
+
@Input() itemsPerPage: number = DEFAULT_ITEMS_PER_PAGE;
|
|
19
|
+
@Input() currentPage: number = 1;
|
|
20
|
+
@Input() pageSizeOptions: number[] = DEFAULT_PAGE_SIZE_OPTIONS;
|
|
21
|
+
@Input() theme: 'theme-1' | 'theme-2' = PAGINATION_THEME_DEFAULT;
|
|
22
|
+
@Input() labels: PaginationLabels = {
|
|
23
|
+
items: 'items',
|
|
24
|
+
of: 'of',
|
|
25
|
+
perPage: 'Per Page'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
@Output() pageChange = new EventEmitter<number>();
|
|
29
|
+
@Output() itemsPerPageChange = new EventEmitter<number>();
|
|
30
|
+
|
|
31
|
+
totalPages: number = 0;
|
|
32
|
+
pages: (number | string)[] = [];
|
|
33
|
+
startItem: number = 0;
|
|
34
|
+
endItem: number = 0;
|
|
35
|
+
|
|
36
|
+
constructor() { }
|
|
37
|
+
|
|
38
|
+
ngOnInit(): void {
|
|
39
|
+
this.calculatePagination();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
43
|
+
if (changes['totalItems'] || changes['itemsPerPage'] || changes['currentPage']) {
|
|
44
|
+
this.calculatePagination();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
calculatePagination(): void {
|
|
49
|
+
this.totalPages = Math.ceil(this.totalItems / this.itemsPerPage);
|
|
50
|
+
|
|
51
|
+
// Ensure current page is valid
|
|
52
|
+
if (this.currentPage < 1) {
|
|
53
|
+
this.currentPage = 1;
|
|
54
|
+
} else if (this.currentPage > this.totalPages && this.totalPages > 0) {
|
|
55
|
+
this.currentPage = this.totalPages;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.startItem = (this.currentPage - 1) * this.itemsPerPage + 1;
|
|
59
|
+
this.endItem = Math.min(this.currentPage * this.itemsPerPage, this.totalItems);
|
|
60
|
+
|
|
61
|
+
if (this.totalItems === 0) {
|
|
62
|
+
this.startItem = 0;
|
|
63
|
+
this.endItem = 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this.pages = this.getVisiblePages(this.currentPage, this.totalPages);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getVisiblePages(current: number, total: number): (number | string)[] {
|
|
70
|
+
if (total <= 7) {
|
|
71
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (current <= 4) {
|
|
75
|
+
return [1, 2, 3, 4, 5, '...', total];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (current >= total - 3) {
|
|
79
|
+
return [1, '...', total - 4, total - 3, total - 2, total - 1, total];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return [1, '...', current - 1, current, current + 1, '...', total];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onPageChange(page: number | string): void {
|
|
86
|
+
if (typeof page === 'string') return;
|
|
87
|
+
if (page < 1 || page > this.totalPages || page === this.currentPage) return;
|
|
88
|
+
|
|
89
|
+
this.pageChange.emit(page);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onItemsPerPageChange(event: Event): void {
|
|
93
|
+
const target = event.target as HTMLSelectElement;
|
|
94
|
+
const newSize = Number(target.value);
|
|
95
|
+
this.itemsPerPageChange.emit(newSize);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
nextPage(): void {
|
|
99
|
+
if (this.currentPage < this.totalPages) {
|
|
100
|
+
this.onPageChange(this.currentPage + 1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
prevPage(): void {
|
|
105
|
+
if (this.currentPage > 1) {
|
|
106
|
+
this.onPageChange(this.currentPage - 1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { PaginationComponent } from './components/pagination/pagination.component';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations: [
|
|
8
|
+
PaginationComponent
|
|
9
|
+
],
|
|
10
|
+
imports: [
|
|
11
|
+
CommonModule
|
|
12
|
+
],
|
|
13
|
+
exports: [
|
|
14
|
+
PaginationComponent
|
|
15
|
+
]
|
|
16
|
+
})
|
|
17
|
+
export class PaginationModule { }
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
// Default configuration for the pagination theme
|
|
4
|
+
$default-pagination-config: (
|
|
5
|
+
// Font & Text
|
|
6
|
+
font-family: ('Roboto', sans-serif),
|
|
7
|
+
text-color: #757575,
|
|
8
|
+
font-size: 14px,
|
|
9
|
+
|
|
10
|
+
// Select Dropdown
|
|
11
|
+
select-bg: #f5f5f5,
|
|
12
|
+
select-border: none,
|
|
13
|
+
select-radius: 4px,
|
|
14
|
+
select-padding: 6px 12px,
|
|
15
|
+
select-text-color: #333,
|
|
16
|
+
select-arrow-color: #f44336, // Red arrow
|
|
17
|
+
|
|
18
|
+
// Buttons
|
|
19
|
+
btn-size: 32px,
|
|
20
|
+
btn-bg: #ffffff,
|
|
21
|
+
btn-border: 1px solid #e0e0e0,
|
|
22
|
+
btn-radius: 4px,
|
|
23
|
+
btn-text-color: #333,
|
|
24
|
+
|
|
25
|
+
// States
|
|
26
|
+
btn-hover-bg: #f5f5f5,
|
|
27
|
+
btn-active-bg: #fff,
|
|
28
|
+
btn-active-border: 1px solid #ff4081, // Pinkish red
|
|
29
|
+
btn-active-text: #ff4081,
|
|
30
|
+
|
|
31
|
+
// Disabled
|
|
32
|
+
disabled-opacity: 0.5,
|
|
33
|
+
disabled-bg: #f9f9f9
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// Mixin to generate CSS variables for the pagination component
|
|
37
|
+
@mixin pagination-theme($user-config: ()) {
|
|
38
|
+
// Merge user config with defaults
|
|
39
|
+
$config: map.merge($default-pagination-config, $user-config);
|
|
40
|
+
|
|
41
|
+
// Generate CSS Variables
|
|
42
|
+
--cc-pagination-font-family: #{map.get($config, font-family)};
|
|
43
|
+
--cc-pagination-text-color: #{map.get($config, text-color)};
|
|
44
|
+
--cc-pagination-font-size: #{map.get($config, font-size)};
|
|
45
|
+
|
|
46
|
+
--cc-pagination-select-bg: #{map.get($config, select-bg)};
|
|
47
|
+
--cc-pagination-select-border: #{map.get($config, select-border)};
|
|
48
|
+
--cc-pagination-select-radius: #{map.get($config, select-radius)};
|
|
49
|
+
--cc-pagination-select-padding: #{map.get($config, select-padding)};
|
|
50
|
+
--cc-pagination-select-text-color: #{map.get($config, select-text-color)};
|
|
51
|
+
--cc-pagination-select-arrow-color: #{map.get($config, select-arrow-color)};
|
|
52
|
+
|
|
53
|
+
--cc-pagination-btn-size: #{map.get($config, btn-size)};
|
|
54
|
+
--cc-pagination-btn-bg: #{map.get($config, btn-bg)};
|
|
55
|
+
--cc-pagination-btn-border: #{map.get($config, btn-border)};
|
|
56
|
+
--cc-pagination-btn-radius: #{map.get($config, btn-radius)};
|
|
57
|
+
--cc-pagination-btn-text-color: #{map.get($config, btn-text-color)};
|
|
58
|
+
|
|
59
|
+
--cc-pagination-btn-hover-bg: #{map.get($config, btn-hover-bg)};
|
|
60
|
+
--cc-pagination-btn-active-bg: #{map.get($config, btn-active-bg)};
|
|
61
|
+
--cc-pagination-btn-active-border: #{map.get($config, btn-active-border)};
|
|
62
|
+
--cc-pagination-btn-active-text: #{map.get($config, btn-active-text)};
|
|
63
|
+
|
|
64
|
+
--cc-pagination-disabled-opacity: #{map.get($config, disabled-opacity)};
|
|
65
|
+
--cc-pagination-disabled-bg: #{map.get($config, disabled-bg)};
|
|
66
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<nav class="cc-side-nav" [class.collapsed]="collapsed" role="navigation" [ngStyle]="customStyles">
|
|
2
|
+
|
|
3
|
+
<div class="cc-side-nav-section" *ngFor="let section of filteredSections; let i = index">
|
|
4
|
+
|
|
5
|
+
<div class="cc-side-nav-heading-row" *ngIf="section.heading && !collapsed">
|
|
6
|
+
<h3 class="cc-side-nav-heading">{{ section.heading }}</h3>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<ul class="cc-side-nav-list">
|
|
10
|
+
<li *ngFor="let item of section.items" class="cc-side-nav-list-item">
|
|
11
|
+
<a (click)="onItemClick(item, $event)" class="cc-side-nav-link" [class.active]="item.id === activeId"
|
|
12
|
+
[class.disabled]="item.disabled" [matTooltip]="item.tooltip || item.label"
|
|
13
|
+
[matTooltipDisabled]="collapsed ? false : !showTooltips" [matTooltipPosition]="tooltipPosition"
|
|
14
|
+
[matTooltipClass]="'cc-side-nav-tooltip'" [attr.aria-current]="(item.id === activeId) ? 'page' : null"
|
|
15
|
+
[attr.aria-disabled]="item.disabled ? true : null">
|
|
16
|
+
<span *ngIf="item.icon && (collapsed || !hideIconsWhenExpanded)" class="cc-side-nav-icon">
|
|
17
|
+
<span *ngIf="!item.icon.includes('fa') && !item.icon.includes('bi')" class="material-icons">
|
|
18
|
+
{{ item.icon }}
|
|
19
|
+
</span>
|
|
20
|
+
<i *ngIf="item.icon.includes('fa') || item.icon.includes('bi')" [class]="item.icon"></i>
|
|
21
|
+
</span>
|
|
22
|
+
<!-- Label: always in DOM, CSS transitions handle fade on collapse -->
|
|
23
|
+
<span class="cc-side-nav-label">{{ item.label }}</span>
|
|
24
|
+
<!-- Arrow: rendered for active items regardless of collapse state; CSS hides it -->
|
|
25
|
+
<span class="cc-side-nav-arrow material-icons"
|
|
26
|
+
*ngIf="(item.id === activeId) && item.showArrow !== false">chevron_right</span>
|
|
27
|
+
</a>
|
|
28
|
+
</li>
|
|
29
|
+
</ul>
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
</nav>
|
|
34
|
+
|
|
35
|
+
<!--
|
|
36
|
+
Toggle pill — always straddles the right edge of :host (right: -12px).
|
|
37
|
+
Hidden via opacity/scale until :host is hovered; always visible when collapsed.
|
|
38
|
+
Single chevron SVG rotates 180° via CSS — no icon swap needed.
|
|
39
|
+
-->
|
|
40
|
+
<button *ngIf="showCollapseToggle"
|
|
41
|
+
class="cc-sn-toggle"
|
|
42
|
+
(click)="toggleCollapse()"
|
|
43
|
+
type="button"
|
|
44
|
+
[attr.aria-label]="collapsed ? 'Expand navigation' : 'Collapse navigation'">
|
|
45
|
+
<svg class="cc-sn-chevron"
|
|
46
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
47
|
+
viewBox="0 0 16 16"
|
|
48
|
+
fill="none"
|
|
49
|
+
aria-hidden="true">
|
|
50
|
+
<path d="M10 3L5 8L10 13"
|
|
51
|
+
stroke="currentColor"
|
|
52
|
+
stroke-width="1.75"
|
|
53
|
+
stroke-linecap="round"
|
|
54
|
+
stroke-linejoin="round"/>
|
|
55
|
+
</svg>
|
|
56
|
+
</button>
|