platformcommons-web-lib 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commons-shared-web-ui-1.0.0.tgz +0 -0
- package/documentation/alert.md +123 -0
- package/documentation/button-dropdown.md +126 -0
- package/documentation/button.md +184 -0
- package/documentation/cards-usage-guidelines.md +131 -0
- package/documentation/configurable-form.md +605 -0
- package/documentation/confirmation-modal.md +250 -0
- package/documentation/filter-sidebar.md +178 -0
- package/documentation/filter-table-selector.md +228 -0
- package/documentation/form-builder.md +597 -0
- package/documentation/form-components.md +384 -0
- package/documentation/nav.md +427 -0
- package/documentation/pagination.md +181 -0
- package/documentation/side-nav-documentation.md +169 -0
- package/documentation/smart-form.md +2177 -0
- package/documentation/smart-table.md +1198 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/ng-package.json +28 -0
- package/package.json +54 -0
- package/src/lib/modules/alert/alert.models.ts +6 -0
- package/src/lib/modules/alert/alert.module.ts +16 -0
- package/src/lib/modules/alert/alert.theme.scss +85 -0
- package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
- package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
- package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
- package/src/lib/modules/button/button.models.ts +13 -0
- package/src/lib/modules/button/button.module.ts +16 -0
- package/src/lib/modules/button/button.theme.scss +121 -0
- package/src/lib/modules/button/components/button/button.component.html +22 -0
- package/src/lib/modules/button/components/button/button.component.scss +88 -0
- package/src/lib/modules/button/components/button/button.component.ts +67 -0
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
- package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
- package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
- package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
- package/src/lib/modules/configurable-form/configurable-form.theme.scss +78 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.theme.scss +87 -0
- package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
- package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
- package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
- package/src/lib/modules/filter/filter.models.ts +88 -0
- package/src/lib/modules/filter/filter.module.ts +24 -0
- package/src/lib/modules/filter/filter.theme.scss +92 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +38 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
- package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
- package/src/lib/modules/form-builder/form-builder.theme.scss +212 -0
- package/src/lib/modules/form-builder/index.ts +9 -0
- package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
- package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
- package/src/lib/modules/form-builder/services/field-selection.service.ts +300 -0
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +652 -0
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
- package/src/lib/modules/form-builder/utils/constants.ts +43 -0
- package/src/lib/modules/form-components/components/checkbox/_theme.scss +63 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
- package/src/lib/modules/form-components/components/datepicker/_theme.scss +82 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
- package/src/lib/modules/form-components/components/dropdown/_theme.scss +91 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
- package/src/lib/modules/form-components/components/input/_theme.scss +77 -0
- package/src/lib/modules/form-components/components/input/input.component.html +51 -0
- package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
- package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
- package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
- package/src/lib/modules/form-components/components/radio/_theme.scss +61 -0
- package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
- package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
- package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
- package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
- package/src/lib/modules/form-components/components/search/_theme.scss +73 -0
- package/src/lib/modules/form-components/components/search/search.component.html +15 -0
- package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
- package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
- package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
- package/src/lib/modules/form-components/components/toggle/_theme.scss +45 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
- package/src/lib/modules/form-components/form-components.module.ts +41 -0
- package/src/lib/modules/form-components/form-components.theme.scss +25 -0
- package/src/lib/modules/material/material.module.ts +94 -0
- package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
- package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
- package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
- package/src/lib/modules/nav/nav.models.ts +31 -0
- package/src/lib/modules/nav/nav.module.ts +17 -0
- package/src/lib/modules/nav/nav.theme.scss +86 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
- package/src/lib/modules/pagination/pagination.module.ts +17 -0
- package/src/lib/modules/pagination/pagination.theme.scss +66 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
- package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
- package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
- package/src/lib/modules/side-nav/side-nav.theme.scss +111 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1109 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +1860 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2232 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +64 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +119 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1087 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +700 -0
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
- package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
- package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
- package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
- package/src/lib/modules/smart-form/smart-form.theme.scss +890 -0
- package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
- package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1118 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +202 -0
- package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
- package/src/lib/modules/smart-table/smart-table.theme.scss +335 -0
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +22 -0
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
- package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
- package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
- package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
- package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
- package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
- package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
- package/src/lib/modules/snackbar/snackbar.theme.scss +93 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
- package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
- package/src/lib/modules/summary-card/summary-card.theme.scss +176 -0
- package/src/lib/shared-ui.module.ts +44 -0
- package/src/lib/styles/global.scss +152 -0
- package/src/lib/styles/utilities.scss +250 -0
- package/src/lib/utils/constants.ts +11 -0
- package/src/lib/utils/storage.utils.ts +37 -0
- package/src/lib/utils/string.utils.ts +23 -0
- package/src/lib/utils/translation.utils.ts +87 -0
- package/src/public-api.ts +104 -0
- package/tsconfig.lib.json +15 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
5
|
+
import { FilterSearchConfig, SearchLabels } from './search.models';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'lib-search',
|
|
9
|
+
templateUrl: './search.component.html',
|
|
10
|
+
styleUrls: ['./search.component.scss'],
|
|
11
|
+
standalone: false,
|
|
12
|
+
providers: [
|
|
13
|
+
{
|
|
14
|
+
provide: NG_VALUE_ACCESSOR,
|
|
15
|
+
useExisting: forwardRef(() => SearchComponent),
|
|
16
|
+
multi: true
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
})
|
|
20
|
+
export class SearchComponent implements ControlValueAccessor, OnInit, OnDestroy, OnChanges {
|
|
21
|
+
@Input() config?: FilterSearchConfig;
|
|
22
|
+
@Input() labels?: SearchLabels;
|
|
23
|
+
@Input() placeholder: string = '';
|
|
24
|
+
@Input() label: string = '';
|
|
25
|
+
@Input() disabled: boolean = false;
|
|
26
|
+
@Input() debounceMs: number = 300;
|
|
27
|
+
@Input() clearable: boolean = true;
|
|
28
|
+
@Input() value: any = '';
|
|
29
|
+
|
|
30
|
+
// Style inputs
|
|
31
|
+
@Input() width?: string;
|
|
32
|
+
@Input() height?: string;
|
|
33
|
+
@Input() borderRadius?: string;
|
|
34
|
+
@Input() fontSize?: string;
|
|
35
|
+
|
|
36
|
+
@Input() gap?: string;
|
|
37
|
+
@Input() fontFamily?: string;
|
|
38
|
+
@Input() labelColor?: string;
|
|
39
|
+
@Input() labelFontSize?: string;
|
|
40
|
+
@Input() labelFontWeight?: string;
|
|
41
|
+
|
|
42
|
+
@Input() backgroundColor?: string;
|
|
43
|
+
@Input() borderColor?: string;
|
|
44
|
+
@Input() borderWidth?: string;
|
|
45
|
+
@Input() border?: string; // Shorthand
|
|
46
|
+
@Input() padding?: string;
|
|
47
|
+
@Input() fontWeight?: string;
|
|
48
|
+
@Input() color?: string;
|
|
49
|
+
@Input() textColor?: string; // Alias for color or specific text color
|
|
50
|
+
@Input() iconColor?: string;
|
|
51
|
+
@Input() placeholderColor?: string;
|
|
52
|
+
@Input() focusBorderColor?: string;
|
|
53
|
+
@Input() disabledBackgroundColor?: string;
|
|
54
|
+
@Input() disabledColor?: string;
|
|
55
|
+
@Input() boxShadow?: string;
|
|
56
|
+
|
|
57
|
+
@Output() search = new EventEmitter<string>();
|
|
58
|
+
@Output() clear = new EventEmitter<void>();
|
|
59
|
+
|
|
60
|
+
private searchSubject = new Subject<string>();
|
|
61
|
+
focused = false;
|
|
62
|
+
onChange: (value: any) => void = () => { };
|
|
63
|
+
onTouched: () => void = () => { };
|
|
64
|
+
|
|
65
|
+
ngOnInit(): void {
|
|
66
|
+
this.updateFromConfig();
|
|
67
|
+
this.updateFromLabels();
|
|
68
|
+
this.searchSubject.pipe(
|
|
69
|
+
debounceTime(this.debounceMs),
|
|
70
|
+
distinctUntilChanged()
|
|
71
|
+
).subscribe(value => {
|
|
72
|
+
this.search.emit(value);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
76
|
+
if (changes['config']) {
|
|
77
|
+
this.updateFromConfig();
|
|
78
|
+
}
|
|
79
|
+
if (changes['labels']) {
|
|
80
|
+
this.updateFromLabels();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private updateFromConfig(): void {
|
|
85
|
+
if (this.config) {
|
|
86
|
+
this.placeholder = this.config.placeholder ?? this.placeholder;
|
|
87
|
+
this.label = this.config.label ?? this.label;
|
|
88
|
+
this.disabled = this.config.disabled ?? this.disabled;
|
|
89
|
+
this.debounceMs = this.config.debounceTime ?? this.debounceMs;
|
|
90
|
+
this.clearable = this.config.clearable ?? this.clearable;
|
|
91
|
+
this.width = this.config.width ?? this.width;
|
|
92
|
+
this.height = this.config.height ?? this.height;
|
|
93
|
+
this.borderRadius = this.config.borderRadius ?? this.borderRadius;
|
|
94
|
+
this.fontSize = this.config.fontSize ?? this.fontSize;
|
|
95
|
+
this.gap = this.config.gap ?? this.gap;
|
|
96
|
+
this.fontFamily = this.config.fontFamily ?? this.fontFamily;
|
|
97
|
+
this.labelColor = this.config.labelColor ?? this.labelColor;
|
|
98
|
+
this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
|
|
99
|
+
this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
|
|
100
|
+
this.backgroundColor = this.config.backgroundColor ?? this.backgroundColor;
|
|
101
|
+
this.borderColor = this.config.borderColor ?? this.borderColor;
|
|
102
|
+
this.borderWidth = this.config.borderWidth ?? this.borderWidth;
|
|
103
|
+
this.border = this.config.border ?? this.border;
|
|
104
|
+
this.padding = this.config.padding ?? this.padding;
|
|
105
|
+
this.fontWeight = this.config.fontWeight ?? this.fontWeight;
|
|
106
|
+
this.color = this.config.color ?? this.color;
|
|
107
|
+
this.textColor = this.config.textColor ?? this.textColor;
|
|
108
|
+
this.iconColor = this.config.iconColor ?? this.iconColor;
|
|
109
|
+
this.placeholderColor = this.config.placeholderColor ?? this.placeholderColor;
|
|
110
|
+
this.focusBorderColor = this.config.focusBorderColor ?? this.focusBorderColor;
|
|
111
|
+
this.disabledBackgroundColor = this.config.disabledBackgroundColor ?? this.disabledBackgroundColor;
|
|
112
|
+
this.disabledColor = this.config.disabledColor ?? this.disabledColor;
|
|
113
|
+
this.boxShadow = this.config.boxShadow ?? this.boxShadow;
|
|
114
|
+
if (this.config.value) {
|
|
115
|
+
this.value = this.config.value;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private updateFromLabels(): void {
|
|
121
|
+
if (this.labels) {
|
|
122
|
+
this.label = this.labels.label || this.label;
|
|
123
|
+
this.placeholder = this.labels.placeholder || this.placeholder;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
ngOnDestroy(): void {
|
|
128
|
+
this.searchSubject.complete();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
get clearAriaLabel(): string {
|
|
132
|
+
return this.labels?.clearAriaLabel || 'Clear search';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
writeValue(value: any): void {
|
|
136
|
+
this.value = value || '';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
registerOnChange(fn: any): void {
|
|
140
|
+
this.onChange = fn;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
registerOnTouched(fn: any): void {
|
|
144
|
+
this.onTouched = fn;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
setDisabledState(isDisabled: boolean): void {
|
|
148
|
+
this.disabled = isDisabled;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
onInputChange(event: any): void {
|
|
152
|
+
this.value = event.target.value;
|
|
153
|
+
this.onChange(this.value);
|
|
154
|
+
this.searchSubject.next(this.value);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
onClear(): void {
|
|
158
|
+
this.value = '';
|
|
159
|
+
this.onChange(this.value);
|
|
160
|
+
this.searchSubject.next(this.value);
|
|
161
|
+
this.clear.emit();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
onBlur(): void {
|
|
165
|
+
this.focused = false;
|
|
166
|
+
this.onTouched();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
onFocus(): void {
|
|
170
|
+
this.focused = true;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private getStyleValue(value: string | undefined): string | undefined {
|
|
174
|
+
return value ? `${value}` : undefined;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
get wrapperStyles(): { [key: string]: string | undefined } {
|
|
178
|
+
return {
|
|
179
|
+
'width': this.getStyleValue(this.width),
|
|
180
|
+
'--cc-search-label-gap': this.getStyleValue(this.gap),
|
|
181
|
+
'--cc-search-font-family': this.getStyleValue(this.fontFamily)
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
get labelStyles(): { [key: string]: string | undefined } {
|
|
186
|
+
return {
|
|
187
|
+
'--cc-search-label-color': this.getStyleValue(this.labelColor),
|
|
188
|
+
'--cc-search-label-font-size': this.getStyleValue(this.labelFontSize),
|
|
189
|
+
'--cc-search-label-font-weight': this.getStyleValue(this.labelFontWeight)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
get fieldStyles(): { [key: string]: string | undefined } {
|
|
194
|
+
return {
|
|
195
|
+
'--cc-search-bg': this.getStyleValue(this.backgroundColor),
|
|
196
|
+
'--cc-search-border-radius': this.getStyleValue(this.borderRadius),
|
|
197
|
+
'--cc-search-border-color': this.getStyleValue(this.borderColor),
|
|
198
|
+
'--cc-search-border-width': this.getStyleValue(this.borderWidth),
|
|
199
|
+
'--cc-search-border': this.getStyleValue(this.border),
|
|
200
|
+
'--cc-search-height': this.getStyleValue(this.height),
|
|
201
|
+
'--cc-search-padding': this.getStyleValue(this.padding),
|
|
202
|
+
'--cc-search-font-size': this.getStyleValue(this.fontSize),
|
|
203
|
+
'--cc-search-font-weight': this.getStyleValue(this.fontWeight),
|
|
204
|
+
'--cc-search-color': this.getStyleValue(this.color || this.textColor),
|
|
205
|
+
'--cc-search-icon-color': this.getStyleValue(this.iconColor),
|
|
206
|
+
'--cc-search-placeholder-color': this.getStyleValue(this.placeholderColor),
|
|
207
|
+
'--cc-search-focus-border-color': this.getStyleValue(this.focusBorderColor),
|
|
208
|
+
'--cc-search-disabled-bg': this.getStyleValue(this.disabledBackgroundColor),
|
|
209
|
+
'--cc-search-disabled-color': this.getStyleValue(this.disabledColor),
|
|
210
|
+
'box-shadow': this.getStyleValue(this.boxShadow)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface SearchLabels {
|
|
2
|
+
label?: string;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
clearAriaLabel?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface FilterSearchConfig {
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
debounceTime?: number;
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
width?: string;
|
|
15
|
+
height?: string;
|
|
16
|
+
borderRadius?: string;
|
|
17
|
+
fontSize?: string;
|
|
18
|
+
|
|
19
|
+
// Additional Style Props
|
|
20
|
+
gap?: string;
|
|
21
|
+
fontFamily?: string;
|
|
22
|
+
labelColor?: string;
|
|
23
|
+
labelFontSize?: string;
|
|
24
|
+
labelFontWeight?: string;
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
borderColor?: string;
|
|
27
|
+
borderWidth?: string;
|
|
28
|
+
border?: string;
|
|
29
|
+
padding?: string;
|
|
30
|
+
fontWeight?: string;
|
|
31
|
+
color?: string;
|
|
32
|
+
textColor?: string;
|
|
33
|
+
iconColor?: string;
|
|
34
|
+
placeholderColor?: string;
|
|
35
|
+
focusBorderColor?: string;
|
|
36
|
+
errorColor?: string;
|
|
37
|
+
disabledBackgroundColor?: string;
|
|
38
|
+
disabledColor?: string;
|
|
39
|
+
boxShadow?: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
$default-toggle-config: (
|
|
4
|
+
// Label
|
|
5
|
+
font-size: 0.875rem,
|
|
6
|
+
font-weight: 400,
|
|
7
|
+
font-family: inherit,
|
|
8
|
+
label-color: #202124,
|
|
9
|
+
|
|
10
|
+
// Size
|
|
11
|
+
width: 2.25rem,
|
|
12
|
+
height: 1rem,
|
|
13
|
+
|
|
14
|
+
// Colors
|
|
15
|
+
track-color: #BDC1C6,
|
|
16
|
+
thumb-color: #FEFEFE,
|
|
17
|
+
checked-track-color: #1A73E8,
|
|
18
|
+
checked-thumb-color: #FEFEFE,
|
|
19
|
+
|
|
20
|
+
// States
|
|
21
|
+
disabled-color: #80868B
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
@mixin toggle-theme($user-config: ()) {
|
|
25
|
+
$config: map.merge($default-toggle-config, $user-config);
|
|
26
|
+
|
|
27
|
+
// Label
|
|
28
|
+
--cc-toggle-font-size: #{map.get($config, font-size)};
|
|
29
|
+
--cc-toggle-font-weight: #{map.get($config, font-weight)};
|
|
30
|
+
--cc-toggle-font-family: #{map.get($config, font-family)};
|
|
31
|
+
--cc-toggle-label-color: #{map.get($config, label-color)};
|
|
32
|
+
|
|
33
|
+
// Size
|
|
34
|
+
--cc-toggle-width: #{map.get($config, width)};
|
|
35
|
+
--cc-toggle-height: #{map.get($config, height)};
|
|
36
|
+
|
|
37
|
+
// Colors
|
|
38
|
+
--cc-toggle-track-color: #{map.get($config, track-color)};
|
|
39
|
+
--cc-toggle-thumb-color: #{map.get($config, thumb-color)};
|
|
40
|
+
--cc-toggle-checked-track-color: #{map.get($config, checked-track-color)};
|
|
41
|
+
--cc-toggle-checked-thumb-color: #{map.get($config, checked-thumb-color)};
|
|
42
|
+
|
|
43
|
+
// States
|
|
44
|
+
--cc-toggle-disabled-color: #{map.get($config, disabled-color)};
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="cc-toggle-wrapper" [ngStyle]="wrapperStyles">
|
|
2
|
+
<label class="cc-toggle-label" [class.label-before]="labelPosition === 'before'" [class.disabled]="disabled">
|
|
3
|
+
|
|
4
|
+
<span class="cc-label-text" *ngIf="label && labelPosition === 'before'">{{ label }}</span>
|
|
5
|
+
|
|
6
|
+
<span class="cc-toggle-switch">
|
|
7
|
+
<input type="checkbox" class="cc-native-toggle" [checked]="checked" [disabled]="disabled"
|
|
8
|
+
(change)="onToggleChange($event)" />
|
|
9
|
+
<span class="cc-toggle-track"></span>
|
|
10
|
+
<span class="cc-toggle-thumb"></span>
|
|
11
|
+
</span>
|
|
12
|
+
|
|
13
|
+
<span class="cc-label-text" *ngIf="label && labelPosition === 'after'">{{ label }}</span>
|
|
14
|
+
</label>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.cc-toggle-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
font-family: var(--cc-toggle-font-family, inherit);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.cc-toggle-label {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
user-select: none;
|
|
12
|
+
font-size: var(--cc-toggle-font-size, 0.875rem);
|
|
13
|
+
font-weight: var(--cc-toggle-font-weight, 400);
|
|
14
|
+
color: var(--cc-toggle-label-color, #202124);
|
|
15
|
+
gap: 0.5rem;
|
|
16
|
+
|
|
17
|
+
&.disabled {
|
|
18
|
+
cursor: not-allowed;
|
|
19
|
+
color: var(--cc-toggle-disabled-color, #80868B);
|
|
20
|
+
|
|
21
|
+
.cc-toggle-track {
|
|
22
|
+
background-color: var(--cc-toggle-disabled-color, #E0E0E0);
|
|
23
|
+
opacity: 0.5;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cc-toggle-thumb {
|
|
27
|
+
background-color: #BDBDBD;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.cc-toggle-switch {
|
|
33
|
+
position: relative;
|
|
34
|
+
width: var(--cc-toggle-width, 2.25rem);
|
|
35
|
+
height: var(--cc-toggle-height, 1.25rem);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.cc-native-toggle {
|
|
39
|
+
position: absolute;
|
|
40
|
+
opacity: 0;
|
|
41
|
+
width: 0;
|
|
42
|
+
height: 0;
|
|
43
|
+
|
|
44
|
+
// Checked State
|
|
45
|
+
&:checked~.cc-toggle-track {
|
|
46
|
+
background-color: var(--cc-toggle-checked-bg, #1A73E8);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:checked~.cc-toggle-thumb {
|
|
50
|
+
// Move to the right: 100% of track width - thumb width - left offset
|
|
51
|
+
// left is 2px. So we want right to be 2px.
|
|
52
|
+
// translateX is relative to the element itself.
|
|
53
|
+
// Better approach: use left and calc.
|
|
54
|
+
left: calc(100% - var(--cc-toggle-height, 1.25rem) + 2px);
|
|
55
|
+
background-color: var(--cc-toggle-checked-thumb-color, #FEFEFE);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cc-toggle-track {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0;
|
|
62
|
+
left: 0;
|
|
63
|
+
right: 0;
|
|
64
|
+
bottom: 0;
|
|
65
|
+
background-color: var(--cc-toggle-unchecked-bg, #BDC1C6);
|
|
66
|
+
border-radius: 1rem;
|
|
67
|
+
transition: 0.2s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.cc-toggle-thumb {
|
|
71
|
+
position: absolute;
|
|
72
|
+
top: 50%;
|
|
73
|
+
left: 2px;
|
|
74
|
+
width: calc(var(--cc-toggle-height, 1.25rem) - 4px);
|
|
75
|
+
height: calc(var(--cc-toggle-height, 1.25rem) - 4px);
|
|
76
|
+
transform: translateY(-50%);
|
|
77
|
+
background-color: var(--cc-toggle-thumb-color, #FEFEFE);
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
transition: 0.2s;
|
|
80
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
81
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { ToggleConfig, ToggleLabels } from './toggle.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-toggle',
|
|
7
|
+
templateUrl: './toggle.component.html',
|
|
8
|
+
styleUrls: ['./toggle.component.scss'],
|
|
9
|
+
standalone: false,
|
|
10
|
+
providers: [
|
|
11
|
+
{
|
|
12
|
+
provide: NG_VALUE_ACCESSOR,
|
|
13
|
+
useExisting: forwardRef(() => ToggleComponent),
|
|
14
|
+
multi: true
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
})
|
|
18
|
+
export class ToggleComponent implements ControlValueAccessor, OnInit, OnChanges {
|
|
19
|
+
@Input() config?: ToggleConfig;
|
|
20
|
+
@Input() labels?: ToggleLabels;
|
|
21
|
+
@Input() label: string = '';
|
|
22
|
+
@Input() checked: boolean = false;
|
|
23
|
+
@Input() disabled: boolean = false;
|
|
24
|
+
@Input() required: boolean = false;
|
|
25
|
+
@Input() labelPosition: 'before' | 'after' = 'after';
|
|
26
|
+
@Input() color: string = '#1A73E8';
|
|
27
|
+
|
|
28
|
+
// Customization — Colors
|
|
29
|
+
@Input() labelColor?: string;
|
|
30
|
+
@Input() uncheckedColor?: string;
|
|
31
|
+
@Input() checkedColor?: string;
|
|
32
|
+
@Input() thumbColor?: string;
|
|
33
|
+
@Input() checkedThumbColor?: string;
|
|
34
|
+
|
|
35
|
+
// Customization — Typography
|
|
36
|
+
@Input() fontSize?: string;
|
|
37
|
+
@Input() fontWeight?: string;
|
|
38
|
+
@Input() fontFamily?: string;
|
|
39
|
+
|
|
40
|
+
// Customization — Size
|
|
41
|
+
@Input() toggleWidth?: string;
|
|
42
|
+
@Input() toggleHeight?: string;
|
|
43
|
+
@Input() gap?: string;
|
|
44
|
+
|
|
45
|
+
// Customization — Slider
|
|
46
|
+
@Input() sliderColor?: string;
|
|
47
|
+
|
|
48
|
+
// Customization — Label
|
|
49
|
+
@Input() labelFontSize?: string;
|
|
50
|
+
@Input() labelFontWeight?: string;
|
|
51
|
+
|
|
52
|
+
// Customization — States
|
|
53
|
+
@Input() disabledColor?: string;
|
|
54
|
+
|
|
55
|
+
@Output() toggleChange = new EventEmitter<boolean>();
|
|
56
|
+
|
|
57
|
+
value: boolean = false;
|
|
58
|
+
|
|
59
|
+
private onChange: (value: any) => void = () => { };
|
|
60
|
+
private onTouched: () => void = () => { };
|
|
61
|
+
|
|
62
|
+
ngOnInit(): void {
|
|
63
|
+
this.updateFromConfig();
|
|
64
|
+
this.updateFromLabels();
|
|
65
|
+
this.value = this.checked;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
69
|
+
if (changes['config']) {
|
|
70
|
+
this.updateFromConfig();
|
|
71
|
+
}
|
|
72
|
+
if (changes['labels']) {
|
|
73
|
+
this.updateFromLabels();
|
|
74
|
+
}
|
|
75
|
+
if (changes['checked']) {
|
|
76
|
+
this.value = this.checked;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private updateFromConfig(): void {
|
|
81
|
+
if (this.config) {
|
|
82
|
+
this.label = this.config.label ?? this.label;
|
|
83
|
+
this.checked = this.config.checked ?? this.checked;
|
|
84
|
+
this.disabled = this.config.disabled ?? this.disabled;
|
|
85
|
+
this.required = this.config.required ?? this.required;
|
|
86
|
+
this.labelPosition = this.config.labelPosition ?? this.labelPosition;
|
|
87
|
+
this.color = this.config.color ?? this.color;
|
|
88
|
+
this.uncheckedColor = this.config.uncheckedColor ?? this.uncheckedColor;
|
|
89
|
+
this.checkedColor = this.config.checkedColor ?? this.checkedColor;
|
|
90
|
+
this.thumbColor = this.config.thumbColor ?? this.thumbColor;
|
|
91
|
+
this.checkedThumbColor = this.config.checkedThumbColor ?? this.checkedThumbColor;
|
|
92
|
+
this.fontSize = this.config.fontSize ?? this.fontSize;
|
|
93
|
+
this.fontWeight = this.config.fontWeight ?? this.fontWeight;
|
|
94
|
+
this.toggleWidth = this.config.toggleWidth ?? this.toggleWidth;
|
|
95
|
+
this.toggleHeight = this.config.toggleHeight ?? this.toggleHeight;
|
|
96
|
+
this.gap = this.config.gap ?? this.gap;
|
|
97
|
+
this.fontFamily = this.config.fontFamily ?? this.fontFamily;
|
|
98
|
+
this.labelColor = this.config.labelColor ?? this.labelColor;
|
|
99
|
+
this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
|
|
100
|
+
this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private updateFromLabels(): void {
|
|
105
|
+
if (this.labels) {
|
|
106
|
+
this.label = this.labels.label || this.label;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
writeValue(value: any): void {
|
|
111
|
+
this.value = !!value;
|
|
112
|
+
this.checked = this.value;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
registerOnChange(fn: any): void {
|
|
116
|
+
this.onChange = fn;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
registerOnTouched(fn: any): void {
|
|
120
|
+
this.onTouched = fn;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
setDisabledState(isDisabled: boolean): void {
|
|
124
|
+
this.disabled = isDisabled;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
onToggleChange(event: any): void {
|
|
128
|
+
this.value = event.target.checked;
|
|
129
|
+
this.checked = this.value;
|
|
130
|
+
this.onChange(this.value);
|
|
131
|
+
this.onTouched();
|
|
132
|
+
this.toggleChange.emit(this.value);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private getStyleValue(value: string | undefined): string | undefined {
|
|
136
|
+
return value ? `${value}` : undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private getThemeColor(colorStr: string | undefined): string | undefined {
|
|
140
|
+
if (!colorStr) return undefined;
|
|
141
|
+
const themeColors: { [key: string]: string } = {
|
|
142
|
+
'primary': 'var(--cc-toggle-primary-bg, var(--cc-btn-primary-bg, #1A73E8))',
|
|
143
|
+
'warning': 'var(--cc-toggle-warning-bg, var(--cc-btn-warning-bg, #F9C80E))',
|
|
144
|
+
'danger': 'var(--cc-toggle-danger-bg, var(--cc-btn-danger-bg, #dc3545))',
|
|
145
|
+
'success': 'var(--cc-toggle-success-bg, var(--cc-btn-success-bg, #28a745))'
|
|
146
|
+
};
|
|
147
|
+
return themeColors[colorStr] || colorStr;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
get wrapperStyles(): { [key: string]: string | undefined } {
|
|
151
|
+
return {
|
|
152
|
+
'--cc-toggle-font-family': this.getStyleValue(this.fontFamily),
|
|
153
|
+
'--cc-toggle-font-size': this.getStyleValue(this.fontSize || this.labelFontSize),
|
|
154
|
+
'--cc-toggle-font-weight': this.getStyleValue(this.fontWeight || this.labelFontWeight),
|
|
155
|
+
'--cc-toggle-label-color': this.getStyleValue(this.labelColor),
|
|
156
|
+
'--cc-toggle-width': this.getStyleValue(this.toggleWidth),
|
|
157
|
+
'--cc-toggle-height': this.getStyleValue(this.toggleHeight),
|
|
158
|
+
'--cc-toggle-gap': this.getStyleValue(this.gap),
|
|
159
|
+
'--cc-toggle-unchecked-bg': this.getStyleValue(this.uncheckedColor),
|
|
160
|
+
'--cc-toggle-checked-bg': this.getStyleValue(this.getThemeColor(this.checkedColor || this.color)),
|
|
161
|
+
'--cc-toggle-thumb-color': this.getStyleValue(this.thumbColor || this.sliderColor),
|
|
162
|
+
'--cc-toggle-checked-thumb-color': this.getStyleValue(this.checkedThumbColor),
|
|
163
|
+
'--cc-toggle-disabled-color': this.getStyleValue(this.disabledColor)
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ToggleLabels {
|
|
2
|
+
label?: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface ToggleConfig {
|
|
6
|
+
label?: string;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
labelPosition?: 'before' | 'after';
|
|
11
|
+
color?: 'primary' | 'warning' | 'danger' | 'success' | string;
|
|
12
|
+
uncheckedColor?: string;
|
|
13
|
+
checkedColor?: string;
|
|
14
|
+
thumbColor?: string;
|
|
15
|
+
checkedThumbColor?: string;
|
|
16
|
+
fontSize?: string;
|
|
17
|
+
fontWeight?: string;
|
|
18
|
+
toggleWidth?: string;
|
|
19
|
+
toggleHeight?: string;
|
|
20
|
+
|
|
21
|
+
// Additional Style Props
|
|
22
|
+
gap?: string;
|
|
23
|
+
fontFamily?: string;
|
|
24
|
+
labelColor?: string;
|
|
25
|
+
labelFontSize?: string;
|
|
26
|
+
labelFontWeight?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Directive, ElementRef, Output, EventEmitter, HostListener } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
selector: '[libClickOutside]',
|
|
5
|
+
standalone: false
|
|
6
|
+
})
|
|
7
|
+
export class ClickOutsideDirective {
|
|
8
|
+
@Output() libClickOutside = new EventEmitter<void>();
|
|
9
|
+
|
|
10
|
+
constructor(private elementRef: ElementRef) { }
|
|
11
|
+
|
|
12
|
+
@HostListener('document:click', ['$event.target'])
|
|
13
|
+
public onClick(target: any): void {
|
|
14
|
+
// Skip if the target was removed from the DOM before the click event fired
|
|
15
|
+
// (happens with CDK virtual scroll which detaches nodes during rendering)
|
|
16
|
+
if (!document.documentElement.contains(target)) return;
|
|
17
|
+
const clickedInside = this.elementRef.nativeElement.contains(target);
|
|
18
|
+
if (!clickedInside) {
|
|
19
|
+
this.libClickOutside.emit();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
4
|
+
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
5
|
+
import { InputComponent } from './components/input/input.component';
|
|
6
|
+
import { DropdownComponent } from './components/dropdown/dropdown.component';
|
|
7
|
+
import { CheckboxComponent } from './components/checkbox/checkbox.component';
|
|
8
|
+
import { RadioComponent } from './components/radio/radio.component';
|
|
9
|
+
import { ToggleComponent } from './components/toggle/toggle.component';
|
|
10
|
+
import { DatepickerComponent } from './components/datepicker/datepicker.component';
|
|
11
|
+
import { SearchComponent } from './components/search/search.component';
|
|
12
|
+
import { ClickOutsideDirective } from './directives/click-outside.directive';
|
|
13
|
+
|
|
14
|
+
@NgModule({
|
|
15
|
+
declarations: [
|
|
16
|
+
InputComponent,
|
|
17
|
+
DropdownComponent,
|
|
18
|
+
CheckboxComponent,
|
|
19
|
+
RadioComponent,
|
|
20
|
+
ToggleComponent,
|
|
21
|
+
DatepickerComponent,
|
|
22
|
+
SearchComponent,
|
|
23
|
+
ClickOutsideDirective
|
|
24
|
+
],
|
|
25
|
+
imports: [
|
|
26
|
+
CommonModule,
|
|
27
|
+
ReactiveFormsModule,
|
|
28
|
+
FormsModule,
|
|
29
|
+
ScrollingModule
|
|
30
|
+
],
|
|
31
|
+
exports: [
|
|
32
|
+
InputComponent,
|
|
33
|
+
DropdownComponent,
|
|
34
|
+
CheckboxComponent,
|
|
35
|
+
RadioComponent,
|
|
36
|
+
ToggleComponent,
|
|
37
|
+
DatepickerComponent,
|
|
38
|
+
SearchComponent
|
|
39
|
+
]
|
|
40
|
+
})
|
|
41
|
+
export class FormComponentsModule { }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@use './components/input/_theme' as input;
|
|
2
|
+
@use './components/dropdown/_theme' as dropdown;
|
|
3
|
+
@use './components/checkbox/_theme' as checkbox;
|
|
4
|
+
@use './components/radio/_theme' as radio;
|
|
5
|
+
@use './components/toggle/_theme' as toggle;
|
|
6
|
+
@use './components/datepicker/_theme' as datepicker;
|
|
7
|
+
@use './components/search/_theme' as search;
|
|
8
|
+
|
|
9
|
+
@forward './components/input/_theme';
|
|
10
|
+
@forward './components/dropdown/_theme';
|
|
11
|
+
@forward './components/checkbox/_theme';
|
|
12
|
+
@forward './components/radio/_theme';
|
|
13
|
+
@forward './components/toggle/_theme';
|
|
14
|
+
@forward './components/datepicker/_theme';
|
|
15
|
+
@forward './components/search/_theme';
|
|
16
|
+
|
|
17
|
+
@mixin form-components-theme() {
|
|
18
|
+
@include input.input-theme();
|
|
19
|
+
@include dropdown.dropdown-theme();
|
|
20
|
+
@include checkbox.checkbox-theme();
|
|
21
|
+
@include radio.radio-theme();
|
|
22
|
+
@include toggle.toggle-theme();
|
|
23
|
+
@include datepicker.datepicker-theme();
|
|
24
|
+
@include search.search-theme();
|
|
25
|
+
}
|