@aaamb/ngx-design-system 1.4.0 → 1.4.1
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/.editorconfig +17 -0
- package/.nvmrc +1 -0
- package/.postcssrc.json +5 -0
- package/.storybook/main.ts +20 -0
- package/.storybook/preview.ts +23 -0
- package/.storybook/storybook.css +1 -0
- package/.storybook/tsconfig.json +19 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/CHANGELOG.md +10 -0
- package/LOCAL_DEVELOPMENT.md +129 -0
- package/angular.json +74 -0
- package/bitbucket-pipelines.yml +41 -0
- package/iac/bin/app.ts +42 -0
- package/iac/cdk.json +82 -0
- package/iac/lib/config/environments.ts +19 -0
- package/iac/lib/config/types.ts +13 -0
- package/iac/lib/stacks/certificate-stack.ts +34 -0
- package/iac/lib/stacks/frontend-stack.ts +120 -0
- package/iac/lib/stacks/index.ts +2 -0
- package/iac/package-lock.json +726 -0
- package/iac/package.json +25 -0
- package/iac/tsconfig.json +24 -0
- package/ng-package.json +8 -0
- package/package.json +58 -14
- package/src/components/button/button-green.stories.ts +101 -0
- package/src/components/button/button-text.stories.ts +105 -0
- package/src/components/button/button-white.stories.ts +105 -0
- package/src/components/button/button.component.stories.ts +91 -0
- package/src/components/button/button.component.ts +93 -0
- package/src/components/checkbox/checkbox.component.html +30 -0
- package/src/components/checkbox/checkbox.component.stories.ts +183 -0
- package/src/components/checkbox/checkbox.component.ts +211 -0
- package/src/components/datepicker-selector/datepicker-selector.component.html +103 -0
- package/src/components/datepicker-selector/datepicker-selector.component.stories.ts +123 -0
- package/src/components/datepicker-selector/datepicker-selector.component.ts +337 -0
- package/src/components/error-message/error-message.component.html +3 -0
- package/src/components/error-message/error-message.component.ts +13 -0
- package/src/components/filter-button/filter-button.component.html +286 -0
- package/src/components/filter-button/filter-button.component.stories.ts +123 -0
- package/src/components/filter-button/filter-button.component.ts +582 -0
- package/src/components/icon/icon.component.ts +20 -0
- package/src/components/icon/icon.html +1424 -0
- package/src/components/icon/icon.stories.ts +49 -0
- package/src/components/icon/icons-list.stories.ts +42 -0
- package/src/components/input/input.component.stories.ts +101 -0
- package/src/components/input/input.component.ts +317 -0
- package/src/components/input/input.html +160 -0
- package/src/components/input-datepicker/input-datepicker.component.ts +356 -0
- package/src/components/input-datepicker/input-datepicker.html +69 -0
- package/src/components/input-datepicker/input-datepicker.stories.ts +99 -0
- package/src/components/input-rangepicker/input-rangepicker.component.ts +365 -0
- package/src/components/input-rangepicker/input-rangepicker.html +54 -0
- package/src/components/input-rangepicker/input-rangepicker.stories.ts +88 -0
- package/src/components/input-weekpicker/input-weekpicker.component.ts +417 -0
- package/src/components/input-weekpicker/input-weekpicker.html +54 -0
- package/src/components/input-weekpicker/input-weekpicker.stories.ts +103 -0
- package/src/components/label/label.component.html +20 -0
- package/src/components/label/label.component.ts +22 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.html +32 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.stories.ts +57 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.ts +48 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.html +118 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.stories.ts +93 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.ts +187 -0
- package/src/components/modals/help-modal/help-modal.component.html +32 -0
- package/src/components/modals/help-modal/help-modal.component.stories.ts +76 -0
- package/src/components/modals/help-modal/help-modal.component.ts +54 -0
- package/src/components/modals/information-modal/information-modal.component.html +24 -0
- package/src/components/modals/information-modal/information-modal.component.stories.ts +62 -0
- package/src/components/modals/information-modal/information-modal.component.ts +35 -0
- package/src/components/modals/main-modal/main-modal.component.html +85 -0
- package/src/components/modals/main-modal/main-modal.component.stories.ts +127 -0
- package/src/components/modals/main-modal/main-modal.component.ts +85 -0
- package/src/components/modals/notification-modal/notification-modal.component.html +22 -0
- package/src/components/modals/notification-modal/notification-modal.component.stories.ts +59 -0
- package/src/components/modals/notification-modal/notification-modal.component.ts +37 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.html +51 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.stories.ts +306 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.ts +308 -0
- package/src/components/selectors/single-selector/single-selector.component.html +46 -0
- package/src/components/selectors/single-selector/single-selector.component.stories.ts +294 -0
- package/src/components/selectors/single-selector/single-selector.component.ts +239 -0
- package/src/components/side-nav/side-nav.component.stories.ts +176 -0
- package/src/components/side-nav/side-nav.component.ts +325 -0
- package/src/components/snackbar/snackbar.component.ts +150 -0
- package/src/components/snackbar/snackbar.html +21 -0
- package/src/components/snackbar/snackbar.stories.ts +51 -0
- package/src/components/state/state.component.ts +30 -0
- package/src/components/state/state.html +13 -0
- package/src/components/state/state.stories.ts +74 -0
- package/src/components/table/table.component.html +466 -0
- package/src/components/table/table.component.scss +28 -0
- package/src/components/table/table.component.stories.ts +655 -0
- package/src/components/table/table.component.ts +475 -0
- package/src/components/tabs/tabs.component.stories.ts +114 -0
- package/src/components/tabs/tabs.component.ts +69 -0
- package/src/core/types.ts +494 -0
- package/src/public-api.ts +23 -0
- package/tsconfig.json +37 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +13 -0
- package/fesm2022/aaamb-ngx-design-system.mjs +0 -4115
- package/fesm2022/aaamb-ngx-design-system.mjs.map +0 -1
- package/styles/compiled.css +0 -2
- package/types/aaamb-ngx-design-system.d.ts +0 -1146
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
Component,
|
|
4
|
+
ElementRef,
|
|
5
|
+
forwardRef,
|
|
6
|
+
HostListener,
|
|
7
|
+
ViewChild,
|
|
8
|
+
computed,
|
|
9
|
+
input,
|
|
10
|
+
signal,
|
|
11
|
+
} from '@angular/core';
|
|
12
|
+
import {
|
|
13
|
+
ControlValueAccessor,
|
|
14
|
+
FormsModule,
|
|
15
|
+
NG_VALUE_ACCESSOR,
|
|
16
|
+
} from '@angular/forms';
|
|
17
|
+
import { en_US, NZ_DATE_CONFIG, NZ_I18N } from 'ng-zorro-antd/i18n';
|
|
18
|
+
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
|
|
19
|
+
import { IconComponent } from '../icon/icon.component';
|
|
20
|
+
import { ButtonComponent } from '../button/button.component';
|
|
21
|
+
import {
|
|
22
|
+
AdsButtonColor,
|
|
23
|
+
AdsButtonVariant,
|
|
24
|
+
AdsIconName,
|
|
25
|
+
DatepickerSelectorButtonLabelMode,
|
|
26
|
+
PickerMode,
|
|
27
|
+
PickerOption,
|
|
28
|
+
} from '../../core/types';
|
|
29
|
+
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'ads-datepicker-selector',
|
|
32
|
+
standalone: true,
|
|
33
|
+
imports: [
|
|
34
|
+
CommonModule,
|
|
35
|
+
FormsModule,
|
|
36
|
+
NzDatePickerModule,
|
|
37
|
+
IconComponent,
|
|
38
|
+
ButtonComponent,
|
|
39
|
+
],
|
|
40
|
+
templateUrl: './datepicker-selector.component.html',
|
|
41
|
+
providers: [
|
|
42
|
+
{
|
|
43
|
+
provide: NZ_I18N,
|
|
44
|
+
useValue: en_US,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
provide: NZ_DATE_CONFIG,
|
|
48
|
+
useValue: { firstDayOfWeek: 2 },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
provide: NG_VALUE_ACCESSOR,
|
|
52
|
+
useExisting: forwardRef(() => DatepickerSelectorComponent),
|
|
53
|
+
multi: true,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
})
|
|
57
|
+
export class DatepickerSelectorComponent implements ControlValueAccessor {
|
|
58
|
+
isPickerDisabled = input<boolean>(false);
|
|
59
|
+
buttonVariant = input<AdsButtonVariant>('secondary');
|
|
60
|
+
buttonColor = input<AdsButtonColor>('white');
|
|
61
|
+
buttonOnlyIconButton = input<boolean>(false);
|
|
62
|
+
buttonIcon = input<AdsIconName>('edit_calendar');
|
|
63
|
+
buttonLabelMode = input<DatepickerSelectorButtonLabelMode>('option');
|
|
64
|
+
@ViewChild('selectorTrigger', { read: ElementRef })
|
|
65
|
+
selectorTriggerRef?: ElementRef<HTMLButtonElement>;
|
|
66
|
+
|
|
67
|
+
readonly dateOptions = {
|
|
68
|
+
annually: 'annually',
|
|
69
|
+
monthly: 'monthly',
|
|
70
|
+
weekly: 'weekly',
|
|
71
|
+
quarterly: 'quarterly',
|
|
72
|
+
daily: 'daily',
|
|
73
|
+
} as const;
|
|
74
|
+
|
|
75
|
+
readonly pickerOptions: PickerOption[] = [
|
|
76
|
+
{ mode: 'annually', label: 'Annually' },
|
|
77
|
+
{ mode: 'monthly', label: 'Monthly' },
|
|
78
|
+
{ mode: 'weekly', label: 'Weekly' },
|
|
79
|
+
{ mode: 'quarterly', label: 'Quarterly' },
|
|
80
|
+
{ mode: 'daily', label: 'Daily' },
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
readonly selectedTimeFrame = signal<PickerMode>(this.dateOptions.monthly);
|
|
84
|
+
readonly hoveredTimeFrame = signal<PickerMode | null>(null);
|
|
85
|
+
readonly isSelectorOpen = signal(false);
|
|
86
|
+
readonly openToLeft = signal(false);
|
|
87
|
+
readonly selectedDate = signal<Date | null>(this.getToday());
|
|
88
|
+
readonly currentTimeFrameLabel = computed(
|
|
89
|
+
() =>
|
|
90
|
+
this.pickerOptions.find(
|
|
91
|
+
(option) => option.mode === this.selectedTimeFrame(),
|
|
92
|
+
)?.label ?? 'Monthly',
|
|
93
|
+
);
|
|
94
|
+
readonly buttonLabel = computed(() => {
|
|
95
|
+
if (this.buttonLabelMode() === 'option') {
|
|
96
|
+
return this.currentTimeFrameLabel();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const date = this.selectedDate();
|
|
100
|
+
return date
|
|
101
|
+
? this.formatSelectionLabel(this.selectedTimeFrame(), date)
|
|
102
|
+
: this.currentTimeFrameLabel();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
readonly activePreviewTimeFrame = computed(() => this.hoveredTimeFrame());
|
|
106
|
+
|
|
107
|
+
date: Date | null = this.getToday();
|
|
108
|
+
private cvaDisabled = false;
|
|
109
|
+
private hasReceivedInitialWrite = false;
|
|
110
|
+
private onChange: (value: Date | null) => void = () => {};
|
|
111
|
+
private onTouched: () => void = () => {};
|
|
112
|
+
|
|
113
|
+
constructor(private elementRef: ElementRef<HTMLElement>) {}
|
|
114
|
+
|
|
115
|
+
isDisabled(): boolean {
|
|
116
|
+
return this.isPickerDisabled() || this.cvaDisabled;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
toggleSelector(): void {
|
|
120
|
+
if (this.isDisabled()) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const willOpen = !this.isSelectorOpen();
|
|
125
|
+
this.isSelectorOpen.set(willOpen);
|
|
126
|
+
|
|
127
|
+
if (willOpen) {
|
|
128
|
+
this.updatePopoverDirection();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
this.clearPreview();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
previewTimeFrame(mode: PickerMode): void {
|
|
136
|
+
this.hoveredTimeFrame.set(mode);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
clearPreview(): void {
|
|
140
|
+
this.hoveredTimeFrame.set(null);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
onDateChange(mode: PickerMode, value: Date | null): void {
|
|
144
|
+
const normalizedDate = this.normalizeDateByMode(mode, value);
|
|
145
|
+
|
|
146
|
+
this.selectedTimeFrame.set(mode);
|
|
147
|
+
this.date = normalizedDate;
|
|
148
|
+
this.selectedDate.set(normalizedDate);
|
|
149
|
+
this.onChange(normalizedDate);
|
|
150
|
+
this.onTouched();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private formatSelectionLabel(mode: PickerMode, date: Date): string {
|
|
154
|
+
const year = date.getFullYear();
|
|
155
|
+
|
|
156
|
+
if (mode === this.dateOptions.annually) {
|
|
157
|
+
return String(year);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (mode === this.dateOptions.monthly) {
|
|
161
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
162
|
+
month: 'long',
|
|
163
|
+
year: 'numeric',
|
|
164
|
+
}).format(date);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (mode === this.dateOptions.quarterly) {
|
|
168
|
+
return `Q${Math.floor(date.getMonth() / 3) + 1} ${year}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (mode === this.dateOptions.weekly) {
|
|
172
|
+
const start = this.getStartOfWeek(date);
|
|
173
|
+
const end = new Date(start);
|
|
174
|
+
end.setDate(start.getDate() + 6);
|
|
175
|
+
return `${this.formatNumericDate(start)} - ${this.formatNumericDate(end)}`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return this.formatNumericDate(date);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private formatNumericDate(date: Date): string {
|
|
182
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
183
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
184
|
+
return `${month}/${day}/${date.getFullYear()}`;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private normalizeDateByMode(
|
|
188
|
+
mode: PickerMode,
|
|
189
|
+
value: Date | null,
|
|
190
|
+
): Date | null {
|
|
191
|
+
const parsedDate = this.toDate(value);
|
|
192
|
+
|
|
193
|
+
if (!parsedDate) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (mode === this.dateOptions.weekly) {
|
|
198
|
+
return this.getStartOfWeek(parsedDate);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return parsedDate;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private getStartOfWeek(date: Date): Date {
|
|
205
|
+
const normalized = new Date(date);
|
|
206
|
+
normalized.setHours(0, 0, 0, 0);
|
|
207
|
+
|
|
208
|
+
const day = normalized.getDay();
|
|
209
|
+
const offsetToMonday = day === 0 ? -6 : 1 - day;
|
|
210
|
+
|
|
211
|
+
normalized.setDate(normalized.getDate() + offsetToMonday);
|
|
212
|
+
return normalized;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
private toDate(value: unknown): Date | null {
|
|
216
|
+
if (!value) return null;
|
|
217
|
+
|
|
218
|
+
if (value instanceof Date) {
|
|
219
|
+
return Number.isNaN(value.getTime()) ? null : value;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (typeof value === 'string') {
|
|
223
|
+
const parsed = new Date(value);
|
|
224
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (typeof value === 'object') {
|
|
228
|
+
const valueWithToDate = value as { toDate?: () => Date };
|
|
229
|
+
if (typeof valueWithToDate.toDate === 'function') {
|
|
230
|
+
const parsed = valueWithToDate.toDate();
|
|
231
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const valueWithNativeDate = value as { $d?: Date };
|
|
235
|
+
if (valueWithNativeDate.$d instanceof Date) {
|
|
236
|
+
return Number.isNaN(valueWithNativeDate.$d.getTime())
|
|
237
|
+
? null
|
|
238
|
+
: valueWithNativeDate.$d;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private getToday(): Date {
|
|
246
|
+
const today = new Date();
|
|
247
|
+
today.setHours(0, 0, 0, 0);
|
|
248
|
+
return today;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
disableFutureDates = (current: Date): boolean => {
|
|
252
|
+
const today = new Date();
|
|
253
|
+
today.setHours(0, 0, 0, 0);
|
|
254
|
+
|
|
255
|
+
const comparedDate = new Date(current);
|
|
256
|
+
comparedDate.setHours(0, 0, 0, 0);
|
|
257
|
+
|
|
258
|
+
return comparedDate.getTime() > today.getTime();
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
closeSelector(): void {
|
|
262
|
+
this.isSelectorOpen.set(false);
|
|
263
|
+
this.openToLeft.set(false);
|
|
264
|
+
this.clearPreview();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@HostListener('window:resize')
|
|
268
|
+
onWindowResize(): void {
|
|
269
|
+
if (!this.isSelectorOpen()) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
this.updatePopoverDirection();
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private updatePopoverDirection(): void {
|
|
277
|
+
const triggerRect =
|
|
278
|
+
this.selectorTriggerRef?.nativeElement.getBoundingClientRect();
|
|
279
|
+
if (!triggerRect) {
|
|
280
|
+
this.openToLeft.set(false);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const viewportWidth =
|
|
285
|
+
window.innerWidth || document.documentElement.clientWidth || 0;
|
|
286
|
+
const estimatedPopoverWidth = 640;
|
|
287
|
+
const spaceToRight = viewportWidth - triggerRect.left;
|
|
288
|
+
const spaceToLeft = triggerRect.right;
|
|
289
|
+
|
|
290
|
+
const shouldOpenToLeft =
|
|
291
|
+
spaceToRight < estimatedPopoverWidth &&
|
|
292
|
+
spaceToLeft > spaceToRight;
|
|
293
|
+
|
|
294
|
+
this.openToLeft.set(shouldOpenToLeft);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
writeValue(value: Date | string | null): void {
|
|
298
|
+
if (!this.hasReceivedInitialWrite) {
|
|
299
|
+
this.hasReceivedInitialWrite = true;
|
|
300
|
+
this.date = value ? this.toDate(value) : this.getToday();
|
|
301
|
+
this.selectedDate.set(this.date);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
this.date = this.toDate(value);
|
|
306
|
+
this.selectedDate.set(this.date);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
registerOnChange(fn: (value: Date | null) => void): void {
|
|
310
|
+
this.onChange = fn;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
registerOnTouched(fn: () => void): void {
|
|
314
|
+
this.onTouched = fn;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
setDisabledState(isDisabled: boolean): void {
|
|
318
|
+
this.cvaDisabled = isDisabled;
|
|
319
|
+
if (isDisabled) {
|
|
320
|
+
this.closeSelector();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
@HostListener('document:click', ['$event'])
|
|
325
|
+
onDocumentClick(event: MouseEvent): void {
|
|
326
|
+
if (!this.isSelectorOpen()) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const target = event.target as HTMLElement;
|
|
331
|
+
if (this.elementRef.nativeElement.contains(target)) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
this.closeSelector();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component, input } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ads-error-message',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [CommonModule],
|
|
8
|
+
templateUrl: './error-message.component.html',
|
|
9
|
+
})
|
|
10
|
+
export class ErrorMessageComponent {
|
|
11
|
+
hasError = input<boolean>(false);
|
|
12
|
+
errorMessage = input<string>('');
|
|
13
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
<div class="relative flex h-full w-fit gap-4">
|
|
2
|
+
<div class="relative flex h-full items-center gap-2">
|
|
3
|
+
<button
|
|
4
|
+
ads-button
|
|
5
|
+
type="button"
|
|
6
|
+
[variant]="resolvedButtonVariant()"
|
|
7
|
+
[color]="resolvedButtonColor()"
|
|
8
|
+
[disabled]="buttonDisabled()"
|
|
9
|
+
[iconButton]="resolvedIconGapValue()"
|
|
10
|
+
(clicked)="togglePanel()"
|
|
11
|
+
>
|
|
12
|
+
{{ buttonLabel() }}
|
|
13
|
+
@if (showButtonIcon()) {
|
|
14
|
+
<ads-icon [iconName]="buttonIcon()" [size]="16"></ads-icon>
|
|
15
|
+
}
|
|
16
|
+
</button>
|
|
17
|
+
|
|
18
|
+
<ng-content select="[filter-button-extra]"></ng-content>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
@if (isOpen()) {
|
|
22
|
+
<div
|
|
23
|
+
class="absolute right-0 top-[calc(100%+0.25rem)] z-400 h-fit min-h-40 w-[min(48rem,calc(100vw-3rem))] overflow-visible rounded-lg bg-white px-8 py-5 shadow-[0px_2px_10px_-4px_#00000040]"
|
|
24
|
+
animate.enter="fade-in"
|
|
25
|
+
animate.leave="fade-out"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="mb-4 flex w-full items-center justify-between border-b border-[#e7e7e7] pb-2"
|
|
29
|
+
>
|
|
30
|
+
<h4 class="m-0 text-[1.12rem] font-medium text-black">
|
|
31
|
+
{{ panelTitle() }}
|
|
32
|
+
</h4>
|
|
33
|
+
|
|
34
|
+
<button
|
|
35
|
+
ads-button
|
|
36
|
+
type="button"
|
|
37
|
+
variant="secondary"
|
|
38
|
+
color="text"
|
|
39
|
+
[iconButton]="'plus'"
|
|
40
|
+
[disabled]="!canAddFilter()"
|
|
41
|
+
class="px-1! py-1! text-[1.12rem]! font-normal! leading-none!"
|
|
42
|
+
(click)="onAddFilterClick()"
|
|
43
|
+
>
|
|
44
|
+
<ads-icon
|
|
45
|
+
iconName="plus"
|
|
46
|
+
[size]="16"
|
|
47
|
+
[ngClass]="{
|
|
48
|
+
'text-gray-400': !canAddFilter(),
|
|
49
|
+
'text-aqua-0': canAddFilter(),
|
|
50
|
+
}"
|
|
51
|
+
></ads-icon>
|
|
52
|
+
{{ addFilterLabel() }}
|
|
53
|
+
</button>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="mb-5 min-w-136">
|
|
57
|
+
<form [formGroup]="filterForm" class="space-y-3">
|
|
58
|
+
@if (hasFilters()) {
|
|
59
|
+
<div class="grid grid-cols-[1fr_1fr_auto] items-start gap-3 mb-1">
|
|
60
|
+
<p class="m-0 pt-1 text-sm font-medium leading-6">Column</p>
|
|
61
|
+
<p class="m-0 pt-1 text-sm font-medium leading-6">Value</p>
|
|
62
|
+
<span aria-hidden="true" style="width: 40px"></span>
|
|
63
|
+
</div>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
<div formArrayName="filters" class="space-y-2">
|
|
67
|
+
@if (hasFilters()) {
|
|
68
|
+
@for (
|
|
69
|
+
group of filtersArray.controls;
|
|
70
|
+
track group;
|
|
71
|
+
let i = $index
|
|
72
|
+
) {
|
|
73
|
+
<div
|
|
74
|
+
[formGroupName]="i"
|
|
75
|
+
class="grid grid-cols-[1fr_1fr_auto] items-start gap-3"
|
|
76
|
+
>
|
|
77
|
+
<ads-single-selector
|
|
78
|
+
formControlName="column"
|
|
79
|
+
[placeholder]="columnPlaceholder()"
|
|
80
|
+
[options]="columnOptionsForRow(i)"
|
|
81
|
+
(valueChange)="onColumnChange(i, $event)"
|
|
82
|
+
[errorMessage]="''"
|
|
83
|
+
></ads-single-selector>
|
|
84
|
+
|
|
85
|
+
@switch (rowValueType(i)) {
|
|
86
|
+
@case ("date") {
|
|
87
|
+
<ads-input-datepicker
|
|
88
|
+
formControlName="value"
|
|
89
|
+
datePickerPlaceholder="MM/DD/YYYY"
|
|
90
|
+
[hasError]="hasDateError(i)"
|
|
91
|
+
></ads-input-datepicker>
|
|
92
|
+
}
|
|
93
|
+
@case ("number") {
|
|
94
|
+
<ads-input
|
|
95
|
+
formControlName="value"
|
|
96
|
+
inputType="number"
|
|
97
|
+
[label]="''"
|
|
98
|
+
placeholder="0000000"
|
|
99
|
+
></ads-input>
|
|
100
|
+
}
|
|
101
|
+
@case ("boolean") {
|
|
102
|
+
<ads-single-selector
|
|
103
|
+
formControlName="value"
|
|
104
|
+
placeholder="Select an option"
|
|
105
|
+
[options]="valueOptionsForRow(i)"
|
|
106
|
+
[errorMessage]="''"
|
|
107
|
+
></ads-single-selector>
|
|
108
|
+
}
|
|
109
|
+
@case ("status") {
|
|
110
|
+
<ads-single-selector
|
|
111
|
+
formControlName="value"
|
|
112
|
+
placeholder="Select an option"
|
|
113
|
+
[options]="valueOptionsForRow(i)"
|
|
114
|
+
[errorMessage]="''"
|
|
115
|
+
></ads-single-selector>
|
|
116
|
+
}
|
|
117
|
+
@case ("codes") {
|
|
118
|
+
<ads-single-selector
|
|
119
|
+
formControlName="value"
|
|
120
|
+
placeholder="Select an option"
|
|
121
|
+
[options]="valueOptionsForRow(i)"
|
|
122
|
+
[errorMessage]="''"
|
|
123
|
+
></ads-single-selector>
|
|
124
|
+
}
|
|
125
|
+
@case ("custom") {
|
|
126
|
+
<ads-single-selector
|
|
127
|
+
formControlName="value"
|
|
128
|
+
placeholder="Select an option"
|
|
129
|
+
[options]="valueOptionsForRow(i)"
|
|
130
|
+
[errorMessage]="''"
|
|
131
|
+
></ads-single-selector>
|
|
132
|
+
}
|
|
133
|
+
@default {
|
|
134
|
+
<ads-input
|
|
135
|
+
formControlName="value"
|
|
136
|
+
inputType="text"
|
|
137
|
+
[label]="''"
|
|
138
|
+
[placeholder]="valuePlaceholder()"
|
|
139
|
+
></ads-input>
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
<button
|
|
144
|
+
ads-button
|
|
145
|
+
type="button"
|
|
146
|
+
variant="primary"
|
|
147
|
+
color="text"
|
|
148
|
+
[onlyIconButton]="true"
|
|
149
|
+
aria-label="Remove filter"
|
|
150
|
+
(clicked)="onRemoveFilterClick(i)"
|
|
151
|
+
>
|
|
152
|
+
<ads-icon
|
|
153
|
+
[iconName]="'error'"
|
|
154
|
+
[size]="16"
|
|
155
|
+
color="#014744"
|
|
156
|
+
></ads-icon>
|
|
157
|
+
</button>
|
|
158
|
+
</div>
|
|
159
|
+
}
|
|
160
|
+
} @else {
|
|
161
|
+
<div
|
|
162
|
+
class="flex min-h-28 items-center justify-center rounded-lg border border-dashed border-[#d7d7d7] bg-white px-4 text-sm text-[#666]"
|
|
163
|
+
>
|
|
164
|
+
{{ noFiltersText() }}
|
|
165
|
+
</div>
|
|
166
|
+
}
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
@if (sortableColumnOptions().length > 0) {
|
|
170
|
+
<div class="mt-4 border-t border-[#e7e7e7] pt-4">
|
|
171
|
+
<div class="mb-3 flex w-full items-center justify-between">
|
|
172
|
+
<h4 class="m-0 text-[1.12rem] font-medium text-black">Sort</h4>
|
|
173
|
+
|
|
174
|
+
<button
|
|
175
|
+
ads-button
|
|
176
|
+
type="button"
|
|
177
|
+
variant="secondary"
|
|
178
|
+
color="text"
|
|
179
|
+
[iconButton]="'plus'"
|
|
180
|
+
[disabled]="!canAddSort()"
|
|
181
|
+
class="px-1! py-1! text-[1.12rem]! font-normal! leading-none!"
|
|
182
|
+
(click)="onAddSortClick()"
|
|
183
|
+
>
|
|
184
|
+
<ads-icon
|
|
185
|
+
iconName="plus"
|
|
186
|
+
[size]="16"
|
|
187
|
+
[ngClass]="{
|
|
188
|
+
'text-gray-400': !canAddSort(),
|
|
189
|
+
'text-aqua-0': canAddSort(),
|
|
190
|
+
}"
|
|
191
|
+
></ads-icon>
|
|
192
|
+
Add Sort
|
|
193
|
+
</button>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
@if (hasSorts()) {
|
|
197
|
+
<div
|
|
198
|
+
class="grid grid-cols-[1fr_1fr_auto] items-start gap-3 mb-1"
|
|
199
|
+
>
|
|
200
|
+
<p class="m-0 pt-1 text-sm font-medium leading-6">Column</p>
|
|
201
|
+
<p class="m-0 pt-1 text-sm font-medium leading-6">
|
|
202
|
+
Direction
|
|
203
|
+
</p>
|
|
204
|
+
<span aria-hidden="true" style="width: 40px"></span>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div formArrayName="sorts" class="space-y-2">
|
|
208
|
+
@for (
|
|
209
|
+
group of sortsArray.controls;
|
|
210
|
+
track group;
|
|
211
|
+
let i = $index
|
|
212
|
+
) {
|
|
213
|
+
<div
|
|
214
|
+
[formGroupName]="i"
|
|
215
|
+
class="grid grid-cols-[1fr_1fr_auto] items-start gap-3"
|
|
216
|
+
>
|
|
217
|
+
<ads-single-selector
|
|
218
|
+
formControlName="column"
|
|
219
|
+
placeholder="Select a sort field"
|
|
220
|
+
[options]="sortColumnOptionsForRow(i)"
|
|
221
|
+
[errorMessage]="''"
|
|
222
|
+
></ads-single-selector>
|
|
223
|
+
|
|
224
|
+
<ads-single-selector
|
|
225
|
+
formControlName="direction"
|
|
226
|
+
placeholder="Direction"
|
|
227
|
+
[options]="sortValueOptions()"
|
|
228
|
+
[errorMessage]="''"
|
|
229
|
+
></ads-single-selector>
|
|
230
|
+
|
|
231
|
+
<button
|
|
232
|
+
ads-button
|
|
233
|
+
type="button"
|
|
234
|
+
variant="primary"
|
|
235
|
+
color="text"
|
|
236
|
+
[onlyIconButton]="true"
|
|
237
|
+
aria-label="Remove sort"
|
|
238
|
+
(clicked)="onRemoveSortClick(i)"
|
|
239
|
+
>
|
|
240
|
+
<ads-icon
|
|
241
|
+
[iconName]="'error'"
|
|
242
|
+
[size]="16"
|
|
243
|
+
color="#014744"
|
|
244
|
+
></ads-icon>
|
|
245
|
+
</button>
|
|
246
|
+
</div>
|
|
247
|
+
}
|
|
248
|
+
</div>
|
|
249
|
+
} @else {
|
|
250
|
+
<div
|
|
251
|
+
class="flex min-h-20 items-center justify-center rounded-lg border border-dashed border-[#d7d7d7] bg-white px-4 text-sm text-[#666]"
|
|
252
|
+
>
|
|
253
|
+
{{ noSortText() }}
|
|
254
|
+
</div>
|
|
255
|
+
}
|
|
256
|
+
</div>
|
|
257
|
+
}
|
|
258
|
+
</form>
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
@if (hasFilters() || hasSorts()) {
|
|
262
|
+
<div class="mt-2 flex h-10 items-center justify-end gap-3">
|
|
263
|
+
<button
|
|
264
|
+
ads-button
|
|
265
|
+
type="button"
|
|
266
|
+
variant="primary"
|
|
267
|
+
color="white"
|
|
268
|
+
(click)="onResetClick()"
|
|
269
|
+
>
|
|
270
|
+
{{ resetLabel() }}
|
|
271
|
+
</button>
|
|
272
|
+
<button
|
|
273
|
+
ads-button
|
|
274
|
+
type="button"
|
|
275
|
+
variant="primary"
|
|
276
|
+
color="green"
|
|
277
|
+
[disabled]="!canApplyFilters()"
|
|
278
|
+
(click)="onApplyClick()"
|
|
279
|
+
>
|
|
280
|
+
{{ applyLabel() }}
|
|
281
|
+
</button>
|
|
282
|
+
</div>
|
|
283
|
+
}
|
|
284
|
+
</div>
|
|
285
|
+
}
|
|
286
|
+
</div>
|