@thalassic/ui 0.6.0 → 0.7.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/fesm2022/thalassic-ui.mjs +1081 -125
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +8 -2
- package/types/thalassic-ui.d.ts +331 -82
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive,
|
|
3
|
-
import { NgTemplateOutlet
|
|
2
|
+
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, ElementRef, Injectable, DestroyRef, viewChild, contentChildren, afterNextRender, forwardRef, model, contentChild, viewChildren, output, Renderer2, signal, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { RouterLink } from '@angular/router';
|
|
5
|
-
import { rxResource } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { takeUntilDestroyed, rxResource } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { ThemeService } from '@thalassic/core';
|
|
7
|
+
import { Chart as Chart$1, BarController, BarElement, CategoryScale, LinearScale, BubbleController, PointElement, DoughnutController, ArcElement, LineController, LineElement, PieController, PolarAreaController, RadialLinearScale, RadarController, ScatterController } from 'chart.js';
|
|
6
8
|
import { HttpClient } from '@angular/common/http';
|
|
7
9
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
8
10
|
import { throwError, map, shareReplay } from 'rxjs';
|
|
11
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
12
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
9
13
|
|
|
10
14
|
const DEFAULT_ALERT_CONFIG = {
|
|
11
15
|
color: 'primary',
|
|
@@ -147,6 +151,325 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
147
151
|
}]
|
|
148
152
|
}] });
|
|
149
153
|
|
|
154
|
+
const CHART_ELEMENT = new InjectionToken('CHART_ELEMENT');
|
|
155
|
+
class ChartElement {
|
|
156
|
+
dataset = input.required({ ...(ngDevMode ? { debugName: "dataset" } : {}), transform: value => ({
|
|
157
|
+
type: this.type,
|
|
158
|
+
...value,
|
|
159
|
+
}) });
|
|
160
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartElement, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
161
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ChartElement, isStandalone: true, inputs: { dataset: { classPropertyName: "dataset", publicName: "dataset", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
162
|
+
}
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartElement, decorators: [{
|
|
164
|
+
type: Directive
|
|
165
|
+
}], propDecorators: { dataset: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataset", required: true }] }] } });
|
|
166
|
+
|
|
167
|
+
const CARTESIAN_CHARTS = [
|
|
168
|
+
'bar',
|
|
169
|
+
'line',
|
|
170
|
+
'scatter',
|
|
171
|
+
'bubble',
|
|
172
|
+
];
|
|
173
|
+
const RADIAL_CHARTS = ['polarArea', 'radar'];
|
|
174
|
+
|
|
175
|
+
class ChartService {
|
|
176
|
+
_elementRef = inject(ElementRef);
|
|
177
|
+
getColorOptions(chartElements) {
|
|
178
|
+
const scaleTypes = this._getScaleTypes(chartElements);
|
|
179
|
+
const computedStyle = getComputedStyle(this._elementRef.nativeElement);
|
|
180
|
+
return {
|
|
181
|
+
backgroundColor: computedStyle.getPropertyValue('--tls-chart-background-color'),
|
|
182
|
+
borderColor: computedStyle.getPropertyValue('--tls-chart-border-color'),
|
|
183
|
+
color: computedStyle.getPropertyValue('--tls-chart-color'),
|
|
184
|
+
scales: this._getScales(scaleTypes),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// Private methods
|
|
188
|
+
_getScales(scaleTypes) {
|
|
189
|
+
const scales = {};
|
|
190
|
+
if (scaleTypes.includes('cartesian')) {
|
|
191
|
+
scales['x'] = this._getCartesianScales('x');
|
|
192
|
+
scales['y'] = this._getCartesianScales('y');
|
|
193
|
+
}
|
|
194
|
+
if (scaleTypes.includes('radial')) {
|
|
195
|
+
scales['r'] = this._getRadialScales();
|
|
196
|
+
}
|
|
197
|
+
return scales;
|
|
198
|
+
}
|
|
199
|
+
_getCartesianScales(axis) {
|
|
200
|
+
const computedStyle = getComputedStyle(this._elementRef.nativeElement);
|
|
201
|
+
return {
|
|
202
|
+
ticks: {
|
|
203
|
+
color: computedStyle.getPropertyValue(`--tls-chart-${axis}-ticks-color`),
|
|
204
|
+
},
|
|
205
|
+
grid: {
|
|
206
|
+
color: computedStyle.getPropertyValue(`--tls-chart-${axis}-grid-color`),
|
|
207
|
+
},
|
|
208
|
+
border: {
|
|
209
|
+
color: computedStyle.getPropertyValue(`--tls-chart-${axis}-axis-color`),
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
_getRadialScales() {
|
|
214
|
+
const computedStyle = getComputedStyle(this._elementRef.nativeElement);
|
|
215
|
+
return {
|
|
216
|
+
angleLines: {
|
|
217
|
+
color: computedStyle.getPropertyValue('--tls-chart-r-angle-lines-color'),
|
|
218
|
+
},
|
|
219
|
+
grid: {
|
|
220
|
+
color: computedStyle.getPropertyValue('--tls-chart-r-grid-color'),
|
|
221
|
+
},
|
|
222
|
+
pointLabels: {
|
|
223
|
+
color: computedStyle.getPropertyValue('--tls-chart-r-labels-color'),
|
|
224
|
+
},
|
|
225
|
+
ticks: {
|
|
226
|
+
color: computedStyle.getPropertyValue('--tls-chart-r-ticks-color'),
|
|
227
|
+
backdropColor: computedStyle.getPropertyValue('--tls-chart-r-ticks-backdrop-color'),
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
_getScaleTypes(chartElements) {
|
|
232
|
+
const types = [];
|
|
233
|
+
if (chartElements.some(element => CARTESIAN_CHARTS.includes(element.type)))
|
|
234
|
+
types.push('cartesian');
|
|
235
|
+
if (chartElements.some(element => RADIAL_CHARTS.includes(element.type)))
|
|
236
|
+
types.push('radial');
|
|
237
|
+
return types;
|
|
238
|
+
}
|
|
239
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
240
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService });
|
|
241
|
+
}
|
|
242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService, decorators: [{
|
|
243
|
+
type: Injectable
|
|
244
|
+
}] });
|
|
245
|
+
|
|
246
|
+
const DEFAULT_CHART_CONFIG = {
|
|
247
|
+
options: {
|
|
248
|
+
maintainAspectRatio: false,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const CHART_CONFIG = new InjectionToken('CHART_CONFIG', {
|
|
253
|
+
factory: () => DEFAULT_CHART_CONFIG,
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
class Chart {
|
|
257
|
+
_config = inject(CHART_CONFIG);
|
|
258
|
+
_chartService = inject(ChartService);
|
|
259
|
+
_destroyRef = inject(DestroyRef);
|
|
260
|
+
_themeService = inject(ThemeService, { optional: true });
|
|
261
|
+
canvasRef = viewChild('canvasRef', ...(ngDevMode ? [{ debugName: "canvasRef" }] : []));
|
|
262
|
+
chartElements = contentChildren(CHART_ELEMENT, ...(ngDevMode ? [{ debugName: "chartElements" }] : []));
|
|
263
|
+
_chart = null;
|
|
264
|
+
labels = input([], ...(ngDevMode ? [{ debugName: "labels" }] : []));
|
|
265
|
+
options = input(undefined, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
266
|
+
// Computed
|
|
267
|
+
_options = computed(() => {
|
|
268
|
+
const options = this.options();
|
|
269
|
+
const colorOptions = this._chartService.getColorOptions(this.chartElements());
|
|
270
|
+
if (options)
|
|
271
|
+
return { ...colorOptions, ...this._config.options, ...options };
|
|
272
|
+
else
|
|
273
|
+
return { ...colorOptions, ...this._config.options };
|
|
274
|
+
}, ...(ngDevMode ? [{ debugName: "_options" }] : []));
|
|
275
|
+
_datasets = computed(() => this.chartElements().map(element => element.dataset()), ...(ngDevMode ? [{ debugName: "_datasets" }] : []));
|
|
276
|
+
hostClasses = computed(() => {
|
|
277
|
+
const className = 'tls-chart';
|
|
278
|
+
const array = [className];
|
|
279
|
+
return array;
|
|
280
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
281
|
+
constructor() {
|
|
282
|
+
afterNextRender(() => {
|
|
283
|
+
if (this.canvasElement) {
|
|
284
|
+
const config = {
|
|
285
|
+
options: this._options(),
|
|
286
|
+
data: {
|
|
287
|
+
labels: this.labels(),
|
|
288
|
+
datasets: this._datasets(),
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
this._chart = new Chart$1(this.canvasElement, config);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
// Accessors
|
|
296
|
+
get canvasElement() {
|
|
297
|
+
return this.canvasRef()?.nativeElement;
|
|
298
|
+
}
|
|
299
|
+
// Private methods
|
|
300
|
+
_tryInitThemeListener() {
|
|
301
|
+
if (this._themeService) {
|
|
302
|
+
this._themeService.onThemeChange.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
|
303
|
+
if (this._chart) {
|
|
304
|
+
const colorOptions = this._chartService.getColorOptions(this.chartElements());
|
|
305
|
+
this._chart.options = { ...this._options(), ...colorOptions };
|
|
306
|
+
this._chart.update('none');
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// Lifecycle
|
|
312
|
+
ngOnInit() {
|
|
313
|
+
this._tryInitThemeListener();
|
|
314
|
+
}
|
|
315
|
+
ngOnDestroy() {
|
|
316
|
+
if (this._chart)
|
|
317
|
+
this._chart.destroy();
|
|
318
|
+
}
|
|
319
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
320
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: Chart, isStandalone: true, selector: "tls-chart", inputs: { labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, providers: [ChartService], queries: [{ propertyName: "chartElements", predicate: CHART_ELEMENT, isSignal: true }], viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvasRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<canvas #canvasRef></canvas>\n", styles: [":host{position:relative;display:block}\n"] });
|
|
321
|
+
}
|
|
322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chart, decorators: [{
|
|
323
|
+
type: Component,
|
|
324
|
+
args: [{ selector: 'tls-chart', imports: [], host: {
|
|
325
|
+
'[class]': 'hostClasses()',
|
|
326
|
+
}, providers: [ChartService], template: "<canvas #canvasRef></canvas>\n", styles: [":host{position:relative;display:block}\n"] }]
|
|
327
|
+
}], ctorParameters: () => [], propDecorators: { canvasRef: [{ type: i0.ViewChild, args: ['canvasRef', { isSignal: true }] }], chartElements: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CHART_ELEMENT), { isSignal: true }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
328
|
+
|
|
329
|
+
class BarChart extends ChartElement {
|
|
330
|
+
type = 'bar';
|
|
331
|
+
constructor() {
|
|
332
|
+
super();
|
|
333
|
+
Chart$1.register(BarController, BarElement, CategoryScale, LinearScale);
|
|
334
|
+
}
|
|
335
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BarChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
336
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: BarChart, isStandalone: true, selector: "tls-bar-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BarChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
337
|
+
}
|
|
338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BarChart, decorators: [{
|
|
339
|
+
type: Component,
|
|
340
|
+
args: [{
|
|
341
|
+
selector: 'tls-bar-chart',
|
|
342
|
+
template: '',
|
|
343
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BarChart) }],
|
|
344
|
+
}]
|
|
345
|
+
}], ctorParameters: () => [] });
|
|
346
|
+
|
|
347
|
+
class BubbleChart extends ChartElement {
|
|
348
|
+
type = 'bubble';
|
|
349
|
+
constructor() {
|
|
350
|
+
super();
|
|
351
|
+
Chart$1.register(BubbleController, PointElement, LinearScale);
|
|
352
|
+
}
|
|
353
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BubbleChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
354
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: BubbleChart, isStandalone: true, selector: "tls-bubble-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BubbleChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
355
|
+
}
|
|
356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BubbleChart, decorators: [{
|
|
357
|
+
type: Component,
|
|
358
|
+
args: [{
|
|
359
|
+
selector: 'tls-bubble-chart',
|
|
360
|
+
template: '',
|
|
361
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BubbleChart) }],
|
|
362
|
+
}]
|
|
363
|
+
}], ctorParameters: () => [] });
|
|
364
|
+
|
|
365
|
+
class DoughnutChart extends ChartElement {
|
|
366
|
+
type = 'doughnut';
|
|
367
|
+
constructor() {
|
|
368
|
+
super();
|
|
369
|
+
Chart$1.register(DoughnutController, ArcElement);
|
|
370
|
+
}
|
|
371
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DoughnutChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
372
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: DoughnutChart, isStandalone: true, selector: "tls-doughnut-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => DoughnutChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
373
|
+
}
|
|
374
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DoughnutChart, decorators: [{
|
|
375
|
+
type: Component,
|
|
376
|
+
args: [{
|
|
377
|
+
selector: 'tls-doughnut-chart',
|
|
378
|
+
template: '',
|
|
379
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => DoughnutChart) }],
|
|
380
|
+
}]
|
|
381
|
+
}], ctorParameters: () => [] });
|
|
382
|
+
|
|
383
|
+
class LineChart extends ChartElement {
|
|
384
|
+
type = 'line';
|
|
385
|
+
constructor() {
|
|
386
|
+
super();
|
|
387
|
+
Chart$1.register(LineController, LineElement, PointElement, CategoryScale, LinearScale);
|
|
388
|
+
}
|
|
389
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: LineChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
390
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: LineChart, isStandalone: true, selector: "tls-line-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => LineChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
391
|
+
}
|
|
392
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: LineChart, decorators: [{
|
|
393
|
+
type: Component,
|
|
394
|
+
args: [{
|
|
395
|
+
selector: 'tls-line-chart',
|
|
396
|
+
template: '',
|
|
397
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => LineChart) }],
|
|
398
|
+
}]
|
|
399
|
+
}], ctorParameters: () => [] });
|
|
400
|
+
|
|
401
|
+
class PieChart extends ChartElement {
|
|
402
|
+
type = 'pie';
|
|
403
|
+
constructor() {
|
|
404
|
+
super();
|
|
405
|
+
Chart$1.register(PieController, ArcElement);
|
|
406
|
+
}
|
|
407
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PieChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
408
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: PieChart, isStandalone: true, selector: "tls-pie-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PieChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
409
|
+
}
|
|
410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PieChart, decorators: [{
|
|
411
|
+
type: Component,
|
|
412
|
+
args: [{
|
|
413
|
+
selector: 'tls-pie-chart',
|
|
414
|
+
template: '',
|
|
415
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PieChart) }],
|
|
416
|
+
}]
|
|
417
|
+
}], ctorParameters: () => [] });
|
|
418
|
+
|
|
419
|
+
class PolarAreaChart extends ChartElement {
|
|
420
|
+
type = 'polarArea';
|
|
421
|
+
constructor() {
|
|
422
|
+
super();
|
|
423
|
+
Chart$1.register(PolarAreaController, ArcElement, RadialLinearScale);
|
|
424
|
+
}
|
|
425
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PolarAreaChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
426
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: PolarAreaChart, isStandalone: true, selector: "tls-polar-area-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PolarAreaChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
427
|
+
}
|
|
428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PolarAreaChart, decorators: [{
|
|
429
|
+
type: Component,
|
|
430
|
+
args: [{
|
|
431
|
+
selector: 'tls-polar-area-chart',
|
|
432
|
+
template: '',
|
|
433
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PolarAreaChart) }],
|
|
434
|
+
}]
|
|
435
|
+
}], ctorParameters: () => [] });
|
|
436
|
+
|
|
437
|
+
class RadarChart extends ChartElement {
|
|
438
|
+
type = 'radar';
|
|
439
|
+
constructor() {
|
|
440
|
+
super();
|
|
441
|
+
Chart$1.register(RadarController, LineElement, PointElement, RadialLinearScale);
|
|
442
|
+
}
|
|
443
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadarChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
444
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: RadarChart, isStandalone: true, selector: "tls-radar-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => RadarChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
445
|
+
}
|
|
446
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadarChart, decorators: [{
|
|
447
|
+
type: Component,
|
|
448
|
+
args: [{
|
|
449
|
+
selector: 'tls-radar-chart',
|
|
450
|
+
template: '',
|
|
451
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => RadarChart) }],
|
|
452
|
+
}]
|
|
453
|
+
}], ctorParameters: () => [] });
|
|
454
|
+
|
|
455
|
+
class ScatterChart extends ChartElement {
|
|
456
|
+
type = 'scatter';
|
|
457
|
+
constructor() {
|
|
458
|
+
super();
|
|
459
|
+
Chart$1.register(ScatterController, PointElement, LinearScale);
|
|
460
|
+
}
|
|
461
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ScatterChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
462
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: ScatterChart, isStandalone: true, selector: "tls-scatter-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => ScatterChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
463
|
+
}
|
|
464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ScatterChart, decorators: [{
|
|
465
|
+
type: Component,
|
|
466
|
+
args: [{
|
|
467
|
+
selector: 'tls-scatter-chart',
|
|
468
|
+
template: '',
|
|
469
|
+
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => ScatterChart) }],
|
|
470
|
+
}]
|
|
471
|
+
}], ctorParameters: () => [] });
|
|
472
|
+
|
|
150
473
|
const DEFAULT_DIVIDER_CONFIG = {
|
|
151
474
|
orientation: 'horizontal',
|
|
152
475
|
position: 'center',
|
|
@@ -494,6 +817,143 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
494
817
|
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n<button class=\"tls-password-toggle tls-form-control-addon\" type=\"button\" (click)=\"toggle()\">\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n <span class=\"text-label-md\">Show</span>\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n <span class=\"text-label-md\">Hide</span>\n </span>\n</button>\n", styles: [":host{display:inline-flex}:host .tls-password-toggle{display:grid;align-items:center}:host .tls-password-toggle__item{grid-area:1/1;text-align:center}:host .tls-password-toggle__item--hidden{visibility:hidden}\n"] }]
|
|
495
818
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }] } });
|
|
496
819
|
|
|
820
|
+
// Matches strings containing only numeric digits (0–9).
|
|
821
|
+
// Ensures the entire input consists exclusively of numbers.
|
|
822
|
+
const PIN_INPUT_NUMERIC_REGEX = /^[0-9]+$/;
|
|
823
|
+
// Matches strings containing only alphanumeric characters (a–z, A–Z, 0–9).
|
|
824
|
+
// The `i` flag makes it case-insensitive (redundant here since both cases are
|
|
825
|
+
// explicitly listed, but harmless). Ensures no special characters are allowed.
|
|
826
|
+
const PIN_INPUT_ALPHANUMERIC_REGEX = /^[a-zA-Z0-9]+$/i;
|
|
827
|
+
|
|
828
|
+
const DEFAULT_PIN_INPUT_CONFIG = {
|
|
829
|
+
type: 'numeric',
|
|
830
|
+
length: 4,
|
|
831
|
+
placeholder: '○',
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
const PIN_INPUT_CONFIG = new InjectionToken('PIN_INPUT_CONFIG', {
|
|
835
|
+
factory: () => DEFAULT_PIN_INPUT_CONFIG,
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
class PinInput extends ValueFormControl {
|
|
839
|
+
_config = inject(PIN_INPUT_CONFIG);
|
|
840
|
+
_inputs = viewChildren('cell', ...(ngDevMode ? [{ debugName: "_inputs" }] : []));
|
|
841
|
+
// Inputs
|
|
842
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
843
|
+
length = input(this._config.length, ...(ngDevMode ? [{ debugName: "length" }] : []));
|
|
844
|
+
type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
845
|
+
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
846
|
+
CLASS_NAME = 'tls-pin-input';
|
|
847
|
+
// Computed
|
|
848
|
+
cells = computed(() => Array.from({ length: this.length() }, (_, index) => index), ...(ngDevMode ? [{ debugName: "cells" }] : []));
|
|
849
|
+
hostClasses = computed(() => {
|
|
850
|
+
const className = this.CLASS_NAME;
|
|
851
|
+
const array = [className];
|
|
852
|
+
return array.concat(this.controlClasses());
|
|
853
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
854
|
+
// Protected methods
|
|
855
|
+
getCellValue(index) {
|
|
856
|
+
return this.value()[index] ?? '';
|
|
857
|
+
}
|
|
858
|
+
onInput(event, index) {
|
|
859
|
+
const element = event.target;
|
|
860
|
+
const char = element.value;
|
|
861
|
+
const allowedRegExp = this._getAllowedRegularExpression();
|
|
862
|
+
if (char && !allowedRegExp.test(char)) {
|
|
863
|
+
element.value = this.getCellValue(index);
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
this._setCell(index, char);
|
|
867
|
+
element.value = this.getCellValue(index);
|
|
868
|
+
if (char)
|
|
869
|
+
this._focusCell(index + 1);
|
|
870
|
+
}
|
|
871
|
+
onKeydown(event, index) {
|
|
872
|
+
const element = event.target;
|
|
873
|
+
if (event.key === 'Backspace') {
|
|
874
|
+
event.preventDefault();
|
|
875
|
+
if (this.getCellValue(index)) {
|
|
876
|
+
this._setCell(index, '');
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
this._setCell(index - 1, '');
|
|
880
|
+
this._focusCell(index - 1);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
else if (event.key === 'ArrowLeft') {
|
|
884
|
+
event.preventDefault();
|
|
885
|
+
this._focusCell(index - 1);
|
|
886
|
+
}
|
|
887
|
+
else if (event.key === 'ArrowRight') {
|
|
888
|
+
event.preventDefault();
|
|
889
|
+
this._focusCell(index + 1);
|
|
890
|
+
}
|
|
891
|
+
element.value = this.getCellValue(index);
|
|
892
|
+
}
|
|
893
|
+
onPaste(event, index) {
|
|
894
|
+
event.preventDefault();
|
|
895
|
+
const clipboardData = event.clipboardData;
|
|
896
|
+
if (!clipboardData)
|
|
897
|
+
return;
|
|
898
|
+
const text = clipboardData.getData('text');
|
|
899
|
+
const allowedRegExp = this._getAllowedRegularExpression();
|
|
900
|
+
if (!allowedRegExp.test(text))
|
|
901
|
+
return;
|
|
902
|
+
const chars = text.slice(0, this.length() - this.value().length).split('');
|
|
903
|
+
if (!chars.length)
|
|
904
|
+
return;
|
|
905
|
+
const array = this._getValueArray();
|
|
906
|
+
for (let i = 0; i < chars.length; i++) {
|
|
907
|
+
array[index + i] = chars[i];
|
|
908
|
+
}
|
|
909
|
+
this._commitArray(array);
|
|
910
|
+
this._focusCell(Math.min(this.value().length, this.length()));
|
|
911
|
+
}
|
|
912
|
+
onFocus(event) {
|
|
913
|
+
event.target.select();
|
|
914
|
+
}
|
|
915
|
+
// Private methods
|
|
916
|
+
_setCell(index, char) {
|
|
917
|
+
if (index < 0 || index >= this.length())
|
|
918
|
+
return;
|
|
919
|
+
const array = this._getValueArray();
|
|
920
|
+
array[index] = char[1] ?? char[0];
|
|
921
|
+
this._commitArray(array);
|
|
922
|
+
}
|
|
923
|
+
_commitArray(array) {
|
|
924
|
+
let end = array.length;
|
|
925
|
+
while (end > 0 && array[end - 1] === '')
|
|
926
|
+
end--;
|
|
927
|
+
this.value.set(array.slice(0, end).join(''));
|
|
928
|
+
}
|
|
929
|
+
_focusCell(index) {
|
|
930
|
+
const clamped = Math.max(0, Math.min(index, this.length() - 1));
|
|
931
|
+
this._inputs()[clamped].nativeElement.focus();
|
|
932
|
+
}
|
|
933
|
+
_getAllowedRegularExpression() {
|
|
934
|
+
const type = this.type();
|
|
935
|
+
if (type instanceof RegExp)
|
|
936
|
+
return type;
|
|
937
|
+
switch (type) {
|
|
938
|
+
case 'numeric':
|
|
939
|
+
return PIN_INPUT_NUMERIC_REGEX;
|
|
940
|
+
case 'alphanumeric':
|
|
941
|
+
return PIN_INPUT_ALPHANUMERIC_REGEX;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
_getValueArray() {
|
|
945
|
+
return Array.from({ length: this.length() }, (_, i) => this.value()[i] ?? '');
|
|
946
|
+
}
|
|
947
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PinInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
948
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: PinInput, isStandalone: true, selector: "tls-pin-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => PinInput) }], viewQueries: [{ propertyName: "_inputs", predicate: ["cell"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (cell of cells(); track cell; let index = $index) {\n <input\n #cell\n class=\"tls-pin-input__cell\"\n type=\"text\"\n maxlength=\"2\"\n autocomplete=\"one-time-code\"\n [placeholder]=\"placeholder()\"\n [tabindex]=\"this.value().length === index ? '0' : '-1'\"\n [value]=\"getCellValue(cell)\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [attr.inputmode]=\"type() === 'numeric' ? 'numeric' : 'text'\"\n (input)=\"onInput($event, cell)\"\n (keydown)=\"onKeydown($event, cell)\"\n (paste)=\"onPaste($event, cell)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"touched.set(true)\"\n />\n}\n\n" });
|
|
949
|
+
}
|
|
950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PinInput, decorators: [{
|
|
951
|
+
type: Component,
|
|
952
|
+
args: [{ selector: 'tls-pin-input', imports: [], host: {
|
|
953
|
+
'[class]': 'hostClasses()',
|
|
954
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => PinInput) }], template: "@for (cell of cells(); track cell; let index = $index) {\n <input\n #cell\n class=\"tls-pin-input__cell\"\n type=\"text\"\n maxlength=\"2\"\n autocomplete=\"one-time-code\"\n [placeholder]=\"placeholder()\"\n [tabindex]=\"this.value().length === index ? '0' : '-1'\"\n [value]=\"getCellValue(cell)\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [attr.inputmode]=\"type() === 'numeric' ? 'numeric' : 'text'\"\n (input)=\"onInput($event, cell)\"\n (keydown)=\"onKeydown($event, cell)\"\n (paste)=\"onPaste($event, cell)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"touched.set(true)\"\n />\n}\n\n" }]
|
|
955
|
+
}], propDecorators: { _inputs: [{ type: i0.ViewChildren, args: ['cell', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
|
|
956
|
+
|
|
497
957
|
const DEFAULT_RADIO_BUTTON_CONFIG = {};
|
|
498
958
|
|
|
499
959
|
const RADIO_BUTTON_CONFIG = new InjectionToken('RADIO_BUTTON_CONFIG', {
|
|
@@ -671,6 +1131,286 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
671
1131
|
args: [{ selector: 'tls-icon', imports: [], host: { class: 'tls-icon' }, template: "@if (isSvg() && iconSrc()) {\n <span [innerHTML]=\"svgContent()\" class=\"tls-svg-icon\"></span>\n} @else if (iconSrc()) {\n <img [src]=\"iconSrc()\" [alt]=\"alt()\" class=\"tls-img-icon\" />\n} @else {\n {{ iconSrc() }}\n}\n" }]
|
|
672
1132
|
}], propDecorators: { iconSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconSrc", required: true }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], allowedSources: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowedSources", required: false }] }] } });
|
|
673
1133
|
|
|
1134
|
+
const DEFAULT_LOADER_CONFIG = {
|
|
1135
|
+
size: 'md',
|
|
1136
|
+
width: null,
|
|
1137
|
+
widthRatio: 5,
|
|
1138
|
+
ariaLabel: 'Loading',
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
const LOADER_CONFIG = new InjectionToken('LOADER_CONFIG', {
|
|
1142
|
+
factory: () => DEFAULT_LOADER_CONFIG,
|
|
1143
|
+
});
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Indeterminate spinner for indicating a loading state.
|
|
1147
|
+
*
|
|
1148
|
+
* @example
|
|
1149
|
+
* <!-- predefined size -->
|
|
1150
|
+
* <tls-loader size="lg" />
|
|
1151
|
+
*
|
|
1152
|
+
* @example
|
|
1153
|
+
* <!-- custom size in pixels -->
|
|
1154
|
+
* <tls-loader [size]="64" />
|
|
1155
|
+
*
|
|
1156
|
+
* @example
|
|
1157
|
+
* <!-- custom size with explicit stroke width -->
|
|
1158
|
+
* <tls-loader [size]="64" [width]="8" />
|
|
1159
|
+
*/
|
|
1160
|
+
class Loader {
|
|
1161
|
+
_config = inject(LOADER_CONFIG);
|
|
1162
|
+
/** Predefined size token or custom pixel value. */
|
|
1163
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1164
|
+
/** Stroke width in pixels. Overrides the size-class default for both token and numeric sizes. */
|
|
1165
|
+
width = input(this._config.width, ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1166
|
+
/** Divisor for auto stroke width when size is a number and width is null (`size / widthRatio`). */
|
|
1167
|
+
widthRatio = input(this._config.widthRatio, ...(ngDevMode ? [{ debugName: "widthRatio" }] : []));
|
|
1168
|
+
/** Text announced by screen readers via `aria-label`. */
|
|
1169
|
+
ariaLabel = input(this._config.ariaLabel, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
1170
|
+
hostClasses = computed(() => {
|
|
1171
|
+
const className = 'tls-loader';
|
|
1172
|
+
const size = this.size();
|
|
1173
|
+
const array = [className];
|
|
1174
|
+
if (typeof size === 'string') {
|
|
1175
|
+
array.push(`${className}--${size}`);
|
|
1176
|
+
}
|
|
1177
|
+
return array;
|
|
1178
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1179
|
+
hostStyles = computed(() => {
|
|
1180
|
+
const size = this.size();
|
|
1181
|
+
const width = this.width();
|
|
1182
|
+
if (typeof size === 'string' && width === null) {
|
|
1183
|
+
return null;
|
|
1184
|
+
}
|
|
1185
|
+
const styles = {};
|
|
1186
|
+
if (typeof size === 'number') {
|
|
1187
|
+
styles['--tls-loader-size'] = `${size}px`;
|
|
1188
|
+
}
|
|
1189
|
+
if (width !== null) {
|
|
1190
|
+
styles['--tls-loader-width'] = `${width}px`;
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
styles['--tls-loader-width'] = `${size / this.widthRatio()}px`;
|
|
1194
|
+
}
|
|
1195
|
+
return styles;
|
|
1196
|
+
}, ...(ngDevMode ? [{ debugName: "hostStyles" }] : []));
|
|
1197
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Loader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1198
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Loader, isStandalone: true, selector: "tls-loader", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, widthRatio: { classPropertyName: "widthRatio", publicName: "widthRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "class": "hostClasses()", "style": "hostStyles()", "attr.aria-label": "ariaLabel()" } }, ngImport: i0, template: '', isInline: true });
|
|
1199
|
+
}
|
|
1200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Loader, decorators: [{
|
|
1201
|
+
type: Component,
|
|
1202
|
+
args: [{
|
|
1203
|
+
selector: 'tls-loader',
|
|
1204
|
+
imports: [],
|
|
1205
|
+
template: '',
|
|
1206
|
+
host: {
|
|
1207
|
+
'[class]': 'hostClasses()',
|
|
1208
|
+
'[style]': 'hostStyles()',
|
|
1209
|
+
role: 'status',
|
|
1210
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
1211
|
+
},
|
|
1212
|
+
}]
|
|
1213
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], widthRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "widthRatio", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
1214
|
+
|
|
1215
|
+
const DEFAULT_SKELETON_CONFIG = {
|
|
1216
|
+
size: 40,
|
|
1217
|
+
width: null,
|
|
1218
|
+
height: null,
|
|
1219
|
+
radius: 8,
|
|
1220
|
+
duration: 2500,
|
|
1221
|
+
rounded: false,
|
|
1222
|
+
animate: true,
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
const SKELETON_CONFIG = new InjectionToken('SKELETON_CONFIG', {
|
|
1226
|
+
factory: () => DEFAULT_SKELETON_CONFIG,
|
|
1227
|
+
});
|
|
1228
|
+
|
|
1229
|
+
class Skeleton {
|
|
1230
|
+
_config = inject(SKELETON_CONFIG);
|
|
1231
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1232
|
+
width = input(this._config.width, ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
1233
|
+
height = input(this._config.height, ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
1234
|
+
radius = input(this._config.radius, ...(ngDevMode ? [{ debugName: "radius" }] : []));
|
|
1235
|
+
duration = input(this._config.duration, ...(ngDevMode ? [{ debugName: "duration" }] : []));
|
|
1236
|
+
rounded = input(this._config.rounded, { ...(ngDevMode ? { debugName: "rounded" } : {}), transform: booleanAttribute });
|
|
1237
|
+
animate = input(this._config.animate, { ...(ngDevMode ? { debugName: "animate" } : {}), transform: booleanAttribute });
|
|
1238
|
+
hostClasses = computed(() => {
|
|
1239
|
+
const className = 'tls-skeleton';
|
|
1240
|
+
const array = [className];
|
|
1241
|
+
if (!this.animate()) {
|
|
1242
|
+
array.push(`${className}--no-animate`);
|
|
1243
|
+
}
|
|
1244
|
+
return array;
|
|
1245
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1246
|
+
hostStyles = computed(() => {
|
|
1247
|
+
const size = this.size();
|
|
1248
|
+
const width = this.width() ?? size;
|
|
1249
|
+
const height = this.height() ?? size;
|
|
1250
|
+
const rounded = this.rounded();
|
|
1251
|
+
const radius = this.radius();
|
|
1252
|
+
return {
|
|
1253
|
+
'--tls-skeleton-width': `${width}px`,
|
|
1254
|
+
'--tls-skeleton-height': `${height}px`,
|
|
1255
|
+
'--tls-skeleton-radius': rounded ? '50%' : `${radius}px`,
|
|
1256
|
+
'--tls-skeleton-duration': `${this.duration()}ms`,
|
|
1257
|
+
};
|
|
1258
|
+
}, ...(ngDevMode ? [{ debugName: "hostStyles" }] : []));
|
|
1259
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Skeleton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1260
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Skeleton, isStandalone: true, selector: "tls-skeleton", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "class": "hostClasses()", "style": "hostStyles()" } }, ngImport: i0, template: '', isInline: true });
|
|
1261
|
+
}
|
|
1262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Skeleton, decorators: [{
|
|
1263
|
+
type: Component,
|
|
1264
|
+
args: [{
|
|
1265
|
+
selector: 'tls-skeleton',
|
|
1266
|
+
imports: [],
|
|
1267
|
+
template: '',
|
|
1268
|
+
host: {
|
|
1269
|
+
'[class]': 'hostClasses()',
|
|
1270
|
+
'[style]': 'hostStyles()',
|
|
1271
|
+
'aria-hidden': 'true',
|
|
1272
|
+
},
|
|
1273
|
+
}]
|
|
1274
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }] } });
|
|
1275
|
+
|
|
1276
|
+
class StepperService {
|
|
1277
|
+
active = null;
|
|
1278
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: StepperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1279
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: StepperService });
|
|
1280
|
+
}
|
|
1281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: StepperService, decorators: [{
|
|
1282
|
+
type: Injectable
|
|
1283
|
+
}] });
|
|
1284
|
+
|
|
1285
|
+
const DEFAULT_STEP_CONFIG = {
|
|
1286
|
+
color: 'primary',
|
|
1287
|
+
};
|
|
1288
|
+
const DEFAULT_STEPPER_CONFIG = {
|
|
1289
|
+
orientation: 'horizontal',
|
|
1290
|
+
linear: false,
|
|
1291
|
+
step: DEFAULT_STEP_CONFIG,
|
|
1292
|
+
};
|
|
1293
|
+
|
|
1294
|
+
const STEPPER_CONFIG = new InjectionToken('STEPPER_CONFIG', {
|
|
1295
|
+
factory: () => DEFAULT_STEPPER_CONFIG,
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
class Step {
|
|
1299
|
+
_config = inject(STEPPER_CONFIG);
|
|
1300
|
+
_stepperService = inject(StepperService);
|
|
1301
|
+
iconTemplateRef = contentChild('stepIcon', ...(ngDevMode ? [{ debugName: "iconTemplateRef" }] : []));
|
|
1302
|
+
completedIconTemplateRef = contentChild('stepCompletedIcon', ...(ngDevMode ? [{ debugName: "completedIconTemplateRef" }] : []));
|
|
1303
|
+
// Inputs
|
|
1304
|
+
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1305
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
1306
|
+
description = input(...(ngDevMode ? [undefined, { debugName: "description" }] : []));
|
|
1307
|
+
color = input(this._config.step.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
1308
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
1309
|
+
_active = computed(() => this._stepperService.active?.() === this.value(), ...(ngDevMode ? [{ debugName: "_active" }] : []));
|
|
1310
|
+
hostClasses = computed(() => {
|
|
1311
|
+
const className = 'tls-step';
|
|
1312
|
+
const array = [className];
|
|
1313
|
+
if (this._active())
|
|
1314
|
+
array.push(`${className}--active`);
|
|
1315
|
+
if (this.disabled())
|
|
1316
|
+
array.push(`${className}--disabled`);
|
|
1317
|
+
return array;
|
|
1318
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1319
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Step, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1320
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: Step, isStandalone: true, selector: "tls-step", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "iconTemplateRef", first: true, predicate: ["stepIcon"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
1321
|
+
}
|
|
1322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Step, decorators: [{
|
|
1323
|
+
type: Component,
|
|
1324
|
+
args: [{ selector: 'tls-step', imports: [], host: {
|
|
1325
|
+
'[class]': 'hostClasses()',
|
|
1326
|
+
}, template: "<ng-content></ng-content>\n" }]
|
|
1327
|
+
}], propDecorators: { iconTemplateRef: [{ type: i0.ContentChild, args: ['stepIcon', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
1328
|
+
|
|
1329
|
+
class Stepper {
|
|
1330
|
+
static _counter = 0;
|
|
1331
|
+
panelId = `tls-stepper-panel-${++Stepper._counter}`;
|
|
1332
|
+
_config = inject(STEPPER_CONFIG);
|
|
1333
|
+
_stepperService = inject(StepperService);
|
|
1334
|
+
steps = contentChildren(Step, ...(ngDevMode ? [{ debugName: "steps" }] : []));
|
|
1335
|
+
completedTemplateRef = contentChild('completedTemplate', ...(ngDevMode ? [{ debugName: "completedTemplateRef" }] : []));
|
|
1336
|
+
completedIconTemplateRef = contentChild('stepCompletedIcon', ...(ngDevMode ? [{ debugName: "completedIconTemplateRef" }] : []));
|
|
1337
|
+
_stepButtons = viewChildren('stepButton', ...(ngDevMode ? [{ debugName: "_stepButtons" }] : []));
|
|
1338
|
+
active = model.required(...(ngDevMode ? [{ debugName: "active" }] : []));
|
|
1339
|
+
orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
|
|
1340
|
+
completed = input(false, ...(ngDevMode ? [{ debugName: "completed" }] : []));
|
|
1341
|
+
linear = input(this._config.linear, ...(ngDevMode ? [{ debugName: "linear" }] : []));
|
|
1342
|
+
stepSelect = output();
|
|
1343
|
+
hostClasses = computed(() => {
|
|
1344
|
+
const className = 'tls-stepper';
|
|
1345
|
+
const array = [className];
|
|
1346
|
+
array.push(`${className}--${this.orientation()}`);
|
|
1347
|
+
if (this.completed())
|
|
1348
|
+
array.push(`${className}--completed`);
|
|
1349
|
+
return array;
|
|
1350
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1351
|
+
activeIndex = computed(() => this.steps().findIndex(step => step.value() === this.active()), ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
1352
|
+
constructor() {
|
|
1353
|
+
this._stepperService.active = this.active.asReadonly();
|
|
1354
|
+
}
|
|
1355
|
+
// Protected methods
|
|
1356
|
+
onSelect(step, index) {
|
|
1357
|
+
if (step.disabled())
|
|
1358
|
+
return;
|
|
1359
|
+
if (this.linear() && index > this.activeIndex() + 1)
|
|
1360
|
+
return;
|
|
1361
|
+
this.active.set(step.value());
|
|
1362
|
+
const eventData = {
|
|
1363
|
+
index: index,
|
|
1364
|
+
value: step.value(),
|
|
1365
|
+
};
|
|
1366
|
+
this.stepSelect.emit(eventData);
|
|
1367
|
+
}
|
|
1368
|
+
onKeydown(event, index) {
|
|
1369
|
+
const orientation = this.orientation();
|
|
1370
|
+
const keyNext = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
|
1371
|
+
const keyPrev = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
|
1372
|
+
let target = null;
|
|
1373
|
+
switch (event.key) {
|
|
1374
|
+
case keyNext:
|
|
1375
|
+
target = this._nextFocusable(index, 1);
|
|
1376
|
+
break;
|
|
1377
|
+
case keyPrev:
|
|
1378
|
+
target = this._nextFocusable(index, -1);
|
|
1379
|
+
break;
|
|
1380
|
+
case 'Home':
|
|
1381
|
+
target = this._nextFocusable(-1, 1);
|
|
1382
|
+
break;
|
|
1383
|
+
case 'End':
|
|
1384
|
+
target = this._nextFocusable(this.steps().length, -1);
|
|
1385
|
+
break;
|
|
1386
|
+
default:
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
event.preventDefault();
|
|
1390
|
+
if (target === null)
|
|
1391
|
+
return;
|
|
1392
|
+
this._stepButtons()[target]?.nativeElement.focus();
|
|
1393
|
+
this.onSelect(this.steps()[target], target);
|
|
1394
|
+
}
|
|
1395
|
+
// Private methods
|
|
1396
|
+
_nextFocusable(from, direction) {
|
|
1397
|
+
const steps = this.steps();
|
|
1398
|
+
for (let i = from + direction; i >= 0 && i < steps.length; i += direction) {
|
|
1399
|
+
if (!steps[i].disabled() && !(this.linear() && i > this.activeIndex() + 1))
|
|
1400
|
+
return i;
|
|
1401
|
+
}
|
|
1402
|
+
return null;
|
|
1403
|
+
}
|
|
1404
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Stepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1405
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Stepper, isStandalone: true, selector: "tls-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", stepSelect: "stepSelect" }, host: { properties: { "class": "hostClasses()" } }, providers: [StepperService], queries: [{ propertyName: "steps", predicate: Step, isSignal: true }, { propertyName: "completedTemplateRef", first: true, predicate: ["completedTemplate"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_stepButtons", predicate: ["stepButton"], descendants: true, isSignal: true }], ngImport: i0, template: "<ul class=\"tls-stepper-header\" role=\"tablist\" [attr.aria-orientation]=\"orientation()\">\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-header--${step.color()}`\"\n [class.tls-stepper-header__item--active]=\"step.value() === active()\"\n [class.tls-stepper-header__item--disabled]=\"step.disabled()\"\n [class.tls-stepper-header__item--unreachable]=\"linear() && index > activeIndex() + 1\"\n [class.tls-stepper-header__item--completed]=\"activeIndex() > index || completed()\">\n @let id = 'tls-stepper-tab-' + step.value();\n <button\n #stepButton\n class=\"tls-stepper-header-button\"\n role=\"tab\"\n type=\"button\"\n [attr.aria-controls]=\"panelId\"\n [id]=\"id\"\n [tabindex]=\"step.value() === active() ? 0 : -1\"\n [disabled]=\"step.disabled()\"\n [attr.aria-selected]=\"step.value() === active()\"\n (click)=\"onSelect(step, index)\"\n (keydown)=\"onKeydown($event, index)\"\n >\n <span class=\"tls-stepper-header-button__index\">\n @let isCompleted = activeIndex() > index || completed();\n @if (isCompleted && step.completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (isCompleted && completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (step.iconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.iconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else {\n {{ index + 1 }}\n }\n </span>\n\n <span class=\"tls-stepper-header-button__text\">\n @if (step.label()) {\n <span class=\"tls-stepper-header-button__label\">{{ step.label() }}</span>\n }\n @if (step.description()) {\n <span class=\"tls-stepper-header-button__description\">{{ step.description() }}</span>\n }\n </span>\n </button>\n @if (!last) {\n <div class=\"tls-stepper-header__divider\"></div>\n }\n </li>\n }\n</ul>\n<div class=\"tls-stepper-content\"\n [id]=\"panelId\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"'tls-stepper-tab-' + active()\">\n <ng-content></ng-content>\n @if (completed() && completedTemplateRef()) {\n <div class=\"tls-stepper-content__template\">\n <ng-container [ngTemplateOutlet]=\"completedTemplateRef()\"></ng-container>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1406
|
+
}
|
|
1407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Stepper, decorators: [{
|
|
1408
|
+
type: Component,
|
|
1409
|
+
args: [{ selector: 'tls-stepper', imports: [NgTemplateOutlet], host: {
|
|
1410
|
+
'[class]': 'hostClasses()',
|
|
1411
|
+
}, providers: [StepperService], template: "<ul class=\"tls-stepper-header\" role=\"tablist\" [attr.aria-orientation]=\"orientation()\">\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-header--${step.color()}`\"\n [class.tls-stepper-header__item--active]=\"step.value() === active()\"\n [class.tls-stepper-header__item--disabled]=\"step.disabled()\"\n [class.tls-stepper-header__item--unreachable]=\"linear() && index > activeIndex() + 1\"\n [class.tls-stepper-header__item--completed]=\"activeIndex() > index || completed()\">\n @let id = 'tls-stepper-tab-' + step.value();\n <button\n #stepButton\n class=\"tls-stepper-header-button\"\n role=\"tab\"\n type=\"button\"\n [attr.aria-controls]=\"panelId\"\n [id]=\"id\"\n [tabindex]=\"step.value() === active() ? 0 : -1\"\n [disabled]=\"step.disabled()\"\n [attr.aria-selected]=\"step.value() === active()\"\n (click)=\"onSelect(step, index)\"\n (keydown)=\"onKeydown($event, index)\"\n >\n <span class=\"tls-stepper-header-button__index\">\n @let isCompleted = activeIndex() > index || completed();\n @if (isCompleted && step.completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (isCompleted && completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (step.iconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.iconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else {\n {{ index + 1 }}\n }\n </span>\n\n <span class=\"tls-stepper-header-button__text\">\n @if (step.label()) {\n <span class=\"tls-stepper-header-button__label\">{{ step.label() }}</span>\n }\n @if (step.description()) {\n <span class=\"tls-stepper-header-button__description\">{{ step.description() }}</span>\n }\n </span>\n </button>\n @if (!last) {\n <div class=\"tls-stepper-header__divider\"></div>\n }\n </li>\n }\n</ul>\n<div class=\"tls-stepper-content\"\n [id]=\"panelId\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"'tls-stepper-tab-' + active()\">\n <ng-content></ng-content>\n @if (completed() && completedTemplateRef()) {\n <div class=\"tls-stepper-content__template\">\n <ng-container [ngTemplateOutlet]=\"completedTemplateRef()\"></ng-container>\n </div>\n }\n</div>\n" }]
|
|
1412
|
+
}], ctorParameters: () => [], propDecorators: { steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Step), { isSignal: true }] }], completedTemplateRef: [{ type: i0.ContentChild, args: ['completedTemplate', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], _stepButtons: [{ type: i0.ViewChildren, args: ['stepButton', { isSignal: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }, { type: i0.Output, args: ["activeChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], completed: [{ type: i0.Input, args: [{ isSignal: true, alias: "completed", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], stepSelect: [{ type: i0.Output, args: ["stepSelect"] }] } });
|
|
1413
|
+
|
|
674
1414
|
class TabsService {
|
|
675
1415
|
selected = null;
|
|
676
1416
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TabsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -722,7 +1462,7 @@ const TABS_CONFIG = new InjectionToken('TABS_CONFIG', {
|
|
|
722
1462
|
class Tabs {
|
|
723
1463
|
_config = inject(TABS_CONFIG);
|
|
724
1464
|
_tabsService = inject(TabsService);
|
|
725
|
-
|
|
1465
|
+
tabs = contentChildren(Tab, ...(ngDevMode ? [{ debugName: "tabs" }] : []));
|
|
726
1466
|
variant = input(this._config.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
727
1467
|
selected = model(null, ...(ngDevMode ? [{ debugName: "selected" }] : []));
|
|
728
1468
|
hostClasses = computed(() => {
|
|
@@ -734,141 +1474,344 @@ class Tabs {
|
|
|
734
1474
|
constructor() {
|
|
735
1475
|
this._tabsService.selected = this.selected.asReadonly();
|
|
736
1476
|
}
|
|
737
|
-
// Accessors
|
|
738
|
-
get tabs() {
|
|
739
|
-
return this._allTabs;
|
|
740
|
-
}
|
|
741
1477
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tabs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
742
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Tabs, isStandalone: true, selector: "tls-tabs", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [TabsService], queries: [{ propertyName: "
|
|
1478
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Tabs, isStandalone: true, selector: "tls-tabs", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [TabsService], queries: [{ propertyName: "tabs", predicate: Tab, isSignal: true }], ngImport: i0, template: "<ul class=\"tls-tabs-header\">\n @for (tab of tabs(); track tab) {\n <li\n class=\"tls-tabs-header__item\"\n [class.tls-tabs-header__item--active]=\"tab.value() === selected()\"\n >\n <button\n class=\"tls-tabs-header__item-button\"\n role=\"tab\"\n (click)=\"selected.set(tab.value())\"\n [attr.aria-selected]=\"tab.value() === selected()\"\n >\n {{ tab.label() }}\n </button>\n </li>\n }\n</ul>\n<div class=\"tls-tabs-content\">\n <ng-content></ng-content>\n</div>\n" });
|
|
743
1479
|
}
|
|
744
1480
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tabs, decorators: [{
|
|
745
1481
|
type: Component,
|
|
746
1482
|
args: [{ selector: 'tls-tabs', imports: [], host: {
|
|
747
1483
|
'[class]': 'hostClasses()',
|
|
748
1484
|
}, providers: [TabsService], template: "<ul class=\"tls-tabs-header\">\n @for (tab of tabs(); track tab) {\n <li\n class=\"tls-tabs-header__item\"\n [class.tls-tabs-header__item--active]=\"tab.value() === selected()\"\n >\n <button\n class=\"tls-tabs-header__item-button\"\n role=\"tab\"\n (click)=\"selected.set(tab.value())\"\n [attr.aria-selected]=\"tab.value() === selected()\"\n >\n {{ tab.label() }}\n </button>\n </li>\n }\n</ul>\n<div class=\"tls-tabs-content\">\n <ng-content></ng-content>\n</div>\n" }]
|
|
749
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
1485
|
+
}], ctorParameters: () => [], propDecorators: { tabs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Tab), { isSignal: true }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }] } });
|
|
750
1486
|
|
|
751
|
-
|
|
752
|
-
|
|
1487
|
+
class Tooltip {
|
|
1488
|
+
static _counter = 0;
|
|
1489
|
+
id = `tls-tooltip-${++Tooltip._counter}`;
|
|
1490
|
+
content = model.required(...(ngDevMode ? [{ debugName: "content" }] : []));
|
|
1491
|
+
templateData = model(null, ...(ngDevMode ? [{ debugName: "templateData" }] : []));
|
|
1492
|
+
color = model.required(...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
1493
|
+
isString = computed(() => typeof this.content() === 'string', ...(ngDevMode ? [{ debugName: "isString" }] : []));
|
|
1494
|
+
templateRef = computed(() => {
|
|
1495
|
+
if (this.isString())
|
|
1496
|
+
return null;
|
|
1497
|
+
return this.content();
|
|
1498
|
+
}, ...(ngDevMode ? [{ debugName: "templateRef" }] : []));
|
|
1499
|
+
hostClasses = computed(() => {
|
|
1500
|
+
const className = 'tls-tooltip';
|
|
1501
|
+
const array = [className];
|
|
1502
|
+
array.push(`${className}--${this.color()}`);
|
|
1503
|
+
return array;
|
|
1504
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1505
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tooltip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1506
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Tooltip, isStandalone: true, selector: "tls-tooltip", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, templateData: { classPropertyName: "templateData", publicName: "templateData", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { content: "contentChange", templateData: "templateDataChange", color: "colorChange" }, host: { attributes: { "role": "tooltip" }, properties: { "class": "hostClasses()", "id": "id" } }, ngImport: i0, template: `
|
|
1507
|
+
@if (isString()) {
|
|
1508
|
+
{{ content() }}
|
|
1509
|
+
} @else {
|
|
1510
|
+
<ng-container
|
|
1511
|
+
[ngTemplateOutlet]="templateRef()"
|
|
1512
|
+
[ngTemplateOutletContext]="{ $implicit: templateData() }"
|
|
1513
|
+
></ng-container>
|
|
1514
|
+
}
|
|
1515
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1516
|
+
}
|
|
1517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tooltip, decorators: [{
|
|
1518
|
+
type: Component,
|
|
1519
|
+
args: [{
|
|
1520
|
+
selector: 'tls-tooltip',
|
|
1521
|
+
template: `
|
|
1522
|
+
@if (isString()) {
|
|
1523
|
+
{{ content() }}
|
|
1524
|
+
} @else {
|
|
1525
|
+
<ng-container
|
|
1526
|
+
[ngTemplateOutlet]="templateRef()"
|
|
1527
|
+
[ngTemplateOutletContext]="{ $implicit: templateData() }"
|
|
1528
|
+
></ng-container>
|
|
1529
|
+
}
|
|
1530
|
+
`,
|
|
1531
|
+
imports: [NgTemplateOutlet],
|
|
1532
|
+
host: {
|
|
1533
|
+
'[class]': 'hostClasses()',
|
|
1534
|
+
'role': 'tooltip',
|
|
1535
|
+
'[id]': 'id',
|
|
1536
|
+
},
|
|
1537
|
+
}]
|
|
1538
|
+
}], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }, { type: i0.Output, args: ["contentChange"] }], templateData: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateData", required: false }] }, { type: i0.Output, args: ["templateDataChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }, { type: i0.Output, args: ["colorChange"] }] } });
|
|
1539
|
+
|
|
1540
|
+
class TooltipService {
|
|
1541
|
+
_overlay = inject(Overlay);
|
|
1542
|
+
_overlayRef = null;
|
|
1543
|
+
// Public methods
|
|
1544
|
+
show(origin, positions, tooltipPortal) {
|
|
1545
|
+
this.dispose();
|
|
1546
|
+
const positionStrategy = this._overlay
|
|
1547
|
+
.position()
|
|
1548
|
+
.flexibleConnectedTo(origin)
|
|
1549
|
+
.withPositions(positions);
|
|
1550
|
+
this._overlayRef = this._overlay.create({
|
|
1551
|
+
positionStrategy,
|
|
1552
|
+
scrollStrategy: this._overlay.scrollStrategies.reposition(),
|
|
1553
|
+
});
|
|
1554
|
+
return this._overlayRef.attach(tooltipPortal);
|
|
1555
|
+
}
|
|
1556
|
+
move(origin, positions) {
|
|
1557
|
+
if (this._overlayRef) {
|
|
1558
|
+
const positionStrategy = this._overlay
|
|
1559
|
+
.position()
|
|
1560
|
+
.flexibleConnectedTo(origin)
|
|
1561
|
+
.withPositions(positions);
|
|
1562
|
+
this._overlayRef.updatePositionStrategy(positionStrategy);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
dispose() {
|
|
1566
|
+
if (!this._overlayRef)
|
|
1567
|
+
return;
|
|
1568
|
+
this._overlayRef.dispose();
|
|
1569
|
+
this._overlayRef = null;
|
|
1570
|
+
}
|
|
1571
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1572
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipService });
|
|
1573
|
+
}
|
|
1574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipService, decorators: [{
|
|
1575
|
+
type: Injectable
|
|
1576
|
+
}] });
|
|
753
1577
|
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
|
|
1578
|
+
const DEFAULT_TOOLTIP_OFFSET = { x: 4, y: 4 };
|
|
1579
|
+
const TOOLTIP_POSITION_MAP = {
|
|
1580
|
+
top: {
|
|
1581
|
+
originX: 'center',
|
|
1582
|
+
originY: 'top',
|
|
1583
|
+
overlayX: 'center',
|
|
1584
|
+
overlayY: 'bottom',
|
|
1585
|
+
offsetX: 0,
|
|
1586
|
+
offsetY: -1,
|
|
1587
|
+
},
|
|
1588
|
+
right: {
|
|
1589
|
+
originX: 'end',
|
|
1590
|
+
originY: 'center',
|
|
1591
|
+
overlayX: 'start',
|
|
1592
|
+
overlayY: 'center',
|
|
1593
|
+
offsetX: 1,
|
|
1594
|
+
offsetY: 0,
|
|
1595
|
+
},
|
|
1596
|
+
bottom: {
|
|
1597
|
+
originX: 'center',
|
|
1598
|
+
originY: 'bottom',
|
|
1599
|
+
overlayX: 'center',
|
|
1600
|
+
overlayY: 'top',
|
|
1601
|
+
offsetX: 1,
|
|
1602
|
+
offsetY: 1,
|
|
1603
|
+
},
|
|
1604
|
+
left: {
|
|
1605
|
+
originX: 'start',
|
|
1606
|
+
originY: 'center',
|
|
1607
|
+
overlayX: 'end',
|
|
1608
|
+
overlayY: 'center',
|
|
1609
|
+
offsetX: -1,
|
|
1610
|
+
offsetY: 0,
|
|
1611
|
+
},
|
|
1612
|
+
'top-start': {
|
|
1613
|
+
originX: 'start',
|
|
1614
|
+
originY: 'top',
|
|
1615
|
+
overlayX: 'start',
|
|
1616
|
+
overlayY: 'bottom',
|
|
1617
|
+
offsetX: 0,
|
|
1618
|
+
offsetY: -1,
|
|
1619
|
+
},
|
|
1620
|
+
'top-end': {
|
|
1621
|
+
originX: 'end',
|
|
1622
|
+
originY: 'top',
|
|
1623
|
+
overlayX: 'end',
|
|
1624
|
+
overlayY: 'bottom',
|
|
1625
|
+
offsetX: 0,
|
|
1626
|
+
offsetY: -1,
|
|
1627
|
+
},
|
|
1628
|
+
'right-start': {
|
|
1629
|
+
originX: 'end',
|
|
1630
|
+
originY: 'top',
|
|
1631
|
+
overlayX: 'start',
|
|
1632
|
+
overlayY: 'top',
|
|
1633
|
+
offsetX: 1,
|
|
1634
|
+
offsetY: 0,
|
|
1635
|
+
},
|
|
1636
|
+
'right-end': {
|
|
1637
|
+
originX: 'end',
|
|
1638
|
+
originY: 'bottom',
|
|
1639
|
+
overlayX: 'start',
|
|
1640
|
+
overlayY: 'bottom',
|
|
1641
|
+
offsetX: 1,
|
|
1642
|
+
offsetY: 0,
|
|
1643
|
+
},
|
|
1644
|
+
'bottom-start': {
|
|
1645
|
+
originX: 'start',
|
|
1646
|
+
originY: 'bottom',
|
|
1647
|
+
overlayX: 'start',
|
|
1648
|
+
overlayY: 'top',
|
|
1649
|
+
offsetX: 0,
|
|
1650
|
+
offsetY: 1,
|
|
1651
|
+
},
|
|
1652
|
+
'bottom-end': {
|
|
1653
|
+
originX: 'end',
|
|
1654
|
+
originY: 'bottom',
|
|
1655
|
+
overlayX: 'end',
|
|
1656
|
+
overlayY: 'top',
|
|
1657
|
+
offsetX: 0,
|
|
1658
|
+
offsetY: 1,
|
|
1659
|
+
},
|
|
1660
|
+
'left-start': {
|
|
1661
|
+
originX: 'start',
|
|
1662
|
+
originY: 'top',
|
|
1663
|
+
overlayX: 'end',
|
|
1664
|
+
overlayY: 'top',
|
|
1665
|
+
offsetX: -1,
|
|
1666
|
+
offsetY: 0,
|
|
1667
|
+
},
|
|
1668
|
+
'left-end': {
|
|
1669
|
+
originX: 'start',
|
|
1670
|
+
originY: 'bottom',
|
|
1671
|
+
overlayX: 'end',
|
|
1672
|
+
overlayY: 'bottom',
|
|
1673
|
+
offsetX: -1,
|
|
1674
|
+
offsetY: 0,
|
|
1675
|
+
},
|
|
1676
|
+
'top-left': {
|
|
1677
|
+
originX: 'start',
|
|
1678
|
+
originY: 'top',
|
|
1679
|
+
overlayX: 'end',
|
|
1680
|
+
overlayY: 'bottom',
|
|
1681
|
+
offsetX: -1,
|
|
1682
|
+
offsetY: -1,
|
|
1683
|
+
},
|
|
1684
|
+
'top-right': {
|
|
1685
|
+
originX: 'end',
|
|
1686
|
+
originY: 'top',
|
|
1687
|
+
overlayX: 'start',
|
|
1688
|
+
overlayY: 'bottom',
|
|
1689
|
+
offsetX: 1,
|
|
1690
|
+
offsetY: -1,
|
|
1691
|
+
},
|
|
1692
|
+
'bottom-left': {
|
|
1693
|
+
originX: 'start',
|
|
1694
|
+
originY: 'bottom',
|
|
1695
|
+
overlayX: 'end',
|
|
1696
|
+
overlayY: 'top',
|
|
1697
|
+
offsetX: -1,
|
|
1698
|
+
offsetY: 1,
|
|
1699
|
+
},
|
|
1700
|
+
'bottom-right': {
|
|
1701
|
+
originX: 'end',
|
|
1702
|
+
originY: 'bottom',
|
|
1703
|
+
overlayX: 'start',
|
|
1704
|
+
overlayY: 'top',
|
|
1705
|
+
offsetX: 1,
|
|
1706
|
+
offsetY: 1,
|
|
1707
|
+
},
|
|
757
1708
|
};
|
|
758
1709
|
|
|
759
|
-
const
|
|
760
|
-
|
|
1710
|
+
const DEFAULT_TOOLTIP_CONFIG = {
|
|
1711
|
+
positions: undefined,
|
|
1712
|
+
position: 'top',
|
|
1713
|
+
offset: DEFAULT_TOOLTIP_OFFSET,
|
|
1714
|
+
origin: 'element',
|
|
1715
|
+
color: 'secondary',
|
|
1716
|
+
};
|
|
1717
|
+
|
|
1718
|
+
const TOOLTIP_CONFIG = new InjectionToken('TOOLTIP_CONFIG', {
|
|
1719
|
+
factory: () => DEFAULT_TOOLTIP_CONFIG,
|
|
761
1720
|
});
|
|
762
1721
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
return this._currentThemePreference.asReadonly();
|
|
1722
|
+
const buildTooltipPositions = (position, offset) => {
|
|
1723
|
+
const preferred = TOOLTIP_POSITION_MAP[position];
|
|
1724
|
+
const rest = Object.values(TOOLTIP_POSITION_MAP).filter(p => p !== preferred);
|
|
1725
|
+
const positions = [preferred, ...rest];
|
|
1726
|
+
return positions.map(position => ({
|
|
1727
|
+
...position,
|
|
1728
|
+
offsetX: Math.sign(position.offsetX ?? 0) * offset.x,
|
|
1729
|
+
offsetY: Math.sign(position.offsetY ?? 0) * offset.y,
|
|
1730
|
+
}));
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
class TooltipDirective {
|
|
1734
|
+
_tooltipService = inject(TooltipService);
|
|
1735
|
+
_elementRef = inject(ElementRef);
|
|
1736
|
+
_renderer = inject(Renderer2);
|
|
1737
|
+
_config = inject(TOOLTIP_CONFIG);
|
|
1738
|
+
content = input('Hello', { ...(ngDevMode ? { debugName: "content" } : {}), alias: 'tlsTooltip' });
|
|
1739
|
+
data = input(null, ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
1740
|
+
tooltipDisabled = input(false, ...(ngDevMode ? [{ debugName: "tooltipDisabled" }] : []));
|
|
1741
|
+
tooltipOrigin = input(this._config.origin, ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : []));
|
|
1742
|
+
tooltipPositions = input(this._config.positions, ...(ngDevMode ? [{ debugName: "tooltipPositions" }] : []));
|
|
1743
|
+
tooltipPosition = input(this._config.position, ...(ngDevMode ? [{ debugName: "tooltipPosition" }] : []));
|
|
1744
|
+
tooltipOffset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "tooltipOffset" }] : []));
|
|
1745
|
+
tooltipColor = input(this._config.color, ...(ngDevMode ? [{ debugName: "tooltipColor" }] : []));
|
|
1746
|
+
_visible = signal(false, ...(ngDevMode ? [{ debugName: "_visible" }] : []));
|
|
1747
|
+
_positions = computed(() => {
|
|
1748
|
+
const positions = this.tooltipPositions();
|
|
1749
|
+
if (positions)
|
|
1750
|
+
return positions;
|
|
1751
|
+
return buildTooltipPositions(this.tooltipPosition(), this.tooltipOffset());
|
|
1752
|
+
}, ...(ngDevMode ? [{ debugName: "_positions" }] : []));
|
|
1753
|
+
// Protected methods
|
|
1754
|
+
onMouseEnter(event) {
|
|
1755
|
+
this._show(event);
|
|
798
1756
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
* Does not toggle to `'system'`.
|
|
803
|
-
*/
|
|
804
|
-
toggle() {
|
|
805
|
-
this.setTheme(this._currentTheme() === 'light' ? 'dark' : 'light');
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
* Sets the theme preference and applies the corresponding theme to the document.
|
|
809
|
-
* When `'system'` is passed, the theme is resolved from the OS color scheme preference.
|
|
810
|
-
*
|
|
811
|
-
* @param preference - The desired theme preference: `'light'`, `'dark'`, or `'system'`.
|
|
812
|
-
*/
|
|
813
|
-
setTheme(preference) {
|
|
814
|
-
this._currentThemePreference.set(preference);
|
|
815
|
-
if (preference === 'system') {
|
|
816
|
-
this._applyTheme(this._detectSystemTheme());
|
|
817
|
-
}
|
|
818
|
-
else {
|
|
819
|
-
this._applyTheme(preference);
|
|
1757
|
+
onMouseMove(event) {
|
|
1758
|
+
if (this.tooltipOrigin() === 'cursor') {
|
|
1759
|
+
this._tooltipService.move({ x: event.clientX, y: event.clientY }, this._positions());
|
|
820
1760
|
}
|
|
821
1761
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const documentElement = this._document.documentElement;
|
|
830
|
-
if (theme === 'dark') {
|
|
831
|
-
this._renderer.removeClass(documentElement, LIGHT_THEME_CLASS);
|
|
832
|
-
this._renderer.addClass(documentElement, DARK_THEME_CLASS);
|
|
833
|
-
this._currentTheme.set('dark');
|
|
1762
|
+
onMouseLeave() {
|
|
1763
|
+
this._tooltipService.dispose();
|
|
1764
|
+
}
|
|
1765
|
+
onTouchStart(event) {
|
|
1766
|
+
event.preventDefault();
|
|
1767
|
+
if (this._visible()) {
|
|
1768
|
+
this._hide();
|
|
834
1769
|
}
|
|
835
1770
|
else {
|
|
836
|
-
this.
|
|
837
|
-
this._renderer.addClass(documentElement, LIGHT_THEME_CLASS);
|
|
838
|
-
this._currentTheme.set('light');
|
|
1771
|
+
this._show(event.touches[0]);
|
|
839
1772
|
}
|
|
840
1773
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
* @returns `'dark'` if the OS prefers dark mode, otherwise `'light'`.
|
|
845
|
-
*/
|
|
846
|
-
_detectSystemTheme() {
|
|
847
|
-
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Initializes the theme on app startup (browser only).
|
|
851
|
-
* Reads the stored preference from localStorage, falling back to the configured default.
|
|
852
|
-
* Also registers a listener for OS color scheme changes to reactively update the theme
|
|
853
|
-
* when the preference is `'system'`.
|
|
854
|
-
*/
|
|
855
|
-
_initTheme() {
|
|
856
|
-
if (!this._isBrowser)
|
|
1774
|
+
// Private methods
|
|
1775
|
+
_show(event) {
|
|
1776
|
+
if (this.tooltipDisabled())
|
|
857
1777
|
return;
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1778
|
+
this._visible.set(true);
|
|
1779
|
+
const tooltipPortal = new ComponentPortal(Tooltip);
|
|
1780
|
+
const origin = this.tooltipOrigin() === 'cursor'
|
|
1781
|
+
? { x: event.clientX, y: event.clientY }
|
|
1782
|
+
: this._elementRef.nativeElement;
|
|
1783
|
+
const tooltipRef = this._tooltipService.show(origin, this._positions(), tooltipPortal);
|
|
1784
|
+
tooltipRef.instance.content.set(this.content());
|
|
1785
|
+
tooltipRef.instance.templateData.set(this.data());
|
|
1786
|
+
tooltipRef.instance.color.set(this.tooltipColor());
|
|
1787
|
+
this._renderer.setAttribute(this._elementRef.nativeElement, 'aria-describedby', tooltipRef.instance.id);
|
|
1788
|
+
}
|
|
1789
|
+
_hide() {
|
|
1790
|
+
this._tooltipService.dispose();
|
|
1791
|
+
this._visible.set(false);
|
|
1792
|
+
this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
|
|
1793
|
+
}
|
|
1794
|
+
// Lifecycle
|
|
1795
|
+
ngOnDestroy() {
|
|
1796
|
+
this._tooltipService.dispose();
|
|
1797
|
+
this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
|
|
865
1798
|
}
|
|
866
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type:
|
|
867
|
-
static
|
|
1799
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1800
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: TooltipDirective, isStandalone: true, selector: "[tlsTooltip]", inputs: { content: { classPropertyName: "content", publicName: "tlsTooltip", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipOrigin: { classPropertyName: "tooltipOrigin", publicName: "tooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, tooltipPositions: { classPropertyName: "tooltipPositions", publicName: "tooltipPositions", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipOffset: { classPropertyName: "tooltipOffset", publicName: "tooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, tooltipColor: { classPropertyName: "tooltipColor", publicName: "tooltipColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter($event)", "mousemove": "onMouseMove($event)", "mouseleave": "onMouseLeave()", "touchstart": "onTouchStart($event)" } }, providers: [TooltipService], ngImport: i0 });
|
|
868
1801
|
}
|
|
869
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type:
|
|
870
|
-
type:
|
|
871
|
-
|
|
1802
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipDirective, decorators: [{
|
|
1803
|
+
type: Directive,
|
|
1804
|
+
args: [{
|
|
1805
|
+
selector: '[tlsTooltip]',
|
|
1806
|
+
providers: [TooltipService],
|
|
1807
|
+
host: {
|
|
1808
|
+
'(mouseenter)': 'onMouseEnter($event)',
|
|
1809
|
+
'(mousemove)': 'onMouseMove($event)',
|
|
1810
|
+
'(mouseleave)': 'onMouseLeave()',
|
|
1811
|
+
'(touchstart)': 'onTouchStart($event)',
|
|
1812
|
+
},
|
|
1813
|
+
}]
|
|
1814
|
+
}], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsTooltip", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }], tooltipOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOrigin", required: false }] }], tooltipPositions: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPositions", required: false }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], tooltipOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOffset", required: false }] }], tooltipColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipColor", required: false }] }] } });
|
|
872
1815
|
|
|
873
1816
|
// Features
|
|
874
1817
|
|
|
@@ -888,6 +1831,15 @@ const mergeConfig = (defaults, overrides) => {
|
|
|
888
1831
|
return result;
|
|
889
1832
|
};
|
|
890
1833
|
|
|
1834
|
+
const provideThalassicChartConfig = (config) => {
|
|
1835
|
+
return makeEnvironmentProviders([
|
|
1836
|
+
{
|
|
1837
|
+
provide: CHART_CONFIG,
|
|
1838
|
+
useValue: mergeConfig(DEFAULT_CHART_CONFIG, config),
|
|
1839
|
+
},
|
|
1840
|
+
]);
|
|
1841
|
+
};
|
|
1842
|
+
|
|
891
1843
|
const provideThalassicUIConfig = (config) => {
|
|
892
1844
|
return makeEnvironmentProviders([
|
|
893
1845
|
// Components
|
|
@@ -917,15 +1869,19 @@ const provideThalassicUIConfig = (config) => {
|
|
|
917
1869
|
useValue: mergeConfig(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
|
|
918
1870
|
},
|
|
919
1871
|
{ provide: ICON_CONFIG, useValue: mergeConfig(DEFAULT_ICON_CONFIG, config.components.icon) },
|
|
1872
|
+
{
|
|
1873
|
+
provide: SKELETON_CONFIG,
|
|
1874
|
+
useValue: mergeConfig(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
provide: STEPPER_CONFIG,
|
|
1878
|
+
useValue: mergeConfig(DEFAULT_STEPPER_CONFIG, config.components.stepper),
|
|
1879
|
+
},
|
|
920
1880
|
{ provide: TABS_CONFIG, useValue: mergeConfig(DEFAULT_TABS_CONFIG, config.components.tabs) },
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
return makeEnvironmentProviders([
|
|
926
|
-
{ provide: THEME_CONFIG, useValue: { ...DEFAULT_THEME_CONFIG, ...config } },
|
|
927
|
-
ThemeService,
|
|
928
|
-
provideEnvironmentInitializer(() => inject(ThemeService)),
|
|
1881
|
+
{
|
|
1882
|
+
provide: TOOLTIP_CONFIG,
|
|
1883
|
+
useValue: mergeConfig(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
|
|
1884
|
+
},
|
|
929
1885
|
]);
|
|
930
1886
|
};
|
|
931
1887
|
|
|
@@ -933,5 +1889,5 @@ const provideTheme = (config) => {
|
|
|
933
1889
|
* Generated bundle index. Do not edit.
|
|
934
1890
|
*/
|
|
935
1891
|
|
|
936
|
-
export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, Checkbox, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABS_CONFIG, DIVIDER_CONFIG, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, PASSWORD_CONFIG, Password, RADIO_BUTTON_CONFIG, RadioButton, SWITCH_CONFIG, Switch, TABS_CONFIG, Tab, Tabs,
|
|
1892
|
+
export { ALERT_CONFIG, Alert, BUTTON_CONFIG, BarChart, BubbleChart, Button, ButtonDirective, CHART_CONFIG, CHECKBOX_CONFIG, Chart, Checkbox, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHART_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIVIDER_CONFIG, Divider, DoughnutChart, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, LineChart, Loader, PASSWORD_CONFIG, PIN_INPUT_CONFIG, Password, PieChart, PinInput, PolarAreaChart, RADIO_BUTTON_CONFIG, RadarChart, RadioButton, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, ScatterChart, Skeleton, Step, Stepper, Switch, TABS_CONFIG, TOOLTIP_CONFIG, Tab, Tabs, TooltipDirective, provideThalassicChartConfig, provideThalassicUIConfig };
|
|
937
1893
|
//# sourceMappingURL=thalassic-ui.mjs.map
|