commons-shared-web-ui 0.0.55 → 0.0.56
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 +15897 -0
- package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
- package/index.d.ts +4916 -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 -2765
- package/documentation/smart-table.md +0 -1221
- 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 -88
- 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 -1330
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2112
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -3006
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -65
- 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 -131
- 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 -1131
- package/src/lib/modules/smart-form/index.ts +0 -10
- package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -793
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -21
- 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 -38
- 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 -1128
- package/src/lib/modules/smart-table/models/table-config.model.ts +0 -213
- 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,87 +0,0 @@
|
|
|
1
|
-
.cc-search-wrapper {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
gap: var(--cc-search-label-gap, 0.5rem);
|
|
5
|
-
width: 100%;
|
|
6
|
-
font-family: var(--cc-search-font-family, inherit);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.cc-search-label {
|
|
10
|
-
font-size: var(--cc-search-label-font-size, 0.875rem);
|
|
11
|
-
font-weight: var(--cc-search-label-font-weight, 500);
|
|
12
|
-
color: var(--cc-search-label-color, #202124);
|
|
13
|
-
margin: 0;
|
|
14
|
-
line-height: 1.4;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.cc-search-field {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
width: 100%;
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
background-color: var(--cc-search-bg, #FEFEFE);
|
|
23
|
-
border: var(--cc-search-border-width, 1px) solid var(--cc-search-border-color, #BDC1C6);
|
|
24
|
-
border-radius: var(--cc-search-border-radius, 0.4375rem);
|
|
25
|
-
padding: var(--cc-search-padding, 0.5rem 0.75rem);
|
|
26
|
-
min-height: var(--cc-search-height, 2.5rem);
|
|
27
|
-
transition: border-color 0.2s, box-shadow 0.2s;
|
|
28
|
-
|
|
29
|
-
&.focused {
|
|
30
|
-
border-color: var(--cc-search-focus-border-color, #1A73E8);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.disabled {
|
|
34
|
-
background-color: var(--cc-search-disabled-bg, #F1F3F4);
|
|
35
|
-
cursor: not-allowed;
|
|
36
|
-
|
|
37
|
-
.cc-search-input {
|
|
38
|
-
cursor: not-allowed;
|
|
39
|
-
color: var(--cc-search-disabled-color, #80868B);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.cc-search-icon,
|
|
43
|
-
.cc-clear-btn {
|
|
44
|
-
color: var(--cc-search-disabled-color, #80868B);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.cc-search-icon {
|
|
50
|
-
margin-right: 0.5rem;
|
|
51
|
-
color: var(--cc-search-icon-color, #5F6368);
|
|
52
|
-
display: flex;
|
|
53
|
-
align-items: center;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.cc-search-input {
|
|
57
|
-
flex: 1;
|
|
58
|
-
border: none;
|
|
59
|
-
background: none;
|
|
60
|
-
outline: none;
|
|
61
|
-
font-family: inherit;
|
|
62
|
-
font-size: var(--cc-search-font-size, 0.875rem);
|
|
63
|
-
font-weight: var(--cc-search-font-weight, 400);
|
|
64
|
-
color: var(--cc-search-color, #202124);
|
|
65
|
-
padding: 0;
|
|
66
|
-
margin: 0;
|
|
67
|
-
width: 100%;
|
|
68
|
-
|
|
69
|
-
&::placeholder {
|
|
70
|
-
color: var(--cc-search-placeholder-color, #80868B);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.cc-clear-btn {
|
|
75
|
-
background: none;
|
|
76
|
-
border: none;
|
|
77
|
-
cursor: pointer;
|
|
78
|
-
padding: 0;
|
|
79
|
-
margin-left: 0.5rem;
|
|
80
|
-
display: flex;
|
|
81
|
-
align-items: center;
|
|
82
|
-
color: var(--cc-search-icon-color, #5F6368);
|
|
83
|
-
|
|
84
|
-
&:focus {
|
|
85
|
-
outline: none;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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>
|
|
@@ -1,81 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|