commons-shared-web-ui 0.0.62 → 0.0.63
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/fesm2022/commons-shared-web-ui.mjs +16153 -0
- package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
- package/index.d.ts +5033 -0
- package/package.json +34 -53
- package/.claude/settings.local.json +0 -10
- package/documentation/alert.md +0 -123
- package/documentation/button-dropdown.md +0 -126
- package/documentation/button.md +0 -184
- package/documentation/cards-usage-guidelines.md +0 -131
- package/documentation/configurable-form.md +0 -605
- package/documentation/confirmation-modal.md +0 -250
- package/documentation/filter-sidebar.md +0 -178
- package/documentation/filter-table-selector.md +0 -228
- package/documentation/form-builder.md +0 -599
- package/documentation/form-components.md +0 -384
- package/documentation/form-field-configuration.md +0 -250
- package/documentation/nav.md +0 -427
- package/documentation/pagination.md +0 -181
- package/documentation/side-nav-documentation.md +0 -169
- package/documentation/smart-form.md +0 -2819
- package/documentation/smart-table.md +0 -1297
- package/documentation/snackbar.md +0 -118
- package/documentation/style-externalization.md +0 -88
- package/documentation/summary-card.md +0 -279
- package/documentation/table-column-configuration.md +0 -221
- package/documentation/time-picker.md +0 -274
- package/ng-package.json +0 -30
- package/src/lib/modules/alert/alert.models.ts +0 -6
- package/src/lib/modules/alert/alert.module.ts +0 -16
- package/src/lib/modules/alert/components/alert/alert.component.html +0 -27
- package/src/lib/modules/alert/components/alert/alert.component.scss +0 -92
- package/src/lib/modules/alert/components/alert/alert.component.ts +0 -81
- package/src/lib/modules/button/button.models.ts +0 -13
- package/src/lib/modules/button/button.module.ts +0 -16
- package/src/lib/modules/button/components/button/button.component.html +0 -22
- package/src/lib/modules/button/components/button/button.component.scss +0 -92
- package/src/lib/modules/button/components/button/button.component.ts +0 -67
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +0 -26
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +0 -22
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +0 -41
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +0 -135
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +0 -160
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +0 -294
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +0 -503
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +0 -628
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +0 -154
- package/src/lib/modules/configurable-form/configurable-form.model.ts +0 -131
- package/src/lib/modules/configurable-form/configurable-form.module.ts +0 -19
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +0 -77
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +0 -395
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +0 -266
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +0 -71
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +0 -20
- package/src/lib/modules/filter/components/filter/filter.component.html +0 -131
- package/src/lib/modules/filter/components/filter/filter.component.scss +0 -245
- package/src/lib/modules/filter/components/filter/filter.component.ts +0 -216
- package/src/lib/modules/filter/filter.models.ts +0 -88
- package/src/lib/modules/filter/filter.module.ts +0 -24
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +0 -112
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +0 -186
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +0 -163
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +0 -95
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +0 -24
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +0 -73
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +0 -321
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +0 -361
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +0 -91
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +0 -22
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +0 -63
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +0 -496
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +0 -445
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +0 -75
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +0 -210
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +0 -55
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +0 -25
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +0 -82
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +0 -95
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +0 -20
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +0 -37
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +0 -94
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +0 -46
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +0 -102
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +0 -50
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +0 -35
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +0 -67
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +0 -34
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +0 -68
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +0 -113
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +0 -74
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +0 -533
- package/src/lib/modules/form-builder/form-builder.module.ts +0 -36
- package/src/lib/modules/form-builder/index.ts +0 -9
- package/src/lib/modules/form-builder/models/builder.models.ts +0 -7
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +0 -38
- package/src/lib/modules/form-builder/models/field-selection.models.ts +0 -51
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +0 -258
- package/src/lib/modules/form-builder/services/field-selection.service.ts +0 -299
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +0 -670
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +0 -10
- package/src/lib/modules/form-builder/utils/constants.ts +0 -43
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +0 -29
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +0 -111
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +0 -207
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +0 -35
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +0 -42
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +0 -115
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +0 -267
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +0 -45
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +0 -74
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +0 -252
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +0 -377
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +0 -53
- package/src/lib/modules/form-components/components/input/input.component.html +0 -51
- package/src/lib/modules/form-components/components/input/input.component.scss +0 -128
- package/src/lib/modules/form-components/components/input/input.component.ts +0 -250
- package/src/lib/modules/form-components/components/input/input.models.ts +0 -55
- package/src/lib/modules/form-components/components/radio/radio.component.html +0 -22
- package/src/lib/modules/form-components/components/radio/radio.component.scss +0 -107
- package/src/lib/modules/form-components/components/radio/radio.component.ts +0 -181
- package/src/lib/modules/form-components/components/radio/radio.models.ts +0 -39
- package/src/lib/modules/form-components/components/search/search.component.html +0 -15
- package/src/lib/modules/form-components/components/search/search.component.scss +0 -87
- package/src/lib/modules/form-components/components/search/search.component.ts +0 -213
- package/src/lib/modules/form-components/components/search/search.models.ts +0 -40
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +0 -15
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +0 -81
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +0 -166
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +0 -27
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +0 -22
- package/src/lib/modules/form-components/form-components.module.ts +0 -42
- package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +0 -89
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +0 -68
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +0 -73
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +0 -34
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +0 -78
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +0 -83
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +0 -94
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +0 -38
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +0 -42
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +0 -92
- package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +0 -23
- package/src/lib/modules/form-field-configuration/index.ts +0 -7
- package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +0 -62
- package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +0 -159
- package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +0 -228
- package/src/lib/modules/material/material.module.ts +0 -94
- package/src/lib/modules/nav/components/nav/nav.component.html +0 -34
- package/src/lib/modules/nav/components/nav/nav.component.scss +0 -171
- package/src/lib/modules/nav/components/nav/nav.component.ts +0 -82
- package/src/lib/modules/nav/nav.models.ts +0 -31
- package/src/lib/modules/nav/nav.module.ts +0 -17
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +0 -52
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +0 -155
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +0 -109
- package/src/lib/modules/pagination/pagination.module.ts +0 -17
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +0 -56
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +0 -342
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +0 -135
- package/src/lib/modules/side-nav/side-nav.models.ts +0 -38
- package/src/lib/modules/side-nav/side-nav.module.ts +0 -16
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +0 -1379
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2255
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -3174
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -67
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +0 -209
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +0 -142
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +0 -253
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +0 -689
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +0 -1134
- package/src/lib/modules/smart-form/index.ts +0 -10
- package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -803
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -22
- package/src/lib/modules/smart-form/services/expression.service.ts +0 -75
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +0 -67
- package/src/lib/modules/smart-form/smart-form.examples.ts +0 -1324
- package/src/lib/modules/smart-form/smart-form.module.ts +0 -40
- package/src/lib/modules/smart-form/utils/translation.utils.ts +0 -82
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +0 -25
- package/src/lib/modules/smart-form/utils/validation.utils.ts +0 -98
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +0 -283
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +0 -685
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +0 -1219
- package/src/lib/modules/smart-table/models/table-config.model.ts +0 -247
- package/src/lib/modules/smart-table/smart-table.module.ts +0 -30
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +0 -28
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +0 -18
- package/src/lib/modules/snackbar/components/snackbar.component.html +0 -41
- package/src/lib/modules/snackbar/components/snackbar.component.scss +0 -99
- package/src/lib/modules/snackbar/components/snackbar.component.ts +0 -18
- package/src/lib/modules/snackbar/models/snackbar.models.ts +0 -10
- package/src/lib/modules/snackbar/services/snackbar.service.ts +0 -40
- package/src/lib/modules/snackbar/snackbar.module.ts +0 -11
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +0 -47
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +0 -199
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +0 -126
- package/src/lib/modules/summary-card/summary-card.module.ts +0 -18
- package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +0 -53
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +0 -47
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +0 -50
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +0 -33
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +0 -30
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +0 -36
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +0 -78
- package/src/lib/modules/table-column-configuration/index.ts +0 -5
- package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +0 -20
- package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +0 -77
- package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +0 -21
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.html +0 -37
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.scss +0 -102
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.ts +0 -178
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.html +0 -78
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.scss +0 -226
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.ts +0 -595
- package/src/lib/modules/time-picker/models/time-picker.models.ts +0 -49
- package/src/lib/modules/time-picker/time-picker.module.ts +0 -23
- package/src/lib/shared-ui.module.ts +0 -55
- package/src/lib/utils/constants.ts +0 -11
- package/src/lib/utils/storage.utils.ts +0 -37
- package/src/lib/utils/string.utils.ts +0 -23
- package/src/lib/utils/translation.utils.ts +0 -87
- package/src/public-api.ts +0 -127
- package/tsconfig.lib.json +0 -15
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export interface ConfirmationModalConfig {
|
|
2
|
-
// Header
|
|
3
|
-
title: string;
|
|
4
|
-
headerTheme?: 'light' | 'dark';
|
|
5
|
-
icon?: string | {
|
|
6
|
-
type: 'material' | 'custom';
|
|
7
|
-
value: string;
|
|
8
|
-
color?: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// Modal appearance
|
|
12
|
-
width?: string;
|
|
13
|
-
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
14
|
-
customClass?: string;
|
|
15
|
-
type?: 'modal' | 'side-panel';
|
|
16
|
-
panelPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
17
|
-
panelSpacing?: string; // e.g. "20px" or "10px 20px"
|
|
18
|
-
panelWidth?: string;
|
|
19
|
-
panelHeight?: string;
|
|
20
|
-
|
|
21
|
-
// Style Overrides
|
|
22
|
-
backgroundColor?: string;
|
|
23
|
-
borderRadius?: string;
|
|
24
|
-
borderTopLeftRadius?: string;
|
|
25
|
-
borderTopRightRadius?: string;
|
|
26
|
-
borderBottomLeftRadius?: string;
|
|
27
|
-
borderBottomRightRadius?: string;
|
|
28
|
-
padding?: string;
|
|
29
|
-
headerBackgroundColor?: string;
|
|
30
|
-
headerTextColor?: string;
|
|
31
|
-
headerBorderBottom?: string;
|
|
32
|
-
bodyTextColor?: string;
|
|
33
|
-
footerBackgroundColor?: string;
|
|
34
|
-
footerBorderTop?: string;
|
|
35
|
-
|
|
36
|
-
// Footer buttons
|
|
37
|
-
confirmButton: {
|
|
38
|
-
label: string;
|
|
39
|
-
type: 'primary' | 'danger' | 'warning';
|
|
40
|
-
disabled?: boolean;
|
|
41
|
-
loading?: boolean;
|
|
42
|
-
};
|
|
43
|
-
cancelButton?: {
|
|
44
|
-
label?: string;
|
|
45
|
-
show?: boolean;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// Custom Footer
|
|
49
|
-
customFooter?: boolean;
|
|
50
|
-
|
|
51
|
-
// Body mode: set true when projecting a lib-smart-form so the body gets form-specific layout
|
|
52
|
-
formMode?: boolean;
|
|
53
|
-
|
|
54
|
-
// Behavior
|
|
55
|
-
closeOnBackdrop?: boolean;
|
|
56
|
-
closeOnEsc?: boolean;
|
|
57
|
-
showCloseButton?: boolean;
|
|
58
|
-
showCodeSnippetButton?: boolean;
|
|
59
|
-
|
|
60
|
-
// Accessibility
|
|
61
|
-
ariaLabel?: string;
|
|
62
|
-
ariaDescribedBy?: string;
|
|
63
|
-
|
|
64
|
-
// i18n Labels
|
|
65
|
-
labels?: {
|
|
66
|
-
closeAriaLabel?: string;
|
|
67
|
-
codeSnippetAriaLabel?: string;
|
|
68
|
-
codeSnippetTitle?: string;
|
|
69
|
-
iconAltText?: string;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { ConfirmationModalComponent } from './components/confirmation-modal/confirmation-modal.component';
|
|
4
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
5
|
-
import { FormsModule } from '@angular/forms';
|
|
6
|
-
|
|
7
|
-
@NgModule({
|
|
8
|
-
declarations: [
|
|
9
|
-
ConfirmationModalComponent
|
|
10
|
-
],
|
|
11
|
-
imports: [
|
|
12
|
-
CommonModule,
|
|
13
|
-
MatIconModule, // For material icons support
|
|
14
|
-
FormsModule // For ngModel in user examples (although mostly projected content, user might need it)
|
|
15
|
-
],
|
|
16
|
-
exports: [
|
|
17
|
-
ConfirmationModalComponent
|
|
18
|
-
]
|
|
19
|
-
})
|
|
20
|
-
export class ConfirmationModalModule { }
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<div class="cc-filter-container" [class.is-open]="isOpen" [ngStyle]="containerStyles">
|
|
2
|
-
|
|
3
|
-
<!-- Trigger Button -->
|
|
4
|
-
<lib-button variant="outline" (click)="togglePanel()" class="cc-filter-trigger"
|
|
5
|
-
[class.active]="activeFilterCount > 0">
|
|
6
|
-
<span class="fas fa-filter"></span> {{ labels?.filterBtn || 'Filter' }}
|
|
7
|
-
<span *ngIf="activeFilterCount > 0" class="cc-badge">{{ activeFilterCount }}</span>
|
|
8
|
-
</lib-button>
|
|
9
|
-
|
|
10
|
-
<!-- Dropdown Panel -->
|
|
11
|
-
<div class="cc-filter-panel mat-elevation-z4" *ngIf="isOpen" (click)="$event.stopPropagation()">
|
|
12
|
-
|
|
13
|
-
<!-- Header / Tabs -->
|
|
14
|
-
<div class="cc-panel-header">
|
|
15
|
-
<div class="cc-tabs">
|
|
16
|
-
<div class="cc-tab" [class.active]="activeTab === 'filters'" (click)="setActiveTab('filters')">
|
|
17
|
-
{{ labels.filterBtn }}
|
|
18
|
-
</div>
|
|
19
|
-
<!-- Hide columns tab if no columns config provided -->
|
|
20
|
-
<div class="cc-tab" [class.active]="activeTab === 'columns'" (click)="setActiveTab('columns')"
|
|
21
|
-
*ngIf="columns?.length">
|
|
22
|
-
{{ labels.columns }}
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
<button type="button" class="cc-icon-btn" (click)="togglePanel()">
|
|
26
|
-
<span class="material-icons">close</span>
|
|
27
|
-
</button>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<!-- Filters Tab Content -->
|
|
31
|
-
<div class="cc-panel-content" *ngIf="activeTab === 'filters'">
|
|
32
|
-
|
|
33
|
-
<!-- Dynamic Items -->
|
|
34
|
-
<ng-container *ngFor="let item of config.items; trackBy: trackByFn">
|
|
35
|
-
<ng-container *ngTemplateOutlet="itemTemplate; context: { item: item }"></ng-container>
|
|
36
|
-
</ng-container>
|
|
37
|
-
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<!-- Columns Tab Content -->
|
|
41
|
-
<div class="cc-panel-content" *ngIf="activeTab === 'columns'">
|
|
42
|
-
<div class="cc-columns-actions">
|
|
43
|
-
<lib-button variant="outline" class="cc-btn-text" (click)="toggleAllColumns(true)">{{ labels.showAll
|
|
44
|
-
}}</lib-button>
|
|
45
|
-
<lib-button variant="outline" class="cc-btn-text" (click)="toggleAllColumns(false)">{{ labels.hideAll
|
|
46
|
-
}}</lib-button>
|
|
47
|
-
</div>
|
|
48
|
-
<div class="cc-columns-list">
|
|
49
|
-
<div *ngFor="let col of tempColumns" class="cc-column-item">
|
|
50
|
-
<lib-checkbox [label]="col.label" [checked]="col.visible" (checkedChange)="toggleColumn(col.id)">
|
|
51
|
-
</lib-checkbox>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<!-- Footer Actions -->
|
|
57
|
-
<div class="cc-panel-footer">
|
|
58
|
-
<lib-button variant="outline" color="warn" class="cc-btn-text text-danger" (click)="clearAll()">
|
|
59
|
-
{{ labels.clear }}
|
|
60
|
-
</lib-button>
|
|
61
|
-
<lib-button class="ms-2" variant="primary" (click)="apply()">
|
|
62
|
-
{{ labels.apply }}
|
|
63
|
-
</lib-button>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<!-- Recursive Template for Items -->
|
|
70
|
-
<ng-template #itemTemplate let-item="item">
|
|
71
|
-
<div class="cc-filter-item" [ngClass]="['type-' + item.type]"
|
|
72
|
-
[style.display]="item.visible === false ? 'none' : 'block'" [ngStyle]="item.styles">
|
|
73
|
-
|
|
74
|
-
<ng-container [ngSwitch]="item.type">
|
|
75
|
-
|
|
76
|
-
<!-- Input -->
|
|
77
|
-
<lib-input *ngSwitchCase="'input'" [config]="item.inputConfig" [label]="item.label"
|
|
78
|
-
[ngModel]="tempFilters[item.key]" (valueChange)="onFilterChange(item.key, $event)">
|
|
79
|
-
</lib-input>
|
|
80
|
-
|
|
81
|
-
<!-- Dropdown -->
|
|
82
|
-
<lib-dropdown *ngSwitchCase="'dropdown'" [config]="item.dropdownConfig" [label]="item.label"
|
|
83
|
-
[ngModel]="tempFilters[item.key]" (selectionChange)="onFilterChange(item.key, $event)">
|
|
84
|
-
</lib-dropdown>
|
|
85
|
-
|
|
86
|
-
<!-- Checkbox -->
|
|
87
|
-
<lib-checkbox *ngSwitchCase="'checkbox'" [config]="item.checkboxConfig" [label]="item.label"
|
|
88
|
-
[ngModel]="tempFilters[item.key]" (checkedChange)="onFilterChange(item.key, $event)">
|
|
89
|
-
</lib-checkbox>
|
|
90
|
-
|
|
91
|
-
<!-- Radio -->
|
|
92
|
-
<lib-radio *ngSwitchCase="'radio'" [config]="item.radioConfig" [label]="item.label"
|
|
93
|
-
[ngModel]="tempFilters[item.key]" (selectionChange)="onFilterChange(item.key, $event)">
|
|
94
|
-
</lib-radio>
|
|
95
|
-
|
|
96
|
-
<!-- Toggle -->
|
|
97
|
-
<lib-toggle *ngSwitchCase="'toggle'" [config]="item.toggleConfig" [label]="item.label"
|
|
98
|
-
[checked]="tempFilters[item.key]" (toggleChange)="onFilterChange(item.key, $event)">
|
|
99
|
-
</lib-toggle>
|
|
100
|
-
|
|
101
|
-
<!-- Datepicker -->
|
|
102
|
-
<lib-datepicker *ngSwitchCase="'datepicker'" [config]="item.datepickerConfig" [label]="item.label"
|
|
103
|
-
[ngModel]="tempFilters[item.key]" (dateChange)="onFilterChange(item.key, $event)">
|
|
104
|
-
</lib-datepicker>
|
|
105
|
-
|
|
106
|
-
<!-- Search -->
|
|
107
|
-
<lib-search *ngSwitchCase="'active-search'" [config]="item.searchConfig" [label]="item.label"
|
|
108
|
-
[ngModel]="tempFilters[item.key]" (search)="onFilterChange(item.key, $event)">
|
|
109
|
-
</lib-search>
|
|
110
|
-
|
|
111
|
-
<!-- Group / Accordion -->
|
|
112
|
-
<div *ngSwitchCase="'group'" class="cc-accordion-item" [class.expanded]="item.expanded">
|
|
113
|
-
<button type="button" class="cc-accordion-header" (click)="item.expanded = !item.expanded">
|
|
114
|
-
<span class="cc-accordion-title">{{ item.label }}</span>
|
|
115
|
-
<span class="material-icons cc-accordion-icon">{{ item.expanded ? 'expand_less' : 'expand_more'
|
|
116
|
-
}}</span>
|
|
117
|
-
</button>
|
|
118
|
-
|
|
119
|
-
<div class="cc-accordion-body" *ngIf="item.expanded">
|
|
120
|
-
<ng-container *ngFor="let child of item.children; trackBy: trackByFn">
|
|
121
|
-
<ng-container *ngTemplateOutlet="itemTemplate; context: { item: child }"></ng-container>
|
|
122
|
-
</ng-container>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
<!-- Custom Divider -->
|
|
127
|
-
<div *ngSwitchCase="'divider'" class="cc-filter-divider"></div>
|
|
128
|
-
|
|
129
|
-
</ng-container>
|
|
130
|
-
</div>
|
|
131
|
-
</ng-template>
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
.cc-filter-container {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: inline-block;
|
|
4
|
-
font-family: var(--cc-filter-font-family, 'Roboto', sans-serif);
|
|
5
|
-
|
|
6
|
-
// Trigger Button (Targeting lib-button via class)
|
|
7
|
-
.cc-filter-trigger {
|
|
8
|
-
::ng-deep button {
|
|
9
|
-
display: inline-flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
gap: 8px;
|
|
13
|
-
width: var(--cc-filter-btn-width, 103px);
|
|
14
|
-
height: var(--cc-filter-btn-height, 44px);
|
|
15
|
-
padding: 0 16px;
|
|
16
|
-
background-color: var(--cc-filter-btn-bg, #FCFCFB);
|
|
17
|
-
border: var(--cc-filter-btn-border, 1px solid #E8EAED);
|
|
18
|
-
border-radius: var(--cc-filter-btn-radius, 8px);
|
|
19
|
-
color: var(--cc-filter-btn-text-color, #5F6368);
|
|
20
|
-
font-size: 14px;
|
|
21
|
-
font-weight: 500;
|
|
22
|
-
transition: all 0.2s ease;
|
|
23
|
-
|
|
24
|
-
mat-icon,
|
|
25
|
-
.material-icons {
|
|
26
|
-
color: #5F6368;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&:hover {
|
|
30
|
-
background-color: var(--cc-filter-btn-hover-bg, #f1f3f4);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&.active {
|
|
35
|
-
::ng-deep button {
|
|
36
|
-
background-color: var(--cc-filter-btn-active-bg, #e3f2fd);
|
|
37
|
-
color: var(--cc-filter-btn-active-text, #1976d2);
|
|
38
|
-
border-color: var(--cc-filter-btn-active-text, #1976d2);
|
|
39
|
-
|
|
40
|
-
mat-icon,
|
|
41
|
-
.material-icons {
|
|
42
|
-
color: var(--cc-filter-btn-active-text, #1976d2);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.cc-badge {
|
|
48
|
-
background-color: var(--cc-filter-btn-badge-bg, #f44336);
|
|
49
|
-
color: var(--cc-filter-btn-badge-text, #fff);
|
|
50
|
-
font-size: 10px;
|
|
51
|
-
font-weight: bold;
|
|
52
|
-
padding: 2px 6px;
|
|
53
|
-
border-radius: 10px;
|
|
54
|
-
min-width: 16px;
|
|
55
|
-
text-align: center;
|
|
56
|
-
margin-left: 4px;
|
|
57
|
-
line-height: 1;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Dropdown/Sidebar Panel
|
|
62
|
-
.cc-filter-panel {
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: calc(100% + 8px);
|
|
65
|
-
right: 0; // Align right by default
|
|
66
|
-
z-index: 1000;
|
|
67
|
-
width: var(--cc-filter-panel-width, 320px);
|
|
68
|
-
min-width: var(--cc-filter-panel-min-width, 480px) !important;
|
|
69
|
-
padding: var(--cc-filter-panel-padding, 0); // Zero padding, handle internal
|
|
70
|
-
background-color: var(--cc-filter-panel-bg, #fff);
|
|
71
|
-
border: var(--cc-filter-panel-border, 1px solid #e0e0e0);
|
|
72
|
-
box-shadow: var(--cc-filter-panel-shadow, 0 4px 12px rgba(0, 0, 0, 0.15));
|
|
73
|
-
border-radius: var(--cc-filter-panel-radius, 8px);
|
|
74
|
-
display: flex;
|
|
75
|
-
flex-direction: column;
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
|
|
78
|
-
&.hidden {
|
|
79
|
-
display: none;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Header
|
|
83
|
-
.cc-panel-header {
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
justify-content: space-between;
|
|
87
|
-
justify-content: space-between;
|
|
88
|
-
padding: 0 1rem;
|
|
89
|
-
height: var(--cc-filter-panel-header-height, 48px);
|
|
90
|
-
border-bottom: 1px solid #E0E0E0;
|
|
91
|
-
background-color: var(--cc-filter-panel-header-bg, #fafafa);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Tabs
|
|
96
|
-
.cc-tabs {
|
|
97
|
-
display: flex;
|
|
98
|
-
gap: 1rem;
|
|
99
|
-
|
|
100
|
-
.cc-tab {
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
padding: 0.5rem 0;
|
|
103
|
-
font-weight: 500;
|
|
104
|
-
color: #5F6368;
|
|
105
|
-
border-bottom: 2px solid transparent;
|
|
106
|
-
font-size: 14px;
|
|
107
|
-
|
|
108
|
-
&.active {
|
|
109
|
-
color: var(--cc-filter-tab-active-text, #1976d2);
|
|
110
|
-
border-bottom: var(--cc-filter-tab-border-bottom, 2px solid #1976d2);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.cc-icon-btn {
|
|
116
|
-
background: none;
|
|
117
|
-
border: none;
|
|
118
|
-
cursor: pointer;
|
|
119
|
-
color: #5F6368;
|
|
120
|
-
padding: 0.25rem;
|
|
121
|
-
border-radius: 50%;
|
|
122
|
-
display: flex;
|
|
123
|
-
align-items: center;
|
|
124
|
-
justify-content: center;
|
|
125
|
-
|
|
126
|
-
&:hover {
|
|
127
|
-
background-color: rgba(0, 0, 0, 0.04);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Content Area
|
|
132
|
-
.cc-panel-content {
|
|
133
|
-
padding: 16px;
|
|
134
|
-
max-height: 400px;
|
|
135
|
-
overflow-y: auto;
|
|
136
|
-
display: flex;
|
|
137
|
-
flex-direction: column;
|
|
138
|
-
gap: var(--cc-filter-panel-gap, 1rem);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Sections
|
|
142
|
-
.cc-filter-section {
|
|
143
|
-
margin-bottom: 16px;
|
|
144
|
-
|
|
145
|
-
.cc-section-title {
|
|
146
|
-
font-size: 13px;
|
|
147
|
-
font-weight: 600;
|
|
148
|
-
margin-bottom: 8px;
|
|
149
|
-
color: var(--cc-filter-section-title, #333);
|
|
150
|
-
text-transform: uppercase;
|
|
151
|
-
letter-spacing: 0.5px;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Checkbox/Radio Groups
|
|
155
|
-
.cc-control-group {
|
|
156
|
-
display: flex;
|
|
157
|
-
flex-direction: column;
|
|
158
|
-
gap: 8px;
|
|
159
|
-
|
|
160
|
-
label {
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
gap: 8px;
|
|
164
|
-
font-size: 14px;
|
|
165
|
-
color: var(--cc-filter-option-text, #555);
|
|
166
|
-
cursor: pointer;
|
|
167
|
-
|
|
168
|
-
&:hover {
|
|
169
|
-
color: #000;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Accordion overrides
|
|
176
|
-
.cc-accordion-item {
|
|
177
|
-
border-bottom: 1px solid #E0E0E0;
|
|
178
|
-
|
|
179
|
-
&:last-child {
|
|
180
|
-
border-bottom: none;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.cc-accordion-header {
|
|
184
|
-
display: flex;
|
|
185
|
-
align-items: center;
|
|
186
|
-
justify-content: space-between;
|
|
187
|
-
width: 100%;
|
|
188
|
-
padding: 0.75rem 0;
|
|
189
|
-
background: none;
|
|
190
|
-
border: none;
|
|
191
|
-
cursor: pointer;
|
|
192
|
-
text-align: left;
|
|
193
|
-
outline: none;
|
|
194
|
-
|
|
195
|
-
.cc-accordion-title {
|
|
196
|
-
font-size: 0.875rem;
|
|
197
|
-
font-weight: 500;
|
|
198
|
-
color: #202124;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.cc-accordion-icon {
|
|
202
|
-
color: #5F6368;
|
|
203
|
-
transition: transform 0.2s;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.cc-accordion-body {
|
|
208
|
-
padding: 0 0 1rem 0;
|
|
209
|
-
display: flex;
|
|
210
|
-
flex-direction: column;
|
|
211
|
-
gap: 1rem;
|
|
212
|
-
animation: slideDown 0.2s ease-out;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.cc-filter-divider {
|
|
217
|
-
height: 1px;
|
|
218
|
-
background-color: #E0E0E0;
|
|
219
|
-
margin: 0.5rem 0;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// Footer
|
|
223
|
-
.cc-panel-footer {
|
|
224
|
-
padding: 12px 16px;
|
|
225
|
-
background-color: var(--cc-filter-footer-bg, #fff);
|
|
226
|
-
border-top: var(--cc-filter-footer-border-top, 1px solid #e0e0e0);
|
|
227
|
-
display: flex;
|
|
228
|
-
justify-content: flex-end;
|
|
229
|
-
align-items: center;
|
|
230
|
-
gap: 10px; // Add gap for spacing between lib-buttons
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Columns list
|
|
234
|
-
.cc-columns-actions {
|
|
235
|
-
display: flex;
|
|
236
|
-
gap: 0.5rem;
|
|
237
|
-
margin-bottom: 0.5rem;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.cc-columns-list {
|
|
241
|
-
display: flex;
|
|
242
|
-
flex-direction: column;
|
|
243
|
-
gap: 0.5rem;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, OnInit, Output, ElementRef, HostListener } from '@angular/core';
|
|
2
|
-
import { Router, ActivatedRoute } from '@angular/router';
|
|
3
|
-
import { TableFilterConfig, TableFilterOutput, TableFilterColumn, TableFilterLabels } from '../../filter.models';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'lib-filter',
|
|
7
|
-
templateUrl: './filter.component.html',
|
|
8
|
-
styleUrls: ['./filter.component.scss'],
|
|
9
|
-
standalone: false
|
|
10
|
-
})
|
|
11
|
-
export class FilterComponent implements OnInit {
|
|
12
|
-
@Input() config: TableFilterConfig = { items: [] };
|
|
13
|
-
@Input() activeFilters: TableFilterOutput = {};
|
|
14
|
-
@Input() columns: TableFilterColumn[] = [];
|
|
15
|
-
@Input() labels: TableFilterLabels = {
|
|
16
|
-
filterBtn: '',
|
|
17
|
-
clear: '',
|
|
18
|
-
apply: '',
|
|
19
|
-
search: '',
|
|
20
|
-
columns: '',
|
|
21
|
-
showAll: '',
|
|
22
|
-
hideAll: ''
|
|
23
|
-
};
|
|
24
|
-
@Input() theme: string = '';
|
|
25
|
-
|
|
26
|
-
@Output() filterChange = new EventEmitter<TableFilterOutput>();
|
|
27
|
-
@Output() columnChange = new EventEmitter<TableFilterColumn[]>();
|
|
28
|
-
@Output() toggle = new EventEmitter<boolean>();
|
|
29
|
-
|
|
30
|
-
isOpen = false;
|
|
31
|
-
activeTab: 'filters' | 'columns' = 'filters';
|
|
32
|
-
|
|
33
|
-
// Temporary state while panel is open
|
|
34
|
-
tempFilters: TableFilterOutput = {};
|
|
35
|
-
tempColumns: TableFilterColumn[] = [];
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
private elementRef: ElementRef,
|
|
39
|
-
private router: Router,
|
|
40
|
-
private route: ActivatedRoute
|
|
41
|
-
) { }
|
|
42
|
-
|
|
43
|
-
ngOnInit(): void {
|
|
44
|
-
this.syncTempState();
|
|
45
|
-
this.initFromUrl();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
private initFromUrl(): void {
|
|
49
|
-
if (this.config.settings?.persistent) {
|
|
50
|
-
this.route.queryParams.subscribe(params => {
|
|
51
|
-
if (Object.keys(params).length > 0) {
|
|
52
|
-
const newFilters: TableFilterOutput = { ...this.activeFilters };
|
|
53
|
-
Object.keys(params).forEach(key => {
|
|
54
|
-
// Skip non-filter params if possible, or assume all are filters
|
|
55
|
-
// Ideally we check against config items
|
|
56
|
-
if (params[key] !== undefined) {
|
|
57
|
-
newFilters[key] = params[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
this.activeFilters = newFilters;
|
|
61
|
-
this.syncTempState();
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@HostListener('document:click', ['$event'])
|
|
68
|
-
onClickOutside(event: Event): void {
|
|
69
|
-
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
70
|
-
this.isOpen = false;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
togglePanel(): void {
|
|
75
|
-
this.isOpen = !this.isOpen;
|
|
76
|
-
if (this.isOpen) {
|
|
77
|
-
this.syncTempState();
|
|
78
|
-
this.activeTab = 'filters';
|
|
79
|
-
}
|
|
80
|
-
this.toggle.emit(this.isOpen);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
setActiveTab(tab: 'filters' | 'columns'): void {
|
|
84
|
-
this.activeTab = tab;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Generic Filter Change Handler
|
|
88
|
-
onFilterChange(key: string | undefined, value: any): void {
|
|
89
|
-
if (!key) return;
|
|
90
|
-
this.tempFilters[key] = value;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Column Visibility Logic
|
|
94
|
-
toggleColumn(columnId: string): void {
|
|
95
|
-
const col = this.tempColumns.find(c => c.id === columnId);
|
|
96
|
-
if (col) {
|
|
97
|
-
col.visible = !col.visible;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
toggleAllColumns(visible: boolean): void {
|
|
102
|
-
this.tempColumns.forEach(c => c.visible = visible);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Actions
|
|
106
|
-
clearAll(): void {
|
|
107
|
-
if (this.activeTab === 'filters') {
|
|
108
|
-
this.tempFilters = {};
|
|
109
|
-
if (this.config.settings?.persistent) {
|
|
110
|
-
this.updateUrl({});
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
// Reset columns to default or show all?
|
|
114
|
-
// Usually 'clear' in filters context means clear filters
|
|
115
|
-
// But if we are in columns tab, maybe we want to reset columns?
|
|
116
|
-
// For now, let's keep it simple: generic clear clears filters.
|
|
117
|
-
this.tempFilters = {};
|
|
118
|
-
}
|
|
119
|
-
// If we want clear to apply immediately without clicking apply:
|
|
120
|
-
// this.apply();
|
|
121
|
-
// But usually "Clear" inside panel just clears temp state until Apply is clicked.
|
|
122
|
-
// However, if the user requested "Persistent" and "Clear", they might expect immediate URL update?
|
|
123
|
-
// Standard UX: panel actions apply on "Apply".
|
|
124
|
-
// The persisted state should only change when "Apply" is clicked?
|
|
125
|
-
// Wait, if I update URL on clearAll inside panel, it might be confusing if panel is still open with cleared state but not "applied" to data.
|
|
126
|
-
// Re-reading expectation: "Persistent" setting usually means the filter state is synced with URL.
|
|
127
|
-
// If I clear temp state, URL shouldn't change until I click Apply.
|
|
128
|
-
// SO I WILL NOT UPDATE URL HERE. The `initFromUrl` loads INTO `activeFilters`.
|
|
129
|
-
// `apply()` updates `activeFilters` AND should update URL.
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
apply(): void {
|
|
133
|
-
// Apply temp state to active state
|
|
134
|
-
this.activeFilters = { ...this.tempFilters };
|
|
135
|
-
// Clean up undefined/null values
|
|
136
|
-
Object.keys(this.activeFilters).forEach(key => {
|
|
137
|
-
if (this.activeFilters[key] === null || this.activeFilters[key] === undefined || this.activeFilters[key] === '') {
|
|
138
|
-
delete this.activeFilters[key];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// Apply columns
|
|
143
|
-
this.columns = this.tempColumns.map(c => ({ ...c }));
|
|
144
|
-
|
|
145
|
-
this.filterChange.emit(this.activeFilters);
|
|
146
|
-
this.columnChange.emit(this.columns);
|
|
147
|
-
|
|
148
|
-
if (this.config.settings?.persistent) {
|
|
149
|
-
this.updateUrl(this.activeFilters);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
this.isOpen = false;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
private updateUrl(queryParams: any): void {
|
|
157
|
-
this.router.navigate([], {
|
|
158
|
-
relativeTo: this.route,
|
|
159
|
-
queryParams: queryParams,
|
|
160
|
-
queryParamsHandling: 'merge', // or 'replace' to clear others? 'merge' ensures we don't lose other params
|
|
161
|
-
// But wait, if we removed a filter, merge keeps it?
|
|
162
|
-
// We need to explicitly clear removed keys if we use merge.
|
|
163
|
-
// Or use pure replacement of filter keys.
|
|
164
|
-
// For simplicity, let's assuming we want to replace parameters that overlap.
|
|
165
|
-
// But to clear keys, we need to pass `null` or `undefined` for those keys in `queryParams`?
|
|
166
|
-
// Angular router: passing null removes the param.
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// Refined updateUrl logic:
|
|
170
|
-
// We merged activeFilters. But if we removed a key, it's missing from activeFilters.
|
|
171
|
-
// We need to compare with current params and remove keys that are no longer in activeFilters?
|
|
172
|
-
// A simpler way for this component:
|
|
173
|
-
// We likely want to replace ALL query params that correspond to filters.
|
|
174
|
-
// But we don't know which params are filters vs other things (e.g. page, sort).
|
|
175
|
-
// For now, I will just push `this.activeFilters`.
|
|
176
|
-
// NOTE: This doesn't clear keys that were removed.
|
|
177
|
-
// To fix clearing:
|
|
178
|
-
// I should probably navigate with exact activeFilters if I knew they are the ONLY params.
|
|
179
|
-
// Better:
|
|
180
|
-
// this.router.navigate([], { queryParams: this.activeFilters }); // property replaces all
|
|
181
|
-
// If we want to keep 'page', etc., we need to include them.
|
|
182
|
-
// Let's use 'merge' but we need to handle clearing.
|
|
183
|
-
// I will implement a smarter update.
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
activeFilterCountValue(): number {
|
|
187
|
-
return Object.keys(this.activeFilters).length;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
get activeFilterCount(): number {
|
|
192
|
-
return Object.keys(this.activeFilters).length;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private syncTempState(): void {
|
|
196
|
-
this.tempFilters = { ...this.activeFilters };
|
|
197
|
-
this.tempColumns = JSON.parse(JSON.stringify(this.columns || []));
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
get containerStyles(): { [key: string]: string } {
|
|
201
|
-
const styles: { [key: string]: string } = {};
|
|
202
|
-
if (this.config.styles) {
|
|
203
|
-
if (this.config.styles.width) styles['--cc-filter-panel-width'] = this.config.styles.width;
|
|
204
|
-
if (this.config.styles.padding) styles['--cc-filter-panel-padding'] = this.config.styles.padding;
|
|
205
|
-
if (this.config.styles.gap) styles['--cc-filter-panel-gap'] = this.config.styles.gap;
|
|
206
|
-
if (this.config.styles.backgroundColor) styles['--cc-filter-panel-bg'] = this.config.styles.backgroundColor;
|
|
207
|
-
if (this.config.styles.borderRadius) styles['--cc-filter-panel-radius'] = this.config.styles.borderRadius;
|
|
208
|
-
if (this.config.styles.headerHeight) styles['--cc-filter-panel-header-height'] = this.config.styles.headerHeight;
|
|
209
|
-
}
|
|
210
|
-
return styles;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
trackByFn(index: number, item: any): any {
|
|
214
|
-
return item.key || index;
|
|
215
|
-
}
|
|
216
|
-
}
|