@thalassic/ui 0.7.0 → 0.8.2
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-charts.mjs +340 -0
- package/fesm2022/thalassic-ui-charts.mjs.map +1 -0
- package/fesm2022/thalassic-ui.mjs +1070 -515
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +6 -1
- package/types/thalassic-ui-charts.d.ts +102 -0
- package/types/thalassic-ui.d.ts +273 -102
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive,
|
|
2
|
+
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, Injectable, model, contentChild, ViewContainerRef, DestroyRef, viewChild, signal, output, effect, forwardRef, viewChildren, contentChildren, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { RouterLink } from '@angular/router';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
|
|
6
|
+
import { CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
|
|
7
|
+
import { format, startOfMonth, endOfMonth, eachDayOfInterval, endOfWeek, startOfWeek, subMonths, addMonths, isSameDay, isSameMonth, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, startOfDay, setHours, setMinutes, setYear } from 'date-fns';
|
|
8
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
9
|
+
import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
|
|
8
10
|
import { HttpClient } from '@angular/common/http';
|
|
9
11
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
10
12
|
import { throwError, map, shareReplay } from 'rxjs';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
+
import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
14
|
+
import { deepMerge } from '@thalassic/core';
|
|
13
15
|
|
|
14
16
|
const DEFAULT_ALERT_CONFIG = {
|
|
15
17
|
color: 'primary',
|
|
@@ -151,324 +153,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
151
153
|
}]
|
|
152
154
|
}] });
|
|
153
155
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
},
|
|
156
|
+
const DEFAULT_DIALOG_CONFIG = {
|
|
157
|
+
size: 'md',
|
|
158
|
+
closeable: true,
|
|
159
|
+
backdropClose: true,
|
|
250
160
|
};
|
|
251
161
|
|
|
252
|
-
const
|
|
253
|
-
factory: () =>
|
|
162
|
+
const DIALOG_CONFIG = new InjectionToken('DIALOG_CONFIG', {
|
|
163
|
+
factory: () => DEFAULT_DIALOG_CONFIG,
|
|
254
164
|
});
|
|
255
165
|
|
|
256
|
-
class
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
}
|
|
166
|
+
class Dialog extends CdkDialogContainer {
|
|
167
|
+
_tlsConfig = inject(DIALOG_CONFIG);
|
|
168
|
+
_dialogRef = inject(DialogRef);
|
|
169
|
+
hostClasses = ['tls-dialog', `tls-dialog--${this._tlsConfig.size}`];
|
|
170
|
+
get config() {
|
|
171
|
+
return this._tlsConfig;
|
|
310
172
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
this._tryInitThemeListener();
|
|
173
|
+
close() {
|
|
174
|
+
this._dialogRef.close();
|
|
314
175
|
}
|
|
315
|
-
|
|
316
|
-
|
|
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"] });
|
|
176
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Dialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
177
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Dialog, isStandalone: true, selector: "tls-dialog", host: { properties: { "class": "hostClasses" } }, usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-dialog__close\" type=\"button\" aria-label=\"Close dialog\" (click)=\"close()\">\n <svg viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n", dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }] });
|
|
321
178
|
}
|
|
322
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type:
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Dialog, decorators: [{
|
|
323
180
|
type: Component,
|
|
324
|
-
args: [{ selector: 'tls-
|
|
325
|
-
|
|
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: () => [] });
|
|
181
|
+
args: [{ selector: 'tls-dialog', imports: [CdkPortalOutlet], host: { '[class]': 'hostClasses' }, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-dialog__close\" type=\"button\" aria-label=\"Close dialog\" (click)=\"close()\">\n <svg viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n" }]
|
|
182
|
+
}] });
|
|
436
183
|
|
|
437
|
-
class
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
184
|
+
class DialogService {
|
|
185
|
+
_dialog = inject(Dialog$1);
|
|
186
|
+
_config = inject(DIALOG_CONFIG);
|
|
187
|
+
open(component, config) {
|
|
188
|
+
const resolvedConfig = {
|
|
189
|
+
size: config?.size ?? this._config.size,
|
|
190
|
+
closeable: config?.closeable ?? this._config.closeable,
|
|
191
|
+
backdropClose: config?.backdropClose ?? this._config.backdropClose,
|
|
192
|
+
};
|
|
193
|
+
return this._dialog.open(component, {
|
|
194
|
+
container: {
|
|
195
|
+
type: Dialog,
|
|
196
|
+
providers: () => [{ provide: DIALOG_CONFIG, useValue: resolvedConfig }],
|
|
197
|
+
},
|
|
198
|
+
hasBackdrop: true,
|
|
199
|
+
backdropClass: 'tls-dialog-backdrop',
|
|
200
|
+
disableClose: !resolvedConfig.backdropClose,
|
|
201
|
+
role: config?.role ?? 'dialog',
|
|
202
|
+
ariaLabel: config?.ariaLabel ?? null,
|
|
203
|
+
ariaLabelledBy: config?.ariaLabelledBy ?? null,
|
|
204
|
+
ariaDescribedBy: config?.ariaDescribedBy ?? null,
|
|
205
|
+
data: config?.data,
|
|
206
|
+
});
|
|
442
207
|
}
|
|
443
|
-
|
|
444
|
-
|
|
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);
|
|
208
|
+
closeAll() {
|
|
209
|
+
this._dialog.closeAll();
|
|
460
210
|
}
|
|
461
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type:
|
|
462
|
-
static
|
|
211
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
212
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DialogService, providedIn: 'root' });
|
|
463
213
|
}
|
|
464
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type:
|
|
465
|
-
type:
|
|
466
|
-
args: [{
|
|
467
|
-
|
|
468
|
-
template: '',
|
|
469
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => ScatterChart) }],
|
|
470
|
-
}]
|
|
471
|
-
}], ctorParameters: () => [] });
|
|
214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DialogService, decorators: [{
|
|
215
|
+
type: Injectable,
|
|
216
|
+
args: [{ providedIn: 'root' }]
|
|
217
|
+
}] });
|
|
472
218
|
|
|
473
219
|
const DEFAULT_DIVIDER_CONFIG = {
|
|
474
220
|
orientation: 'horizontal',
|
|
@@ -702,6 +448,544 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
702
448
|
}, template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<div class=\"tls-checkbox-icon\">\n @if (indeterminate()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M288-444v-72h384v72H288Z\" />\n </svg>\n } @else {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M400-301 240-461l51-51 109 109 269-269 51 51-320 320Z\" />\n </svg>\n }\n</div>\n" }]
|
|
703
449
|
}], propDecorators: { indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
704
450
|
|
|
451
|
+
const OVERLAY_POSITION_MAP = {
|
|
452
|
+
top: {
|
|
453
|
+
originX: 'center',
|
|
454
|
+
originY: 'top',
|
|
455
|
+
overlayX: 'center',
|
|
456
|
+
overlayY: 'bottom',
|
|
457
|
+
offsetX: 0,
|
|
458
|
+
offsetY: -1,
|
|
459
|
+
},
|
|
460
|
+
right: {
|
|
461
|
+
originX: 'end',
|
|
462
|
+
originY: 'center',
|
|
463
|
+
overlayX: 'start',
|
|
464
|
+
overlayY: 'center',
|
|
465
|
+
offsetX: 1,
|
|
466
|
+
offsetY: 0,
|
|
467
|
+
},
|
|
468
|
+
bottom: {
|
|
469
|
+
originX: 'center',
|
|
470
|
+
originY: 'bottom',
|
|
471
|
+
overlayX: 'center',
|
|
472
|
+
overlayY: 'top',
|
|
473
|
+
offsetX: 1,
|
|
474
|
+
offsetY: 1,
|
|
475
|
+
},
|
|
476
|
+
left: {
|
|
477
|
+
originX: 'start',
|
|
478
|
+
originY: 'center',
|
|
479
|
+
overlayX: 'end',
|
|
480
|
+
overlayY: 'center',
|
|
481
|
+
offsetX: -1,
|
|
482
|
+
offsetY: 0,
|
|
483
|
+
},
|
|
484
|
+
'top-start': {
|
|
485
|
+
originX: 'start',
|
|
486
|
+
originY: 'top',
|
|
487
|
+
overlayX: 'start',
|
|
488
|
+
overlayY: 'bottom',
|
|
489
|
+
offsetX: 0,
|
|
490
|
+
offsetY: -1,
|
|
491
|
+
},
|
|
492
|
+
'top-end': {
|
|
493
|
+
originX: 'end',
|
|
494
|
+
originY: 'top',
|
|
495
|
+
overlayX: 'end',
|
|
496
|
+
overlayY: 'bottom',
|
|
497
|
+
offsetX: 0,
|
|
498
|
+
offsetY: -1,
|
|
499
|
+
},
|
|
500
|
+
'right-start': {
|
|
501
|
+
originX: 'end',
|
|
502
|
+
originY: 'top',
|
|
503
|
+
overlayX: 'start',
|
|
504
|
+
overlayY: 'top',
|
|
505
|
+
offsetX: 1,
|
|
506
|
+
offsetY: 0,
|
|
507
|
+
},
|
|
508
|
+
'right-end': {
|
|
509
|
+
originX: 'end',
|
|
510
|
+
originY: 'bottom',
|
|
511
|
+
overlayX: 'start',
|
|
512
|
+
overlayY: 'bottom',
|
|
513
|
+
offsetX: 1,
|
|
514
|
+
offsetY: 0,
|
|
515
|
+
},
|
|
516
|
+
'bottom-start': {
|
|
517
|
+
originX: 'start',
|
|
518
|
+
originY: 'bottom',
|
|
519
|
+
overlayX: 'start',
|
|
520
|
+
overlayY: 'top',
|
|
521
|
+
offsetX: 0,
|
|
522
|
+
offsetY: 1,
|
|
523
|
+
},
|
|
524
|
+
'bottom-end': {
|
|
525
|
+
originX: 'end',
|
|
526
|
+
originY: 'bottom',
|
|
527
|
+
overlayX: 'end',
|
|
528
|
+
overlayY: 'top',
|
|
529
|
+
offsetX: 0,
|
|
530
|
+
offsetY: 1,
|
|
531
|
+
},
|
|
532
|
+
'left-start': {
|
|
533
|
+
originX: 'start',
|
|
534
|
+
originY: 'top',
|
|
535
|
+
overlayX: 'end',
|
|
536
|
+
overlayY: 'top',
|
|
537
|
+
offsetX: -1,
|
|
538
|
+
offsetY: 0,
|
|
539
|
+
},
|
|
540
|
+
'left-end': {
|
|
541
|
+
originX: 'start',
|
|
542
|
+
originY: 'bottom',
|
|
543
|
+
overlayX: 'end',
|
|
544
|
+
overlayY: 'bottom',
|
|
545
|
+
offsetX: -1,
|
|
546
|
+
offsetY: 0,
|
|
547
|
+
},
|
|
548
|
+
'top-left': {
|
|
549
|
+
originX: 'start',
|
|
550
|
+
originY: 'top',
|
|
551
|
+
overlayX: 'end',
|
|
552
|
+
overlayY: 'bottom',
|
|
553
|
+
offsetX: -1,
|
|
554
|
+
offsetY: -1,
|
|
555
|
+
},
|
|
556
|
+
'top-right': {
|
|
557
|
+
originX: 'end',
|
|
558
|
+
originY: 'top',
|
|
559
|
+
overlayX: 'start',
|
|
560
|
+
overlayY: 'bottom',
|
|
561
|
+
offsetX: 1,
|
|
562
|
+
offsetY: -1,
|
|
563
|
+
},
|
|
564
|
+
'bottom-left': {
|
|
565
|
+
originX: 'start',
|
|
566
|
+
originY: 'bottom',
|
|
567
|
+
overlayX: 'end',
|
|
568
|
+
overlayY: 'top',
|
|
569
|
+
offsetX: -1,
|
|
570
|
+
offsetY: 1,
|
|
571
|
+
},
|
|
572
|
+
'bottom-right': {
|
|
573
|
+
originX: 'end',
|
|
574
|
+
originY: 'bottom',
|
|
575
|
+
overlayX: 'start',
|
|
576
|
+
overlayY: 'top',
|
|
577
|
+
offsetX: 1,
|
|
578
|
+
offsetY: 1,
|
|
579
|
+
},
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
const buildOverlayPositions = (position, offset) => {
|
|
583
|
+
const preferred = OVERLAY_POSITION_MAP[position];
|
|
584
|
+
const rest = Object.values(OVERLAY_POSITION_MAP).filter(p => p !== preferred);
|
|
585
|
+
const positions = [preferred, ...rest];
|
|
586
|
+
return positions.map(position => ({
|
|
587
|
+
...position,
|
|
588
|
+
offsetX: Math.sign(position.offsetX ?? 0) * offset.x,
|
|
589
|
+
offsetY: Math.sign(position.offsetY ?? 0) * offset.y,
|
|
590
|
+
}));
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
const DEFAULT_POPOVER_CONFIG = {
|
|
594
|
+
position: 'bottom',
|
|
595
|
+
offset: { x: 0, y: 4 },
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
const POPOVER_CONFIG = new InjectionToken('POPOVER_CONFIG', {
|
|
599
|
+
factory: () => DEFAULT_POPOVER_CONFIG,
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
class Popover {
|
|
603
|
+
static _counter = 0;
|
|
604
|
+
_overlay = inject(Overlay);
|
|
605
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
606
|
+
_config = inject(POPOVER_CONFIG);
|
|
607
|
+
_destroyRef = inject(DestroyRef);
|
|
608
|
+
_templateRef = viewChild.required('content');
|
|
609
|
+
_overlayRef = null;
|
|
610
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
611
|
+
id = `tls-popover-${++Popover._counter}`;
|
|
612
|
+
isOpen = this._isOpen.asReadonly();
|
|
613
|
+
position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
614
|
+
offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
|
|
615
|
+
ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
616
|
+
_positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
|
|
617
|
+
// Public methods
|
|
618
|
+
open(trigger) {
|
|
619
|
+
if (this._overlayRef)
|
|
620
|
+
return;
|
|
621
|
+
const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
|
|
622
|
+
const positionStrategy = this._overlay
|
|
623
|
+
.position()
|
|
624
|
+
.flexibleConnectedTo(origin)
|
|
625
|
+
.withPositions(this._positions());
|
|
626
|
+
this._overlayRef = this._overlay.create({
|
|
627
|
+
positionStrategy,
|
|
628
|
+
scrollStrategy: this._overlay.scrollStrategies.reposition(),
|
|
629
|
+
hasBackdrop: true,
|
|
630
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
631
|
+
});
|
|
632
|
+
this._overlayRef
|
|
633
|
+
.backdropClick()
|
|
634
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
635
|
+
.subscribe(() => this.close());
|
|
636
|
+
this._overlayRef.attach(new TemplatePortal(this._templateRef(), this._viewContainerRef));
|
|
637
|
+
this._isOpen.set(true);
|
|
638
|
+
}
|
|
639
|
+
close() {
|
|
640
|
+
if (!this._overlayRef)
|
|
641
|
+
return;
|
|
642
|
+
this._overlayRef.dispose();
|
|
643
|
+
this._overlayRef = null;
|
|
644
|
+
this._isOpen.set(false);
|
|
645
|
+
}
|
|
646
|
+
toggle(trigger) {
|
|
647
|
+
if (this._overlayRef) {
|
|
648
|
+
this.close();
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
this.open(trigger);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
// Lifecycle
|
|
655
|
+
ngOnDestroy() {
|
|
656
|
+
if (this._overlayRef)
|
|
657
|
+
this._overlayRef.dispose();
|
|
658
|
+
}
|
|
659
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Popover, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
660
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: Popover, isStandalone: true, selector: "tls-popover", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "_templateRef", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
661
|
+
<ng-template #content>
|
|
662
|
+
<div
|
|
663
|
+
class="tls-popover"
|
|
664
|
+
[id]="id"
|
|
665
|
+
role="dialog"
|
|
666
|
+
aria-modal="false"
|
|
667
|
+
[attr.aria-label]="ariaLabel() ?? null"
|
|
668
|
+
>
|
|
669
|
+
<ng-content></ng-content>
|
|
670
|
+
</div>
|
|
671
|
+
</ng-template>
|
|
672
|
+
`, isInline: true });
|
|
673
|
+
}
|
|
674
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Popover, decorators: [{
|
|
675
|
+
type: Component,
|
|
676
|
+
args: [{
|
|
677
|
+
selector: 'tls-popover',
|
|
678
|
+
template: `
|
|
679
|
+
<ng-template #content>
|
|
680
|
+
<div
|
|
681
|
+
class="tls-popover"
|
|
682
|
+
[id]="id"
|
|
683
|
+
role="dialog"
|
|
684
|
+
aria-modal="false"
|
|
685
|
+
[attr.aria-label]="ariaLabel() ?? null"
|
|
686
|
+
>
|
|
687
|
+
<ng-content></ng-content>
|
|
688
|
+
</div>
|
|
689
|
+
</ng-template>
|
|
690
|
+
`,
|
|
691
|
+
}]
|
|
692
|
+
}], propDecorators: { _templateRef: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
693
|
+
|
|
694
|
+
class Calendar {
|
|
695
|
+
// Inputs
|
|
696
|
+
viewDate = input.required(...(ngDevMode ? [{ debugName: "viewDate" }] : []));
|
|
697
|
+
selectedDate = input.required(...(ngDevMode ? [{ debugName: "selectedDate" }] : []));
|
|
698
|
+
weekStartsOn = input.required(...(ngDevMode ? [{ debugName: "weekStartsOn" }] : []));
|
|
699
|
+
weekDays = input.required(...(ngDevMode ? [{ debugName: "weekDays" }] : []));
|
|
700
|
+
// Outputs
|
|
701
|
+
daySelect = output();
|
|
702
|
+
viewDateChange = output();
|
|
703
|
+
navigateUp = output();
|
|
704
|
+
// Computed
|
|
705
|
+
displayedWeekDays = computed(() => {
|
|
706
|
+
const startDay = this.weekStartsOn();
|
|
707
|
+
const days = this.weekDays();
|
|
708
|
+
return [...days.slice(startDay), ...days.slice(0, startDay)];
|
|
709
|
+
}, ...(ngDevMode ? [{ debugName: "displayedWeekDays" }] : []));
|
|
710
|
+
headerLabel = computed(() => format(this.viewDate(), 'MMMM yyyy'), ...(ngDevMode ? [{ debugName: "headerLabel" }] : []));
|
|
711
|
+
days = computed(() => {
|
|
712
|
+
const monthStart = startOfMonth(this.viewDate());
|
|
713
|
+
const monthEnd = endOfMonth(this.viewDate());
|
|
714
|
+
const weekStartsOn = this.weekStartsOn();
|
|
715
|
+
return eachDayOfInterval({
|
|
716
|
+
start: startOfWeek(monthStart, { weekStartsOn }),
|
|
717
|
+
end: endOfWeek(monthEnd, { weekStartsOn }),
|
|
718
|
+
});
|
|
719
|
+
}, ...(ngDevMode ? [{ debugName: "days" }] : []));
|
|
720
|
+
// Protected methods
|
|
721
|
+
prevMonth() {
|
|
722
|
+
this.viewDateChange.emit(subMonths(this.viewDate(), 1));
|
|
723
|
+
}
|
|
724
|
+
nextMonth() {
|
|
725
|
+
this.viewDateChange.emit(addMonths(this.viewDate(), 1));
|
|
726
|
+
}
|
|
727
|
+
getDayLabel(day) {
|
|
728
|
+
return format(day, 'd');
|
|
729
|
+
}
|
|
730
|
+
isSelectedDay(day) {
|
|
731
|
+
const selected = this.selectedDate();
|
|
732
|
+
return selected !== null && isSameDay(day, selected);
|
|
733
|
+
}
|
|
734
|
+
isInCurrentMonth(day) {
|
|
735
|
+
return isSameMonth(day, this.viewDate());
|
|
736
|
+
}
|
|
737
|
+
isTodayDay(day) {
|
|
738
|
+
return isToday(day);
|
|
739
|
+
}
|
|
740
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Calendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
741
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Calendar, isStandalone: true, selector: "tls-calendar", inputs: { viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: true, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: true, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { daySelect: "daySelect", viewDateChange: "viewDateChange", navigateUp: "navigateUp" }, host: { classAttribute: "tls-calendar" }, ngImport: i0, template: "<div class=\"tls-calendar__header\">\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"prevMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-calendar__header-button\" (click)=\"navigateUp.emit()\">\n {{ headerLabel() }}\n </button>\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"nextMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<div class=\"tls-calendar__grid\">\n @for (day of displayedWeekDays(); track day) {\n <span class=\"tls-calendar__weekday\">{{ day }}</span>\n }\n @for (day of days(); track day.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar__day\"\n [class.tls-calendar__day--outside]=\"!isInCurrentMonth(day)\"\n [class.tls-calendar__day--today]=\"isTodayDay(day)\"\n [class.tls-calendar__day--selected]=\"isSelectedDay(day)\"\n (click)=\"daySelect.emit(day)\"\n >\n {{ getDayLabel(day) }}\n </button>\n }\n</div>\n" });
|
|
742
|
+
}
|
|
743
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Calendar, decorators: [{
|
|
744
|
+
type: Component,
|
|
745
|
+
args: [{ selector: 'tls-calendar', imports: [], host: { class: 'tls-calendar' }, template: "<div class=\"tls-calendar__header\">\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"prevMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-calendar__header-button\" (click)=\"navigateUp.emit()\">\n {{ headerLabel() }}\n </button>\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"nextMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<div class=\"tls-calendar__grid\">\n @for (day of displayedWeekDays(); track day) {\n <span class=\"tls-calendar__weekday\">{{ day }}</span>\n }\n @for (day of days(); track day.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar__day\"\n [class.tls-calendar__day--outside]=\"!isInCurrentMonth(day)\"\n [class.tls-calendar__day--today]=\"isTodayDay(day)\"\n [class.tls-calendar__day--selected]=\"isSelectedDay(day)\"\n (click)=\"daySelect.emit(day)\"\n >\n {{ getDayLabel(day) }}\n </button>\n }\n</div>\n" }]
|
|
746
|
+
}], propDecorators: { viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: true }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: true }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: true }] }], daySelect: [{ type: i0.Output, args: ["daySelect"] }], viewDateChange: [{ type: i0.Output, args: ["viewDateChange"] }], navigateUp: [{ type: i0.Output, args: ["navigateUp"] }] } });
|
|
747
|
+
|
|
748
|
+
const DEFAULT_DATE_TIME_PICKER_CONFIG = {
|
|
749
|
+
mode: 'calendar',
|
|
750
|
+
inline: false,
|
|
751
|
+
placeholder: '',
|
|
752
|
+
size: 'md',
|
|
753
|
+
yearsPerPage: 12,
|
|
754
|
+
weekStartsOn: 0,
|
|
755
|
+
weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
const DATE_TIME_PICKER_CONFIG = new InjectionToken('DATE_TIME_PICKER_CONFIG', { factory: () => DEFAULT_DATE_TIME_PICKER_CONFIG });
|
|
759
|
+
|
|
760
|
+
const MONTH_INDEXES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
761
|
+
class MonthPicker {
|
|
762
|
+
// Inputs
|
|
763
|
+
viewDate = input.required(...(ngDevMode ? [{ debugName: "viewDate" }] : []));
|
|
764
|
+
selectedDate = input.required(...(ngDevMode ? [{ debugName: "selectedDate" }] : []));
|
|
765
|
+
// Outputs
|
|
766
|
+
monthSelect = output();
|
|
767
|
+
viewDateChange = output();
|
|
768
|
+
navigateUp = output();
|
|
769
|
+
// Computed
|
|
770
|
+
months = MONTH_INDEXES;
|
|
771
|
+
yearLabel = computed(() => format(this.viewDate(), 'yyyy'), ...(ngDevMode ? [{ debugName: "yearLabel" }] : []));
|
|
772
|
+
// Protected methods
|
|
773
|
+
getMonthLabel(monthIndex) {
|
|
774
|
+
return format(setMonth(new Date(2000, 0, 1), monthIndex), 'MMM');
|
|
775
|
+
}
|
|
776
|
+
prevYear() {
|
|
777
|
+
this.viewDateChange.emit(subYears(this.viewDate(), 1));
|
|
778
|
+
}
|
|
779
|
+
nextYear() {
|
|
780
|
+
this.viewDateChange.emit(addYears(this.viewDate(), 1));
|
|
781
|
+
}
|
|
782
|
+
selectMonth(monthIndex) {
|
|
783
|
+
this.monthSelect.emit(setMonth(this.viewDate(), monthIndex));
|
|
784
|
+
}
|
|
785
|
+
isSelectedMonth(monthIndex) {
|
|
786
|
+
const selected = this.selectedDate();
|
|
787
|
+
return (selected !== null &&
|
|
788
|
+
getYear(selected) === getYear(this.viewDate()) &&
|
|
789
|
+
getMonth(selected) === monthIndex);
|
|
790
|
+
}
|
|
791
|
+
isCurrentMonth(monthIndex) {
|
|
792
|
+
return isSameMonth(new Date(), setMonth(this.viewDate(), monthIndex));
|
|
793
|
+
}
|
|
794
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MonthPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
795
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MonthPicker, isStandalone: true, selector: "tls-month-picker", inputs: { viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { monthSelect: "monthSelect", viewDateChange: "viewDateChange", navigateUp: "navigateUp" }, host: { classAttribute: "tls-month-picker" }, ngImport: i0, template: "<div class=\"tls-month-picker__header\">\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"prevYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-month-picker__header-button\" (click)=\"navigateUp.emit()\">\n {{ yearLabel() }}\n </button>\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"nextYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-month-picker__grid\">\n @for (month of months; track month) {\n <button\n type=\"button\"\n class=\"tls-month-picker__cell\"\n [class.tls-month-picker__cell--selected]=\"isSelectedMonth(month)\"\n [class.tls-month-picker__cell--current]=\"isCurrentMonth(month)\"\n (click)=\"selectMonth(month)\"\n >\n {{ getMonthLabel(month) }}\n </button>\n }\n</div>\n" });
|
|
796
|
+
}
|
|
797
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MonthPicker, decorators: [{
|
|
798
|
+
type: Component,
|
|
799
|
+
args: [{ selector: 'tls-month-picker', imports: [], host: { class: 'tls-month-picker' }, template: "<div class=\"tls-month-picker__header\">\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"prevYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-month-picker__header-button\" (click)=\"navigateUp.emit()\">\n {{ yearLabel() }}\n </button>\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"nextYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-month-picker__grid\">\n @for (month of months; track month) {\n <button\n type=\"button\"\n class=\"tls-month-picker__cell\"\n [class.tls-month-picker__cell--selected]=\"isSelectedMonth(month)\"\n [class.tls-month-picker__cell--current]=\"isCurrentMonth(month)\"\n (click)=\"selectMonth(month)\"\n >\n {{ getMonthLabel(month) }}\n </button>\n }\n</div>\n" }]
|
|
800
|
+
}], propDecorators: { viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: true }] }], monthSelect: [{ type: i0.Output, args: ["monthSelect"] }], viewDateChange: [{ type: i0.Output, args: ["viewDateChange"] }], navigateUp: [{ type: i0.Output, args: ["navigateUp"] }] } });
|
|
801
|
+
|
|
802
|
+
class TimePicker {
|
|
803
|
+
// Inputs
|
|
804
|
+
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
805
|
+
// Outputs
|
|
806
|
+
timeChange = output();
|
|
807
|
+
// Computed
|
|
808
|
+
hours = computed(() => {
|
|
809
|
+
const date = this.value();
|
|
810
|
+
return date ? getHours(date) : 0;
|
|
811
|
+
}, ...(ngDevMode ? [{ debugName: "hours" }] : []));
|
|
812
|
+
minutes = computed(() => {
|
|
813
|
+
const date = this.value();
|
|
814
|
+
return date ? getMinutes(date) : 0;
|
|
815
|
+
}, ...(ngDevMode ? [{ debugName: "minutes" }] : []));
|
|
816
|
+
hoursLabel = computed(() => String(this.hours()).padStart(2, '0'), ...(ngDevMode ? [{ debugName: "hoursLabel" }] : []));
|
|
817
|
+
minutesLabel = computed(() => String(this.minutes()).padStart(2, '0'), ...(ngDevMode ? [{ debugName: "minutesLabel" }] : []));
|
|
818
|
+
// Private accessors
|
|
819
|
+
get _baseDate() {
|
|
820
|
+
return this.value() ?? startOfDay(new Date());
|
|
821
|
+
}
|
|
822
|
+
// Protected methods
|
|
823
|
+
incrementHours() {
|
|
824
|
+
this.timeChange.emit(setHours(this._baseDate, (this.hours() + 1) % 24));
|
|
825
|
+
}
|
|
826
|
+
decrementHours() {
|
|
827
|
+
this.timeChange.emit(setHours(this._baseDate, (this.hours() + 23) % 24));
|
|
828
|
+
}
|
|
829
|
+
incrementMinutes() {
|
|
830
|
+
this.timeChange.emit(setMinutes(this._baseDate, (this.minutes() + 1) % 60));
|
|
831
|
+
}
|
|
832
|
+
decrementMinutes() {
|
|
833
|
+
this.timeChange.emit(setMinutes(this._baseDate, (this.minutes() + 59) % 60));
|
|
834
|
+
}
|
|
835
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
836
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: TimePicker, isStandalone: true, selector: "tls-time-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { timeChange: "timeChange" }, host: { classAttribute: "tls-time-picker" }, ngImport: i0, template: "<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ hoursLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<span class=\"tls-time-picker__separator\">:</span>\n\n<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ minutesLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n" });
|
|
837
|
+
}
|
|
838
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TimePicker, decorators: [{
|
|
839
|
+
type: Component,
|
|
840
|
+
args: [{ selector: 'tls-time-picker', imports: [], host: { class: 'tls-time-picker' }, template: "<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ hoursLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<span class=\"tls-time-picker__separator\">:</span>\n\n<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ minutesLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n" }]
|
|
841
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], timeChange: [{ type: i0.Output, args: ["timeChange"] }] } });
|
|
842
|
+
|
|
843
|
+
class YearPicker {
|
|
844
|
+
// Inputs
|
|
845
|
+
viewDate = input.required(...(ngDevMode ? [{ debugName: "viewDate" }] : []));
|
|
846
|
+
selectedDate = input.required(...(ngDevMode ? [{ debugName: "selectedDate" }] : []));
|
|
847
|
+
yearsPerPage = input.required(...(ngDevMode ? [{ debugName: "yearsPerPage" }] : []));
|
|
848
|
+
// Outputs
|
|
849
|
+
yearSelect = output();
|
|
850
|
+
viewDateChange = output();
|
|
851
|
+
// Computed
|
|
852
|
+
years = computed(() => {
|
|
853
|
+
const year = getYear(this.viewDate());
|
|
854
|
+
const perPage = this.yearsPerPage();
|
|
855
|
+
const start = Math.floor(year / perPage) * perPage;
|
|
856
|
+
return Array.from({ length: perPage }, (_, index) => start + index);
|
|
857
|
+
}, ...(ngDevMode ? [{ debugName: "years" }] : []));
|
|
858
|
+
rangeLabel = computed(() => {
|
|
859
|
+
const yearsArray = this.years();
|
|
860
|
+
return `${yearsArray[0]} – ${yearsArray[yearsArray.length - 1]}`;
|
|
861
|
+
}, ...(ngDevMode ? [{ debugName: "rangeLabel" }] : []));
|
|
862
|
+
// Protected methods
|
|
863
|
+
prevPage() {
|
|
864
|
+
this.viewDateChange.emit(subYears(this.viewDate(), this.yearsPerPage()));
|
|
865
|
+
}
|
|
866
|
+
nextPage() {
|
|
867
|
+
this.viewDateChange.emit(addYears(this.viewDate(), this.yearsPerPage()));
|
|
868
|
+
}
|
|
869
|
+
selectYear(year) {
|
|
870
|
+
this.yearSelect.emit(setYear(this.viewDate(), year));
|
|
871
|
+
}
|
|
872
|
+
isSelectedYear(year) {
|
|
873
|
+
const selected = this.selectedDate();
|
|
874
|
+
return selected !== null && getYear(selected) === year;
|
|
875
|
+
}
|
|
876
|
+
isCurrentYear(year) {
|
|
877
|
+
return getYear(new Date()) === year;
|
|
878
|
+
}
|
|
879
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: YearPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
880
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: YearPicker, isStandalone: true, selector: "tls-year-picker", inputs: { viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: true, transformFunction: null }, yearsPerPage: { classPropertyName: "yearsPerPage", publicName: "yearsPerPage", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { yearSelect: "yearSelect", viewDateChange: "viewDateChange" }, host: { classAttribute: "tls-year-picker" }, ngImport: i0, template: "<div class=\"tls-year-picker__header\">\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"prevPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-year-picker__range\">{{ rangeLabel() }}</span>\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"nextPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-year-picker__grid\">\n @for (year of years(); track year) {\n <button\n type=\"button\"\n class=\"tls-year-picker__cell\"\n [class.tls-year-picker__cell--selected]=\"isSelectedYear(year)\"\n [class.tls-year-picker__cell--current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n</div>\n" });
|
|
881
|
+
}
|
|
882
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: YearPicker, decorators: [{
|
|
883
|
+
type: Component,
|
|
884
|
+
args: [{ selector: 'tls-year-picker', imports: [], host: { class: 'tls-year-picker' }, template: "<div class=\"tls-year-picker__header\">\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"prevPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-year-picker__range\">{{ rangeLabel() }}</span>\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"nextPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-year-picker__grid\">\n @for (year of years(); track year) {\n <button\n type=\"button\"\n class=\"tls-year-picker__cell\"\n [class.tls-year-picker__cell--selected]=\"isSelectedYear(year)\"\n [class.tls-year-picker__cell--current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n</div>\n" }]
|
|
885
|
+
}], propDecorators: { viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: true }] }], yearsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "yearsPerPage", required: true }] }], yearSelect: [{ type: i0.Output, args: ["yearSelect"] }], viewDateChange: [{ type: i0.Output, args: ["viewDateChange"] }] } });
|
|
886
|
+
|
|
887
|
+
class DateTimePicker extends ValueFormControl {
|
|
888
|
+
// Injections
|
|
889
|
+
config = inject(DATE_TIME_PICKER_CONFIG);
|
|
890
|
+
// View children
|
|
891
|
+
popoverComponent = viewChild('popoverRef', ...(ngDevMode ? [{ debugName: "popoverComponent" }] : []));
|
|
892
|
+
// Inputs
|
|
893
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
894
|
+
mode = input(this.config.mode, ...(ngDevMode ? [{ debugName: "mode" }] : []));
|
|
895
|
+
inline = input(this.config.inline, { ...(ngDevMode ? { debugName: "inline" } : {}), transform: booleanAttribute });
|
|
896
|
+
placeholder = input(this.config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
897
|
+
size = input(this.config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
898
|
+
fluid = input(false, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
899
|
+
yearsPerPage = input(this.config.yearsPerPage, ...(ngDevMode ? [{ debugName: "yearsPerPage" }] : []));
|
|
900
|
+
weekStartsOn = input(this.config.weekStartsOn, ...(ngDevMode ? [{ debugName: "weekStartsOn" }] : []));
|
|
901
|
+
weekDays = input(this.config.weekDays, ...(ngDevMode ? [{ debugName: "weekDays" }] : []));
|
|
902
|
+
// State
|
|
903
|
+
viewDate = signal(new Date(), ...(ngDevMode ? [{ debugName: "viewDate" }] : []));
|
|
904
|
+
activeView = signal(this.config.mode, ...(ngDevMode ? [{ debugName: "activeView" }] : []));
|
|
905
|
+
// Computed
|
|
906
|
+
hostClasses = computed(() => {
|
|
907
|
+
const classes = ['tls-date-time-picker'];
|
|
908
|
+
if (!this.inline()) {
|
|
909
|
+
classes.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
910
|
+
if (this.fluid())
|
|
911
|
+
classes.push(`${this.CLASS_NAME}--fluid`);
|
|
912
|
+
return classes.concat(this.controlClasses());
|
|
913
|
+
}
|
|
914
|
+
return classes;
|
|
915
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
916
|
+
triggerLabel = computed(() => {
|
|
917
|
+
const value = this.value();
|
|
918
|
+
if (!value)
|
|
919
|
+
return this.placeholder();
|
|
920
|
+
const mode = this.mode();
|
|
921
|
+
if (mode === 'calendar')
|
|
922
|
+
return format(value, 'MMM d, yyyy');
|
|
923
|
+
if (mode === 'month-picker')
|
|
924
|
+
return format(value, 'MMMM yyyy');
|
|
925
|
+
if (mode === 'year-picker')
|
|
926
|
+
return format(value, 'yyyy');
|
|
927
|
+
if (mode === 'time-picker')
|
|
928
|
+
return format(value, 'HH:mm');
|
|
929
|
+
return format(value, 'MMM d, yyyy HH:mm');
|
|
930
|
+
}, ...(ngDevMode ? [{ debugName: "triggerLabel" }] : []));
|
|
931
|
+
constructor() {
|
|
932
|
+
super();
|
|
933
|
+
effect(() => {
|
|
934
|
+
this.activeView.set(this.mode());
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
// Protected methods
|
|
938
|
+
onViewDateChange(date) {
|
|
939
|
+
this.viewDate.set(date);
|
|
940
|
+
}
|
|
941
|
+
onDaySelect(date) {
|
|
942
|
+
if (this.notInteractive())
|
|
943
|
+
return;
|
|
944
|
+
this.value.set(date);
|
|
945
|
+
if (this.mode() === 'calendar') {
|
|
946
|
+
this.popoverComponent()?.close();
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
onMonthSelect(date) {
|
|
950
|
+
this.viewDate.set(date);
|
|
951
|
+
if (this.notInteractive())
|
|
952
|
+
return;
|
|
953
|
+
if (this.mode() === 'month-picker') {
|
|
954
|
+
this.value.set(date);
|
|
955
|
+
this.popoverComponent()?.close();
|
|
956
|
+
}
|
|
957
|
+
else if (this.mode() === 'date-time') {
|
|
958
|
+
this.activeView.set('date-time');
|
|
959
|
+
}
|
|
960
|
+
else {
|
|
961
|
+
this.activeView.set('calendar');
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
onYearSelect(date) {
|
|
965
|
+
this.viewDate.set(date);
|
|
966
|
+
if (this.notInteractive())
|
|
967
|
+
return;
|
|
968
|
+
if (this.mode() === 'year-picker') {
|
|
969
|
+
this.value.set(date);
|
|
970
|
+
this.popoverComponent()?.close();
|
|
971
|
+
}
|
|
972
|
+
else {
|
|
973
|
+
this.activeView.set('month-picker');
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
onTimeChange(date) {
|
|
977
|
+
if (this.notInteractive())
|
|
978
|
+
return;
|
|
979
|
+
this.value.set(date);
|
|
980
|
+
}
|
|
981
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
982
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: DateTimePicker, isStandalone: true, selector: "tls-date-time-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, yearsPerPage: { classPropertyName: "yearsPerPage", publicName: "yearsPerPage", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], viewQueries: [{ propertyName: "popoverComponent", first: true, predicate: ["popoverRef"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"popoverRef.toggle($event)\"\n (blur)=\"touched.set(true)\"\n >\n <span [class.tls-form-control__placeholder]=\"!value()\">{{ triggerLabel() }}</span>\n </button>\n <tls-popover #popoverRef position=\"bottom-start\">\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n", dependencies: [{ kind: "component", type: Calendar, selector: "tls-calendar", inputs: ["viewDate", "selectedDate", "weekStartsOn", "weekDays"], outputs: ["daySelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: MonthPicker, selector: "tls-month-picker", inputs: ["viewDate", "selectedDate"], outputs: ["monthSelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: YearPicker, selector: "tls-year-picker", inputs: ["viewDate", "selectedDate", "yearsPerPage"], outputs: ["yearSelect", "viewDateChange"] }, { kind: "component", type: TimePicker, selector: "tls-time-picker", inputs: ["value"], outputs: ["timeChange"] }, { kind: "component", type: Popover, selector: "tls-popover", inputs: ["position", "offset", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
983
|
+
}
|
|
984
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, decorators: [{
|
|
985
|
+
type: Component,
|
|
986
|
+
args: [{ selector: 'tls-date-time-picker', imports: [Calendar, MonthPicker, YearPicker, TimePicker, Popover, NgTemplateOutlet], host: { '[class]': 'hostClasses()' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"popoverRef.toggle($event)\"\n (blur)=\"touched.set(true)\"\n >\n <span [class.tls-form-control__placeholder]=\"!value()\">{{ triggerLabel() }}</span>\n </button>\n <tls-popover #popoverRef position=\"bottom-start\">\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n" }]
|
|
987
|
+
}], ctorParameters: () => [], propDecorators: { popoverComponent: [{ type: i0.ViewChild, args: ['popoverRef', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", 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 }] }], yearsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "yearsPerPage", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }] } });
|
|
988
|
+
|
|
705
989
|
const DEFAULT_INPUT_CONFIG = {
|
|
706
990
|
size: 'md',
|
|
707
991
|
type: 'text',
|
|
@@ -724,11 +1008,10 @@ class Input extends ValueFormControl {
|
|
|
724
1008
|
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
725
1009
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
726
1010
|
classes = computed(() => {
|
|
727
|
-
const
|
|
728
|
-
|
|
729
|
-
array.push(`${className}--${this.size()}`);
|
|
1011
|
+
const array = [this.CLASS_NAME];
|
|
1012
|
+
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
730
1013
|
if (this.fluid())
|
|
731
|
-
array.push(`${
|
|
1014
|
+
array.push(`${this.CLASS_NAME}--fluid`);
|
|
732
1015
|
return array.concat(this.controlClasses());
|
|
733
1016
|
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
734
1017
|
// Protected methods
|
|
@@ -789,11 +1072,11 @@ class Password extends ValueFormControl {
|
|
|
789
1072
|
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
790
1073
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
791
1074
|
hostClasses = computed(() => {
|
|
792
|
-
const
|
|
793
|
-
const array = [
|
|
794
|
-
array.push(`${
|
|
1075
|
+
const groupClass = 'tls-form-control-group';
|
|
1076
|
+
const array = ['tls-password', groupClass];
|
|
1077
|
+
array.push(`${groupClass}--${this.size()}`);
|
|
795
1078
|
if (this.fluid())
|
|
796
|
-
array.push(`${
|
|
1079
|
+
array.push(`${groupClass}--fluid`);
|
|
797
1080
|
return array;
|
|
798
1081
|
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
799
1082
|
type = computed(() => (this.visible() ? 'text' : 'password'), ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
@@ -808,13 +1091,13 @@ class Password extends ValueFormControl {
|
|
|
808
1091
|
this.visible.update(prev => !prev);
|
|
809
1092
|
}
|
|
810
1093
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
811
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Password, isStandalone: true, selector: "tls-password", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", visible: "visibleChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], usesInheritance: true, ngImport: i0, 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"
|
|
1094
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Password, isStandalone: true, selector: "tls-password", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", visible: "visibleChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], usesInheritance: true, ngImport: i0, 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" });
|
|
812
1095
|
}
|
|
813
1096
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, decorators: [{
|
|
814
1097
|
type: Component,
|
|
815
1098
|
args: [{ selector: 'tls-password', host: {
|
|
816
1099
|
'[class]': 'hostClasses()',
|
|
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"
|
|
1100
|
+
}, 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" }]
|
|
818
1101
|
}], 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 }] }] } });
|
|
819
1102
|
|
|
820
1103
|
// Matches strings containing only numeric digits (0–9).
|
|
@@ -976,21 +1259,228 @@ class RadioButton extends ValueFormControl {
|
|
|
976
1259
|
return array.concat(this.controlClasses());
|
|
977
1260
|
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
978
1261
|
// Protected methods
|
|
979
|
-
check() {
|
|
980
|
-
if (this.notInteractive())
|
|
1262
|
+
check() {
|
|
1263
|
+
if (this.notInteractive())
|
|
1264
|
+
return;
|
|
1265
|
+
this.value.set(this.radioValue());
|
|
1266
|
+
}
|
|
1267
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadioButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1268
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: RadioButton, isStandalone: true, selector: "tls-radio-button", inputs: { radioValue: { classPropertyName: "radioValue", publicName: "radioValue", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()", "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, template: "<input\n type=\"radio\"\n class=\"tls-radio-button-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [value]=\"radioValue()\"\n (change)=\"check()\"\n (blur)=\"touched.set(true)\"\n/>\n<div class=\"tls-radio-button-circle\"></div>\n" });
|
|
1269
|
+
}
|
|
1270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadioButton, decorators: [{
|
|
1271
|
+
type: Component,
|
|
1272
|
+
args: [{ selector: 'tls-radio-button', imports: [], host: {
|
|
1273
|
+
'[class]': 'hostClasses()',
|
|
1274
|
+
'[tabindex]': '-1',
|
|
1275
|
+
}, template: "<input\n type=\"radio\"\n class=\"tls-radio-button-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [value]=\"radioValue()\"\n (change)=\"check()\"\n (blur)=\"touched.set(true)\"\n/>\n<div class=\"tls-radio-button-circle\"></div>\n" }]
|
|
1276
|
+
}], propDecorators: { radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
1277
|
+
|
|
1278
|
+
const DEFAULT_SELECT_CONFIG = {
|
|
1279
|
+
size: 'md',
|
|
1280
|
+
placeholder: '',
|
|
1281
|
+
fluid: false,
|
|
1282
|
+
clearable: false,
|
|
1283
|
+
};
|
|
1284
|
+
|
|
1285
|
+
const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
1286
|
+
factory: () => DEFAULT_SELECT_CONFIG,
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
class Select extends ValueFormControl {
|
|
1290
|
+
_config = inject(SELECT_CONFIG);
|
|
1291
|
+
_overlay = inject(Overlay);
|
|
1292
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
1293
|
+
_destroyRef = inject(DestroyRef);
|
|
1294
|
+
_triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "_triggerElement" }] : []));
|
|
1295
|
+
_panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "_panelTemplate" }] : []));
|
|
1296
|
+
_overlayRef = null;
|
|
1297
|
+
_portal = null;
|
|
1298
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1299
|
+
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
1300
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1301
|
+
optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
|
|
1302
|
+
optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
|
|
1303
|
+
optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
|
|
1304
|
+
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1305
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1306
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1307
|
+
tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
|
|
1308
|
+
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
|
|
1309
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1310
|
+
activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
1311
|
+
normalizedOptions = computed(() => {
|
|
1312
|
+
const options = this.options();
|
|
1313
|
+
const optionLabel = this.optionLabel();
|
|
1314
|
+
const optionValue = this.optionValue();
|
|
1315
|
+
const optionDisabled = this.optionDisabled();
|
|
1316
|
+
return options.map(option => {
|
|
1317
|
+
if (typeof option === 'string' || typeof option === 'number') {
|
|
1318
|
+
return { value: option, label: String(option), disabled: false };
|
|
1319
|
+
}
|
|
1320
|
+
const typedOption = option;
|
|
1321
|
+
return {
|
|
1322
|
+
value: (optionValue ? typedOption[optionValue] : typedOption),
|
|
1323
|
+
label: String(optionLabel ? typedOption[optionLabel] : typedOption),
|
|
1324
|
+
disabled: Boolean(optionDisabled ? typedOption[optionDisabled] : false),
|
|
1325
|
+
};
|
|
1326
|
+
});
|
|
1327
|
+
}, ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
|
|
1328
|
+
hasValue = computed(() => {
|
|
1329
|
+
const value = this.value();
|
|
1330
|
+
return value !== null && value !== undefined && value !== '';
|
|
1331
|
+
}, ...(ngDevMode ? [{ debugName: "hasValue" }] : []));
|
|
1332
|
+
selectedLabel = computed(() => {
|
|
1333
|
+
if (!this.hasValue())
|
|
1334
|
+
return '';
|
|
1335
|
+
return this.normalizedOptions().find(option => option.value === this.value())?.label ?? '';
|
|
1336
|
+
}, ...(ngDevMode ? [{ debugName: "selectedLabel" }] : []));
|
|
1337
|
+
// Classes
|
|
1338
|
+
hostClasses = computed(() => {
|
|
1339
|
+
const array = ['tls-select'];
|
|
1340
|
+
if (this.isOpen())
|
|
1341
|
+
array.push('tls-select--open');
|
|
1342
|
+
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
1343
|
+
if (this.fluid())
|
|
1344
|
+
array.push(`${this.CLASS_NAME}--fluid`);
|
|
1345
|
+
return array.concat(this.controlClasses());
|
|
1346
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1347
|
+
// Protected methods
|
|
1348
|
+
open() {
|
|
1349
|
+
const triggerElement = this._triggerElement();
|
|
1350
|
+
const panelTemplate = this._panelTemplate();
|
|
1351
|
+
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
981
1352
|
return;
|
|
982
|
-
|
|
1353
|
+
if (!this._overlayRef) {
|
|
1354
|
+
this._overlayRef = this._overlay.create({
|
|
1355
|
+
positionStrategy: this._overlay
|
|
1356
|
+
.position()
|
|
1357
|
+
.flexibleConnectedTo(triggerElement)
|
|
1358
|
+
.withPositions([
|
|
1359
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
1360
|
+
{
|
|
1361
|
+
originX: 'start',
|
|
1362
|
+
originY: 'top',
|
|
1363
|
+
overlayX: 'start',
|
|
1364
|
+
overlayY: 'bottom',
|
|
1365
|
+
offsetY: -4,
|
|
1366
|
+
},
|
|
1367
|
+
])
|
|
1368
|
+
.withFlexibleDimensions(false)
|
|
1369
|
+
.withPush(false),
|
|
1370
|
+
scrollStrategy: this._overlay.scrollStrategies.reposition(),
|
|
1371
|
+
hasBackdrop: true,
|
|
1372
|
+
panelClass: 'tls-select-panel',
|
|
1373
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
1374
|
+
});
|
|
1375
|
+
this._overlayRef
|
|
1376
|
+
.backdropClick()
|
|
1377
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
1378
|
+
.subscribe(() => this.close());
|
|
1379
|
+
}
|
|
1380
|
+
this._portal ??= new TemplatePortal(panelTemplate, this._viewContainerRef);
|
|
1381
|
+
this._overlayRef.updateSize({ minWidth: triggerElement.nativeElement.offsetWidth });
|
|
1382
|
+
this._overlayRef.attach(this._portal);
|
|
1383
|
+
this.isOpen.set(true);
|
|
1384
|
+
this.activeIndex.set(this.normalizedOptions().findIndex(option => option.value === this.value()));
|
|
983
1385
|
}
|
|
984
|
-
|
|
985
|
-
|
|
1386
|
+
close() {
|
|
1387
|
+
this._overlayRef?.detach();
|
|
1388
|
+
this.isOpen.set(false);
|
|
1389
|
+
this.activeIndex.set(-1);
|
|
1390
|
+
this._triggerElement()?.nativeElement.focus();
|
|
1391
|
+
}
|
|
1392
|
+
toggle() {
|
|
1393
|
+
if (this.isOpen()) {
|
|
1394
|
+
this.close();
|
|
1395
|
+
}
|
|
1396
|
+
else {
|
|
1397
|
+
this.open();
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
select(option) {
|
|
1401
|
+
if (option.disabled)
|
|
1402
|
+
return;
|
|
1403
|
+
this.value.set(option.value);
|
|
1404
|
+
this.close();
|
|
1405
|
+
}
|
|
1406
|
+
clear() {
|
|
1407
|
+
this.value.set(null);
|
|
1408
|
+
}
|
|
1409
|
+
onOptionHover(index, disabled) {
|
|
1410
|
+
if (!disabled)
|
|
1411
|
+
this.activeIndex.set(index);
|
|
1412
|
+
}
|
|
1413
|
+
onKeydown(event) {
|
|
1414
|
+
if (event.key === 'ArrowDown') {
|
|
1415
|
+
event.preventDefault();
|
|
1416
|
+
if (this.isOpen()) {
|
|
1417
|
+
this._moveActive(1);
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
this.open();
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
else if (event.key === 'ArrowUp') {
|
|
1424
|
+
event.preventDefault();
|
|
1425
|
+
if (this.isOpen()) {
|
|
1426
|
+
this._moveActive(-1);
|
|
1427
|
+
}
|
|
1428
|
+
else {
|
|
1429
|
+
this.open();
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
else if (event.key === 'Enter' || event.key === ' ') {
|
|
1433
|
+
event.preventDefault();
|
|
1434
|
+
if (!this.isOpen()) {
|
|
1435
|
+
this.open();
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
const active = this.normalizedOptions()[this.activeIndex()];
|
|
1439
|
+
if (active && !active.disabled)
|
|
1440
|
+
this.select(active);
|
|
1441
|
+
}
|
|
1442
|
+
else if (event.key === 'Escape') {
|
|
1443
|
+
event.preventDefault();
|
|
1444
|
+
if (this.isOpen())
|
|
1445
|
+
this.close();
|
|
1446
|
+
}
|
|
1447
|
+
else if (event.key === 'Tab') {
|
|
1448
|
+
if (this.isOpen())
|
|
1449
|
+
this.close();
|
|
1450
|
+
}
|
|
1451
|
+
else if ((event.key === 'Delete' || event.key === 'Backspace') &&
|
|
1452
|
+
this.clearable() &&
|
|
1453
|
+
this.hasValue()) {
|
|
1454
|
+
event.preventDefault();
|
|
1455
|
+
this.clear();
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
// Private methods
|
|
1459
|
+
_moveActive(direction) {
|
|
1460
|
+
const options = this.normalizedOptions();
|
|
1461
|
+
let next = this.activeIndex() + direction;
|
|
1462
|
+
while (next >= 0 && next < options.length) {
|
|
1463
|
+
if (!options[next].disabled) {
|
|
1464
|
+
this.activeIndex.set(next);
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
next += direction;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
// Lifecycle
|
|
1471
|
+
ngOnDestroy() {
|
|
1472
|
+
if (this._overlayRef)
|
|
1473
|
+
this._overlayRef.dispose();
|
|
1474
|
+
}
|
|
1475
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1476
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], viewQueries: [{ propertyName: "_triggerElement", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "_panelTemplate", first: true, predicate: ["panel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-select__chevron\" viewBox=\"0 0 10 6\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L5 5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-select__clear-icon\" viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n\n<ng-template #panel>\n <ul class=\"tls-select__panel\" role=\"listbox\">\n @for (option of normalizedOptions(); track option.value; let i = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"i === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(i, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
|
|
986
1477
|
}
|
|
987
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type:
|
|
1478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, decorators: [{
|
|
988
1479
|
type: Component,
|
|
989
|
-
args: [{ selector: 'tls-
|
|
1480
|
+
args: [{ selector: 'tls-select', host: {
|
|
990
1481
|
'[class]': 'hostClasses()',
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
}], propDecorators: { radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
1482
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-select__chevron\" viewBox=\"0 0 10 6\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L5 5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-select__clear-icon\" viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n\n<ng-template #panel>\n <ul class=\"tls-select__panel\" role=\"listbox\">\n @for (option of normalizedOptions(); track option.value; let i = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"i === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(i, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" }]
|
|
1483
|
+
}], propDecorators: { _triggerElement: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], _panelTemplate: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", 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 }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }] } });
|
|
994
1484
|
|
|
995
1485
|
const DEFAULT_SWITCH_CONFIG = {
|
|
996
1486
|
color: 'primary',
|
|
@@ -1212,6 +1702,91 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1212
1702
|
}]
|
|
1213
1703
|
}], 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
1704
|
|
|
1705
|
+
const DEFAULT_PAGINATION_CONFIG = {
|
|
1706
|
+
size: 'md',
|
|
1707
|
+
pageSize: 10,
|
|
1708
|
+
boundaries: 1,
|
|
1709
|
+
siblings: 1,
|
|
1710
|
+
showFirstButton: false,
|
|
1711
|
+
showLastButton: false,
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1714
|
+
const PAGINATION_CONFIG = new InjectionToken('PAGINATION_CONFIG', {
|
|
1715
|
+
factory: () => DEFAULT_PAGINATION_CONFIG,
|
|
1716
|
+
});
|
|
1717
|
+
|
|
1718
|
+
class Pagination {
|
|
1719
|
+
_config = inject(PAGINATION_CONFIG);
|
|
1720
|
+
value = model(1, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1721
|
+
pageSize = input(this._config.pageSize, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
1722
|
+
total = input(0, ...(ngDevMode ? [{ debugName: "total" }] : []));
|
|
1723
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1724
|
+
boundaries = input(this._config.boundaries, ...(ngDevMode ? [{ debugName: "boundaries" }] : []));
|
|
1725
|
+
siblings = input(this._config.siblings, ...(ngDevMode ? [{ debugName: "siblings" }] : []));
|
|
1726
|
+
showFirstButton = input(this._config.showFirstButton, { ...(ngDevMode ? { debugName: "showFirstButton" } : {}), transform: booleanAttribute });
|
|
1727
|
+
showLastButton = input(this._config.showLastButton, { ...(ngDevMode ? { debugName: "showLastButton" } : {}), transform: booleanAttribute });
|
|
1728
|
+
pageCount = computed(() => Math.ceil(this.total() / this.pageSize()), ...(ngDevMode ? [{ debugName: "pageCount" }] : []));
|
|
1729
|
+
visiblePages = computed(() => this._buildPages(this.pageCount(), this.value(), this.siblings(), this.boundaries()), ...(ngDevMode ? [{ debugName: "visiblePages" }] : []));
|
|
1730
|
+
classes = computed(() => ['tls-pagination', `tls-pagination--${this.size()}`], ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
1731
|
+
// Protected methods
|
|
1732
|
+
setPage(page) {
|
|
1733
|
+
this.value.set(page);
|
|
1734
|
+
}
|
|
1735
|
+
firstPage() {
|
|
1736
|
+
this.value.set(1);
|
|
1737
|
+
}
|
|
1738
|
+
prevPage() {
|
|
1739
|
+
this.value.update(page => Math.max(1, page - 1));
|
|
1740
|
+
}
|
|
1741
|
+
nextPage() {
|
|
1742
|
+
this.value.update(page => Math.min(this.pageCount(), page + 1));
|
|
1743
|
+
}
|
|
1744
|
+
lastPage() {
|
|
1745
|
+
this.value.set(this.pageCount());
|
|
1746
|
+
}
|
|
1747
|
+
// Private methods
|
|
1748
|
+
/** Returns an inclusive array of integers from start to end. Returns [] if end < start. */
|
|
1749
|
+
_range(start, end) {
|
|
1750
|
+
const length = end - start + 1;
|
|
1751
|
+
return length > 0 ? Array.from({ length }, (_, i) => start + i) : [];
|
|
1752
|
+
}
|
|
1753
|
+
/** Computes the visible page items, inserting 'gap' where ellipsis should appear based on boundaries and siblings. */
|
|
1754
|
+
_buildPages(total, current, siblings, boundaries) {
|
|
1755
|
+
if (total <= 0)
|
|
1756
|
+
return [];
|
|
1757
|
+
// + 3: current page + two potential gap placeholders (left and right ellipsis)
|
|
1758
|
+
if (siblings * 2 + boundaries * 2 + 3 >= total)
|
|
1759
|
+
return this._range(1, total);
|
|
1760
|
+
const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);
|
|
1761
|
+
const rightSiblingIndex = Math.min(current + siblings, total - boundaries);
|
|
1762
|
+
const showLeftGap = leftSiblingIndex > boundaries + 2;
|
|
1763
|
+
const showRightGap = rightSiblingIndex < total - boundaries - 1;
|
|
1764
|
+
const startPages = this._range(1, boundaries);
|
|
1765
|
+
const endPages = this._range(total - boundaries + 1, total);
|
|
1766
|
+
if (!showLeftGap && showRightGap) {
|
|
1767
|
+
// Expand left side to compensate for the missing left gap, keeping total item count stable
|
|
1768
|
+
return [...this._range(1, boundaries + siblings * 2 + 2), 'gap', ...endPages];
|
|
1769
|
+
}
|
|
1770
|
+
if (showLeftGap && !showRightGap) {
|
|
1771
|
+
// Expand right side to compensate for the missing right gap, keeping total item count stable
|
|
1772
|
+
return [...startPages, 'gap', ...this._range(total - boundaries - siblings * 2 - 1, total)];
|
|
1773
|
+
}
|
|
1774
|
+
return [
|
|
1775
|
+
...startPages,
|
|
1776
|
+
'gap',
|
|
1777
|
+
...this._range(leftSiblingIndex, rightSiblingIndex),
|
|
1778
|
+
'gap',
|
|
1779
|
+
...endPages,
|
|
1780
|
+
];
|
|
1781
|
+
}
|
|
1782
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Pagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1783
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Pagination, isStandalone: true, selector: "tls-pagination", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, boundaries: { classPropertyName: "boundaries", publicName: "boundaries", isSignal: true, isRequired: false, transformFunction: null }, siblings: { classPropertyName: "siblings", publicName: "siblings", isSignal: true, isRequired: false, transformFunction: null }, showFirstButton: { classPropertyName: "showFirstButton", publicName: "showFirstButton", isSignal: true, isRequired: false, transformFunction: null }, showLastButton: { classPropertyName: "showLastButton", publicName: "showLastButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"11 17 6 12 11 7\" />\n <polyline points=\"18 17 13 12 18 7\" />\n </svg>\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"15 18 9 12 15 6\" />\n </svg>\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"13 17 18 12 13 7\" />\n <polyline points=\"6 17 11 12 6 7\" />\n </svg>\n </span>\n </button>\n}\n" });
|
|
1784
|
+
}
|
|
1785
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Pagination, decorators: [{
|
|
1786
|
+
type: Component,
|
|
1787
|
+
args: [{ selector: 'tls-pagination', host: { '[class]': 'classes()' }, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"11 17 6 12 11 7\" />\n <polyline points=\"18 17 13 12 18 7\" />\n </svg>\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"15 18 9 12 15 6\" />\n </svg>\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"13 17 18 12 13 7\" />\n <polyline points=\"6 17 11 12 6 7\" />\n </svg>\n </span>\n </button>\n}\n" }]
|
|
1788
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], boundaries: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaries", required: false }] }], siblings: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblings", required: false }] }], showFirstButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFirstButton", required: false }] }], showLastButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLastButton", required: false }] }] } });
|
|
1789
|
+
|
|
1215
1790
|
const DEFAULT_SKELETON_CONFIG = {
|
|
1216
1791
|
size: 40,
|
|
1217
1792
|
width: null,
|
|
@@ -1411,6 +1986,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1411
1986
|
}, 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
1987
|
}], 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
1988
|
|
|
1989
|
+
class TableColumn {
|
|
1990
|
+
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
|
|
1991
|
+
header = input(...(ngDevMode ? [undefined, { debugName: "header" }] : []));
|
|
1992
|
+
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : {}), transform: booleanAttribute });
|
|
1993
|
+
alignment = input(...(ngDevMode ? [undefined, { debugName: "alignment" }] : []));
|
|
1994
|
+
width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : []));
|
|
1995
|
+
template = contentChild(TemplateRef, ...(ngDevMode ? [{ debugName: "template" }] : []));
|
|
1996
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TableColumn, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1997
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: TableColumn, isStandalone: true, selector: "tls-table-column", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: '', isInline: true });
|
|
1998
|
+
}
|
|
1999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TableColumn, decorators: [{
|
|
2000
|
+
type: Component,
|
|
2001
|
+
args: [{
|
|
2002
|
+
selector: 'tls-table-column',
|
|
2003
|
+
imports: [],
|
|
2004
|
+
template: '',
|
|
2005
|
+
}]
|
|
2006
|
+
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], template: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|
|
2007
|
+
|
|
2008
|
+
const DEFAULT_TABLE_CONFIG = {
|
|
2009
|
+
hideHeader: false,
|
|
2010
|
+
striped: false,
|
|
2011
|
+
};
|
|
2012
|
+
|
|
2013
|
+
const TABLE_CONFIG = new InjectionToken('TABLE_CONFIG', {
|
|
2014
|
+
factory: () => DEFAULT_TABLE_CONFIG,
|
|
2015
|
+
});
|
|
2016
|
+
|
|
2017
|
+
class Table {
|
|
2018
|
+
_config = inject(TABLE_CONFIG);
|
|
2019
|
+
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
2020
|
+
columnDefinitions = input([], ...(ngDevMode ? [{ debugName: "columnDefinitions" }] : []));
|
|
2021
|
+
hideHeader = input(this._config.hideHeader, { ...(ngDevMode ? { debugName: "hideHeader" } : {}), transform: booleanAttribute });
|
|
2022
|
+
striped = input(this._config.striped, { ...(ngDevMode ? { debugName: "striped" } : {}), transform: booleanAttribute });
|
|
2023
|
+
trackBy = input(...(ngDevMode ? [undefined, { debugName: "trackBy" }] : []));
|
|
2024
|
+
tableColumns = contentChildren(TableColumn, ...(ngDevMode ? [{ debugName: "tableColumns" }] : []));
|
|
2025
|
+
// Merges columnDefinitions input and tls-table-column content children into a single list.
|
|
2026
|
+
// Input drives order; content children override matching keys and append unmatched columns at the end.
|
|
2027
|
+
// Map keyed by content column key → O(1) lookup when applying overrides to each input column.
|
|
2028
|
+
// Set of input keys → O(1) membership check when finding content columns absent from input (extras).
|
|
2029
|
+
// extras: content columns with no matching input entry, appended after the merged input columns.
|
|
2030
|
+
effectiveColumnDefinitions = computed(() => {
|
|
2031
|
+
const fromContent = this._mapContentColumns(this.tableColumns());
|
|
2032
|
+
const fromInput = this.columnDefinitions();
|
|
2033
|
+
if (fromContent.length === 0)
|
|
2034
|
+
return fromInput;
|
|
2035
|
+
if (fromInput.length === 0)
|
|
2036
|
+
return fromContent;
|
|
2037
|
+
const contentByKey = new Map(fromContent.map(definition => [definition.key, definition]));
|
|
2038
|
+
const inputKeys = new Set(fromInput.map(definition => definition.key));
|
|
2039
|
+
const merged = fromInput.map(definition => ({
|
|
2040
|
+
...definition,
|
|
2041
|
+
...(contentByKey.get(definition.key) ?? {}),
|
|
2042
|
+
}));
|
|
2043
|
+
const extras = fromContent.filter(definition => !inputKeys.has(definition.key));
|
|
2044
|
+
return [...merged, ...extras];
|
|
2045
|
+
}, ...(ngDevMode ? [{ debugName: "effectiveColumnDefinitions" }] : []));
|
|
2046
|
+
columns = computed(() => this.effectiveColumnDefinitions().reduce((filtered, columnDefinition) => {
|
|
2047
|
+
if (!columnDefinition.hidden)
|
|
2048
|
+
filtered.push(columnDefinition.key);
|
|
2049
|
+
return filtered;
|
|
2050
|
+
}, []), ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
2051
|
+
resolvedTrackBy = computed(() => {
|
|
2052
|
+
const trackBy = this.trackBy();
|
|
2053
|
+
if (trackBy === undefined)
|
|
2054
|
+
return (_, row) => row;
|
|
2055
|
+
if (typeof trackBy === 'string')
|
|
2056
|
+
return (_, row) => row[trackBy];
|
|
2057
|
+
return trackBy;
|
|
2058
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedTrackBy" }] : []));
|
|
2059
|
+
classes = computed(() => {
|
|
2060
|
+
const className = 'tls-table';
|
|
2061
|
+
const array = [className];
|
|
2062
|
+
if (this.hideHeader())
|
|
2063
|
+
array.push(`${className}--hide-header`);
|
|
2064
|
+
if (this.striped())
|
|
2065
|
+
array.push(`${className}--striped`);
|
|
2066
|
+
return array;
|
|
2067
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
2068
|
+
dataSource = {
|
|
2069
|
+
connect: () => {
|
|
2070
|
+
return toObservable(this.data);
|
|
2071
|
+
},
|
|
2072
|
+
disconnect: () => {
|
|
2073
|
+
// no operation
|
|
2074
|
+
},
|
|
2075
|
+
};
|
|
2076
|
+
// Private methods
|
|
2077
|
+
_mapContentColumns(columns) {
|
|
2078
|
+
return columns.map((column) => this._mapContentColumn(column));
|
|
2079
|
+
}
|
|
2080
|
+
_mapContentColumn(column) {
|
|
2081
|
+
const definition = { key: column.key(), hidden: column.hidden() };
|
|
2082
|
+
const header = column.header();
|
|
2083
|
+
if (header !== undefined)
|
|
2084
|
+
definition.header = header;
|
|
2085
|
+
const alignment = column.alignment();
|
|
2086
|
+
if (alignment !== undefined)
|
|
2087
|
+
definition.alignment = alignment;
|
|
2088
|
+
const width = column.width();
|
|
2089
|
+
if (width !== undefined)
|
|
2090
|
+
definition.width = width;
|
|
2091
|
+
const template = column.template();
|
|
2092
|
+
if (template !== undefined)
|
|
2093
|
+
definition.template = template;
|
|
2094
|
+
return definition;
|
|
2095
|
+
}
|
|
2096
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Table, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2097
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Table, isStandalone: true, selector: "tls-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, columnDefinitions: { classPropertyName: "columnDefinitions", publicName: "columnDefinitions", isSignal: true, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "tableColumns", predicate: TableColumn, isSignal: true }], ngImport: i0, template: "<table cdk-table [class]=\"classes()\" [dataSource]=\"dataSource\" [trackBy]=\"resolvedTrackBy()\">\n @for (column of effectiveColumnDefinitions(); track column.key) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <!-- Header cell -->\n <th cdk-header-cell *cdkHeaderCellDef class=\"tls-table__header-cell\" [style.width]=\"column.width + 'px'\">\n {{ column.header }}\n </th>\n\n <!-- Row cell -->\n <td\n cdk-cell\n *cdkCellDef=\"let data; let index = index; let count = count; let first = first; let last = last; let even = even; let odd = odd\"\n class=\"tls-table__cell\"\n [style.text-align]=\"column.alignment\"\n >\n @if (column.template) {\n <ng-container\n [ngTemplateOutlet]=\"column.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: data[column.key],\n data: data,\n index: index,\n count: count,\n first: first,\n last: last,\n even: even,\n odd: odd\n }\"\n />\n } @else {\n {{ data[column.key] }}\n }\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row *cdkHeaderRowDef=\"columns()\" class=\"tls-table__header-row\"></tr>\n\n <tr *cdkRowDef=\"let row; columns: columns()\" cdk-row class=\"tls-table__row\"></tr>\n</table>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: CdkTable, selector: "cdk-table, table[cdk-table]", inputs: ["trackBy", "dataSource", "multiTemplateDataRows", "fixedLayout", "recycleRows"], outputs: ["contentChanged"], exportAs: ["cdkTable"] }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }, { kind: "directive", type: CdkCellDef, selector: "[cdkCellDef]" }, { kind: "directive", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]" }, { kind: "directive", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["cdkColumnDef", "sticky", "stickyEnd"] }, { kind: "component", type: CdkHeaderRow, selector: "cdk-header-row, tr[cdk-header-row]" }, { kind: "directive", type: CdkHeaderRowDef, selector: "[cdkHeaderRowDef]", inputs: ["cdkHeaderRowDef", "cdkHeaderRowDefSticky"] }, { kind: "component", type: CdkRow, selector: "cdk-row, tr[cdk-row]" }, { kind: "directive", type: CdkRowDef, selector: "[cdkRowDef]", inputs: ["cdkRowDefColumns", "cdkRowDefWhen"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2098
|
+
}
|
|
2099
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Table, decorators: [{
|
|
2100
|
+
type: Component,
|
|
2101
|
+
args: [{ selector: 'tls-table', imports: [
|
|
2102
|
+
CdkTable,
|
|
2103
|
+
CdkHeaderCell,
|
|
2104
|
+
CdkCell,
|
|
2105
|
+
CdkCellDef,
|
|
2106
|
+
CdkHeaderCellDef,
|
|
2107
|
+
CdkColumnDef,
|
|
2108
|
+
CdkHeaderRow,
|
|
2109
|
+
CdkHeaderRowDef,
|
|
2110
|
+
CdkRow,
|
|
2111
|
+
CdkRowDef,
|
|
2112
|
+
NgTemplateOutlet,
|
|
2113
|
+
], host: {}, template: "<table cdk-table [class]=\"classes()\" [dataSource]=\"dataSource\" [trackBy]=\"resolvedTrackBy()\">\n @for (column of effectiveColumnDefinitions(); track column.key) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <!-- Header cell -->\n <th cdk-header-cell *cdkHeaderCellDef class=\"tls-table__header-cell\" [style.width]=\"column.width + 'px'\">\n {{ column.header }}\n </th>\n\n <!-- Row cell -->\n <td\n cdk-cell\n *cdkCellDef=\"let data; let index = index; let count = count; let first = first; let last = last; let even = even; let odd = odd\"\n class=\"tls-table__cell\"\n [style.text-align]=\"column.alignment\"\n >\n @if (column.template) {\n <ng-container\n [ngTemplateOutlet]=\"column.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: data[column.key],\n data: data,\n index: index,\n count: count,\n first: first,\n last: last,\n even: even,\n odd: odd\n }\"\n />\n } @else {\n {{ data[column.key] }}\n }\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row *cdkHeaderRowDef=\"columns()\" class=\"tls-table__header-row\"></tr>\n\n <tr *cdkRowDef=\"let row; columns: columns()\" cdk-row class=\"tls-table__row\"></tr>\n</table>\n", styles: [":host{display:block}\n"] }]
|
|
2114
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], columnDefinitions: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnDefinitions", required: false }] }], hideHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideHeader", required: false }] }], striped: [{ type: i0.Input, args: [{ isSignal: true, alias: "striped", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], tableColumns: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TableColumn), { isSignal: true }] }] } });
|
|
2115
|
+
|
|
1414
2116
|
class TabsService {
|
|
1415
2117
|
selected = null;
|
|
1416
2118
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TabsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -1575,142 +2277,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1575
2277
|
type: Injectable
|
|
1576
2278
|
}] });
|
|
1577
2279
|
|
|
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
|
-
},
|
|
1708
|
-
};
|
|
1709
|
-
|
|
1710
2280
|
const DEFAULT_TOOLTIP_CONFIG = {
|
|
1711
2281
|
positions: undefined,
|
|
1712
2282
|
position: 'top',
|
|
1713
|
-
offset:
|
|
2283
|
+
offset: { x: 4, y: 4 },
|
|
1714
2284
|
origin: 'element',
|
|
1715
2285
|
color: 'secondary',
|
|
1716
2286
|
};
|
|
@@ -1719,17 +2289,6 @@ const TOOLTIP_CONFIG = new InjectionToken('TOOLTIP_CONFIG', {
|
|
|
1719
2289
|
factory: () => DEFAULT_TOOLTIP_CONFIG,
|
|
1720
2290
|
});
|
|
1721
2291
|
|
|
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
2292
|
class TooltipDirective {
|
|
1734
2293
|
_tooltipService = inject(TooltipService);
|
|
1735
2294
|
_elementRef = inject(ElementRef);
|
|
@@ -1748,7 +2307,7 @@ class TooltipDirective {
|
|
|
1748
2307
|
const positions = this.tooltipPositions();
|
|
1749
2308
|
if (positions)
|
|
1750
2309
|
return positions;
|
|
1751
|
-
return
|
|
2310
|
+
return buildOverlayPositions(this.tooltipPosition(), this.tooltipOffset());
|
|
1752
2311
|
}, ...(ngDevMode ? [{ debugName: "_positions" }] : []));
|
|
1753
2312
|
// Protected methods
|
|
1754
2313
|
onMouseEnter(event) {
|
|
@@ -1815,72 +2374,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1815
2374
|
|
|
1816
2375
|
// Features
|
|
1817
2376
|
|
|
1818
|
-
const isPlainObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
1819
|
-
|
|
1820
|
-
const mergeConfig = (defaults, overrides) => {
|
|
1821
|
-
if (!overrides)
|
|
1822
|
-
return defaults;
|
|
1823
|
-
const result = { ...defaults };
|
|
1824
|
-
for (const key in overrides) {
|
|
1825
|
-
const defaultValue = defaults[key];
|
|
1826
|
-
const overrideValue = overrides[key];
|
|
1827
|
-
result[key] = (isPlainObject(defaultValue) && isPlainObject(overrideValue)
|
|
1828
|
-
? mergeConfig(defaultValue, overrideValue)
|
|
1829
|
-
: overrideValue);
|
|
1830
|
-
}
|
|
1831
|
-
return result;
|
|
1832
|
-
};
|
|
1833
|
-
|
|
1834
|
-
const provideThalassicChartConfig = (config) => {
|
|
1835
|
-
return makeEnvironmentProviders([
|
|
1836
|
-
{
|
|
1837
|
-
provide: CHART_CONFIG,
|
|
1838
|
-
useValue: mergeConfig(DEFAULT_CHART_CONFIG, config),
|
|
1839
|
-
},
|
|
1840
|
-
]);
|
|
1841
|
-
};
|
|
1842
|
-
|
|
1843
2377
|
const provideThalassicUIConfig = (config) => {
|
|
1844
2378
|
return makeEnvironmentProviders([
|
|
1845
2379
|
// Components
|
|
1846
2380
|
{
|
|
1847
2381
|
provide: ALERT_CONFIG,
|
|
1848
|
-
useValue:
|
|
2382
|
+
useValue: deepMerge(DEFAULT_ALERT_CONFIG, config.components.alert),
|
|
1849
2383
|
},
|
|
1850
2384
|
{
|
|
1851
2385
|
provide: BUTTON_CONFIG,
|
|
1852
|
-
useValue:
|
|
2386
|
+
useValue: deepMerge(DEFAULT_BUTTON_CONFIG, config.components.button),
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
provide: DATE_TIME_PICKER_CONFIG,
|
|
2390
|
+
useValue: deepMerge(DEFAULT_DATE_TIME_PICKER_CONFIG, config.components.dateTimePicker),
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
provide: DIALOG_CONFIG,
|
|
2394
|
+
useValue: deepMerge(DEFAULT_DIALOG_CONFIG, config.components.dialog),
|
|
1853
2395
|
},
|
|
1854
2396
|
{
|
|
1855
2397
|
provide: DIVIDER_CONFIG,
|
|
1856
|
-
useValue:
|
|
2398
|
+
useValue: deepMerge(DEFAULT_DIVIDER_CONFIG, config.components.divider),
|
|
1857
2399
|
},
|
|
1858
|
-
{ provide: INPUT_CONFIG, useValue:
|
|
2400
|
+
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
|
|
1859
2401
|
{
|
|
1860
2402
|
provide: PASSWORD_CONFIG,
|
|
1861
|
-
useValue:
|
|
2403
|
+
useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, config.components.password),
|
|
2404
|
+
},
|
|
2405
|
+
{
|
|
2406
|
+
provide: SELECT_CONFIG,
|
|
2407
|
+
useValue: deepMerge(DEFAULT_SELECT_CONFIG, config.components.select),
|
|
1862
2408
|
},
|
|
1863
2409
|
{
|
|
1864
2410
|
provide: SWITCH_CONFIG,
|
|
1865
|
-
useValue:
|
|
2411
|
+
useValue: deepMerge(DEFAULT_SWITCH_CONFIG, config.components.switch),
|
|
1866
2412
|
},
|
|
1867
2413
|
{
|
|
1868
2414
|
provide: FORM_ITEM_CONFIG,
|
|
1869
|
-
useValue:
|
|
2415
|
+
useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
|
|
2416
|
+
},
|
|
2417
|
+
{ provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG, config.components.icon) },
|
|
2418
|
+
{
|
|
2419
|
+
provide: PAGINATION_CONFIG,
|
|
2420
|
+
useValue: deepMerge(DEFAULT_PAGINATION_CONFIG, config.components.pagination),
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
provide: POPOVER_CONFIG,
|
|
2424
|
+
useValue: deepMerge(DEFAULT_POPOVER_CONFIG, config.components.popover),
|
|
1870
2425
|
},
|
|
1871
|
-
{ provide: ICON_CONFIG, useValue: mergeConfig(DEFAULT_ICON_CONFIG, config.components.icon) },
|
|
1872
2426
|
{
|
|
1873
2427
|
provide: SKELETON_CONFIG,
|
|
1874
|
-
useValue:
|
|
2428
|
+
useValue: deepMerge(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
|
|
1875
2429
|
},
|
|
1876
2430
|
{
|
|
1877
2431
|
provide: STEPPER_CONFIG,
|
|
1878
|
-
useValue:
|
|
2432
|
+
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, config.components.stepper),
|
|
1879
2433
|
},
|
|
1880
|
-
{ provide:
|
|
2434
|
+
{ provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG, config.components.table) },
|
|
2435
|
+
{ provide: TABS_CONFIG, useValue: deepMerge(DEFAULT_TABS_CONFIG, config.components.tabs) },
|
|
1881
2436
|
{
|
|
1882
2437
|
provide: TOOLTIP_CONFIG,
|
|
1883
|
-
useValue:
|
|
2438
|
+
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
|
|
1884
2439
|
},
|
|
1885
2440
|
]);
|
|
1886
2441
|
};
|
|
@@ -1889,5 +2444,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
1889
2444
|
* Generated bundle index. Do not edit.
|
|
1890
2445
|
*/
|
|
1891
2446
|
|
|
1892
|
-
export { ALERT_CONFIG, Alert, BUTTON_CONFIG,
|
|
2447
|
+
export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, Checkbox, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TooltipDirective, provideThalassicUIConfig };
|
|
1893
2448
|
//# sourceMappingURL=thalassic-ui.mjs.map
|