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
package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<div class="cc-btn-dropdown-container">
|
|
2
|
+
<!-- Main Toggle Button -->
|
|
3
|
+
<lib-button
|
|
4
|
+
[variant]="variant"
|
|
5
|
+
[disabled]="disabled"
|
|
6
|
+
(click)="toggleDropdown($event)">
|
|
7
|
+
<span class="cc-btn-dropdown-content">
|
|
8
|
+
{{ label }}
|
|
9
|
+
<i *ngIf="icon" [class]="icon" class="cc-btn-dropdown-icon"></i>
|
|
10
|
+
</span>
|
|
11
|
+
</lib-button>
|
|
12
|
+
|
|
13
|
+
<!-- Dropdown Menu -->
|
|
14
|
+
<div class="cc-dropdown-menu" [ngClass]="'cc-dropdown-menu--' + menuTheme" *ngIf="isOpen">
|
|
15
|
+
<button
|
|
16
|
+
type="button"
|
|
17
|
+
class="cc-dropdown-item"
|
|
18
|
+
*ngFor="let action of actions"
|
|
19
|
+
[disabled]="action.disabled"
|
|
20
|
+
[ngClass]="action.variant ? 'cc-dropdown-item--' + action.variant : (action.color === 'red' || action.color === 'danger') ? 'cc-dropdown-item--danger' : ''"
|
|
21
|
+
[style.color]="action.color && !action.variant && action.color !== 'red' && action.color !== 'danger' ? action.color : null"
|
|
22
|
+
(click)="onActionItemClick(action, $event)">
|
|
23
|
+
<i *ngIf="action.icon" [class]="action.icon" class="cc-dropdown-item-icon"></i>
|
|
24
|
+
<span>{{ action.label }}</span>
|
|
25
|
+
</button>
|
|
26
|
+
<div class="cc-dropdown-empty" *ngIf="!actions || actions.length === 0">
|
|
27
|
+
No actions available
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<!-- Confirmation Modal for Critical Actions -->
|
|
33
|
+
<cc-confirmation-modal
|
|
34
|
+
*ngIf="isConfirmModalOpen"
|
|
35
|
+
[isOpen]="isConfirmModalOpen"
|
|
36
|
+
[config]="confirmConfig!"
|
|
37
|
+
(confirm)="invokePendingAction()"
|
|
38
|
+
(close)="closeConfirmModal()"
|
|
39
|
+
(cancel)="closeConfirmModal()">
|
|
40
|
+
<p>{{ confirmMessage }}</p>
|
|
41
|
+
</cc-confirmation-modal>
|
package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
.cc-btn-dropdown-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
|
|
5
|
+
.cc-btn-dropdown-content {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 0.5rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.cc-btn-dropdown-icon {
|
|
12
|
+
font-size: 0.85em;
|
|
13
|
+
margin-left: 2px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.cc-dropdown-menu {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: calc(100% + 4px);
|
|
20
|
+
right: 0; // Align right edge
|
|
21
|
+
z-index: 1000;
|
|
22
|
+
min-width: 140px;
|
|
23
|
+
border-radius: var(--cc-btn-dropdown-radius, 4px);
|
|
24
|
+
padding: 0.25rem 0;
|
|
25
|
+
font-family: var(--cc-btn-font-family, 'Inter', sans-serif);
|
|
26
|
+
font-size: var(--cc-btn-font-size, 0.875rem);
|
|
27
|
+
|
|
28
|
+
/* ------------------------------ */
|
|
29
|
+
/* Light vs Dark Global Container */
|
|
30
|
+
/* ------------------------------ */
|
|
31
|
+
&--light {
|
|
32
|
+
background-color: var(--cc-btn-dropdown-light-bg, #ffffff);
|
|
33
|
+
border: var(--cc-btn-dropdown-border-light, 1px solid #e0e0e0);
|
|
34
|
+
box-shadow: var(--cc-btn-dropdown-shadow-light, 0 4px 6px rgba(0, 0, 0, 0.1));
|
|
35
|
+
|
|
36
|
+
.cc-dropdown-item {
|
|
37
|
+
color: var(--cc-btn-dropdown-light-item-color, #333333);
|
|
38
|
+
&:hover:not(:disabled) {
|
|
39
|
+
background-color: var(--cc-btn-dropdown-light-item-hover-bg, #f5f5f5);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.cc-dropdown-empty {
|
|
44
|
+
color: #888888;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&--dark {
|
|
49
|
+
background-color: var(--cc-btn-dropdown-dark-bg, #1a1a1a);
|
|
50
|
+
border: var(--cc-btn-dropdown-border-dark, 1px solid #444444);
|
|
51
|
+
box-shadow: var(--cc-btn-dropdown-shadow-dark, 0 4px 6px rgba(0, 0, 0, 0.5));
|
|
52
|
+
|
|
53
|
+
.cc-dropdown-item {
|
|
54
|
+
color: var(--cc-btn-dropdown-dark-item-color, #ffffff);
|
|
55
|
+
&:hover:not(:disabled) {
|
|
56
|
+
background-color: var(--cc-btn-dropdown-dark-item-hover-bg, #2d2d2d);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cc-dropdown-empty {
|
|
61
|
+
color: #bbbbbb;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ------------------------------ */
|
|
66
|
+
/* Shared Item Styles */
|
|
67
|
+
/* ------------------------------ */
|
|
68
|
+
.cc-dropdown-empty {
|
|
69
|
+
padding: 0.5rem 1rem;
|
|
70
|
+
font-style: italic;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.cc-dropdown-item {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
width: 100%;
|
|
77
|
+
padding: 0.5rem 1rem;
|
|
78
|
+
border: none;
|
|
79
|
+
background: transparent;
|
|
80
|
+
text-align: left;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
transition: background-color 0.2s, color 0.2s;
|
|
83
|
+
|
|
84
|
+
&:disabled {
|
|
85
|
+
opacity: 0.5;
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.cc-dropdown-item-icon {
|
|
90
|
+
margin-right: 0.5rem;
|
|
91
|
+
width: 1rem;
|
|
92
|
+
text-align: center;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* ------------------------------ */
|
|
96
|
+
/* Explicit Action Variants */
|
|
97
|
+
/* ------------------------------ */
|
|
98
|
+
&--primary {
|
|
99
|
+
background-color: var(--cc-btn-dropdown-primary-bg, #262125);
|
|
100
|
+
color: var(--cc-btn-dropdown-primary-color, #ffffff);
|
|
101
|
+
&:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-primary-hover, #3d353b); }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&--warning {
|
|
105
|
+
background-color: var(--cc-btn-dropdown-warning-bg, #F9C80E);
|
|
106
|
+
color: var(--cc-btn-dropdown-warning-color, #000000);
|
|
107
|
+
&:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-warning-hover, #ebd573); }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&--danger {
|
|
111
|
+
background-color: var(--cc-btn-dropdown-danger-bg, #E63E30);
|
|
112
|
+
color: var(--cc-btn-dropdown-danger-color, #ffffff);
|
|
113
|
+
&:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-danger-hover, #c93528); }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&--success {
|
|
117
|
+
background-color: var(--cc-btn-dropdown-success-bg, #16A34A);
|
|
118
|
+
color: var(--cc-btn-dropdown-success-color, #ffffff);
|
|
119
|
+
&:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-success-hover, #148f41); }
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&--secondary {
|
|
123
|
+
background-color: var(--cc-btn-dropdown-secondary-bg, #E8EAED);
|
|
124
|
+
color: var(--cc-btn-dropdown-secondary-color, #000000);
|
|
125
|
+
&:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-secondary-hover, #d1d5db); }
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&--outline {
|
|
129
|
+
background-color: var(--cc-btn-dropdown-outline-bg, transparent);
|
|
130
|
+
color: var(--cc-btn-dropdown-outline-color, #000000);
|
|
131
|
+
border: 1px solid var(--cc-btn-dropdown-outline-color, #000000); // Usually actions don't have borders, but adding for completeness
|
|
132
|
+
&:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-outline-hover, rgba(0,0,0,0.05)); }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
Output,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
HostListener,
|
|
7
|
+
ElementRef
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { Router } from '@angular/router';
|
|
10
|
+
import { HttpClient } from '@angular/common/http';
|
|
11
|
+
import { DropdownAction } from '../../button-dropdown.models';
|
|
12
|
+
import { ButtonVariant } from '../../../button/button.models';
|
|
13
|
+
import { ConfirmationModalConfig } from '../../../confirmation-modal/confirmation-modal.models';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'lib-button-dropdown',
|
|
17
|
+
templateUrl: './button-dropdown.component.html',
|
|
18
|
+
styleUrls: ['./button-dropdown.component.scss'],
|
|
19
|
+
standalone: false
|
|
20
|
+
})
|
|
21
|
+
export class ButtonDropdownComponent {
|
|
22
|
+
@Input() label: string = 'Actions';
|
|
23
|
+
@Input() variant: ButtonVariant = 'primary';
|
|
24
|
+
@Input() menuTheme: 'light' | 'dark' = 'light';
|
|
25
|
+
@Input() icon: string = 'fa fa-chevron-down';
|
|
26
|
+
@Input() actions: DropdownAction[] = [];
|
|
27
|
+
@Input() data: any = null;
|
|
28
|
+
@Input() disabled: boolean = false;
|
|
29
|
+
|
|
30
|
+
@Output() apiActionStart = new EventEmitter<DropdownAction>();
|
|
31
|
+
@Output() apiActionSuccess = new EventEmitter<{ action: DropdownAction, response: any }>();
|
|
32
|
+
@Output() apiActionError = new EventEmitter<{ action: DropdownAction, error: any }>();
|
|
33
|
+
@Output() actionClick = new EventEmitter<{ action: DropdownAction, data: any }>();
|
|
34
|
+
|
|
35
|
+
isOpen = false;
|
|
36
|
+
isConfirmModalOpen = false;
|
|
37
|
+
pendingAction: DropdownAction | null = null;
|
|
38
|
+
confirmConfig: ConfirmationModalConfig | null = null;
|
|
39
|
+
confirmMessage: string = '';
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
private elementRef: ElementRef,
|
|
43
|
+
private router: Router,
|
|
44
|
+
private http: HttpClient
|
|
45
|
+
) {}
|
|
46
|
+
|
|
47
|
+
@HostListener('document:click', ['$event'])
|
|
48
|
+
onClickOutside(event: Event) {
|
|
49
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
50
|
+
this.isOpen = false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
toggleDropdown(event: Event) {
|
|
55
|
+
if (this.disabled) return;
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
this.isOpen = !this.isOpen;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
onActionItemClick(action: DropdownAction, event: Event) {
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
this.isOpen = false;
|
|
63
|
+
|
|
64
|
+
if (action.disabled) return;
|
|
65
|
+
|
|
66
|
+
if (action.confirmationNeeded) {
|
|
67
|
+
this.pendingAction = action;
|
|
68
|
+
|
|
69
|
+
// Smart inference for "delete" actions
|
|
70
|
+
const isDelete = action.apiMethod === 'DELETE' ||
|
|
71
|
+
action.variant === 'danger' ||
|
|
72
|
+
action.color === 'red' ||
|
|
73
|
+
action.label.toLowerCase().includes('delete');
|
|
74
|
+
|
|
75
|
+
// Apply intelligent fallbacks based on action intent
|
|
76
|
+
this.confirmMessage = action.confirmationMessage || (isDelete
|
|
77
|
+
? 'Are you sure you want to delete this item? This action cannot be undone.'
|
|
78
|
+
: 'Are you sure you want to proceed?');
|
|
79
|
+
|
|
80
|
+
this.confirmConfig = {
|
|
81
|
+
title: action.confirmationTitle || (isDelete ? 'Confirm Deletion' : 'Please Confirm'),
|
|
82
|
+
icon: { type: 'material', value: 'warning', color: isDelete ? '#E63E30' : '#F9C80E' },
|
|
83
|
+
confirmButton: {
|
|
84
|
+
label: isDelete ? 'Delete' : 'Confirm',
|
|
85
|
+
type: isDelete ? 'danger' : 'primary'
|
|
86
|
+
},
|
|
87
|
+
cancelButton: {
|
|
88
|
+
show: true,
|
|
89
|
+
label: 'Cancel'
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
this.isConfirmModalOpen = true;
|
|
93
|
+
} else {
|
|
94
|
+
this.executeAction(action);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private executeAction(action: DropdownAction) {
|
|
99
|
+
this.actionClick.emit({ action, data: this.data });
|
|
100
|
+
|
|
101
|
+
if (action.type === 'callback' && action.callback) {
|
|
102
|
+
action.callback(this.data);
|
|
103
|
+
} else if (action.type === 'route' && action.route) {
|
|
104
|
+
this.navigateToRoute(action.route, this.data);
|
|
105
|
+
} else if (action.type === 'api' && action.apiUrl) {
|
|
106
|
+
this.executeApiCall(action);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private navigateToRoute(routePattern: string, rowData: any) {
|
|
111
|
+
let finalRoute = routePattern;
|
|
112
|
+
// Simple parameter replacement like smart-table: /users/:id -> /users/123
|
|
113
|
+
if (rowData) {
|
|
114
|
+
Object.keys(rowData).forEach(key => {
|
|
115
|
+
finalRoute = finalRoute.replace(`:${key}`, rowData[key]);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
this.router.navigate([finalRoute]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private executeApiCall(action: DropdownAction) {
|
|
122
|
+
this.apiActionStart.emit(action);
|
|
123
|
+
|
|
124
|
+
let url = action.apiUrl!;
|
|
125
|
+
if (this.data) {
|
|
126
|
+
Object.keys(this.data).forEach(key => {
|
|
127
|
+
url = url.replace(`:${key}`, this.data[key]);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const method = (action.apiMethod || 'GET').toUpperCase();
|
|
132
|
+
let request$;
|
|
133
|
+
|
|
134
|
+
if (method === 'GET') request$ = this.http.get(url);
|
|
135
|
+
else if (method === 'POST') request$ = this.http.post(url, action.apiPayload || this.data);
|
|
136
|
+
else if (method === 'PUT') request$ = this.http.put(url, action.apiPayload || this.data);
|
|
137
|
+
else if (method === 'DELETE') request$ = this.http.delete(url);
|
|
138
|
+
else if (method === 'PATCH') request$ = this.http.patch(url, action.apiPayload || this.data);
|
|
139
|
+
else request$ = this.http.get(url); // fallback
|
|
140
|
+
|
|
141
|
+
request$.subscribe({
|
|
142
|
+
next: (res) => this.apiActionSuccess.emit({ action, response: res }),
|
|
143
|
+
error: (err) => this.apiActionError.emit({ action, error: err })
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
invokePendingAction() {
|
|
148
|
+
if (this.pendingAction) {
|
|
149
|
+
this.executeAction(this.pendingAction);
|
|
150
|
+
}
|
|
151
|
+
this.closeConfirmModal();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
closeConfirmModal() {
|
|
155
|
+
this.isConfirmModalOpen = false;
|
|
156
|
+
this.pendingAction = null;
|
|
157
|
+
this.confirmConfig = null;
|
|
158
|
+
this.confirmMessage = '';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<form [formGroup]="form" class="configurable-form-container" *ngIf="form">
|
|
2
|
+
|
|
3
|
+
<ng-container *ngFor="let section of sections">
|
|
4
|
+
|
|
5
|
+
<!-- Repeater Section -->
|
|
6
|
+
<div *ngIf="section.isRepeater; else normalSection"
|
|
7
|
+
[ngClass]="section.noCardLayout ? 'section-no-card' : 'section-card'">
|
|
8
|
+
<div class="section-header" *ngIf="section.sectionTitle">
|
|
9
|
+
<h3 class="section-title">{{ section.sectionTitle }}</h3>
|
|
10
|
+
<button *ngIf="section.collapsible" mat-icon-button type="button" (click)="toggleSection(section)">
|
|
11
|
+
<mat-icon>{{ section.collapsed ? 'expand_more' : 'expand_less' }}</mat-icon>
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div [formArrayName]="section.formArrayName || 'items'" *ngIf="!section.collapsed">
|
|
16
|
+
<div *ngFor="let item of getFormArray(section.formArrayName!).controls; let i = index"
|
|
17
|
+
[formGroupName]="i" class="repeater-item">
|
|
18
|
+
<div class="repeater-item-header" *ngIf="getFormArray(section.formArrayName!).length > 1">
|
|
19
|
+
<span class="text-small">{{ section.repeaterItemLabel || labels.repeaterItemDefaultLabel }} {{i
|
|
20
|
+
+ 1}}</span>
|
|
21
|
+
<button mat-icon-button color="warn" type="button"
|
|
22
|
+
(click)="removeRepeaterItem(section.formArrayName!, i)"
|
|
23
|
+
[disabled]="section.minItems && getFormArray(section.formArrayName!).length <= section.minItems">
|
|
24
|
+
<mat-icon>delete</mat-icon>
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- Fields Grid -->
|
|
29
|
+
<div class="form-grid">
|
|
30
|
+
<div *ngFor="let field of section.fields" [ngClass]="['form-col', field.class || 'col-12']"
|
|
31
|
+
[hidden]="!isFieldVisible(field)">
|
|
32
|
+
<ng-container
|
|
33
|
+
*ngTemplateOutlet="fieldTemplate; context: {field: field, group: item}"></ng-container>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="repeater-separator" *ngIf="i < getFormArray(section.formArrayName!).length - 1"></div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<button mat-button color="primary" type="button" (click)="addRepeaterItem(section)" class="add-btn"
|
|
42
|
+
*ngIf="!section.collapsed"
|
|
43
|
+
[disabled]="section.maxItems && getFormArray(section.formArrayName!).length >= section.maxItems">
|
|
44
|
+
<mat-icon>add_circle_outline</mat-icon> {{ section.addLabel || labels.addMoreDefaultLabel }}
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<!-- Normal Section -->
|
|
49
|
+
<ng-template #normalSection>
|
|
50
|
+
<div [ngClass]="section.noCardLayout ? 'section-no-card' : 'section-card'">
|
|
51
|
+
<div class="section-header" *ngIf="section.sectionTitle">
|
|
52
|
+
<h3 class="section-title">{{ section.sectionTitle }}</h3>
|
|
53
|
+
<button *ngIf="section.collapsible" mat-icon-button type="button" (click)="toggleSection(section)">
|
|
54
|
+
<mat-icon>{{ section.collapsed ? 'expand_more' : 'expand_less' }}</mat-icon>
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="form-grid" *ngIf="!section.collapsed">
|
|
58
|
+
<div *ngFor="let field of section.fields" [ngClass]="['form-col', field.class || 'col-12']"
|
|
59
|
+
[hidden]="!isFieldVisible(field)">
|
|
60
|
+
<!-- Pass the root form group to the template -->
|
|
61
|
+
<ng-container
|
|
62
|
+
*ngTemplateOutlet="fieldTemplate; context: {field: field, group: form}"></ng-container>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</ng-template>
|
|
67
|
+
|
|
68
|
+
</ng-container>
|
|
69
|
+
|
|
70
|
+
</form>
|
|
71
|
+
|
|
72
|
+
<!-- Reusable Field Template -->
|
|
73
|
+
<ng-template #fieldTemplate let-field="field" let-group="group">
|
|
74
|
+
<div [formGroup]="group">
|
|
75
|
+
|
|
76
|
+
<!-- Text / Email / Number / Tel / URL (Password removed) -->
|
|
77
|
+
<div *ngIf="['text', 'email', 'number', 'tel', 'url'].includes(field.type || '')" class="field-container">
|
|
78
|
+
<div class="field-label" *ngIf="field.label">
|
|
79
|
+
{{ field.label }}
|
|
80
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="input-wrapper">
|
|
83
|
+
<input [type]="field.type" [formControlName]="field.name" [placeholder]="field.placeholder || ''"
|
|
84
|
+
[readonly]="field.readonly" class="form-input" [name]="field.name"
|
|
85
|
+
[class.is-invalid]="group.get(field.name)?.touched && group.get(field.name)?.invalid"
|
|
86
|
+
[maxlength]="field.validationRules?.maxLength || field.uiConfig?.maxCharacters">
|
|
87
|
+
<div class="input-suffix">
|
|
88
|
+
<span class="suffix-text" *ngIf="field.suffixText">{{ field.suffixText }}</span>
|
|
89
|
+
<mat-icon *ngIf="field.suffixIcon">{{ field.suffixIcon }}</mat-icon>
|
|
90
|
+
<mat-icon *ngIf="field.icon">{{ field.icon }}</mat-icon>
|
|
91
|
+
<mat-icon *ngIf="field.readonly" class="lock-icon">lock_outline</mat-icon>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<!-- Character count -->
|
|
95
|
+
<div class="char-count-row" *ngIf="field.uiConfig?.maxCharacters || field.validationRules?.maxLength">
|
|
96
|
+
<div class="hint-text" *ngIf="field.hint || field.helpText">{{ field.hint || field.helpText }}</div>
|
|
97
|
+
<div class="char-count">
|
|
98
|
+
{{ getCharacterCount(field.name) }} / {{ field.uiConfig?.maxCharacters ||
|
|
99
|
+
field.validationRules?.maxLength }} {{ labels.charactersLabel }}
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="hint-text mt-2"
|
|
103
|
+
*ngIf="(field.hint || field.helpText) && !field.uiConfig?.maxCharacters && !field.validationRules?.maxLength">
|
|
104
|
+
{{ field.hint || field.helpText }}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<!-- Password Field (Separated) -->
|
|
109
|
+
<div *ngIf="field.type === 'password'" class="field-container">
|
|
110
|
+
<div class="field-label" *ngIf="field.label">
|
|
111
|
+
{{ field.label }}
|
|
112
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="input-wrapper">
|
|
115
|
+
<input [type]="isPasswordVisible(field.name) ? 'text' : 'password'" [formControlName]="field.name"
|
|
116
|
+
[placeholder]="field.placeholder || ''" [readonly]="field.readonly" class="form-input"
|
|
117
|
+
[class.is-invalid]="group.get(field.name)?.touched && group.get(field.name)?.invalid"
|
|
118
|
+
[maxlength]="field.validationRules?.maxLength || field.uiConfig?.maxCharacters">
|
|
119
|
+
<div class="input-suffix">
|
|
120
|
+
<span class="suffix-text" *ngIf="field.suffixText">{{ field.suffixText }}</span>
|
|
121
|
+
<mat-icon *ngIf="field.suffixIcon">{{ field.suffixIcon }}</mat-icon>
|
|
122
|
+
<mat-icon *ngIf="field.icon">{{ field.icon }}</mat-icon>
|
|
123
|
+
<mat-icon *ngIf="field.readonly" class="lock-icon">lock_outline</mat-icon>
|
|
124
|
+
<mat-icon class="password-toggle-icon" (click)="togglePassword(field.name)">
|
|
125
|
+
{{ isPasswordVisible(field.name) ? 'visibility' : 'visibility_off' }}
|
|
126
|
+
</mat-icon>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
<!-- Character count -->
|
|
130
|
+
<div class="char-count-row" *ngIf="field.uiConfig?.maxCharacters || field.validationRules?.maxLength">
|
|
131
|
+
<div class="hint-text" *ngIf="field.hint || field.helpText">{{ field.hint || field.helpText }}</div>
|
|
132
|
+
<div class="char-count">
|
|
133
|
+
{{ getCharacterCount(field.name) }} / {{ field.uiConfig?.maxCharacters ||
|
|
134
|
+
field.validationRules?.maxLength }} {{ labels.charactersLabel }}
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="hint-text mt-2"
|
|
138
|
+
*ngIf="(field.hint || field.helpText) && !field.uiConfig?.maxCharacters && !field.validationRules?.maxLength">
|
|
139
|
+
{{ field.hint || field.helpText }}
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<!-- Textarea -->
|
|
144
|
+
<div *ngIf="field.type === 'textarea'" class="field-container">
|
|
145
|
+
<div class="field-label" *ngIf="field.label">
|
|
146
|
+
{{ field.label }}
|
|
147
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
148
|
+
</div>
|
|
149
|
+
<textarea [formControlName]="field.name" [placeholder]="field.placeholder || ''" [readonly]="field.readonly"
|
|
150
|
+
class="form-input form-textarea" rows="4"
|
|
151
|
+
[class.is-invalid]="group.get(field.name)?.touched && group.get(field.name)?.invalid"
|
|
152
|
+
[maxlength]="field.validationRules?.maxLength || field.uiConfig?.maxCharacters"></textarea>
|
|
153
|
+
<!-- Character count -->
|
|
154
|
+
<div class="char-count-row" *ngIf="field.uiConfig?.maxCharacters || field.validationRules?.maxLength">
|
|
155
|
+
<div class="hint-text" *ngIf="field.hint || field.helpText">{{ field.hint || field.helpText }}</div>
|
|
156
|
+
<div class="char-count">
|
|
157
|
+
{{ getCharacterCount(field.name) }} / {{ field.uiConfig?.maxCharacters ||
|
|
158
|
+
field.validationRules?.maxLength }} {{ labels.charactersLabel }}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="hint-text mt-2"
|
|
162
|
+
*ngIf="(field.hint || field.helpText) && !field.uiConfig?.maxCharacters && !field.validationRules?.maxLength">
|
|
163
|
+
{{ field.hint || field.helpText }}
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<!-- Select / Dropdown -->
|
|
168
|
+
<div *ngIf="field.type === 'select' || field.type === 'dropdown'" class="field-container">
|
|
169
|
+
<div class="field-label" *ngIf="field.label">
|
|
170
|
+
{{ field.label }}
|
|
171
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
172
|
+
</div>
|
|
173
|
+
<select [formControlName]="field.name" class="form-input"
|
|
174
|
+
[class.is-invalid]="group.get(field.name)?.touched && group.get(field.name)?.invalid">
|
|
175
|
+
<option value="" disabled selected *ngIf="field.placeholder">{{ field.placeholder }}</option>
|
|
176
|
+
<option value="" disabled selected *ngIf="!field.placeholder">{{ labels.selectDefaultPlaceholder }}
|
|
177
|
+
</option>
|
|
178
|
+
<option *ngFor="let opt of getFieldOptions(field)" [value]="opt.value">{{ opt.label }}</option>
|
|
179
|
+
</select>
|
|
180
|
+
<div class="hint-text mt-2" *ngIf="field.hint || field.helpText">{{ field.hint || field.helpText }}</div>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<!-- Date -->
|
|
184
|
+
<div *ngIf="field.type === 'date'" class="field-container">
|
|
185
|
+
<div class="field-label" *ngIf="field.label">
|
|
186
|
+
{{ field.label }}
|
|
187
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
188
|
+
</div>
|
|
189
|
+
<div class="relative">
|
|
190
|
+
<input matInput [matDatepicker]="picker" [formControlName]="field.name"
|
|
191
|
+
[placeholder]="field.placeholder || ''" class="form-input"
|
|
192
|
+
[class.is-invalid]="group.get(field.name)?.touched && group.get(field.name)?.invalid">
|
|
193
|
+
<mat-datepicker-toggle matSuffix [for]="picker" class="date-toggle"></mat-datepicker-toggle>
|
|
194
|
+
<mat-datepicker #picker></mat-datepicker>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="hint-text mt-2" *ngIf="field.hint || field.helpText">{{ field.hint || field.helpText }}</div>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<!-- Radio -->
|
|
200
|
+
<div *ngIf="field.type === 'radio'" class="radio-group-container"
|
|
201
|
+
[class.is-invalid]="group.get(field.name)?.touched && group.get(field.name)?.invalid">
|
|
202
|
+
<label class="field-label">
|
|
203
|
+
{{ field.label }}
|
|
204
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
205
|
+
</label>
|
|
206
|
+
<mat-radio-group [formControlName]="field.name" class="radio-group">
|
|
207
|
+
<mat-radio-button *ngFor="let opt of getFieldOptions(field)" [value]="opt.value" class="radio-button">
|
|
208
|
+
{{ opt.label }}
|
|
209
|
+
</mat-radio-button>
|
|
210
|
+
</mat-radio-group>
|
|
211
|
+
<div class="hint-text mt-2" *ngIf="field.hint || field.helpText">{{ field.hint || field.helpText }}</div>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<!-- Composite Field (Sub-groups) -->
|
|
215
|
+
<div *ngIf="field.type === 'composite'" class="field-container">
|
|
216
|
+
<div class="field-label" *ngIf="field.label">
|
|
217
|
+
{{ field.label }}
|
|
218
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
219
|
+
</div>
|
|
220
|
+
<div class="composite-container">
|
|
221
|
+
<ng-container *ngFor="let sub of field.subFields; let last = last">
|
|
222
|
+
<div class="composite-sub-field" style="flex: 1;">
|
|
223
|
+
<div class="field-label" *ngIf="sub.label"
|
|
224
|
+
style="font-size: 0.75rem; font-weight: normal; margin-bottom: 0.25rem;">
|
|
225
|
+
{{ sub.label }}
|
|
226
|
+
</div>
|
|
227
|
+
<div class="input-wrapper">
|
|
228
|
+
<input [type]="sub.type" [formControlName]="sub.name" [placeholder]="sub.placeholder || ''"
|
|
229
|
+
[readonly]="sub.readonly" class="form-input"
|
|
230
|
+
[class.is-invalid]="group.get(sub.name)?.touched && group.get(sub.name)?.invalid">
|
|
231
|
+
<div class="input-suffix" [class.color-suffix]="sub.suffixText === '%'">
|
|
232
|
+
<span class="suffix-text" *ngIf="sub.suffixText">{{ sub.suffixText }}</span>
|
|
233
|
+
<mat-icon *ngIf="sub.readonly" class="lock-icon">lock_outline</mat-icon>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
<!-- Adjust separator alignment if labels are present -->
|
|
238
|
+
<span class="separator" *ngIf="!last && field.separator"
|
|
239
|
+
[style.padding-top]="sub.label ? '1.25rem' : '0'">{{ field.separator }}</span>
|
|
240
|
+
</ng-container>
|
|
241
|
+
</div>
|
|
242
|
+
<div class="hint-text mt-2" *ngIf="field.hint || field.helpText">{{ field.hint || field.helpText }}</div>
|
|
243
|
+
<div class="error-text text-danger text-small mt-1" *ngIf="group.errors?.['invalid_minMax_' + field.name]">
|
|
244
|
+
{{ labels.errorMinValue }}
|
|
245
|
+
</div>
|
|
246
|
+
<div class="error-text text-danger text-small mt-1"
|
|
247
|
+
*ngIf="group.errors?.['invalid_percentageTotal_' + field.name]">
|
|
248
|
+
{{ labels.errorPercentageTotal }}
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<!-- File Upload -->
|
|
254
|
+
<div *ngIf="field.type === 'file'" class="field-container">
|
|
255
|
+
<div class="field-label" *ngIf="field.label">
|
|
256
|
+
{{ field.label }}
|
|
257
|
+
<span class="text-danger" *ngIf="field.required || field.mandatory">*</span>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<!-- Upload Box -->
|
|
261
|
+
<div class="upload-box" (click)="fileInput.click()"
|
|
262
|
+
[class.is-invalid]="group.get(field.name)?.touched && group.get(field.name)?.invalid"
|
|
263
|
+
*ngIf="!field.uploadedFiles || field.uploadedFiles.length === 0 || field.multiple">
|
|
264
|
+
<mat-icon class="upload-icon">cloud_upload</mat-icon>
|
|
265
|
+
<div class="upload-text">{{ labels.uploadDragDropText }}</div>
|
|
266
|
+
<div class="upload-hint">{{ labels.uploadHint }}</div>
|
|
267
|
+
<input #fileInput type="file" [attr.multiple]="field.multiple ? true : null" [attr.accept]="field.accept"
|
|
268
|
+
(change)="onFileChange($event, field)" style="display: none;">
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<!-- Uploaded Files List -->
|
|
272
|
+
<div class="uploaded-files-list" *ngIf="field.uploadedFiles && field.uploadedFiles.length > 0">
|
|
273
|
+
<div class="uploaded-file-item" *ngFor="let file of field.uploadedFiles; let i = index">
|
|
274
|
+
<div class="file-icon">
|
|
275
|
+
<mat-icon class="pdf-icon" *ngIf="file.type === 'application/pdf'">picture_as_pdf</mat-icon>
|
|
276
|
+
<mat-icon class="doc-icon"
|
|
277
|
+
*ngIf="file.type.includes('word') || file.type.includes('document')">description</mat-icon>
|
|
278
|
+
<mat-icon class="img-icon" *ngIf="file.type.includes('image')">image</mat-icon>
|
|
279
|
+
<mat-icon class="file-icon-default"
|
|
280
|
+
*ngIf="!file.type.includes('pdf') && !file.type.includes('word') && !file.type.includes('document') && !file.type.includes('image')">insert_drive_file</mat-icon>
|
|
281
|
+
</div>
|
|
282
|
+
<div class="file-info">
|
|
283
|
+
<div class="file-name">{{ file.name }}</div>
|
|
284
|
+
<div class="file-size">{{ (file.size / 1024).toFixed(2) }} KB</div>
|
|
285
|
+
</div>
|
|
286
|
+
<button mat-icon-button color="warn" type="button" (click)="removeFile(field, i)"
|
|
287
|
+
class="remove-file-btn">
|
|
288
|
+
<mat-icon>close</mat-icon>
|
|
289
|
+
</button>
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
</div>
|
|
294
|
+
</ng-template>
|