commons-shared-web-ui 0.0.48 → 0.0.50

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.
Files changed (186) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/documentation/alert.md +123 -0
  3. package/documentation/button-dropdown.md +126 -0
  4. package/documentation/button.md +184 -0
  5. package/documentation/cards-usage-guidelines.md +131 -0
  6. package/documentation/configurable-form.md +605 -0
  7. package/documentation/confirmation-modal.md +250 -0
  8. package/documentation/filter-sidebar.md +178 -0
  9. package/documentation/filter-table-selector.md +228 -0
  10. package/documentation/form-builder.md +597 -0
  11. package/documentation/form-components.md +384 -0
  12. package/documentation/nav.md +427 -0
  13. package/documentation/pagination.md +181 -0
  14. package/documentation/side-nav-documentation.md +169 -0
  15. package/documentation/smart-form.md +2405 -0
  16. package/documentation/smart-table.md +1221 -0
  17. package/documentation/snackbar.md +118 -0
  18. package/documentation/style-externalization.md +88 -0
  19. package/documentation/summary-card.md +279 -0
  20. package/ng-package.json +28 -0
  21. package/package.json +53 -34
  22. package/src/lib/modules/alert/alert.models.ts +6 -0
  23. package/src/lib/modules/alert/alert.module.ts +16 -0
  24. package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
  25. package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
  26. package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
  27. package/src/lib/modules/button/button.models.ts +13 -0
  28. package/src/lib/modules/button/button.module.ts +16 -0
  29. package/src/lib/modules/button/components/button/button.component.html +22 -0
  30. package/src/lib/modules/button/components/button/button.component.scss +88 -0
  31. package/src/lib/modules/button/components/button/button.component.ts +67 -0
  32. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
  33. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
  34. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
  35. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
  36. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
  37. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
  38. package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
  39. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
  40. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
  41. package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
  42. package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
  43. package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
  44. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
  45. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
  46. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
  47. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
  48. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
  49. package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
  50. package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
  51. package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
  52. package/src/lib/modules/filter/filter.models.ts +88 -0
  53. package/src/lib/modules/filter/filter.module.ts +24 -0
  54. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
  55. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
  56. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
  57. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
  58. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
  59. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
  60. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
  61. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
  62. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
  63. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
  64. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
  65. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
  66. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
  67. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
  70. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
  71. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
  72. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
  73. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
  74. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
  75. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
  76. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
  77. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
  78. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
  79. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
  80. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
  81. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
  82. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
  83. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
  84. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
  85. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
  86. package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
  87. package/src/lib/modules/form-builder/index.ts +9 -0
  88. package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
  89. package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
  90. package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
  91. package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
  92. package/src/lib/modules/form-builder/services/field-selection.service.ts +299 -0
  93. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +670 -0
  94. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
  95. package/src/lib/modules/form-builder/utils/constants.ts +43 -0
  96. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
  97. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
  98. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
  99. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
  100. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
  101. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
  102. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
  103. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
  104. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
  105. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
  106. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
  107. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
  108. package/src/lib/modules/form-components/components/input/input.component.html +51 -0
  109. package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
  110. package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
  111. package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
  112. package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
  113. package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
  114. package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
  115. package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
  116. package/src/lib/modules/form-components/components/search/search.component.html +15 -0
  117. package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
  118. package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
  119. package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
  120. package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
  121. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
  122. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
  123. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
  124. package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
  125. package/src/lib/modules/form-components/form-components.module.ts +41 -0
  126. package/src/lib/modules/material/material.module.ts +94 -0
  127. package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
  128. package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
  129. package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
  130. package/src/lib/modules/nav/nav.models.ts +31 -0
  131. package/src/lib/modules/nav/nav.module.ts +17 -0
  132. package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
  133. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
  134. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
  135. package/src/lib/modules/pagination/pagination.module.ts +17 -0
  136. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
  137. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
  138. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
  139. package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
  140. package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
  141. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1196 -0
  142. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2014 -0
  143. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2525 -0
  144. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +65 -0
  145. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
  146. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +131 -0
  147. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
  148. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
  149. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1124 -0
  150. package/src/lib/modules/smart-form/index.ts +10 -0
  151. package/src/lib/modules/smart-form/models/form-schema.model.ts +733 -0
  152. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
  153. package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
  154. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
  155. package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
  156. package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
  157. package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
  158. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
  159. package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
  160. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
  161. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
  162. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1128 -0
  163. package/src/lib/modules/smart-table/models/table-config.model.ts +207 -0
  164. package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
  165. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +28 -0
  166. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
  167. package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
  168. package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
  169. package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
  170. package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
  171. package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
  172. package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
  173. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
  174. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
  175. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
  176. package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
  177. package/src/lib/shared-ui.module.ts +44 -0
  178. package/src/lib/utils/constants.ts +11 -0
  179. package/src/lib/utils/storage.utils.ts +37 -0
  180. package/src/lib/utils/string.utils.ts +23 -0
  181. package/src/lib/utils/translation.utils.ts +87 -0
  182. package/src/public-api.ts +104 -0
  183. package/tsconfig.lib.json +15 -0
  184. package/fesm2022/commons-shared-web-ui.mjs +0 -13669
  185. package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
  186. package/index.d.ts +0 -4202
@@ -0,0 +1,267 @@
1
+ import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import { DatePickerConfig, DatepickerLabels } from './datepicker.models';
4
+
5
+ @Component({
6
+ selector: 'lib-datepicker',
7
+ templateUrl: './datepicker.component.html',
8
+ styleUrls: ['./datepicker.component.scss'],
9
+ standalone: false,
10
+ providers: [
11
+ {
12
+ provide: NG_VALUE_ACCESSOR,
13
+ useExisting: forwardRef(() => DatepickerComponent),
14
+ multi: true
15
+ }
16
+ ]
17
+ })
18
+ export class DatepickerComponent implements ControlValueAccessor, OnInit, OnChanges {
19
+ @Input() config?: DatePickerConfig;
20
+ @Input() labels?: DatepickerLabels;
21
+ @Input() label: string = '';
22
+ @Input() placeholder: string = '';
23
+ @Input() disabled: boolean = false;
24
+ @Input() required: boolean = false;
25
+ @Input() minDate?: string | Date; // Support string for native input
26
+ @Input() maxDate?: string | Date; // Support string for native input
27
+ @Input() isRange: boolean = false;
28
+ @Input() startView: 'month' | 'year' | 'multi-year' = 'month';
29
+ @Input() value: any = null;
30
+ @Input() startDate?: string | Date;
31
+ @Input() endDate?: string | Date;
32
+ @Input() errorMessage: string = '';
33
+
34
+ // Style inputs
35
+ @Input() width?: string;
36
+ @Input() height?: string;
37
+ @Input() borderRadius?: string;
38
+ @Input() fontSize?: string;
39
+
40
+ @Input() gap?: string;
41
+ @Input() fontFamily?: string;
42
+ @Input() labelColor?: string;
43
+ @Input() labelFontSize?: string;
44
+ @Input() labelFontWeight?: string;
45
+
46
+ @Input() backgroundColor?: string;
47
+ @Input() borderColor?: string;
48
+ @Input() borderWidth?: string;
49
+ @Input() padding?: string;
50
+ @Input() fontWeight?: string;
51
+ @Input() color?: string;
52
+ @Input() placeholderColor?: string;
53
+ @Input() focusBorderColor?: string;
54
+ @Input() errorColor?: string;
55
+ @Input() disabledBackgroundColor?: string;
56
+ @Input() disabledColor?: string;
57
+ @Input() boxShadow?: string;
58
+
59
+ @Output() dateChange = new EventEmitter<any>();
60
+
61
+ onChange: (value: any) => void = () => { };
62
+ onTouched: () => void = () => { };
63
+
64
+ focused = false;
65
+
66
+ ngOnInit(): void {
67
+ this.updateFromConfig();
68
+ this.updateFromLabels();
69
+ }
70
+
71
+ ngOnChanges(changes: SimpleChanges): void {
72
+ if (changes['config']) {
73
+ this.updateFromConfig();
74
+ }
75
+ if (changes['labels']) {
76
+ this.updateFromLabels();
77
+ }
78
+ }
79
+
80
+ private updateFromConfig(): void {
81
+ if (this.config) {
82
+ this.label = this.config.label ?? this.label;
83
+ this.placeholder = this.config.placeholder ?? this.placeholder;
84
+ this.disabled = this.config.disabled ?? this.disabled;
85
+ this.required = this.config.required ?? this.required;
86
+ this.minDate = this.config.minDate ?? this.minDate;
87
+ this.maxDate = this.config.maxDate ?? this.maxDate;
88
+ this.isRange = this.config.isRange ?? this.isRange;
89
+ this.width = this.config.width ?? this.width;
90
+ this.borderRadius = this.config.borderRadius ?? this.borderRadius;
91
+ this.fontSize = this.config.fontSize ?? this.fontSize;
92
+ this.errorMessage = this.config.errorMessage ?? this.errorMessage;
93
+ this.gap = this.config.gap ?? this.gap;
94
+ this.fontFamily = this.config.fontFamily ?? this.fontFamily;
95
+ this.labelColor = this.config.labelColor ?? this.labelColor;
96
+ this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
97
+ this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
98
+ this.backgroundColor = this.config.backgroundColor ?? this.backgroundColor;
99
+ this.borderColor = this.config.borderColor ?? this.borderColor;
100
+ this.borderWidth = this.config.borderWidth ?? this.borderWidth;
101
+ this.padding = this.config.padding ?? this.padding;
102
+ this.fontWeight = this.config.fontWeight ?? this.fontWeight;
103
+ this.color = this.config.color ?? this.color;
104
+ this.placeholderColor = this.config.placeholderColor ?? this.placeholderColor;
105
+ this.focusBorderColor = this.config.focusBorderColor ?? this.focusBorderColor;
106
+ this.errorColor = this.config.errorColor ?? this.errorColor;
107
+ this.disabledBackgroundColor = this.config.disabledBackgroundColor ?? this.disabledBackgroundColor;
108
+ this.disabledColor = this.config.disabledColor ?? this.disabledColor;
109
+ this.boxShadow = this.config.boxShadow ?? this.boxShadow;
110
+ this.height = this.config.height ?? this.height;
111
+
112
+ if (this.config.value !== undefined) {
113
+ this.value = this.config.value;
114
+ }
115
+ if (this.config.startDate) {
116
+ this.startDate = this.config.startDate;
117
+ }
118
+ if (this.config.endDate) {
119
+ this.endDate = this.config.endDate;
120
+ }
121
+ }
122
+ }
123
+
124
+ private updateFromLabels(): void {
125
+ if (this.labels) {
126
+ this.label = this.labels.label || this.label;
127
+ this.placeholder = this.labels.placeholder || this.placeholder;
128
+ }
129
+ }
130
+
131
+ get requiredMarker(): string {
132
+ return this.labels?.requiredMarker || '*';
133
+ }
134
+
135
+ get startDateLabel(): string {
136
+ return this.labels?.startDateLabel || 'Start Date';
137
+ }
138
+
139
+ get endDateLabel(): string {
140
+ return this.labels?.endDateLabel || 'End Date';
141
+ }
142
+
143
+ // Helper to format Date or string to YYYY-MM-DD for native input
144
+ private formatDate(date: Date | string | undefined | null): string {
145
+ if (!date) return '';
146
+ if (typeof date === 'string') return date; // Assume already formatted or ISO
147
+ try {
148
+ return date.toISOString().split('T')[0];
149
+ } catch (e) {
150
+ return '';
151
+ }
152
+ }
153
+
154
+ get formattedValue(): string {
155
+ return this.formatDate(this.value);
156
+ }
157
+
158
+ get formattedStartDate(): string {
159
+ return this.formatDate(this.startDate);
160
+ }
161
+
162
+ get formattedEndDate(): string {
163
+ return this.formatDate(this.endDate);
164
+ }
165
+
166
+ get formattedMin(): string {
167
+ return this.formatDate(this.minDate);
168
+ }
169
+
170
+ get formattedMax(): string {
171
+ return this.formatDate(this.maxDate);
172
+ }
173
+
174
+
175
+ writeValue(value: any): void {
176
+ if (this.isRange && value && typeof value === 'object' && 'start' in value) {
177
+ this.startDate = value.start;
178
+ this.endDate = value.end;
179
+ } else {
180
+ this.value = value;
181
+ }
182
+ }
183
+
184
+ registerOnChange(fn: any): void {
185
+ this.onChange = fn;
186
+ }
187
+
188
+ registerOnTouched(fn: any): void {
189
+ this.onTouched = fn;
190
+ }
191
+
192
+ setDisabledState(isDisabled: boolean): void {
193
+ this.disabled = isDisabled;
194
+ }
195
+
196
+ onDateInput(event: any): void {
197
+ const value = event.target.value;
198
+ this.value = value; // Keep as string or convert if needed
199
+ this.onChange(this.value);
200
+ this.dateChange.emit(this.value);
201
+ }
202
+
203
+ onBlur(): void {
204
+ this.focused = false;
205
+ this.onTouched();
206
+ }
207
+
208
+ onFocus(): void {
209
+ this.focused = true;
210
+ }
211
+
212
+ onRangeStartInput(event: any): void {
213
+ this.startDate = event.target.value;
214
+ this.updateRangeValue();
215
+ }
216
+
217
+ onRangeEndInput(event: any): void {
218
+ this.endDate = event.target.value;
219
+ this.updateRangeValue();
220
+ }
221
+
222
+ private updateRangeValue(): void {
223
+ const rangeValue = { start: this.startDate, end: this.endDate };
224
+ this.onChange(rangeValue);
225
+ this.dateChange.emit(rangeValue);
226
+ }
227
+
228
+ private getStyleValue(value: string | undefined): string | undefined {
229
+ return value ? `${value}` : undefined;
230
+ }
231
+
232
+ get wrapperStyles(): { [key: string]: string | undefined } {
233
+ return {
234
+ 'width': this.getStyleValue(this.width),
235
+ '--cc-datepicker-label-gap': this.getStyleValue(this.gap),
236
+ '--cc-datepicker-font-family': this.getStyleValue(this.fontFamily)
237
+ };
238
+ }
239
+
240
+ get labelStyles(): { [key: string]: string | undefined } {
241
+ return {
242
+ '--cc-datepicker-label-color': this.getStyleValue(this.labelColor),
243
+ '--cc-datepicker-label-font-size': this.getStyleValue(this.labelFontSize),
244
+ '--cc-datepicker-label-font-weight': this.getStyleValue(this.labelFontWeight)
245
+ };
246
+ }
247
+
248
+ get fieldStyles(): { [key: string]: string | undefined } {
249
+ return {
250
+ '--cc-datepicker-bg': this.getStyleValue(this.backgroundColor),
251
+ '--cc-datepicker-border-radius': this.getStyleValue(this.borderRadius),
252
+ '--cc-datepicker-border-color': this.getStyleValue(this.borderColor),
253
+ '--cc-datepicker-border-width': this.getStyleValue(this.borderWidth),
254
+ '--cc-datepicker-height': this.getStyleValue(this.height),
255
+ '--cc-datepicker-padding': this.getStyleValue(this.padding),
256
+ '--cc-datepicker-font-size': this.getStyleValue(this.fontSize),
257
+ '--cc-datepicker-font-weight': this.getStyleValue(this.fontWeight),
258
+ '--cc-datepicker-color': this.getStyleValue(this.color),
259
+ '--cc-datepicker-placeholder-color': this.getStyleValue(this.placeholderColor),
260
+ '--cc-datepicker-focus-border-color': this.getStyleValue(this.focusBorderColor),
261
+ '--cc-datepicker-error-color': this.getStyleValue(this.errorColor),
262
+ '--cc-datepicker-disabled-bg': this.getStyleValue(this.disabledBackgroundColor),
263
+ '--cc-datepicker-disabled-color': this.getStyleValue(this.disabledColor),
264
+ 'box-shadow': this.getStyleValue(this.boxShadow)
265
+ };
266
+ }
267
+ }
@@ -0,0 +1,45 @@
1
+ export interface DatepickerLabels {
2
+ label?: string;
3
+ placeholder?: string;
4
+ startDateLabel?: string;
5
+ endDateLabel?: string;
6
+ requiredMarker?: string;
7
+ }
8
+
9
+ export interface DatePickerConfig {
10
+ label?: string;
11
+ placeholder?: string;
12
+ value?: Date;
13
+ disabled?: boolean;
14
+ required?: boolean;
15
+ minDate?: Date;
16
+ maxDate?: Date;
17
+ startView?: 'month' | 'year' | 'multi-year';
18
+ isRange?: boolean;
19
+ startDate?: Date;
20
+ endDate?: Date;
21
+ width?: string;
22
+ borderRadius?: string;
23
+ fontSize?: string;
24
+ errorMessage?: string;
25
+
26
+ // Additional Style Props
27
+ gap?: string;
28
+ fontFamily?: string;
29
+ labelColor?: string;
30
+ labelFontSize?: string;
31
+ labelFontWeight?: string;
32
+ backgroundColor?: string;
33
+ borderColor?: string;
34
+ borderWidth?: string;
35
+ padding?: string;
36
+ fontWeight?: string;
37
+ color?: string;
38
+ placeholderColor?: string;
39
+ focusBorderColor?: string;
40
+ errorColor?: string;
41
+ disabledBackgroundColor?: string;
42
+ disabledColor?: string;
43
+ boxShadow?: string;
44
+ height?: string;
45
+ }
@@ -0,0 +1,74 @@
1
+ <div class="cc-dropdown-wrapper" [ngStyle]="wrapperStyles" libClickOutside (libClickOutside)="close()">
2
+ <!-- Label -->
3
+ <label *ngIf="label" class="cc-dropdown-label" [ngStyle]="labelStyles">
4
+ {{ label }}
5
+ <span *ngIf="required" class="cc-required">{{ resolvedLabels.requiredMarker }}</span>
6
+ </label>
7
+
8
+ <!-- Trigger -->
9
+ <div #triggerEl class="cc-dropdown-trigger" [class.disabled]="disabled" [class.open]="isOpen" [class.error]="errorMessage"
10
+ (click)="toggle()" tabindex="0" (keydown)="handleKeyboardEvent($event)" [ngStyle]="fieldStyles">
11
+
12
+ <div class="cc-selected-value" *ngIf="hasValue()">
13
+ {{ multiple ? value.length + ' ' + resolvedLabels.selectedSuffix : getSelectedLabel() }}
14
+ </div>
15
+ <div class="cc-placeholder" *ngIf="!hasValue()">{{ placeholder }}</div>
16
+
17
+ <div class="cc-actions">
18
+ <span *ngIf="clearable && hasValue() && !disabled" class="cc-clear-btn" (click)="clearSelection($event)"
19
+ [attr.aria-label]="resolvedLabels.clearAriaLabel">
20
+ <span class="material-icons">close</span>
21
+ </span>
22
+ <span class="cc-arrow material-icons">expand_more</span>
23
+ </div>
24
+ </div>
25
+
26
+ <!-- Dropdown Menu -->
27
+ <div class="cc-dropdown-menu" *ngIf="isOpen"
28
+ [ngStyle]="{ position: 'fixed', top: menuPosition.top + 'px', left: menuPosition.left + 'px', width: menuPosition.width + 'px', 'z-index': '9999' }"
29
+ (click)="$event.stopPropagation()" (mousedown)="$event.stopPropagation()">
30
+ <!-- Search -->
31
+ <div class="cc-search-container" *ngIf="searchable">
32
+ <input type="text" #searchInput [placeholder]="resolvedLabels.searchPlaceholder"
33
+ (input)="onSearch($any($event.target).value)" (click)="$event.stopPropagation()"
34
+ class="cc-dropdown-search-input" />
35
+ </div>
36
+
37
+ <!-- Options Virtual Scroll -->
38
+ <cdk-virtual-scroll-viewport itemSize="40" class="cc-virtual-scroll"
39
+ [style.height.px]="filteredOptions.length * 40 > 240 ? 240 : (filteredOptions.length * 40 || 40)">
40
+
41
+ <div *cdkVirtualFor="let option of filteredOptions; let i = index" class="cc-option"
42
+ [class.selected]="isSelected(option)" [class.focused]="i === focusedIndex"
43
+ [class.disabled]="option.disabled" (click)="selectOption(option)">
44
+
45
+ <!-- Multi-select checkbox visual -->
46
+ <span class="cc-multi-check" *ngIf="multiple">
47
+ <span class="material-icons" *ngIf="isSelected(option)">check_box</span>
48
+ <span class="material-icons" *ngIf="!isSelected(option)">check_box_outline_blank</span>
49
+ </span>
50
+
51
+ <!-- Icon -->
52
+ <span class="cc-option-icon-wrapper" *ngIf="option.icon">
53
+ <span class="material-icons" *ngIf="getIconType(option.icon) === 'material'">{{
54
+ getIconValue(option.icon) }}</span>
55
+ <i *ngIf="getIconType(option.icon) === 'fontawesome'" [class]="getIconValue(option.icon)"></i>
56
+ <img *ngIf="getIconType(option.icon) === 'img'" [src]="getIconValue(option.icon)"
57
+ class="cc-option-img" alt="icon" />
58
+ </span>
59
+
60
+ <span class="cc-option-label">{{ option.label }}</span>
61
+
62
+ <!-- Single-select check visual -->
63
+ <span class="cc-single-check" *ngIf="!multiple && isSelected(option)">
64
+ <span class="material-icons">check</span>
65
+ </span>
66
+ </div>
67
+
68
+ <div *ngIf="filteredOptions.length === 0" class="cc-no-results">{{ resolvedLabels.noResultsFound }}</div>
69
+ </cdk-virtual-scroll-viewport>
70
+ </div>
71
+
72
+ <!-- Error Message -->
73
+ <div class="cc-error-message" *ngIf="errorMessage">{{ errorMessage }}</div>
74
+ </div>
@@ -0,0 +1,252 @@
1
+ .cc-dropdown-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
+ position: relative; // Context for absolute menu
6
+ font-family: var(--cc-dropdown-font-family, inherit);
7
+ gap: var(--cc-dropdown-label-gap, 0.5rem);
8
+ }
9
+
10
+ .cc-dropdown-label {
11
+ font-size: var(--cc-dropdown-font-size, 0.875rem);
12
+ font-weight: var(--cc-dropdown-font-weight, 500);
13
+ color: var(--cc-dropdown-label-color, #202124);
14
+ margin: 0;
15
+ line-height: 1.4;
16
+ }
17
+
18
+ .cc-required {
19
+ color: var(--cc-dropdown-required-color, #D93025);
20
+ margin-left: 0.25rem;
21
+ }
22
+
23
+ .cc-dropdown-trigger {
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ width: 100%;
28
+ min-height: var(--cc-dropdown-height, 2.5rem);
29
+ padding: var(--cc-dropdown-padding, 0.5rem 0.75rem);
30
+ background-color: var(--cc-dropdown-bg, #FEFEFE);
31
+ border: var(--cc-dropdown-border-width, 1px) solid var(--cc-dropdown-border-color, #BDC1C6);
32
+ border-radius: var(--cc-dropdown-border-radius, 0.4375rem);
33
+ cursor: pointer;
34
+ user-select: none;
35
+ box-sizing: border-box;
36
+ transition: all 0.2s;
37
+
38
+ &:focus {
39
+ outline: none;
40
+ border-color: var(--cc-dropdown-focus-border-color, #1A73E8);
41
+ }
42
+
43
+ &.open {
44
+ border-color: var(--cc-dropdown-focus-border-color, #1A73E8);
45
+ }
46
+
47
+ &.error {
48
+ border-color: var(--cc-dropdown-error-color, #D93025);
49
+ }
50
+
51
+ &.disabled {
52
+ background-color: var(--cc-dropdown-disabled-bg, #F1F3F4);
53
+ cursor: not-allowed;
54
+ color: var(--cc-dropdown-disabled-color, #80868B);
55
+
56
+ .cc-arrow,
57
+ .cc-clear-btn {
58
+ color: var(--cc-dropdown-disabled-color, #80868B);
59
+ }
60
+ }
61
+ }
62
+
63
+ .cc-selected-value {
64
+ flex: 1;
65
+ white-space: nowrap;
66
+ overflow: hidden;
67
+ text-overflow: ellipsis;
68
+ color: var(--cc-dropdown-color, #202124);
69
+ font-size: var(--cc-dropdown-font-size, 0.875rem);
70
+ font-weight: var(--cc-dropdown-font-weight, 400);
71
+ }
72
+
73
+ .cc-placeholder {
74
+ flex: 1;
75
+ color: var(--cc-dropdown-placeholder-color, #80868B);
76
+ font-size: var(--cc-dropdown-font-size, 0.875rem);
77
+ }
78
+
79
+ .cc-actions {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 0.5rem;
83
+ }
84
+
85
+ .cc-arrow {
86
+ color: var(--cc-dropdown-arrow-color, #5F6368);
87
+ transition: transform 0.2s;
88
+ font-size: 1.25rem;
89
+ }
90
+
91
+ .cc-dropdown-trigger.open .cc-arrow {
92
+ transform: rotate(180deg);
93
+ }
94
+
95
+ .cc-clear-btn {
96
+ display: flex;
97
+ align-items: center;
98
+ justify-content: center;
99
+ color: var(--cc-dropdown-arrow-color, #5F6368);
100
+ cursor: pointer;
101
+
102
+ &:hover {
103
+ color: #202124;
104
+ }
105
+
106
+ .material-icons {
107
+ font-size: 1.125rem;
108
+ }
109
+ }
110
+
111
+ // Dropdown Menu
112
+ .cc-dropdown-menu {
113
+ position: absolute;
114
+ top: 100%;
115
+ left: 0;
116
+ width: 100%;
117
+ background-color: #FFF;
118
+ border: 1px solid #BDC1C6; // Default border
119
+ border-radius: 0 0 4px 4px;
120
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
121
+ z-index: 1000;
122
+ margin-top: 2px;
123
+ overflow: hidden;
124
+ animation: fadeIn 0.1s ease-out;
125
+ }
126
+
127
+ @keyframes fadeIn {
128
+ from {
129
+ opacity: 0;
130
+ transform: translateY(-5px);
131
+ }
132
+
133
+ to {
134
+ opacity: 1;
135
+ transform: translateY(0);
136
+ }
137
+ }
138
+
139
+ .cc-search-container {
140
+ padding: 0.5rem;
141
+ border-bottom: 1px solid var(--cc-dropdown-divider-color, #E0E0E0);
142
+ }
143
+
144
+ .cc-dropdown-search-input {
145
+ width: 100%;
146
+ padding: 0.5rem;
147
+ border: 1px solid #BDC1C6;
148
+ border-radius: 4px;
149
+ outline: none;
150
+ box-sizing: border-box;
151
+ font-size: 0.875rem;
152
+
153
+ &:focus {
154
+ border-color: var(--cc-dropdown-focus-border-color, #1A73E8);
155
+ }
156
+ }
157
+
158
+ .cc-virtual-scroll {
159
+ width: 100%;
160
+ // Height set dynamically in template but max-height fallback here
161
+ max-height: 240px;
162
+ }
163
+
164
+ .cc-option {
165
+ display: flex;
166
+ align-items: center;
167
+ padding: 0 0.75rem;
168
+ height: 40px; // Match itemSize
169
+ cursor: pointer;
170
+ color: var(--cc-dropdown-color, #202124);
171
+ font-size: var(--cc-dropdown-font-size, 0.875rem);
172
+ transition: background-color 0.1s;
173
+ box-sizing: border-box;
174
+
175
+ &:hover,
176
+ &.focused {
177
+ background-color: #F1F3F4;
178
+ }
179
+
180
+ &.selected {
181
+ background-color: #E8F0FE;
182
+ color: #1A73E8;
183
+ }
184
+
185
+ &.disabled {
186
+ opacity: 0.5;
187
+ cursor: not-allowed;
188
+ background-color: transparent;
189
+ }
190
+ }
191
+
192
+ .cc-multi-check {
193
+ margin-right: 0.5rem;
194
+ color: var(--cc-dropdown-arrow-color, #5F6368);
195
+ display: flex;
196
+ align-items: center;
197
+
198
+ .material-icons {
199
+ font-size: 1.25rem;
200
+ }
201
+ }
202
+
203
+ .cc-option.selected .cc-multi-check {
204
+ color: #1A73E8;
205
+ }
206
+
207
+ .cc-option-icon-wrapper {
208
+ margin-right: 0.5rem;
209
+ display: flex;
210
+ align-items: center;
211
+
212
+ .material-icons {
213
+ font-size: 1.25rem;
214
+ }
215
+ }
216
+
217
+ .cc-option-img {
218
+ width: 1.25rem;
219
+ height: 1.25rem;
220
+ object-fit: contain;
221
+ }
222
+
223
+ .cc-option-label {
224
+ flex: 1;
225
+ white-space: nowrap;
226
+ overflow: hidden;
227
+ text-overflow: ellipsis;
228
+ }
229
+
230
+ .cc-single-check {
231
+ margin-left: 0.5rem;
232
+ color: #1A73E8;
233
+ display: flex;
234
+ align-items: center;
235
+
236
+ .material-icons {
237
+ font-size: 1.125rem;
238
+ }
239
+ }
240
+
241
+ .cc-no-results {
242
+ padding: 0.75rem;
243
+ color: #80868B;
244
+ text-align: center;
245
+ font-size: 0.875rem;
246
+ }
247
+
248
+ .cc-error-message {
249
+ font-size: 0.75rem;
250
+ color: var(--cc-dropdown-error-color, #D93025);
251
+ margin-top: 0.25rem;
252
+ }