commons-shared-web-ui 0.0.52 → 0.0.53
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/.claude/settings.local.json +10 -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 +599 -0
- package/documentation/form-components.md +384 -0
- package/documentation/form-field-configuration.md +250 -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 +2532 -0
- package/documentation/smart-table.md +1221 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/documentation/table-column-configuration.md +221 -0
- package/ng-package.json +28 -0
- package/package.json +53 -34
- 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/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/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/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/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-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-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/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/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 +299 -0
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +670 -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/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/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/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/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/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/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/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-field-configuration/components/_ffc-controls.scss +89 -0
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +68 -0
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +73 -0
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +34 -0
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +78 -0
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +83 -0
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +94 -0
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +38 -0
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +42 -0
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +92 -0
- package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +23 -0
- package/src/lib/modules/form-field-configuration/index.ts +7 -0
- package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +62 -0
- package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +148 -0
- package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +228 -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/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/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/smart-form/components/form-field/form-field.component.html +1196 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2014 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2782 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +65 -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 +131 -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 +1131 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +749 -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 +67 -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/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 +1128 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +213 -0
- package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +28 -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/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/table-column-configuration/components/_tcc-controls.scss +53 -0
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +47 -0
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +50 -0
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +33 -0
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +30 -0
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +36 -0
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +78 -0
- package/src/lib/modules/table-column-configuration/index.ts +5 -0
- package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +20 -0
- package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +77 -0
- package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +21 -0
- package/src/lib/shared-ui.module.ts +50 -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 +121 -0
- package/tsconfig.lib.json +15 -0
- package/fesm2022/commons-shared-web-ui.mjs +0 -14557
- package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
- package/index.d.ts +0 -4534
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.cc-summary-card {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
font-family: var(--cc-sc-font-family, 'Inter', sans-serif);
|
|
12
|
+
background-color: var(--cc-sc-bg-color, #ffffff);
|
|
13
|
+
border-radius: var(--cc-sc-border-radius, 8px);
|
|
14
|
+
border: var(--cc-sc-border, 1px solid #e0e0e0);
|
|
15
|
+
padding: var(--cc-sc-padding, 16px);
|
|
16
|
+
box-shadow: var(--cc-sc-shadow, 0 2px 4px rgba(0, 0, 0, 0.05));
|
|
17
|
+
transition: all var(--cc-sc-transition-duration, 0.2s) ease;
|
|
18
|
+
height: 100%;
|
|
19
|
+
width: 100%;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
gap: var(--cc-sc-icon-margin, 1rem);
|
|
22
|
+
|
|
23
|
+
&.clickable {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
transform: var(--cc-sc-hover-transform);
|
|
28
|
+
box-shadow: var(--cc-sc-hover-shadow);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.disabled {
|
|
33
|
+
opacity: var(--cc-sc-disabled-opacity);
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Icon Section (Left Side)
|
|
39
|
+
.icon-section {
|
|
40
|
+
width: var(--cc-sc-icon-box-size);
|
|
41
|
+
height: var(--cc-sc-icon-box-size);
|
|
42
|
+
min-width: var(--cc-sc-icon-box-size);
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
border-radius: var(--cc-sc-icon-radius);
|
|
47
|
+
background-color: var(--cc-sc-icon-bg);
|
|
48
|
+
color: var(--cc-sc-icon-color);
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
align-self: center;
|
|
51
|
+
|
|
52
|
+
mat-icon {
|
|
53
|
+
width: var(--cc-sc-icon-size);
|
|
54
|
+
height: var(--cc-sc-icon-size);
|
|
55
|
+
font-size: var(--cc-sc-icon-size);
|
|
56
|
+
line-height: var(--cc-sc-icon-size);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
img {
|
|
60
|
+
width: var(--cc-sc-icon-size);
|
|
61
|
+
height: var(--cc-sc-icon-size);
|
|
62
|
+
object-fit: contain;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Right Section (Header + Value/Meta)
|
|
67
|
+
.right-section {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
flex: 1;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
gap: var(--cc-sc-content-gap, 0.5rem);
|
|
73
|
+
|
|
74
|
+
.header {
|
|
75
|
+
font-size: var(--cc-sc-header-size);
|
|
76
|
+
font-weight: var(--cc-sc-header-weight);
|
|
77
|
+
text-transform: var(--cc-sc-header-transform);
|
|
78
|
+
color: var(--cc-sc-header-color);
|
|
79
|
+
letter-spacing: var(--cc-sc-header-letter-spacing);
|
|
80
|
+
line-height: var(--cc-sc-header-line-height);
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Value and Meta Row
|
|
88
|
+
.value-meta-row {
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: row;
|
|
91
|
+
align-items: flex-start;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
gap: 1rem;
|
|
94
|
+
flex: 1;
|
|
95
|
+
|
|
96
|
+
// Content Section
|
|
97
|
+
.content-section {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
justify-content: flex-start;
|
|
101
|
+
flex: 1;
|
|
102
|
+
min-width: 0;
|
|
103
|
+
|
|
104
|
+
.value-row {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
gap: var(--cc-sc-value-desc-gap);
|
|
108
|
+
|
|
109
|
+
&.inline-layout {
|
|
110
|
+
flex-direction: row;
|
|
111
|
+
align-items: baseline;
|
|
112
|
+
flex-wrap: wrap;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.value {
|
|
116
|
+
font-size: var(--cc-sc-value-size);
|
|
117
|
+
font-weight: var(--cc-sc-value-weight);
|
|
118
|
+
color: var(--cc-sc-value-color);
|
|
119
|
+
line-height: var(--cc-sc-value-line-height);
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
|
|
122
|
+
.value-subtext {
|
|
123
|
+
font-size: var(--cc-sc-desc-size);
|
|
124
|
+
font-weight: var(--cc-sc-desc-weight);
|
|
125
|
+
color: var(--cc-sc-desc-color);
|
|
126
|
+
margin-left: 4px;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.description {
|
|
131
|
+
font-size: var(--cc-sc-desc-size);
|
|
132
|
+
font-weight: var(--cc-sc-desc-weight);
|
|
133
|
+
color: var(--cc-sc-desc-color);
|
|
134
|
+
line-height: var(--cc-sc-desc-line-height);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Meta Section (Aligned with Value)
|
|
140
|
+
.meta-section {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
align-items: flex-end;
|
|
144
|
+
justify-content: flex-start;
|
|
145
|
+
flex-shrink: 0;
|
|
146
|
+
gap: 6px;
|
|
147
|
+
|
|
148
|
+
.meta-item {
|
|
149
|
+
font-size: 0.8125rem; // ~13px
|
|
150
|
+
line-height: 1.4;
|
|
151
|
+
white-space: nowrap;
|
|
152
|
+
text-align: right;
|
|
153
|
+
flex-shrink: 0;
|
|
154
|
+
|
|
155
|
+
&.meta-text {
|
|
156
|
+
color: var(--cc-sc-desc-color, #64748b);
|
|
157
|
+
font-weight: 500;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&.meta-pill {
|
|
161
|
+
display: inline-flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
padding: var(--cc-sc-meta-pill-padding, 4px 12px);
|
|
165
|
+
border-radius: var(--cc-sc-meta-pill-radius, 20px);
|
|
166
|
+
font-size: var(--cc-sc-meta-pill-font-size, 0.75rem);
|
|
167
|
+
font-weight: var(--cc-sc-meta-pill-font-weight, 600);
|
|
168
|
+
line-height: 1.2;
|
|
169
|
+
background-color: var(--cc-sc-meta-pill-bg, #f1f5f9);
|
|
170
|
+
color: var(--cc-sc-meta-pill-color, #475569);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Responsive Design
|
|
178
|
+
@media (max-width: 600px) {
|
|
179
|
+
.icon-section {
|
|
180
|
+
margin-right: var(--cc-sc-icon-margin-mobile, 0.75rem);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.content-section {
|
|
184
|
+
.header {
|
|
185
|
+
font-size: var(--cc-sc-header-size-mobile, 0.7rem);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.value-row {
|
|
189
|
+
.value {
|
|
190
|
+
font-size: var(--cc-sc-value-size-mobile, 1.25rem);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.description {
|
|
194
|
+
font-size: var(--cc-sc-desc-size-mobile, 0.7rem);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
export interface SummaryCardConfig {
|
|
4
|
+
header: string;
|
|
5
|
+
value: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
|
|
8
|
+
// Icon or Image (mutually exclusive)
|
|
9
|
+
icon?: string; // Material icon name
|
|
10
|
+
iconImage?: string; // URL for image icon
|
|
11
|
+
|
|
12
|
+
// Layout configurations
|
|
13
|
+
descriptionPosition?: 'bottom' | 'inline'; // 'bottom' (default) or 'inline' (right side of value)
|
|
14
|
+
|
|
15
|
+
// Extended Content
|
|
16
|
+
valueSubtext?: string; // Text displayed next to the value (e.g. "/ 15 Target")
|
|
17
|
+
metaData?: SummaryCardMeta[]; // Right-aligned meta information
|
|
18
|
+
|
|
19
|
+
// Color configurations
|
|
20
|
+
valueColor?: string; // Color for the value text
|
|
21
|
+
headerColor?: string; // Color for the header text
|
|
22
|
+
descriptionColor?: string; // Color for the description text
|
|
23
|
+
iconColor?: string; // Color for the icon
|
|
24
|
+
iconBackgroundColor?: string; // Background color for the icon container
|
|
25
|
+
|
|
26
|
+
// Additional styling
|
|
27
|
+
iconClass?: string; // Additional CSS classes for icon
|
|
28
|
+
valueClass?: string; // Additional CSS classes for value
|
|
29
|
+
headerClass?: string; // Additional CSS classes for header
|
|
30
|
+
descriptionClass?: string; // Additional CSS classes for description
|
|
31
|
+
|
|
32
|
+
// Interaction
|
|
33
|
+
isDisabled?: boolean; // Disable click interaction
|
|
34
|
+
isClickable?: boolean; // Whether card is clickable (default: true)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface SummaryCardMeta {
|
|
38
|
+
text: string;
|
|
39
|
+
type?: 'text' | 'pill'; // 'text' (default) or 'pill' (badge style)
|
|
40
|
+
color?: string; // Text color
|
|
41
|
+
backgroundColor?: string; // Background color for pill
|
|
42
|
+
cssClass?: string; // Custom CSS class
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface SummaryCardLabels {
|
|
46
|
+
iconAlt: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Component({
|
|
50
|
+
selector: 'lib-summary-card',
|
|
51
|
+
templateUrl: './summary-card.component.html',
|
|
52
|
+
styleUrls: ['./summary-card.component.scss'],
|
|
53
|
+
standalone: false
|
|
54
|
+
})
|
|
55
|
+
export class SummaryCardComponent {
|
|
56
|
+
@Input() config!: SummaryCardConfig;
|
|
57
|
+
@Input() theme?: 'theme-1' | 'theme-2';
|
|
58
|
+
@Input() labels: any;
|
|
59
|
+
@Output() cardClick = new EventEmitter<void>();
|
|
60
|
+
|
|
61
|
+
constructor() { }
|
|
62
|
+
|
|
63
|
+
onCardClick(): void {
|
|
64
|
+
if (this.config?.isDisabled || this.config?.isClickable === false) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.cardClick.emit();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get cardClasses(): { [key: string]: boolean } {
|
|
71
|
+
return {
|
|
72
|
+
'disabled': !!this.config?.isDisabled,
|
|
73
|
+
'clickable': this.config?.isClickable !== false && !this.config?.isDisabled
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get iconStyles(): { [key: string]: string } {
|
|
78
|
+
const styles: { [key: string]: string } = {};
|
|
79
|
+
if (this.config.iconBackgroundColor) {
|
|
80
|
+
styles['backgroundColor'] = this.config.iconBackgroundColor;
|
|
81
|
+
}
|
|
82
|
+
if (this.config.iconColor) {
|
|
83
|
+
styles['color'] = this.config.iconColor;
|
|
84
|
+
}
|
|
85
|
+
return styles;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get headerStyles(): { [key: string]: string } {
|
|
89
|
+
const styles: { [key: string]: string } = {};
|
|
90
|
+
if (this.config.headerColor) {
|
|
91
|
+
styles['color'] = this.config.headerColor;
|
|
92
|
+
}
|
|
93
|
+
return styles;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get valueStyles(): { [key: string]: string } {
|
|
97
|
+
const styles: { [key: string]: string } = {};
|
|
98
|
+
if (this.config.valueColor) {
|
|
99
|
+
styles['color'] = this.config.valueColor;
|
|
100
|
+
}
|
|
101
|
+
return styles;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get descriptionStyles(): { [key: string]: string } {
|
|
105
|
+
const styles: { [key: string]: string } = {};
|
|
106
|
+
if (this.config.descriptionColor) {
|
|
107
|
+
styles['color'] = this.config.descriptionColor;
|
|
108
|
+
}
|
|
109
|
+
return styles;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get isDescriptionInline(): boolean {
|
|
113
|
+
return this.config.descriptionPosition === 'inline';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
getMetaStyles(meta: SummaryCardMeta): { [key: string]: string } {
|
|
117
|
+
const styles: { [key: string]: string } = {};
|
|
118
|
+
if (meta.color) {
|
|
119
|
+
styles['color'] = meta.color;
|
|
120
|
+
}
|
|
121
|
+
if (meta.backgroundColor && meta.type === 'pill') {
|
|
122
|
+
styles['backgroundColor'] = meta.backgroundColor;
|
|
123
|
+
}
|
|
124
|
+
return styles;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
+
import { SummaryCardComponent } from './components/summary-card/summary-card.component';
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations: [
|
|
8
|
+
SummaryCardComponent
|
|
9
|
+
],
|
|
10
|
+
imports: [
|
|
11
|
+
CommonModule,
|
|
12
|
+
MatIconModule
|
|
13
|
+
],
|
|
14
|
+
exports: [
|
|
15
|
+
SummaryCardComponent
|
|
16
|
+
]
|
|
17
|
+
})
|
|
18
|
+
export class SummaryCardModule { }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Shared, self-contained controls for the table-column-configuration list.
|
|
2
|
+
// Used (via @use) by the column-node component so the pill toggle / lock render
|
|
3
|
+
// consistently in a dense, inline row without depending on the quirks of the
|
|
4
|
+
// generic lib-toggle.
|
|
5
|
+
|
|
6
|
+
// ── Pill toggle ───────────────────────────────────────────────────────────────
|
|
7
|
+
.tcc-toggle {
|
|
8
|
+
position: relative;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
width: var(--tcc-toggle-width, 38px);
|
|
11
|
+
height: var(--tcc-toggle-height, 22px);
|
|
12
|
+
padding: 0;
|
|
13
|
+
border: none;
|
|
14
|
+
border-radius: 999px;
|
|
15
|
+
background: var(--tcc-toggle-off-bg, #cbd2d9);
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
transition: background 0.18s ease;
|
|
18
|
+
|
|
19
|
+
&__thumb {
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 2px;
|
|
22
|
+
left: 2px;
|
|
23
|
+
width: calc(var(--tcc-toggle-height, 22px) - 4px);
|
|
24
|
+
height: calc(var(--tcc-toggle-height, 22px) - 4px);
|
|
25
|
+
border-radius: 50%;
|
|
26
|
+
background: var(--tcc-toggle-thumb, #ffffff);
|
|
27
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
|
|
28
|
+
transition: left 0.18s ease;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--on {
|
|
32
|
+
background: var(--tcc-toggle-on-bg, #2f9e6f);
|
|
33
|
+
|
|
34
|
+
.tcc-toggle__thumb {
|
|
35
|
+
left: calc(100% - (var(--tcc-toggle-height, 22px) - 2px));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:focus-visible {
|
|
40
|
+
outline: 2px solid var(--tcc-focus-ring, #2f9e6f);
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ── Lock indicator (occupies the toggle footprint so rows stay aligned) ────────
|
|
46
|
+
.tcc-lock {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
width: var(--tcc-toggle-width, 38px);
|
|
52
|
+
color: var(--tcc-lock-color, #9aa2ab);
|
|
53
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="tcc-col"
|
|
3
|
+
[class.tcc-col--hidden]="!column.visible"
|
|
4
|
+
[class.tcc-col--locked]="column.lockVisibility"
|
|
5
|
+
>
|
|
6
|
+
<!-- Visibility indicator (eye / eye-off) -->
|
|
7
|
+
<span class="tcc-col__eye" [class.tcc-col__eye--off]="!column.visible" aria-hidden="true">
|
|
8
|
+
@if (column.visible) {
|
|
9
|
+
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
10
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
11
|
+
<path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z"></path>
|
|
12
|
+
<circle cx="12" cy="12" r="3"></circle>
|
|
13
|
+
</svg>
|
|
14
|
+
} @else {
|
|
15
|
+
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
16
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
17
|
+
<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path>
|
|
18
|
+
<line x1="1" y1="1" x2="23" y2="23"></line>
|
|
19
|
+
</svg>
|
|
20
|
+
}
|
|
21
|
+
</span>
|
|
22
|
+
|
|
23
|
+
<span class="tcc-col__label" [title]="displayLabel">{{ displayLabel }}</span>
|
|
24
|
+
|
|
25
|
+
<!-- Visibility toggle / lock -->
|
|
26
|
+
@if (column.lockVisibility) {
|
|
27
|
+
<span class="tcc-lock" title="This column is always visible">
|
|
28
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
29
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
30
|
+
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
|
|
31
|
+
<path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
|
|
32
|
+
</svg>
|
|
33
|
+
</span>
|
|
34
|
+
} @else {
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
class="tcc-toggle"
|
|
38
|
+
[class.tcc-toggle--on]="column.visible"
|
|
39
|
+
role="switch"
|
|
40
|
+
[attr.aria-checked]="column.visible"
|
|
41
|
+
[attr.aria-label]="'Show ' + displayLabel"
|
|
42
|
+
(click)="toggleVisible.emit()"
|
|
43
|
+
>
|
|
44
|
+
<span class="tcc-toggle__thumb"></span>
|
|
45
|
+
</button>
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@use '../tcc-controls';
|
|
2
|
+
|
|
3
|
+
.tcc-col {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--tcc-col-gap, 12px);
|
|
7
|
+
padding: var(--tcc-col-padding, 10px 14px);
|
|
8
|
+
border-radius: var(--tcc-col-radius, 8px);
|
|
9
|
+
background: var(--tcc-col-bg, #ffffff);
|
|
10
|
+
border: 1px solid var(--tcc-col-border, #eef0f2);
|
|
11
|
+
transition: background 0.15s, border-color 0.15s, opacity 0.15s;
|
|
12
|
+
|
|
13
|
+
&:hover:not(.tcc-col--locked) {
|
|
14
|
+
background: var(--tcc-col-hover-bg, #f8fafc);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Hidden columns: dim the row and mute the eye/label, but keep the toggle
|
|
18
|
+
// crisp so it's obvious how to turn the column back on.
|
|
19
|
+
&--hidden {
|
|
20
|
+
.tcc-col__eye,
|
|
21
|
+
.tcc-col__label {
|
|
22
|
+
opacity: 0.55;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--locked {
|
|
27
|
+
background: var(--tcc-col-locked-bg, #f6f7f8);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__eye {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
color: var(--tcc-eye-color, #6b7280);
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
|
|
36
|
+
&--off {
|
|
37
|
+
color: var(--tcc-eye-off-color, #b0b6be);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__label {
|
|
42
|
+
flex: 1 1 auto;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
font-size: var(--tcc-col-label-size, 14px);
|
|
45
|
+
color: var(--tcc-col-label-color, #1f2933);
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Input,
|
|
5
|
+
Output,
|
|
6
|
+
EventEmitter,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { ConfigColumnNode } from '../../models/table-column-configuration.models';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A single column row inside the table-column-configuration list.
|
|
12
|
+
* Shows a visibility indicator + column name on the left and a visibility
|
|
13
|
+
* toggle (or a lock, when the column is locked visible) on the right.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'lib-config-column-node',
|
|
17
|
+
standalone: false,
|
|
18
|
+
templateUrl: './config-column-node.component.html',
|
|
19
|
+
styleUrls: ['./config-column-node.component.scss'],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
})
|
|
22
|
+
export class ConfigColumnNodeComponent {
|
|
23
|
+
@Input({ required: true }) column!: ConfigColumnNode;
|
|
24
|
+
/** Optional label translator (e.g. an ngx-translate instant fn). */
|
|
25
|
+
@Input() translate?: (key: string) => string;
|
|
26
|
+
|
|
27
|
+
@Output() toggleVisible = new EventEmitter<void>();
|
|
28
|
+
|
|
29
|
+
get displayLabel(): string {
|
|
30
|
+
const label = this.column.label;
|
|
31
|
+
return this.translate ? this.translate(label) : label;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<div class="tcc-root">
|
|
2
|
+
@if (showLegend) {
|
|
3
|
+
<div class="tcc-legend">
|
|
4
|
+
<span class="tcc-legend__item">
|
|
5
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
6
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
7
|
+
<path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z"></path>
|
|
8
|
+
<circle cx="12" cy="12" r="3"></circle>
|
|
9
|
+
</svg>
|
|
10
|
+
<span>Visible</span>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
<div class="tcc-list">
|
|
16
|
+
@for (column of store.columns(); track trackByIndex($index); let ci = $index) {
|
|
17
|
+
<lib-config-column-node
|
|
18
|
+
[column]="column"
|
|
19
|
+
[translate]="translate"
|
|
20
|
+
(toggleVisible)="onToggleVisible(ci)"
|
|
21
|
+
/>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@if (store.columns().length === 0) {
|
|
25
|
+
<div class="tcc-empty">
|
|
26
|
+
<p>No columns found in the config.</p>
|
|
27
|
+
</div>
|
|
28
|
+
}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.tcc-root {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--tcc-root-gap, 12px);
|
|
5
|
+
font-family: var(--tcc-font-family, inherit);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.tcc-legend {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: var(--tcc-legend-gap, 24px);
|
|
12
|
+
padding: var(--tcc-legend-padding, 4px 2px 8px);
|
|
13
|
+
border-bottom: 1px solid var(--tcc-legend-border, #eef0f2);
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
|
|
16
|
+
&__item {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 6px;
|
|
20
|
+
font-size: var(--tcc-legend-size, 13px);
|
|
21
|
+
color: var(--tcc-legend-color, #52606d);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tcc-list {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: var(--tcc-list-gap, 10px);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.tcc-empty {
|
|
32
|
+
padding: 24px;
|
|
33
|
+
text-align: center;
|
|
34
|
+
color: var(--tcc-empty-color, #9aa2ab);
|
|
35
|
+
font-size: 13px;
|
|
36
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Input,
|
|
5
|
+
OnChanges,
|
|
6
|
+
SimpleChanges,
|
|
7
|
+
inject,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { TableConfig } from '../../../smart-table/models/table-config.model';
|
|
10
|
+
import { TableColumnConfigurationService } from '../../services/table-column-configuration.service';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Table Column Configuration
|
|
14
|
+
* --------------------------
|
|
15
|
+
* Renders a compact list of a table config's columns, each with a **visibility**
|
|
16
|
+
* toggle. Intended to be embedded inside a `cc-confirmation-modal` on a host page
|
|
17
|
+
* ("Configure columns").
|
|
18
|
+
*
|
|
19
|
+
* Pass a `TableConfig` via `[config]`. The input is deep-cloned, so it is never
|
|
20
|
+
* mutated. When the user confirms, call `getUpdatedConfig()` to read back the
|
|
21
|
+
* modified config (isEnabled/visible flags updated per column).
|
|
22
|
+
*
|
|
23
|
+
* Columns carrying `lockVisibility: true` cannot be hidden — their toggle is
|
|
24
|
+
* replaced by a lock icon.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```html
|
|
28
|
+
* <cc-confirmation-modal [isOpen]="open" (confirm)="save()" (cancel)="open = false">
|
|
29
|
+
* <lib-table-column-configuration #cfg [config]="tableConfig" [translate]="translateFn" />
|
|
30
|
+
* </cc-confirmation-modal>
|
|
31
|
+
* ```
|
|
32
|
+
* ```ts
|
|
33
|
+
* @ViewChild('cfg') cfg!: TableColumnConfigurationComponent;
|
|
34
|
+
* save() { this.updatedConfig = this.cfg.getUpdatedConfig(); }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
@Component({
|
|
38
|
+
selector: 'lib-table-column-configuration',
|
|
39
|
+
standalone: false,
|
|
40
|
+
providers: [TableColumnConfigurationService],
|
|
41
|
+
templateUrl: './table-column-configuration.component.html',
|
|
42
|
+
styleUrls: ['./table-column-configuration.component.scss'],
|
|
43
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
44
|
+
})
|
|
45
|
+
export class TableColumnConfigurationComponent implements OnChanges {
|
|
46
|
+
/** The table config to configure. Deep-cloned internally; never mutated. */
|
|
47
|
+
@Input({ required: true }) config!: TableConfig;
|
|
48
|
+
|
|
49
|
+
/** Optional label translator, e.g. an ngx-translate `instant` function. */
|
|
50
|
+
@Input() translate?: (key: string) => string;
|
|
51
|
+
|
|
52
|
+
/** Show the "Visible" legend row. Default true. */
|
|
53
|
+
@Input() showLegend = true;
|
|
54
|
+
|
|
55
|
+
protected readonly store = inject(TableColumnConfigurationService);
|
|
56
|
+
|
|
57
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
58
|
+
if (changes['config'] && this.config) {
|
|
59
|
+
this.store.loadConfig(this.config);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns a fresh, modified copy of the config with the current visibility
|
|
65
|
+
* selections applied. Returns null if no config has been loaded.
|
|
66
|
+
*/
|
|
67
|
+
getUpdatedConfig(): TableConfig | null {
|
|
68
|
+
return this.store.buildUpdatedConfig();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
onToggleVisible(index: number): void {
|
|
72
|
+
this.store.toggleColumnVisible(index);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
trackByIndex(index: number): number {
|
|
76
|
+
return index;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './table-column-configuration.module';
|
|
2
|
+
export * from './components/table-column-configuration/table-column-configuration.component';
|
|
3
|
+
export * from './components/config-column-node/config-column-node.component';
|
|
4
|
+
export * from './models/table-column-configuration.models';
|
|
5
|
+
export * from './services/table-column-configuration.service';
|