@cqa-lib/cqa-ui 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/action-menu/action-menu.component.mjs +42 -0
- package/esm2020/lib/assets/images/image-assets.constants.mjs +28 -0
- package/esm2020/lib/badge/badge.component.mjs +141 -0
- package/esm2020/lib/button/button.component.mjs +232 -0
- package/esm2020/lib/column-visibility/column-visibility.component.mjs +69 -0
- package/esm2020/lib/dashboards/chart-card/chart-card.component.mjs +22 -0
- package/esm2020/lib/dashboards/coverage-module-card/coverage-module-card.component.mjs +104 -0
- package/esm2020/lib/dashboards/dashboard-header/dashboard-header.component.mjs +82 -0
- package/esm2020/lib/dashboards/failed-test-cases-card/failed-test-cases-card.component.mjs +60 -0
- package/esm2020/lib/dashboards/heat-error-map-cell/heat-error-map-cell.component.mjs +45 -0
- package/esm2020/lib/dashboards/insight-card/insight-card.component.mjs +201 -0
- package/esm2020/lib/dashboards/metrics-card/metrics-block.component.mjs +41 -0
- package/esm2020/lib/dashboards/metrics-card/metrics-card-item.interface.mjs +2 -0
- package/esm2020/lib/dashboards/metrics-card/metrics-card.component.mjs +62 -0
- package/esm2020/lib/dashboards/progress-text-card/progress-text-card.component.mjs +46 -0
- package/esm2020/lib/dashboards/test-distribution-card/test-distribution-card.component.mjs +35 -0
- package/esm2020/lib/dialog/dialog.component.mjs +127 -0
- package/esm2020/lib/dropdown-button/dropdown-button.component.mjs +189 -0
- package/esm2020/lib/dynamic-select/dynamic-select-field.component.mjs +160 -0
- package/esm2020/lib/empty-state/empty-state.component.mjs +37 -0
- package/esm2020/lib/filters/dynamic-filter/dynamic-filter.component.mjs +239 -0
- package/esm2020/lib/full-table-loader/full-table-loader.component.mjs +16 -0
- package/esm2020/lib/inline-sort/inline-sort.component.mjs +58 -0
- package/esm2020/lib/other-button/other-button.component.mjs +76 -0
- package/esm2020/lib/pagination/pagination.component.mjs +102 -0
- package/{dist/cqa-ui/esm2020 → esm2020}/lib/search-bar/search-bar.component.mjs +3 -3
- package/{dist/cqa-ui/esm2020 → esm2020}/lib/segment-control/segment-control.component.mjs +3 -3
- package/esm2020/lib/selected-filters/selected-filters.component.mjs +27 -0
- package/esm2020/lib/table/dynamic-table/dynamic-cell.directive.mjs +35 -0
- package/esm2020/lib/table/dynamic-table/dynamic-table.component.mjs +258 -0
- package/esm2020/lib/table-action-toolbar/table-action-toolbar.component.mjs +52 -0
- package/esm2020/lib/table-data-loader/table-data-loader.component.mjs +19 -0
- package/esm2020/lib/templates/table-template.component.mjs +365 -0
- package/esm2020/lib/ui-kit.module.mjs +248 -0
- package/esm2020/lib/utils/metadata-colors.util.mjs +100 -0
- package/esm2020/lib/utils/tw-overlay-container.mjs +22 -0
- package/esm2020/public-api.mjs +38 -0
- package/fesm2015/cqa-lib-cqa-ui.mjs +3661 -0
- package/fesm2015/cqa-lib-cqa-ui.mjs.map +1 -0
- package/fesm2020/cqa-lib-cqa-ui.mjs +3615 -0
- package/fesm2020/cqa-lib-cqa-ui.mjs.map +1 -0
- package/lib/action-menu/action-menu.component.d.ts +17 -0
- package/lib/assets/images/image-assets.constants.d.ts +20 -0
- package/lib/badge/badge.component.d.ts +25 -0
- package/{dist/cqa-ui/lib → lib}/button/button.component.d.ts +6 -5
- package/lib/column-visibility/column-visibility.component.d.ts +33 -0
- package/lib/dashboards/chart-card/chart-card.component.d.ts +8 -0
- package/lib/dashboards/coverage-module-card/coverage-module-card.component.d.ts +44 -0
- package/lib/dashboards/dashboard-header/dashboard-header.component.d.ts +30 -0
- package/lib/dashboards/failed-test-cases-card/failed-test-cases-card.component.d.ts +28 -0
- package/lib/dashboards/heat-error-map-cell/heat-error-map-cell.component.d.ts +14 -0
- package/lib/dashboards/insight-card/insight-card.component.d.ts +73 -0
- package/lib/dashboards/metrics-card/metrics-block.component.d.ts +12 -0
- package/lib/dashboards/metrics-card/metrics-card-item.interface.d.ts +12 -0
- package/lib/dashboards/metrics-card/metrics-card.component.d.ts +17 -0
- package/lib/dashboards/progress-text-card/progress-text-card.component.d.ts +13 -0
- package/lib/dashboards/test-distribution-card/test-distribution-card.component.d.ts +29 -0
- package/lib/dropdown-button/dropdown-button.component.d.ts +32 -0
- package/lib/dynamic-select/dynamic-select-field.component.d.ts +43 -0
- package/lib/empty-state/empty-state.component.d.ts +20 -0
- package/lib/filters/dynamic-filter/dynamic-filter.component.d.ts +56 -0
- package/lib/full-table-loader/full-table-loader.component.d.ts +6 -0
- package/lib/inline-sort/inline-sort.component.d.ts +12 -0
- package/lib/other-button/other-button.component.d.ts +37 -0
- package/lib/pagination/pagination.component.d.ts +37 -0
- package/lib/selected-filters/selected-filters.component.d.ts +17 -0
- package/lib/table/dynamic-table/dynamic-cell.directive.d.ts +16 -0
- package/lib/table/dynamic-table/dynamic-table.component.d.ts +72 -0
- package/lib/table-action-toolbar/table-action-toolbar.component.d.ts +34 -0
- package/lib/table-data-loader/table-data-loader.component.d.ts +7 -0
- package/lib/templates/table-template.component.d.ts +90 -0
- package/lib/ui-kit.module.d.ts +52 -0
- package/lib/utils/metadata-colors.util.d.ts +50 -0
- package/lib/utils/tw-overlay-container.d.ts +12 -0
- package/package.json +23 -49
- package/public-api.d.ts +37 -0
- package/src/lib/assets/images/.gitkeep +0 -0
- package/src/lib/assets/images/DashboardIcon.png +0 -0
- package/src/lib/assets/images/FilesIcon.png +0 -0
- package/src/lib/assets/images/README.md +66 -0
- package/src/lib/assets/images/ReportsIcon.png +0 -0
- package/src/lib/assets/images/SearchIcon.png +0 -0
- package/src/lib/assets/images/StepsIcon.png +0 -0
- package/src/lib/assets/images/TestCaseIcon.png +0 -0
- package/src/lib/assets/images/analytics-chart-icon.svg +11 -0
- package/src/lib/assets/images/checklist-add-icon.svg +10 -0
- package/src/lib/assets/images/document-gear-icon.svg +9 -0
- package/src/lib/assets/images/empty-state-default-icon.svg +8 -0
- package/src/lib/assets/images/image-assets.constants.ts +38 -0
- package/src/lib/assets/images/search-debug-icon.svg +8 -0
- package/src/lib/assets/images/test-case-icon.svg +9 -0
- package/src/lib/assets/images/upload-folder-icon.svg +7 -0
- package/src/lib/utils/metadata-colors.constants.js +33 -0
- package/storybook-static/assets/images/README.md +66 -0
- package/styles.css +1 -0
- package/dist/cqa-ui/README.md +0 -226
- package/dist/cqa-ui/esm2020/lib/button/button.component.mjs +0 -257
- package/dist/cqa-ui/esm2020/lib/dialog/dialog.component.mjs +0 -127
- package/dist/cqa-ui/esm2020/lib/ui-kit.module.mjs +0 -69
- package/dist/cqa-ui/esm2020/public-api.mjs +0 -10
- package/dist/cqa-ui/fesm2015/cqa-lib-cqa-ui.mjs +0 -895
- package/dist/cqa-ui/fesm2015/cqa-lib-cqa-ui.mjs.map +0 -1
- package/dist/cqa-ui/fesm2020/cqa-lib-cqa-ui.mjs +0 -881
- package/dist/cqa-ui/fesm2020/cqa-lib-cqa-ui.mjs.map +0 -1
- package/dist/cqa-ui/lib/ui-kit.module.d.ts +0 -15
- package/dist/cqa-ui/package.json +0 -56
- package/dist/cqa-ui/public-api.d.ts +0 -9
- package/dist/cqa-ui/styles.css +0 -1
- /package/{dist/cqa-ui/cqa-lib-cqa-ui.d.ts → cqa-lib-cqa-ui.d.ts} +0 -0
- /package/{dist/cqa-ui/esm2020 → esm2020}/cqa-lib-cqa-ui.mjs +0 -0
- /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog-ref.mjs +0 -0
- /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog.models.mjs +0 -0
- /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog.service.mjs +0 -0
- /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog.tokens.mjs +0 -0
- /package/{dist/cqa-ui/lib → lib}/dialog/dialog-ref.d.ts +0 -0
- /package/{dist/cqa-ui/lib → lib}/dialog/dialog.component.d.ts +0 -0
- /package/{dist/cqa-ui/lib → lib}/dialog/dialog.models.d.ts +0 -0
- /package/{dist/cqa-ui/lib → lib}/dialog/dialog.service.d.ts +0 -0
- /package/{dist/cqa-ui/lib → lib}/dialog/dialog.tokens.d.ts +0 -0
- /package/{dist/cqa-ui/lib → lib}/search-bar/search-bar.component.d.ts +0 -0
- /package/{dist/cqa-ui/lib → lib}/segment-control/segment-control.component.d.ts +0 -0
|
@@ -1,881 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Component, Input, Output, HostListener, ViewChildren, ViewChild, ChangeDetectionStrategy, NgModule, InjectionToken, Injector, Injectable } from '@angular/core';
|
|
3
|
-
import * as i2 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as i2$1 from '@angular/forms';
|
|
6
|
-
import { FormsModule } from '@angular/forms';
|
|
7
|
-
import * as i1 from '@angular/material/icon';
|
|
8
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
-
import * as i1$1 from '@angular/cdk/overlay';
|
|
10
|
-
import { OverlayModule, OverlayConfig } from '@angular/cdk/overlay';
|
|
11
|
-
import * as i3 from '@angular/cdk/portal';
|
|
12
|
-
import { TemplatePortal, CdkPortalOutlet, PortalModule, ComponentPortal } from '@angular/cdk/portal';
|
|
13
|
-
import { filter } from 'rxjs/operators';
|
|
14
|
-
import { Subject } from 'rxjs';
|
|
15
|
-
|
|
16
|
-
class ButtonComponent {
|
|
17
|
-
constructor() {
|
|
18
|
-
this.variant = 'filled';
|
|
19
|
-
this.disabled = false;
|
|
20
|
-
this.iconPosition = 'start';
|
|
21
|
-
this.type = 'button';
|
|
22
|
-
this.clicked = new EventEmitter();
|
|
23
|
-
// Internal state tracking
|
|
24
|
-
this.isHovered = false;
|
|
25
|
-
this.isFocused = false;
|
|
26
|
-
this.isPressed = false;
|
|
27
|
-
}
|
|
28
|
-
get hasIcon() {
|
|
29
|
-
return !!this.icon;
|
|
30
|
-
}
|
|
31
|
-
get buttonClasses() {
|
|
32
|
-
const baseClasses = [
|
|
33
|
-
'cqa-flex',
|
|
34
|
-
'cqa-flex-col',
|
|
35
|
-
'cqa-justify-center',
|
|
36
|
-
'cqa-items-center',
|
|
37
|
-
'cqa-p-0',
|
|
38
|
-
'cqa-gap-2',
|
|
39
|
-
'cqa-rounded-lg',
|
|
40
|
-
'cqa-cursor-pointer',
|
|
41
|
-
'cqa-font-inter',
|
|
42
|
-
'cqa-font-semibold',
|
|
43
|
-
'cqa-text-sm',
|
|
44
|
-
'cqa-leading-[14px]',
|
|
45
|
-
'cqa-transition-all',
|
|
46
|
-
'cqa-duration-200',
|
|
47
|
-
'cqa-outline-none'
|
|
48
|
-
];
|
|
49
|
-
if (this.disabled) {
|
|
50
|
-
baseClasses.push('cqa-cursor-not-allowed');
|
|
51
|
-
}
|
|
52
|
-
// Add variant and state specific classes
|
|
53
|
-
const variantClasses = this.getVariantClasses();
|
|
54
|
-
return [...baseClasses, ...variantClasses].join(' ');
|
|
55
|
-
}
|
|
56
|
-
get stateLayerClasses() {
|
|
57
|
-
const classes = [
|
|
58
|
-
'cqa-flex',
|
|
59
|
-
'cqa-flex-row',
|
|
60
|
-
'cqa-justify-center',
|
|
61
|
-
'cqa-items-center',
|
|
62
|
-
'cqa-gap-2',
|
|
63
|
-
'cqa-w-full',
|
|
64
|
-
'cqa-h-full',
|
|
65
|
-
'cqa-py-[10px]',
|
|
66
|
-
'cqa-px-6',
|
|
67
|
-
];
|
|
68
|
-
return classes.join(' ');
|
|
69
|
-
}
|
|
70
|
-
get labelClasses() {
|
|
71
|
-
const classes = [
|
|
72
|
-
'cqa-flex',
|
|
73
|
-
'cqa-items-center',
|
|
74
|
-
'cqa-text-center',
|
|
75
|
-
'cqa-font-inter',
|
|
76
|
-
'cqa-font-semibold',
|
|
77
|
-
'cqa-text-sm',
|
|
78
|
-
'cqa-leading-[14px]',
|
|
79
|
-
'cqa-flex-none',
|
|
80
|
-
this.textClass,
|
|
81
|
-
];
|
|
82
|
-
if (this.disabled) {
|
|
83
|
-
classes.push('cqa-opacity-[0.38]');
|
|
84
|
-
}
|
|
85
|
-
return classes.join(' ');
|
|
86
|
-
}
|
|
87
|
-
get iconClasses() {
|
|
88
|
-
const classes = [
|
|
89
|
-
'cqa-flex',
|
|
90
|
-
'cqa-items-center',
|
|
91
|
-
'cqa-justify-center',
|
|
92
|
-
'cqa-w-[14px]',
|
|
93
|
-
'cqa-h-[14px]',
|
|
94
|
-
'cqa-shrink-0',
|
|
95
|
-
'cqa-flex-none'
|
|
96
|
-
];
|
|
97
|
-
if (this.disabled) {
|
|
98
|
-
classes.push('cqa-opacity-[0.38]');
|
|
99
|
-
}
|
|
100
|
-
return classes.join(' ');
|
|
101
|
-
}
|
|
102
|
-
getVariantClasses() {
|
|
103
|
-
const classes = [];
|
|
104
|
-
if (this.variant === 'filled') {
|
|
105
|
-
if (this.disabled) {
|
|
106
|
-
classes.push('cqa-bg-primary-muted');
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
classes.push('cqa-bg-primary');
|
|
110
|
-
if (this.isHovered) {
|
|
111
|
-
classes.push('cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else if (this.variant === 'outlined') {
|
|
116
|
-
if (this.disabled) {
|
|
117
|
-
classes.push('cqa-bg-transparent', 'cqa-border', 'cqa-border-primary-muted');
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
if (this.isFocused) {
|
|
121
|
-
classes.push('cqa-bg-primary-surface-alt', 'cqa-border', 'cqa-border-primary-hover', 'cqa-shadow-[0px_4px_4px_rgba(0,0,0,0.25)]');
|
|
122
|
-
}
|
|
123
|
-
else if (this.isHovered || this.isPressed) {
|
|
124
|
-
classes.push('cqa-bg-primary-surface', 'cqa-border', 'cqa-border-primary');
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
classes.push('cqa-bg-transparent', 'cqa-border', 'cqa-border-slate');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else if (this.variant === 'text') {
|
|
132
|
-
if (this.disabled) {
|
|
133
|
-
classes.push('cqa-bg-transparent');
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
classes.push('cqa-bg-transparent');
|
|
137
|
-
if (this.isHovered || this.isFocused || this.isPressed) {
|
|
138
|
-
classes.push('cqa-bg-primary-surface');
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else if (this.variant === 'elevated') {
|
|
143
|
-
if (this.disabled) {
|
|
144
|
-
classes.push('cqa-bg-primary-muted', 'cqa-shadow-none');
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
if (this.isFocused) {
|
|
148
|
-
classes.push('cqa-bg-primary-surface-alt', 'cqa-shadow-[0px_4px_4px_rgba(0,0,0,0.25)]');
|
|
149
|
-
}
|
|
150
|
-
else if (this.isPressed) {
|
|
151
|
-
classes.push('cqa-bg-primary-surface', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
|
|
152
|
-
}
|
|
153
|
-
else if (this.isHovered) {
|
|
154
|
-
classes.push('cqa-bg-primary-surface-alt', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_2px_6px_2px_rgba(0,0,0,0.15)]');
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
classes.push('cqa-bg-primary-surface', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
else if (this.variant === 'tonal') {
|
|
162
|
-
if (this.disabled) {
|
|
163
|
-
classes.push('cqa-bg-primary-muted');
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
if (this.isHovered) {
|
|
167
|
-
classes.push('cqa-bg-tonal-hover', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
classes.push('cqa-bg-primary-surface-alt');
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return classes;
|
|
175
|
-
}
|
|
176
|
-
get textClass() {
|
|
177
|
-
if (this.disabled) {
|
|
178
|
-
if (this.variant === 'outlined' || this.variant === 'text') {
|
|
179
|
-
return 'cqa-text-ink';
|
|
180
|
-
}
|
|
181
|
-
return 'cqa-text-ink-muted';
|
|
182
|
-
}
|
|
183
|
-
switch (this.variant) {
|
|
184
|
-
case 'filled':
|
|
185
|
-
return 'cqa-text-surface-default';
|
|
186
|
-
case 'outlined':
|
|
187
|
-
if (this.isFocused || this.isHovered || this.isPressed) {
|
|
188
|
-
return 'cqa-text-primary-hover';
|
|
189
|
-
}
|
|
190
|
-
return 'cqa-text-slate';
|
|
191
|
-
case 'text':
|
|
192
|
-
case 'elevated':
|
|
193
|
-
return 'cqa-text-primary-hover';
|
|
194
|
-
case 'tonal':
|
|
195
|
-
return 'cqa-text-ink';
|
|
196
|
-
default:
|
|
197
|
-
return '';
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
onMouseEnter() {
|
|
201
|
-
if (!this.disabled) {
|
|
202
|
-
this.isHovered = true;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
onMouseLeave() {
|
|
206
|
-
this.isHovered = false;
|
|
207
|
-
this.isPressed = false;
|
|
208
|
-
}
|
|
209
|
-
onMouseDown() {
|
|
210
|
-
if (!this.disabled) {
|
|
211
|
-
this.isPressed = true;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
onMouseUp() {
|
|
215
|
-
this.isPressed = false;
|
|
216
|
-
}
|
|
217
|
-
onFocus() {
|
|
218
|
-
if (!this.disabled) {
|
|
219
|
-
this.isFocused = true;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
onBlur() {
|
|
223
|
-
this.isFocused = false;
|
|
224
|
-
this.isPressed = false;
|
|
225
|
-
}
|
|
226
|
-
onClick(event) {
|
|
227
|
-
if (!this.disabled) {
|
|
228
|
-
this.clicked.emit(event);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
233
|
-
ButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ButtonComponent, selector: "cqa-button", inputs: { variant: "variant", disabled: "disabled", icon: "icon", iconPosition: "iconPosition", type: "type" }, outputs: { clicked: "clicked" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "mousedown": "onMouseDown()", "mouseup": "onMouseUp()", "focus": "onFocus()", "blur": "onBlur()" } }, ngImport: i0, template: "<div id=\"cqa-ui-root\" style=\"display: inline-block; width: auto;\">\n <button\n [type]=\"type\"\n [disabled]=\"disabled\"\n [attr.aria-disabled]=\"disabled\"\n [class]=\"buttonClasses\"\n (click)=\"onClick($event)\"\n >\n <span [class]=\"stateLayerClasses\">\n <span *ngIf=\"icon && iconPosition === 'start'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n <span [class]=\"labelClasses\" [ngClass]=\"textClass\">\n <ng-content></ng-content>\n </span>\n <span *ngIf=\"icon && iconPosition === 'end'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n </span>\n </button>\n</div>\n\n", components: [{ type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
234
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
235
|
-
type: Component,
|
|
236
|
-
args: [{ selector: 'cqa-button', template: "<div id=\"cqa-ui-root\" style=\"display: inline-block; width: auto;\">\n <button\n [type]=\"type\"\n [disabled]=\"disabled\"\n [attr.aria-disabled]=\"disabled\"\n [class]=\"buttonClasses\"\n (click)=\"onClick($event)\"\n >\n <span [class]=\"stateLayerClasses\">\n <span *ngIf=\"icon && iconPosition === 'start'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n <span [class]=\"labelClasses\" [ngClass]=\"textClass\">\n <ng-content></ng-content>\n </span>\n <span *ngIf=\"icon && iconPosition === 'end'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n </span>\n </button>\n</div>\n\n", styles: [] }]
|
|
237
|
-
}], propDecorators: { variant: [{
|
|
238
|
-
type: Input
|
|
239
|
-
}], disabled: [{
|
|
240
|
-
type: Input
|
|
241
|
-
}], icon: [{
|
|
242
|
-
type: Input
|
|
243
|
-
}], iconPosition: [{
|
|
244
|
-
type: Input
|
|
245
|
-
}], type: [{
|
|
246
|
-
type: Input
|
|
247
|
-
}], clicked: [{
|
|
248
|
-
type: Output
|
|
249
|
-
}], onMouseEnter: [{
|
|
250
|
-
type: HostListener,
|
|
251
|
-
args: ['mouseenter']
|
|
252
|
-
}], onMouseLeave: [{
|
|
253
|
-
type: HostListener,
|
|
254
|
-
args: ['mouseleave']
|
|
255
|
-
}], onMouseDown: [{
|
|
256
|
-
type: HostListener,
|
|
257
|
-
args: ['mousedown']
|
|
258
|
-
}], onMouseUp: [{
|
|
259
|
-
type: HostListener,
|
|
260
|
-
args: ['mouseup']
|
|
261
|
-
}], onFocus: [{
|
|
262
|
-
type: HostListener,
|
|
263
|
-
args: ['focus']
|
|
264
|
-
}], onBlur: [{
|
|
265
|
-
type: HostListener,
|
|
266
|
-
args: ['blur']
|
|
267
|
-
}] } });
|
|
268
|
-
|
|
269
|
-
class SearchBarComponent {
|
|
270
|
-
constructor() {
|
|
271
|
-
/** Placeholder text for the input */
|
|
272
|
-
this.placeholder = 'Search';
|
|
273
|
-
/** Initial value or externally controlled value */
|
|
274
|
-
this.value = '';
|
|
275
|
-
/** Disable interactions */
|
|
276
|
-
this.disabled = false;
|
|
277
|
-
/** Whether the clear button should be visible when there is text */
|
|
278
|
-
this.showClear = true;
|
|
279
|
-
/** Accessible label for the input */
|
|
280
|
-
this.ariaLabel = 'Search';
|
|
281
|
-
/** Automatically focus the input when rendered */
|
|
282
|
-
this.autoFocus = false;
|
|
283
|
-
/** Search bar size */
|
|
284
|
-
this.size = 'md';
|
|
285
|
-
/** Stretch to fill container width */
|
|
286
|
-
this.fullWidth = false;
|
|
287
|
-
/** Emit on value changes (e.g. for two-way binding) */
|
|
288
|
-
this.valueChange = new EventEmitter();
|
|
289
|
-
/** Emit when user submits search (Enter key or form submit) */
|
|
290
|
-
this.search = new EventEmitter();
|
|
291
|
-
/** Emit when the value is cleared via the clear button */
|
|
292
|
-
this.cleared = new EventEmitter();
|
|
293
|
-
this.inputValue = '';
|
|
294
|
-
this.widthClasses = {
|
|
295
|
-
sm: 'cqa-w-[295px]',
|
|
296
|
-
md: 'cqa-w-[395px]',
|
|
297
|
-
lg: 'cqa-w-[495px]',
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
ngOnChanges(changes) {
|
|
301
|
-
if (changes['value'] && changes['value'].currentValue !== undefined) {
|
|
302
|
-
const newValue = changes['value'].currentValue ?? '';
|
|
303
|
-
if (newValue !== this.inputValue) {
|
|
304
|
-
this.inputValue = newValue;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
onInput(event) {
|
|
309
|
-
const target = event.target;
|
|
310
|
-
const nextValue = target?.value ?? '';
|
|
311
|
-
this.inputValue = nextValue;
|
|
312
|
-
this.valueChange.emit(this.inputValue);
|
|
313
|
-
}
|
|
314
|
-
onSubmit(event) {
|
|
315
|
-
event.preventDefault();
|
|
316
|
-
if (this.disabled) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
this.search.emit(this.inputValue.trim());
|
|
320
|
-
}
|
|
321
|
-
clear() {
|
|
322
|
-
if (this.disabled || this.inputValue === '') {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
this.inputValue = '';
|
|
326
|
-
this.valueChange.emit('');
|
|
327
|
-
this.cleared.emit();
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
SearchBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SearchBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
331
|
-
SearchBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SearchBarComponent, selector: "cqa-search-bar", inputs: { placeholder: "placeholder", value: "value", disabled: "disabled", showClear: "showClear", ariaLabel: "ariaLabel", autoFocus: "autoFocus", size: "size", fullWidth: "fullWidth" }, outputs: { valueChange: "valueChange", search: "search", cleared: "cleared" }, usesOnChanges: true, ngImport: i0, template: "<div id=\"cqa-ui-root\" [style.display]=\"fullWidth ? 'block' : 'inline-block'\" [style.width]=\"fullWidth ? '100%' : 'auto'\">\n <form\n class=\"cqa-inline-flex cqa-items-center cqa-gap-2 cqa-px-6 cqa-py-3 cqa-text-[14px] cqa-border cqa-border-gray-200 cqa-rounded-md cqa-bg-white cqa-shadow-sm cqa-transition-colors\"\n [ngClass]=\"fullWidth ? 'cqa-w-full' : widthClasses[size]\"\n (submit)=\"onSubmit($event)\"\n >\n <span\n class=\"cqa-flex-none cqa-flex cqa-items-center cqa-justify-center cqa-text-gray-400 cqa-w-4 cqa-h-4\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n >\n search\n </mat-icon>\n </span>\n\n <input\n type=\"text\"\n class=\"cqa-flex-1 cqa-min-w-[180px] cqa-border-none cqa-outline-none cqa-bg-transparent placeholder:cqa-text-gray-400 disabled:cqa-text-gray-400 disabled:cqa-cursor-not-allowed cqa-font-['SF_Pro_Text'] cqa-font-normal cqa-text-[12.3px] cqa-leading-none cqa-tracking-normal cqa-align-middle cqa-text-[#99999E]\"\n style=\"font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 0;\"\n [placeholder]=\"placeholder\"\n [value]=\"inputValue\"\n (input)=\"onInput($event)\"\n [disabled]=\"disabled\"\n [attr.aria-label]=\"ariaLabel\"\n autocomplete=\"off\"\n autocapitalize=\"none\"\n spellcheck=\"false\"\n [attr.autofocus]=\"autoFocus ? '' : null\"\n />\n\n <button\n *ngIf=\"showClear && inputValue\"\n type=\"button\"\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-p-0 cqa-w-4 cqa-h-4 cqa-border-0 cqa-bg-transparent cqa-cursor-pointer cqa-text-gray-500 cqa-hover:cqa-text-gray-700 disabled:cqa-text-gray-300 cqa-transition-colors cqa-leading-none\"\n (click)=\"clear()\"\n [disabled]=\"disabled\"\n aria-label=\"Clear search\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n close\n </mat-icon>\n </button>\n </form>\n</div>\n", components: [{ type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
332
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SearchBarComponent, decorators: [{
|
|
333
|
-
type: Component,
|
|
334
|
-
args: [{ selector: 'cqa-search-bar', template: "<div id=\"cqa-ui-root\" [style.display]=\"fullWidth ? 'block' : 'inline-block'\" [style.width]=\"fullWidth ? '100%' : 'auto'\">\n <form\n class=\"cqa-inline-flex cqa-items-center cqa-gap-2 cqa-px-6 cqa-py-3 cqa-text-[14px] cqa-border cqa-border-gray-200 cqa-rounded-md cqa-bg-white cqa-shadow-sm cqa-transition-colors\"\n [ngClass]=\"fullWidth ? 'cqa-w-full' : widthClasses[size]\"\n (submit)=\"onSubmit($event)\"\n >\n <span\n class=\"cqa-flex-none cqa-flex cqa-items-center cqa-justify-center cqa-text-gray-400 cqa-w-4 cqa-h-4\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n >\n search\n </mat-icon>\n </span>\n\n <input\n type=\"text\"\n class=\"cqa-flex-1 cqa-min-w-[180px] cqa-border-none cqa-outline-none cqa-bg-transparent placeholder:cqa-text-gray-400 disabled:cqa-text-gray-400 disabled:cqa-cursor-not-allowed cqa-font-['SF_Pro_Text'] cqa-font-normal cqa-text-[12.3px] cqa-leading-none cqa-tracking-normal cqa-align-middle cqa-text-[#99999E]\"\n style=\"font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 0;\"\n [placeholder]=\"placeholder\"\n [value]=\"inputValue\"\n (input)=\"onInput($event)\"\n [disabled]=\"disabled\"\n [attr.aria-label]=\"ariaLabel\"\n autocomplete=\"off\"\n autocapitalize=\"none\"\n spellcheck=\"false\"\n [attr.autofocus]=\"autoFocus ? '' : null\"\n />\n\n <button\n *ngIf=\"showClear && inputValue\"\n type=\"button\"\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-p-0 cqa-w-4 cqa-h-4 cqa-border-0 cqa-bg-transparent cqa-cursor-pointer cqa-text-gray-500 cqa-hover:cqa-text-gray-700 disabled:cqa-text-gray-300 cqa-transition-colors cqa-leading-none\"\n (click)=\"clear()\"\n [disabled]=\"disabled\"\n aria-label=\"Clear search\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n close\n </mat-icon>\n </button>\n </form>\n</div>\n", styles: [] }]
|
|
335
|
-
}], propDecorators: { placeholder: [{
|
|
336
|
-
type: Input
|
|
337
|
-
}], value: [{
|
|
338
|
-
type: Input
|
|
339
|
-
}], disabled: [{
|
|
340
|
-
type: Input
|
|
341
|
-
}], showClear: [{
|
|
342
|
-
type: Input
|
|
343
|
-
}], ariaLabel: [{
|
|
344
|
-
type: Input
|
|
345
|
-
}], autoFocus: [{
|
|
346
|
-
type: Input
|
|
347
|
-
}], size: [{
|
|
348
|
-
type: Input
|
|
349
|
-
}], fullWidth: [{
|
|
350
|
-
type: Input
|
|
351
|
-
}], valueChange: [{
|
|
352
|
-
type: Output
|
|
353
|
-
}], search: [{
|
|
354
|
-
type: Output
|
|
355
|
-
}], cleared: [{
|
|
356
|
-
type: Output
|
|
357
|
-
}] } });
|
|
358
|
-
|
|
359
|
-
class SegmentControlComponent {
|
|
360
|
-
constructor() {
|
|
361
|
-
this.segments = [
|
|
362
|
-
{ label: 'Tab Group', value: 'tab-group-1' },
|
|
363
|
-
{ label: 'Tab Group', value: 'tab-group-2' },
|
|
364
|
-
];
|
|
365
|
-
this.disabled = false;
|
|
366
|
-
this.valueChange = new EventEmitter();
|
|
367
|
-
this.indicatorStyle = {};
|
|
368
|
-
this.indicatorVisible = false;
|
|
369
|
-
}
|
|
370
|
-
ngOnChanges(changes) {
|
|
371
|
-
if (changes['segments'] || changes['value']) {
|
|
372
|
-
this.ensureSelectedValue();
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
ngAfterViewInit() {
|
|
376
|
-
this.buttonChangesSub = this.segmentButtons.changes.subscribe(() => this.updateIndicator());
|
|
377
|
-
this.ensureSelectedValue();
|
|
378
|
-
this.updateIndicator();
|
|
379
|
-
}
|
|
380
|
-
ngOnDestroy() {
|
|
381
|
-
this.buttonChangesSub?.unsubscribe?.();
|
|
382
|
-
}
|
|
383
|
-
trackByValue(_index, option) {
|
|
384
|
-
return option.value;
|
|
385
|
-
}
|
|
386
|
-
isSelected(option) {
|
|
387
|
-
return option.value === this.value;
|
|
388
|
-
}
|
|
389
|
-
select(option, index) {
|
|
390
|
-
if (this.disabled || option.disabled) {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
const nextValue = option.value;
|
|
394
|
-
if (nextValue !== this.value) {
|
|
395
|
-
this.value = nextValue;
|
|
396
|
-
this.valueChange.emit(nextValue);
|
|
397
|
-
}
|
|
398
|
-
this.focusButton(index);
|
|
399
|
-
this.updateIndicator();
|
|
400
|
-
}
|
|
401
|
-
onKeyDown(event, currentIndex) {
|
|
402
|
-
if (this.disabled) {
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
switch (event.key) {
|
|
406
|
-
case 'ArrowRight':
|
|
407
|
-
case 'ArrowDown':
|
|
408
|
-
event.preventDefault();
|
|
409
|
-
this.moveSelection(1, currentIndex);
|
|
410
|
-
break;
|
|
411
|
-
case 'ArrowLeft':
|
|
412
|
-
case 'ArrowUp':
|
|
413
|
-
event.preventDefault();
|
|
414
|
-
this.moveSelection(-1, currentIndex);
|
|
415
|
-
break;
|
|
416
|
-
case 'Home':
|
|
417
|
-
event.preventDefault();
|
|
418
|
-
this.selectFirstEnabled();
|
|
419
|
-
break;
|
|
420
|
-
case 'End':
|
|
421
|
-
event.preventDefault();
|
|
422
|
-
this.selectLastEnabled();
|
|
423
|
-
break;
|
|
424
|
-
case ' ':
|
|
425
|
-
case 'Enter':
|
|
426
|
-
event.preventDefault();
|
|
427
|
-
this.select(this.segments[currentIndex], currentIndex);
|
|
428
|
-
break;
|
|
429
|
-
default:
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
moveSelection(step, startIndex) {
|
|
434
|
-
const enabledIndexes = this.getEnabledIndexes();
|
|
435
|
-
if (enabledIndexes.length === 0) {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
const currentEnabledIndex = enabledIndexes.indexOf(startIndex);
|
|
439
|
-
const fallbackIndex = this.getSelectedIndex(enabledIndexes);
|
|
440
|
-
const baseIndex = currentEnabledIndex >= 0 ? currentEnabledIndex : fallbackIndex;
|
|
441
|
-
const nextPosition = (baseIndex + step + enabledIndexes.length) % enabledIndexes.length;
|
|
442
|
-
const targetIndex = enabledIndexes[nextPosition];
|
|
443
|
-
this.select(this.segments[targetIndex], targetIndex);
|
|
444
|
-
}
|
|
445
|
-
selectFirstEnabled() {
|
|
446
|
-
const enabledIndexes = this.getEnabledIndexes();
|
|
447
|
-
if (enabledIndexes.length > 0) {
|
|
448
|
-
const index = enabledIndexes[0];
|
|
449
|
-
this.select(this.segments[index], index);
|
|
450
|
-
this.updateIndicator();
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
selectLastEnabled() {
|
|
454
|
-
const enabledIndexes = this.getEnabledIndexes();
|
|
455
|
-
if (enabledIndexes.length > 0) {
|
|
456
|
-
const index = enabledIndexes[enabledIndexes.length - 1];
|
|
457
|
-
this.select(this.segments[index], index);
|
|
458
|
-
this.updateIndicator();
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
getEnabledIndexes() {
|
|
462
|
-
return this.segments
|
|
463
|
-
.map((option, index) => ({ option, index }))
|
|
464
|
-
.filter(({ option }) => !option.disabled)
|
|
465
|
-
.map(({ index }) => index);
|
|
466
|
-
}
|
|
467
|
-
getSelectedIndex(enabledIndexes) {
|
|
468
|
-
const current = this.segments.findIndex((option) => option.value === this.value && !option.disabled);
|
|
469
|
-
if (current >= 0) {
|
|
470
|
-
return enabledIndexes.indexOf(current);
|
|
471
|
-
}
|
|
472
|
-
return 0;
|
|
473
|
-
}
|
|
474
|
-
ensureSelectedValue() {
|
|
475
|
-
const enabled = this.segments.filter((option) => !option.disabled);
|
|
476
|
-
if (enabled.length === 0) {
|
|
477
|
-
this.value = undefined;
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
if (!this.value || !this.segments.some((option) => option.value === this.value)) {
|
|
481
|
-
this.value = enabled[0].value;
|
|
482
|
-
this.valueChange.emit(this.value);
|
|
483
|
-
const index = this.segments.indexOf(enabled[0]);
|
|
484
|
-
this.focusButton(index);
|
|
485
|
-
this.updateIndicator(index);
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
const selected = this.segments.find((option) => option.value === this.value);
|
|
489
|
-
if (selected?.disabled) {
|
|
490
|
-
this.value = enabled[0].value;
|
|
491
|
-
this.valueChange.emit(this.value);
|
|
492
|
-
const index = this.segments.indexOf(enabled[0]);
|
|
493
|
-
this.focusButton(index);
|
|
494
|
-
this.updateIndicator(index);
|
|
495
|
-
}
|
|
496
|
-
this.updateIndicator();
|
|
497
|
-
}
|
|
498
|
-
focusButton(index) {
|
|
499
|
-
queueMicrotask(() => {
|
|
500
|
-
const button = this.segmentButtons?.get(index)?.nativeElement;
|
|
501
|
-
button?.focus();
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
updateIndicator(preferredIndex) {
|
|
505
|
-
queueMicrotask(() => {
|
|
506
|
-
const container = this.segmentContainer?.nativeElement;
|
|
507
|
-
const buttons = this.segmentButtons?.toArray() ?? [];
|
|
508
|
-
if (!container || buttons.length === 0) {
|
|
509
|
-
this.indicatorVisible = false;
|
|
510
|
-
this.indicatorStyle = {};
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
const index = preferredIndex ?? buttons.findIndex((button, idx) => this.segments[idx]?.value === this.value);
|
|
514
|
-
if (index === -1) {
|
|
515
|
-
this.indicatorVisible = false;
|
|
516
|
-
this.indicatorStyle = {};
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
const buttonEl = buttons[index]?.nativeElement;
|
|
520
|
-
if (!buttonEl) {
|
|
521
|
-
this.indicatorVisible = false;
|
|
522
|
-
this.indicatorStyle = {};
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
|
-
const containerRect = container.getBoundingClientRect();
|
|
526
|
-
const buttonRect = buttonEl.getBoundingClientRect();
|
|
527
|
-
const offsetLeft = buttonEl.offsetLeft;
|
|
528
|
-
const offsetTop = buttonEl.offsetTop;
|
|
529
|
-
const width = buttonEl.offsetWidth;
|
|
530
|
-
const height = buttonEl.offsetHeight;
|
|
531
|
-
const isDisabled = this.disabled || this.segments[index]?.disabled;
|
|
532
|
-
this.indicatorStyle = {
|
|
533
|
-
width: `${width}px`,
|
|
534
|
-
height: `${height}px`,
|
|
535
|
-
left: `${offsetLeft}px`,
|
|
536
|
-
top: `${offsetTop}px`,
|
|
537
|
-
backgroundColor: isDisabled ? '#9BA0F4' : '#3F43EE',
|
|
538
|
-
};
|
|
539
|
-
this.indicatorVisible = true;
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
get isIndicatorVisible() {
|
|
543
|
-
return this.indicatorVisible;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
SegmentControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SegmentControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
547
|
-
SegmentControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SegmentControlComponent, selector: "cqa-segment-control", inputs: { segments: "segments", value: "value", disabled: "disabled" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "segmentContainer", first: true, predicate: ["segmentContainer"], descendants: true }, { propertyName: "segmentButtons", predicate: ["segmentButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"cqa-ui-root\" style=\"display: inline-block;\">\n <div\n #segmentContainer\n class=\"cqa-relative cqa-inline-flex cqa-flex-row cqa-items-start cqa-p-[3.5px] cqa-h-[31.5px] cqa-bg-[#F5F5F5] cqa-rounded-[8px]\"\n role=\"tablist\"\n [attr.aria-disabled]=\"disabled || null\"\n >\n <div\n class=\"cqa-absolute cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-pointer-events-none\"\n [class.cqa-opacity-0]=\"!isIndicatorVisible\"\n [ngStyle]=\"indicatorStyle\"\n aria-hidden=\"true\"\n ></div>\n\n <button\n *ngFor=\"let segment of segments; index as index; trackBy: trackByValue\"\n #segmentButton\n type=\"button\"\n role=\"tab\"\n class=\"cqa-relative cqa-z-10 cqa-flex cqa-flex-col cqa-justify-center cqa-items-center cqa-px-[14px] cqa-py-[3.5px] cqa-h-[25px] cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-whitespace-nowrap cqa-text-center focus:cqa-outline-none focus-visible:cqa-outline-none focus-visible:cqa-ring-0 focus-visible:cqa-ring-offset-0 cqa-flex-none\"\n [ngClass]=\"{\n 'cqa-text-white cqa-font-medium': isSelected(segment),\n 'cqa-text-[#99999E]': !isSelected(segment) && !(disabled || segment.disabled),\n 'cqa-cursor-not-allowed': disabled || segment.disabled,\n 'cqa-text-[#C7C7C7]': (disabled || segment.disabled) && !isSelected(segment),\n 'cqa-hover:cqa-text-black': !isSelected(segment) && !disabled && !segment.disabled\n }\"\n [disabled]=\"disabled || segment.disabled\"\n [attr.aria-selected]=\"isSelected(segment)\"\n [attr.tabindex]=\"!disabled && !segment.disabled ? (isSelected(segment) ? 0 : -1) : -1\"\n (click)=\"select(segment, index)\"\n (keydown)=\"onKeyDown($event, index)\"\n >\n <span class=\"cqa-flex cqa-items-center cqa-justify-center cqa-h-[18px] cqa-font-['Inter'] cqa-font-normal cqa-text-[12px] cqa-leading-[12px] cqa-text-center cqa-align-middle\">\n {{ segment.label }}\n </span>\n </button>\n </div>\n</div>\n", directives: [{ type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SegmentControlComponent, decorators: [{
|
|
549
|
-
type: Component,
|
|
550
|
-
args: [{ selector: 'cqa-segment-control', template: "<div id=\"cqa-ui-root\" style=\"display: inline-block;\">\n <div\n #segmentContainer\n class=\"cqa-relative cqa-inline-flex cqa-flex-row cqa-items-start cqa-p-[3.5px] cqa-h-[31.5px] cqa-bg-[#F5F5F5] cqa-rounded-[8px]\"\n role=\"tablist\"\n [attr.aria-disabled]=\"disabled || null\"\n >\n <div\n class=\"cqa-absolute cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-pointer-events-none\"\n [class.cqa-opacity-0]=\"!isIndicatorVisible\"\n [ngStyle]=\"indicatorStyle\"\n aria-hidden=\"true\"\n ></div>\n\n <button\n *ngFor=\"let segment of segments; index as index; trackBy: trackByValue\"\n #segmentButton\n type=\"button\"\n role=\"tab\"\n class=\"cqa-relative cqa-z-10 cqa-flex cqa-flex-col cqa-justify-center cqa-items-center cqa-px-[14px] cqa-py-[3.5px] cqa-h-[25px] cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-whitespace-nowrap cqa-text-center focus:cqa-outline-none focus-visible:cqa-outline-none focus-visible:cqa-ring-0 focus-visible:cqa-ring-offset-0 cqa-flex-none\"\n [ngClass]=\"{\n 'cqa-text-white cqa-font-medium': isSelected(segment),\n 'cqa-text-[#99999E]': !isSelected(segment) && !(disabled || segment.disabled),\n 'cqa-cursor-not-allowed': disabled || segment.disabled,\n 'cqa-text-[#C7C7C7]': (disabled || segment.disabled) && !isSelected(segment),\n 'cqa-hover:cqa-text-black': !isSelected(segment) && !disabled && !segment.disabled\n }\"\n [disabled]=\"disabled || segment.disabled\"\n [attr.aria-selected]=\"isSelected(segment)\"\n [attr.tabindex]=\"!disabled && !segment.disabled ? (isSelected(segment) ? 0 : -1) : -1\"\n (click)=\"select(segment, index)\"\n (keydown)=\"onKeyDown($event, index)\"\n >\n <span class=\"cqa-flex cqa-items-center cqa-justify-center cqa-h-[18px] cqa-font-['Inter'] cqa-font-normal cqa-text-[12px] cqa-leading-[12px] cqa-text-center cqa-align-middle\">\n {{ segment.label }}\n </span>\n </button>\n </div>\n</div>\n", styles: [] }]
|
|
551
|
-
}], propDecorators: { segments: [{
|
|
552
|
-
type: Input
|
|
553
|
-
}], value: [{
|
|
554
|
-
type: Input
|
|
555
|
-
}], disabled: [{
|
|
556
|
-
type: Input
|
|
557
|
-
}], valueChange: [{
|
|
558
|
-
type: Output
|
|
559
|
-
}], segmentButtons: [{
|
|
560
|
-
type: ViewChildren,
|
|
561
|
-
args: ['segmentButton']
|
|
562
|
-
}], segmentContainer: [{
|
|
563
|
-
type: ViewChild,
|
|
564
|
-
args: ['segmentContainer']
|
|
565
|
-
}] } });
|
|
566
|
-
|
|
567
|
-
class DialogComponent {
|
|
568
|
-
constructor(viewContainerRef, cdr) {
|
|
569
|
-
this.viewContainerRef = viewContainerRef;
|
|
570
|
-
this.cdr = cdr;
|
|
571
|
-
this.contentAttached = false;
|
|
572
|
-
}
|
|
573
|
-
attachTemplate(template, context) {
|
|
574
|
-
if (!this.portalOutlet) {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
const templateContext = context ??
|
|
578
|
-
{
|
|
579
|
-
$implicit: this.config?.data,
|
|
580
|
-
data: this.config?.data,
|
|
581
|
-
};
|
|
582
|
-
const portal = new TemplatePortal(template, this.viewContainerRef, templateContext);
|
|
583
|
-
this.portalOutlet.attachTemplatePortal(portal);
|
|
584
|
-
this.markContentAttached();
|
|
585
|
-
}
|
|
586
|
-
attachComponent(component) {
|
|
587
|
-
if (!this.portalOutlet) {
|
|
588
|
-
return undefined;
|
|
589
|
-
}
|
|
590
|
-
const componentRef = this.portalOutlet.attachComponentPortal(component);
|
|
591
|
-
this.markContentAttached();
|
|
592
|
-
return componentRef;
|
|
593
|
-
}
|
|
594
|
-
async onButtonClick(button) {
|
|
595
|
-
const closeOnClick = button.closeOnClick ?? true;
|
|
596
|
-
let handlerResult = undefined;
|
|
597
|
-
if (button.handler) {
|
|
598
|
-
handlerResult = button.handler(this.dialogRef);
|
|
599
|
-
}
|
|
600
|
-
const resolved = handlerResult instanceof Promise ? await handlerResult : handlerResult;
|
|
601
|
-
if (!closeOnClick || resolved === false) {
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
this.dialogRef.close(resolved);
|
|
605
|
-
}
|
|
606
|
-
get buttonAlignmentClass() {
|
|
607
|
-
const alignment = this.config?.buttonAlignment ?? 'right';
|
|
608
|
-
return this.mapAlignmentToClass(alignment);
|
|
609
|
-
}
|
|
610
|
-
get panelClassList() {
|
|
611
|
-
const baseClasses = [
|
|
612
|
-
'cqa-relative',
|
|
613
|
-
'cqa-w-full',
|
|
614
|
-
'cqa-bg-white',
|
|
615
|
-
'cqa-rounded-2xl',
|
|
616
|
-
'cqa-shadow-md',
|
|
617
|
-
'cqa-border',
|
|
618
|
-
'cqa-border-[#E5E7EB]',
|
|
619
|
-
'cqa-p-6',
|
|
620
|
-
'cqa-text-left',
|
|
621
|
-
];
|
|
622
|
-
const custom = this.config?.panelClass;
|
|
623
|
-
if (!custom) {
|
|
624
|
-
return baseClasses;
|
|
625
|
-
}
|
|
626
|
-
return Array.isArray(custom) ? [...baseClasses, ...custom] : [...baseClasses, custom];
|
|
627
|
-
}
|
|
628
|
-
get panelStyles() {
|
|
629
|
-
return {
|
|
630
|
-
width: this.config?.width,
|
|
631
|
-
maxWidth: this.config?.maxWidth ?? '480px',
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
buttonVariant(button) {
|
|
635
|
-
const role = this.normalizeRole(button.role);
|
|
636
|
-
switch (role) {
|
|
637
|
-
case 'secondary':
|
|
638
|
-
return 'outlined';
|
|
639
|
-
case 'text':
|
|
640
|
-
return 'text';
|
|
641
|
-
case 'tonal':
|
|
642
|
-
return 'tonal';
|
|
643
|
-
case 'elevated':
|
|
644
|
-
return 'elevated';
|
|
645
|
-
case 'filled':
|
|
646
|
-
case 'primary':
|
|
647
|
-
case 'warn':
|
|
648
|
-
default:
|
|
649
|
-
return 'filled';
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
buttonHostClasses(button) {
|
|
653
|
-
const role = this.normalizeRole(button.role);
|
|
654
|
-
if (role === 'warn') {
|
|
655
|
-
return ['cqa-dialog-btn-warn'];
|
|
656
|
-
}
|
|
657
|
-
return [];
|
|
658
|
-
}
|
|
659
|
-
mapAlignmentToClass(alignment) {
|
|
660
|
-
switch (alignment) {
|
|
661
|
-
case 'left':
|
|
662
|
-
return 'cqa-justify-start';
|
|
663
|
-
case 'center':
|
|
664
|
-
return 'cqa-justify-center';
|
|
665
|
-
case 'right':
|
|
666
|
-
default:
|
|
667
|
-
return 'cqa-justify-end';
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
markContentAttached() {
|
|
671
|
-
this.contentAttached = true;
|
|
672
|
-
this.cdr.markForCheck();
|
|
673
|
-
}
|
|
674
|
-
normalizeRole(role) {
|
|
675
|
-
return (role ?? 'secondary').trim().split(/\s+/)[0];
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
DialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
679
|
-
DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: DialogComponent, selector: "cqa-dialog", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], ngImport: i0, template: "<div id=\"cqa-ui-root\" style=\"display: block;\">\n <div class=\"cqa-flex cqa-w-full cqa-justify-center cqa-px-4 sm:cqa-px-6\">\n <div [ngClass]=\"panelClassList\" [ngStyle]=\"panelStyles\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-5\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-3\">\n <h2 class=\"cqa-text-lg cqa-font-semibold cqa-text-[#111827]\">\n {{ config.title }}\n </h2>\n\n <p *ngIf=\"config.description\" class=\"cqa-text-sm cqa-leading-6 cqa-text-[#4B5563]\">\n {{ config.description }}\n </p>\n\n <div\n *ngIf=\"config.warning\"\n class=\"cqa-rounded-xl cqa-border cqa-border-red-200 cqa-bg-red-50 cqa-px-4 cqa-py-3 cqa-text-sm cqa-leading-5 cqa-text-red-700\"\n >\n {{ config.warning }}\n </div>\n </div>\n\n <div class=\"cqa-text-sm cqa-text-[#111827]\" [class.hidden]=\"!contentAttached\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div class=\"cqa-mt-4 cqa-flex cqa-flex-wrap cqa-gap-3\" [ngClass]=\"buttonAlignmentClass\">\n <cqa-button\n *ngFor=\"let button of config.buttons\"\n type=\"button\"\n [variant]=\"buttonVariant(button)\"\n [ngClass]=\"buttonHostClasses(button)\"\n (clicked)=\"onButtonClick(button)\"\n >\n {{ button.label }}\n </cqa-button>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n", components: [{ type: ButtonComponent, selector: "cqa-button", inputs: ["variant", "disabled", "icon", "iconPosition", "type"], outputs: ["clicked"] }], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
680
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogComponent, decorators: [{
|
|
681
|
-
type: Component,
|
|
682
|
-
args: [{ selector: 'cqa-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div id=\"cqa-ui-root\" style=\"display: block;\">\n <div class=\"cqa-flex cqa-w-full cqa-justify-center cqa-px-4 sm:cqa-px-6\">\n <div [ngClass]=\"panelClassList\" [ngStyle]=\"panelStyles\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-5\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-3\">\n <h2 class=\"cqa-text-lg cqa-font-semibold cqa-text-[#111827]\">\n {{ config.title }}\n </h2>\n\n <p *ngIf=\"config.description\" class=\"cqa-text-sm cqa-leading-6 cqa-text-[#4B5563]\">\n {{ config.description }}\n </p>\n\n <div\n *ngIf=\"config.warning\"\n class=\"cqa-rounded-xl cqa-border cqa-border-red-200 cqa-bg-red-50 cqa-px-4 cqa-py-3 cqa-text-sm cqa-leading-5 cqa-text-red-700\"\n >\n {{ config.warning }}\n </div>\n </div>\n\n <div class=\"cqa-text-sm cqa-text-[#111827]\" [class.hidden]=\"!contentAttached\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div class=\"cqa-mt-4 cqa-flex cqa-flex-wrap cqa-gap-3\" [ngClass]=\"buttonAlignmentClass\">\n <cqa-button\n *ngFor=\"let button of config.buttons\"\n type=\"button\"\n [variant]=\"buttonVariant(button)\"\n [ngClass]=\"buttonHostClasses(button)\"\n (clicked)=\"onButtonClick(button)\"\n >\n {{ button.label }}\n </cqa-button>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n", styles: [] }]
|
|
683
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { portalOutlet: [{
|
|
684
|
-
type: ViewChild,
|
|
685
|
-
args: [CdkPortalOutlet, { static: true }]
|
|
686
|
-
}] } });
|
|
687
|
-
|
|
688
|
-
// import { RootWrapperComponent } from './root-wrapper/root-wrapper.component';
|
|
689
|
-
// import { CardComponent } from './card/card.component';
|
|
690
|
-
// import { InputComponent } from './input/input.component';
|
|
691
|
-
// import { IconButtonComponent } from './icon-button/icon-button.component';
|
|
692
|
-
class UiKitModule {
|
|
693
|
-
}
|
|
694
|
-
UiKitModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
695
|
-
UiKitModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, declarations: [ButtonComponent,
|
|
696
|
-
SearchBarComponent,
|
|
697
|
-
SegmentControlComponent,
|
|
698
|
-
DialogComponent], imports: [CommonModule,
|
|
699
|
-
FormsModule,
|
|
700
|
-
MatIconModule,
|
|
701
|
-
OverlayModule,
|
|
702
|
-
PortalModule], exports: [ButtonComponent,
|
|
703
|
-
SearchBarComponent,
|
|
704
|
-
SegmentControlComponent,
|
|
705
|
-
DialogComponent] });
|
|
706
|
-
UiKitModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, imports: [[
|
|
707
|
-
CommonModule,
|
|
708
|
-
FormsModule,
|
|
709
|
-
MatIconModule,
|
|
710
|
-
OverlayModule,
|
|
711
|
-
PortalModule
|
|
712
|
-
]] });
|
|
713
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, decorators: [{
|
|
714
|
-
type: NgModule,
|
|
715
|
-
args: [{
|
|
716
|
-
declarations: [
|
|
717
|
-
ButtonComponent,
|
|
718
|
-
SearchBarComponent,
|
|
719
|
-
SegmentControlComponent,
|
|
720
|
-
DialogComponent,
|
|
721
|
-
// RootWrapperComponent,
|
|
722
|
-
// CardComponent,
|
|
723
|
-
// InputComponent,
|
|
724
|
-
// IconButtonComponent
|
|
725
|
-
],
|
|
726
|
-
imports: [
|
|
727
|
-
CommonModule,
|
|
728
|
-
FormsModule,
|
|
729
|
-
MatIconModule,
|
|
730
|
-
OverlayModule,
|
|
731
|
-
PortalModule
|
|
732
|
-
],
|
|
733
|
-
exports: [
|
|
734
|
-
ButtonComponent,
|
|
735
|
-
SearchBarComponent,
|
|
736
|
-
SegmentControlComponent,
|
|
737
|
-
DialogComponent,
|
|
738
|
-
// RootWrapperComponent,
|
|
739
|
-
// CardComponent,
|
|
740
|
-
// InputComponent,
|
|
741
|
-
// IconButtonComponent
|
|
742
|
-
]
|
|
743
|
-
}]
|
|
744
|
-
}] });
|
|
745
|
-
|
|
746
|
-
class DialogRef {
|
|
747
|
-
constructor(overlayRef) {
|
|
748
|
-
this.overlayRef = overlayRef;
|
|
749
|
-
this.closed$ = new Subject();
|
|
750
|
-
this.isClosed = false;
|
|
751
|
-
this.overlayRef.detachments().subscribe(() => {
|
|
752
|
-
this.finishClose(undefined);
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
close(result) {
|
|
756
|
-
if (this.isClosed) {
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
this.finishClose(result);
|
|
760
|
-
this.overlayRef.dispose();
|
|
761
|
-
}
|
|
762
|
-
afterClosed() {
|
|
763
|
-
return this.closed$.asObservable();
|
|
764
|
-
}
|
|
765
|
-
setComponentInstance(instance) {
|
|
766
|
-
this.componentInstance = instance;
|
|
767
|
-
}
|
|
768
|
-
getComponentInstance() {
|
|
769
|
-
return this.componentInstance;
|
|
770
|
-
}
|
|
771
|
-
finishClose(result) {
|
|
772
|
-
if (this.isClosed) {
|
|
773
|
-
return;
|
|
774
|
-
}
|
|
775
|
-
this.isClosed = true;
|
|
776
|
-
this.closed$.next(result);
|
|
777
|
-
this.closed$.complete();
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
const DIALOG_REF = new InjectionToken('CQA_DIALOG_REF');
|
|
782
|
-
const DIALOG_DATA = new InjectionToken('CQA_DIALOG_DATA');
|
|
783
|
-
|
|
784
|
-
class DialogService {
|
|
785
|
-
constructor(overlay, injector) {
|
|
786
|
-
this.overlay = overlay;
|
|
787
|
-
this.injector = injector;
|
|
788
|
-
}
|
|
789
|
-
open(config) {
|
|
790
|
-
this.assertValidConfig(config);
|
|
791
|
-
const overlayRef = this.overlay.create(this.buildOverlayConfig(config));
|
|
792
|
-
const dialogRef = new DialogRef(overlayRef);
|
|
793
|
-
const injector = Injector.create({
|
|
794
|
-
parent: this.injector,
|
|
795
|
-
providers: [
|
|
796
|
-
{ provide: DIALOG_REF, useValue: dialogRef },
|
|
797
|
-
{ provide: DIALOG_DATA, useValue: config.data },
|
|
798
|
-
],
|
|
799
|
-
});
|
|
800
|
-
const containerPortal = new ComponentPortal(DialogComponent, undefined, injector);
|
|
801
|
-
const containerRef = overlayRef.attach(containerPortal);
|
|
802
|
-
const containerInstance = containerRef.instance;
|
|
803
|
-
containerInstance.config = config;
|
|
804
|
-
containerInstance.dialogRef = dialogRef;
|
|
805
|
-
if (config.content?.type === 'template') {
|
|
806
|
-
containerInstance.attachTemplate(config.content.template, config.content.context ?? {
|
|
807
|
-
$implicit: config.data,
|
|
808
|
-
data: config.data,
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
if (config.content?.type === 'component') {
|
|
812
|
-
const componentPortal = new ComponentPortal(config.content.component, undefined, Injector.create({
|
|
813
|
-
parent: injector,
|
|
814
|
-
providers: [
|
|
815
|
-
{ provide: DIALOG_REF, useValue: dialogRef },
|
|
816
|
-
{ provide: DIALOG_DATA, useValue: config.data },
|
|
817
|
-
],
|
|
818
|
-
}));
|
|
819
|
-
const componentRef = containerInstance.attachComponent(componentPortal);
|
|
820
|
-
if (componentRef && config.content.inputs) {
|
|
821
|
-
Object.entries(config.content.inputs).forEach(([key, value]) => {
|
|
822
|
-
componentRef.instance[key] = value;
|
|
823
|
-
});
|
|
824
|
-
componentRef.changeDetectorRef.markForCheck();
|
|
825
|
-
}
|
|
826
|
-
if (componentRef) {
|
|
827
|
-
dialogRef.setComponentInstance(componentRef.instance);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
containerRef.changeDetectorRef.markForCheck();
|
|
831
|
-
if (!config.disableClose) {
|
|
832
|
-
overlayRef.backdropClick().subscribe(() => dialogRef.close());
|
|
833
|
-
overlayRef
|
|
834
|
-
.keydownEvents()
|
|
835
|
-
.pipe(filter((event) => {
|
|
836
|
-
return event.key === 'Escape' || event.key === 'Esc';
|
|
837
|
-
}))
|
|
838
|
-
.subscribe(() => dialogRef.close());
|
|
839
|
-
}
|
|
840
|
-
return dialogRef;
|
|
841
|
-
}
|
|
842
|
-
assertValidConfig(config) {
|
|
843
|
-
if (!config.title) {
|
|
844
|
-
throw new Error('Dialog title is required.');
|
|
845
|
-
}
|
|
846
|
-
if (!config.buttons || config.buttons.length < 2) {
|
|
847
|
-
throw new Error('Dialog requires at least two buttons to be provided.');
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
buildOverlayConfig(config) {
|
|
851
|
-
const panelClass = Array.isArray(config.panelClass)
|
|
852
|
-
? config.panelClass
|
|
853
|
-
: config.panelClass
|
|
854
|
-
? [config.panelClass]
|
|
855
|
-
: [];
|
|
856
|
-
return new OverlayConfig({
|
|
857
|
-
hasBackdrop: true,
|
|
858
|
-
backdropClass: ['cdk-overlay-dark-backdrop', 'cqa-dialog-backdrop'],
|
|
859
|
-
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
860
|
-
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
|
|
861
|
-
width: config.width,
|
|
862
|
-
maxWidth: config.maxWidth ?? '90vw',
|
|
863
|
-
panelClass: ['cqa-dialog-panel', ...panelClass],
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
DialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogService, deps: [{ token: i1$1.Overlay }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
868
|
-
DialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogService, providedIn: 'root' });
|
|
869
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogService, decorators: [{
|
|
870
|
-
type: Injectable,
|
|
871
|
-
args: [{
|
|
872
|
-
providedIn: 'root',
|
|
873
|
-
}]
|
|
874
|
-
}], ctorParameters: function () { return [{ type: i1$1.Overlay }, { type: i0.Injector }]; } });
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* Generated bundle index. Do not edit.
|
|
878
|
-
*/
|
|
879
|
-
|
|
880
|
-
export { ButtonComponent, DIALOG_DATA, DIALOG_REF, DialogComponent, DialogRef, DialogService, SearchBarComponent, SegmentControlComponent, UiKitModule };
|
|
881
|
-
//# sourceMappingURL=cqa-lib-cqa-ui.mjs.map
|