@thalassic/ui 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/thalassic-ui-charts.mjs +340 -0
- package/fesm2022/thalassic-ui-charts.mjs.map +1 -0
- package/fesm2022/thalassic-ui.mjs +357 -450
- 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 +125 -115
|
@@ -1,18 +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, signal, viewChild, output, effect, forwardRef, viewChildren, numberAttribute, contentChildren, isDevMode, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { RouterLink } from '@angular/router';
|
|
5
|
-
import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
|
|
6
|
-
import { ThemeService } from '@thalassic/core';
|
|
7
|
-
import { Chart as Chart$1, BarController, BarElement, CategoryScale, LinearScale, BubbleController, PointElement, DoughnutController, ArcElement, LineController, LineElement, PieController, PolarAreaController, RadialLinearScale, RadarController, ScatterController } from 'chart.js';
|
|
8
5
|
import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
|
|
9
6
|
import { CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
|
|
10
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';
|
|
11
8
|
import { Overlay } from '@angular/cdk/overlay';
|
|
9
|
+
import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
|
|
10
|
+
import { filter, throwError, map, shareReplay } from 'rxjs';
|
|
12
11
|
import { HttpClient } from '@angular/common/http';
|
|
13
12
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
14
|
-
import { throwError, map, shareReplay } from 'rxjs';
|
|
15
13
|
import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
14
|
+
import { deepMerge } from '@thalassic/core';
|
|
16
15
|
|
|
17
16
|
const DEFAULT_ALERT_CONFIG = {
|
|
18
17
|
color: 'primary',
|
|
@@ -154,325 +153,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
154
153
|
}]
|
|
155
154
|
}] });
|
|
156
155
|
|
|
157
|
-
const CHART_ELEMENT = new InjectionToken('CHART_ELEMENT');
|
|
158
|
-
class ChartElement {
|
|
159
|
-
dataset = input.required({ ...(ngDevMode ? { debugName: "dataset" } : {}), transform: value => ({
|
|
160
|
-
type: this.type,
|
|
161
|
-
...value,
|
|
162
|
-
}) });
|
|
163
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartElement, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
164
|
-
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 });
|
|
165
|
-
}
|
|
166
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartElement, decorators: [{
|
|
167
|
-
type: Directive
|
|
168
|
-
}], propDecorators: { dataset: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataset", required: true }] }] } });
|
|
169
|
-
|
|
170
|
-
const CARTESIAN_CHARTS = [
|
|
171
|
-
'bar',
|
|
172
|
-
'line',
|
|
173
|
-
'scatter',
|
|
174
|
-
'bubble',
|
|
175
|
-
];
|
|
176
|
-
const RADIAL_CHARTS = ['polarArea', 'radar'];
|
|
177
|
-
|
|
178
|
-
class ChartService {
|
|
179
|
-
_elementRef = inject(ElementRef);
|
|
180
|
-
getColorOptions(chartElements) {
|
|
181
|
-
const scaleTypes = this._getScaleTypes(chartElements);
|
|
182
|
-
const computedStyle = getComputedStyle(this._elementRef.nativeElement);
|
|
183
|
-
return {
|
|
184
|
-
backgroundColor: computedStyle.getPropertyValue('--tls-chart-background-color'),
|
|
185
|
-
borderColor: computedStyle.getPropertyValue('--tls-chart-border-color'),
|
|
186
|
-
color: computedStyle.getPropertyValue('--tls-chart-color'),
|
|
187
|
-
scales: this._getScales(scaleTypes),
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
// Private methods
|
|
191
|
-
_getScales(scaleTypes) {
|
|
192
|
-
const scales = {};
|
|
193
|
-
if (scaleTypes.includes('cartesian')) {
|
|
194
|
-
scales['x'] = this._getCartesianScales('x');
|
|
195
|
-
scales['y'] = this._getCartesianScales('y');
|
|
196
|
-
}
|
|
197
|
-
if (scaleTypes.includes('radial')) {
|
|
198
|
-
scales['r'] = this._getRadialScales();
|
|
199
|
-
}
|
|
200
|
-
return scales;
|
|
201
|
-
}
|
|
202
|
-
_getCartesianScales(axis) {
|
|
203
|
-
const computedStyle = getComputedStyle(this._elementRef.nativeElement);
|
|
204
|
-
return {
|
|
205
|
-
ticks: {
|
|
206
|
-
color: computedStyle.getPropertyValue(`--tls-chart-${axis}-ticks-color`),
|
|
207
|
-
},
|
|
208
|
-
grid: {
|
|
209
|
-
color: computedStyle.getPropertyValue(`--tls-chart-${axis}-grid-color`),
|
|
210
|
-
},
|
|
211
|
-
border: {
|
|
212
|
-
color: computedStyle.getPropertyValue(`--tls-chart-${axis}-axis-color`),
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
_getRadialScales() {
|
|
217
|
-
const computedStyle = getComputedStyle(this._elementRef.nativeElement);
|
|
218
|
-
return {
|
|
219
|
-
angleLines: {
|
|
220
|
-
color: computedStyle.getPropertyValue('--tls-chart-r-angle-lines-color'),
|
|
221
|
-
},
|
|
222
|
-
grid: {
|
|
223
|
-
color: computedStyle.getPropertyValue('--tls-chart-r-grid-color'),
|
|
224
|
-
},
|
|
225
|
-
pointLabels: {
|
|
226
|
-
color: computedStyle.getPropertyValue('--tls-chart-r-labels-color'),
|
|
227
|
-
},
|
|
228
|
-
ticks: {
|
|
229
|
-
color: computedStyle.getPropertyValue('--tls-chart-r-ticks-color'),
|
|
230
|
-
backdropColor: computedStyle.getPropertyValue('--tls-chart-r-ticks-backdrop-color'),
|
|
231
|
-
},
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
_getScaleTypes(chartElements) {
|
|
235
|
-
const types = [];
|
|
236
|
-
if (chartElements.some(element => CARTESIAN_CHARTS.includes(element.type)))
|
|
237
|
-
types.push('cartesian');
|
|
238
|
-
if (chartElements.some(element => RADIAL_CHARTS.includes(element.type)))
|
|
239
|
-
types.push('radial');
|
|
240
|
-
return types;
|
|
241
|
-
}
|
|
242
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
243
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService });
|
|
244
|
-
}
|
|
245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService, decorators: [{
|
|
246
|
-
type: Injectable
|
|
247
|
-
}] });
|
|
248
|
-
|
|
249
|
-
const DEFAULT_CHART_CONFIG = {
|
|
250
|
-
options: {
|
|
251
|
-
maintainAspectRatio: false,
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const CHART_CONFIG = new InjectionToken('CHART_CONFIG', {
|
|
256
|
-
factory: () => DEFAULT_CHART_CONFIG,
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
class Chart {
|
|
260
|
-
_config = inject(CHART_CONFIG);
|
|
261
|
-
_chartService = inject(ChartService);
|
|
262
|
-
_destroyRef = inject(DestroyRef);
|
|
263
|
-
_themeService = inject(ThemeService, { optional: true });
|
|
264
|
-
canvasRef = viewChild('canvas', ...(ngDevMode ? [{ debugName: "canvasRef" }] : []));
|
|
265
|
-
chartElements = contentChildren(CHART_ELEMENT, ...(ngDevMode ? [{ debugName: "chartElements" }] : []));
|
|
266
|
-
_chart = null;
|
|
267
|
-
labels = input([], ...(ngDevMode ? [{ debugName: "labels" }] : []));
|
|
268
|
-
options = input(undefined, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
269
|
-
// Computed
|
|
270
|
-
_options = computed(() => {
|
|
271
|
-
const options = this.options();
|
|
272
|
-
const colorOptions = this._chartService.getColorOptions(this.chartElements());
|
|
273
|
-
if (options)
|
|
274
|
-
return { ...colorOptions, ...this._config.options, ...options };
|
|
275
|
-
else
|
|
276
|
-
return { ...colorOptions, ...this._config.options };
|
|
277
|
-
}, ...(ngDevMode ? [{ debugName: "_options" }] : []));
|
|
278
|
-
_datasets = computed(() => this.chartElements().map(element => element.dataset()), ...(ngDevMode ? [{ debugName: "_datasets" }] : []));
|
|
279
|
-
hostClasses = computed(() => {
|
|
280
|
-
const className = 'tls-chart';
|
|
281
|
-
const array = [className];
|
|
282
|
-
return array;
|
|
283
|
-
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
284
|
-
constructor() {
|
|
285
|
-
afterNextRender(() => {
|
|
286
|
-
if (this.canvasElement) {
|
|
287
|
-
const config = {
|
|
288
|
-
options: this._options(),
|
|
289
|
-
data: {
|
|
290
|
-
labels: this.labels(),
|
|
291
|
-
datasets: this._datasets(),
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
this._chart = new Chart$1(this.canvasElement, config);
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
// Accessors
|
|
299
|
-
get canvasElement() {
|
|
300
|
-
return this.canvasRef()?.nativeElement;
|
|
301
|
-
}
|
|
302
|
-
// Private methods
|
|
303
|
-
_tryInitThemeListener() {
|
|
304
|
-
if (this._themeService) {
|
|
305
|
-
this._themeService.onThemeChange.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
|
306
|
-
if (this._chart) {
|
|
307
|
-
const colorOptions = this._chartService.getColorOptions(this.chartElements());
|
|
308
|
-
this._chart.options = { ...this._options(), ...colorOptions };
|
|
309
|
-
this._chart.update('none');
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
// Lifecycle
|
|
315
|
-
ngOnInit() {
|
|
316
|
-
this._tryInitThemeListener();
|
|
317
|
-
}
|
|
318
|
-
ngOnDestroy() {
|
|
319
|
-
if (this._chart)
|
|
320
|
-
this._chart.destroy();
|
|
321
|
-
}
|
|
322
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
323
|
-
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: ["canvas"], descendants: true, isSignal: true }], ngImport: i0, template: "<canvas #canvas></canvas>\n", styles: [":host{position:relative;display:block}\n"] });
|
|
324
|
-
}
|
|
325
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chart, decorators: [{
|
|
326
|
-
type: Component,
|
|
327
|
-
args: [{ selector: 'tls-chart', imports: [], host: {
|
|
328
|
-
'[class]': 'hostClasses()',
|
|
329
|
-
}, providers: [ChartService], template: "<canvas #canvas></canvas>\n", styles: [":host{position:relative;display:block}\n"] }]
|
|
330
|
-
}], ctorParameters: () => [], propDecorators: { canvasRef: [{ type: i0.ViewChild, args: ['canvas', { 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 }] }] } });
|
|
331
|
-
|
|
332
|
-
class BarChart extends ChartElement {
|
|
333
|
-
type = 'bar';
|
|
334
|
-
constructor() {
|
|
335
|
-
super();
|
|
336
|
-
Chart$1.register(BarController, BarElement, CategoryScale, LinearScale);
|
|
337
|
-
}
|
|
338
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BarChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
339
|
-
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 });
|
|
340
|
-
}
|
|
341
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BarChart, decorators: [{
|
|
342
|
-
type: Component,
|
|
343
|
-
args: [{
|
|
344
|
-
selector: 'tls-bar-chart',
|
|
345
|
-
template: '',
|
|
346
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BarChart) }],
|
|
347
|
-
}]
|
|
348
|
-
}], ctorParameters: () => [] });
|
|
349
|
-
|
|
350
|
-
class BubbleChart extends ChartElement {
|
|
351
|
-
type = 'bubble';
|
|
352
|
-
constructor() {
|
|
353
|
-
super();
|
|
354
|
-
Chart$1.register(BubbleController, PointElement, LinearScale);
|
|
355
|
-
}
|
|
356
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BubbleChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
357
|
-
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 });
|
|
358
|
-
}
|
|
359
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BubbleChart, decorators: [{
|
|
360
|
-
type: Component,
|
|
361
|
-
args: [{
|
|
362
|
-
selector: 'tls-bubble-chart',
|
|
363
|
-
template: '',
|
|
364
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BubbleChart) }],
|
|
365
|
-
}]
|
|
366
|
-
}], ctorParameters: () => [] });
|
|
367
|
-
|
|
368
|
-
class DoughnutChart extends ChartElement {
|
|
369
|
-
type = 'doughnut';
|
|
370
|
-
constructor() {
|
|
371
|
-
super();
|
|
372
|
-
Chart$1.register(DoughnutController, ArcElement);
|
|
373
|
-
}
|
|
374
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DoughnutChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
375
|
-
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 });
|
|
376
|
-
}
|
|
377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DoughnutChart, decorators: [{
|
|
378
|
-
type: Component,
|
|
379
|
-
args: [{
|
|
380
|
-
selector: 'tls-doughnut-chart',
|
|
381
|
-
template: '',
|
|
382
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => DoughnutChart) }],
|
|
383
|
-
}]
|
|
384
|
-
}], ctorParameters: () => [] });
|
|
385
|
-
|
|
386
|
-
class LineChart extends ChartElement {
|
|
387
|
-
type = 'line';
|
|
388
|
-
constructor() {
|
|
389
|
-
super();
|
|
390
|
-
Chart$1.register(LineController, LineElement, PointElement, CategoryScale, LinearScale);
|
|
391
|
-
}
|
|
392
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: LineChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
393
|
-
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 });
|
|
394
|
-
}
|
|
395
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: LineChart, decorators: [{
|
|
396
|
-
type: Component,
|
|
397
|
-
args: [{
|
|
398
|
-
selector: 'tls-line-chart',
|
|
399
|
-
template: '',
|
|
400
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => LineChart) }],
|
|
401
|
-
}]
|
|
402
|
-
}], ctorParameters: () => [] });
|
|
403
|
-
|
|
404
|
-
class PieChart extends ChartElement {
|
|
405
|
-
type = 'pie';
|
|
406
|
-
constructor() {
|
|
407
|
-
super();
|
|
408
|
-
Chart$1.register(PieController, ArcElement);
|
|
409
|
-
}
|
|
410
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PieChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
411
|
-
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 });
|
|
412
|
-
}
|
|
413
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PieChart, decorators: [{
|
|
414
|
-
type: Component,
|
|
415
|
-
args: [{
|
|
416
|
-
selector: 'tls-pie-chart',
|
|
417
|
-
template: '',
|
|
418
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PieChart) }],
|
|
419
|
-
}]
|
|
420
|
-
}], ctorParameters: () => [] });
|
|
421
|
-
|
|
422
|
-
class PolarAreaChart extends ChartElement {
|
|
423
|
-
type = 'polarArea';
|
|
424
|
-
constructor() {
|
|
425
|
-
super();
|
|
426
|
-
Chart$1.register(PolarAreaController, ArcElement, RadialLinearScale);
|
|
427
|
-
}
|
|
428
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PolarAreaChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
429
|
-
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 });
|
|
430
|
-
}
|
|
431
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PolarAreaChart, decorators: [{
|
|
432
|
-
type: Component,
|
|
433
|
-
args: [{
|
|
434
|
-
selector: 'tls-polar-area-chart',
|
|
435
|
-
template: '',
|
|
436
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PolarAreaChart) }],
|
|
437
|
-
}]
|
|
438
|
-
}], ctorParameters: () => [] });
|
|
439
|
-
|
|
440
|
-
class RadarChart extends ChartElement {
|
|
441
|
-
type = 'radar';
|
|
442
|
-
constructor() {
|
|
443
|
-
super();
|
|
444
|
-
Chart$1.register(RadarController, LineElement, PointElement, RadialLinearScale);
|
|
445
|
-
}
|
|
446
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadarChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
447
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: RadarChart, isStandalone: true, selector: "tls-radar-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => RadarChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
448
|
-
}
|
|
449
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadarChart, decorators: [{
|
|
450
|
-
type: Component,
|
|
451
|
-
args: [{
|
|
452
|
-
selector: 'tls-radar-chart',
|
|
453
|
-
template: '',
|
|
454
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => RadarChart) }],
|
|
455
|
-
}]
|
|
456
|
-
}], ctorParameters: () => [] });
|
|
457
|
-
|
|
458
|
-
class ScatterChart extends ChartElement {
|
|
459
|
-
type = 'scatter';
|
|
460
|
-
constructor() {
|
|
461
|
-
super();
|
|
462
|
-
Chart$1.register(ScatterController, PointElement, LinearScale);
|
|
463
|
-
}
|
|
464
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ScatterChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
465
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: ScatterChart, isStandalone: true, selector: "tls-scatter-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => ScatterChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
466
|
-
}
|
|
467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ScatterChart, decorators: [{
|
|
468
|
-
type: Component,
|
|
469
|
-
args: [{
|
|
470
|
-
selector: 'tls-scatter-chart',
|
|
471
|
-
template: '',
|
|
472
|
-
providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => ScatterChart) }],
|
|
473
|
-
}]
|
|
474
|
-
}], ctorParameters: () => [] });
|
|
475
|
-
|
|
476
156
|
const DEFAULT_DIALOG_CONFIG = {
|
|
477
157
|
size: 'md',
|
|
478
158
|
closeable: true,
|
|
@@ -768,6 +448,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
768
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" }]
|
|
769
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 }] }] } });
|
|
770
450
|
|
|
451
|
+
const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
|
|
452
|
+
/**
|
|
453
|
+
* Owns the CDK-Overlay lifecycle shared by the library's connected overlay
|
|
454
|
+
* components (popover, menu, select): create/attach, dismissal wiring
|
|
455
|
+
* (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
|
|
456
|
+
* positional and dismissal differences between components are expressed through
|
|
457
|
+
* {@link ConnectedOverlayConfig} rather than duplicated per component.
|
|
458
|
+
*
|
|
459
|
+
* Create one via {@link createOverlayManager} from a component field initializer
|
|
460
|
+
* so it is bound to the host's injection context.
|
|
461
|
+
*/
|
|
462
|
+
class OverlayManager {
|
|
463
|
+
_overlay = inject(Overlay);
|
|
464
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
465
|
+
_destroyRef = inject(DestroyRef);
|
|
466
|
+
_overlayRef = null;
|
|
467
|
+
_config = null;
|
|
468
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
469
|
+
isOpen = this._isOpen.asReadonly();
|
|
470
|
+
// Dispose the overlay with the host. Registered in a field initializer so no
|
|
471
|
+
// constructor is needed.
|
|
472
|
+
_teardown = this._destroyRef.onDestroy(() => this._dispose());
|
|
473
|
+
open(config) {
|
|
474
|
+
if (this._isOpen())
|
|
475
|
+
return;
|
|
476
|
+
this._config = config;
|
|
477
|
+
if (!this._overlayRef) {
|
|
478
|
+
this._overlayRef = this._overlay.create({
|
|
479
|
+
positionStrategy: this._buildPositionStrategy(config),
|
|
480
|
+
scrollStrategy: config.scrollStrategy === 'close'
|
|
481
|
+
? this._overlay.scrollStrategies.close()
|
|
482
|
+
: this._overlay.scrollStrategies.reposition(),
|
|
483
|
+
hasBackdrop: config.hasBackdrop ?? true,
|
|
484
|
+
backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
|
|
485
|
+
...(config.panelClass != null && { panelClass: config.panelClass }),
|
|
486
|
+
});
|
|
487
|
+
this._wireDismissal(this._overlayRef, config);
|
|
488
|
+
}
|
|
489
|
+
if (config.minWidth != null) {
|
|
490
|
+
this._overlayRef.updateSize({ minWidth: config.minWidth });
|
|
491
|
+
}
|
|
492
|
+
this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
|
|
493
|
+
this._isOpen.set(true);
|
|
494
|
+
}
|
|
495
|
+
close() {
|
|
496
|
+
if (!this._isOpen())
|
|
497
|
+
return;
|
|
498
|
+
if (this._config?.reuse) {
|
|
499
|
+
this._overlayRef?.detach();
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
this._overlayRef?.dispose();
|
|
503
|
+
this._overlayRef = null;
|
|
504
|
+
}
|
|
505
|
+
this._isOpen.set(false);
|
|
506
|
+
this._config?.onClose?.();
|
|
507
|
+
}
|
|
508
|
+
// Private
|
|
509
|
+
_buildPositionStrategy(config) {
|
|
510
|
+
let strategy = this._overlay
|
|
511
|
+
.position()
|
|
512
|
+
.flexibleConnectedTo(config.origin)
|
|
513
|
+
.withPositions(config.positions);
|
|
514
|
+
if (config.flexibleDimensions === false)
|
|
515
|
+
strategy = strategy.withFlexibleDimensions(false);
|
|
516
|
+
if (config.push === false)
|
|
517
|
+
strategy = strategy.withPush(false);
|
|
518
|
+
return strategy;
|
|
519
|
+
}
|
|
520
|
+
_wireDismissal(overlayRef, config) {
|
|
521
|
+
const hasBackdrop = config.hasBackdrop ?? true;
|
|
522
|
+
if (config.closeOnBackdropClick ?? hasBackdrop) {
|
|
523
|
+
overlayRef
|
|
524
|
+
.backdropClick()
|
|
525
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
526
|
+
.subscribe(() => this.close());
|
|
527
|
+
}
|
|
528
|
+
if (config.closeOnOutsidePointer ?? !hasBackdrop) {
|
|
529
|
+
overlayRef
|
|
530
|
+
.outsidePointerEvents()
|
|
531
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'))
|
|
532
|
+
.subscribe(() => this.close());
|
|
533
|
+
}
|
|
534
|
+
if (config.closeOnEscape ?? true) {
|
|
535
|
+
overlayRef
|
|
536
|
+
.keydownEvents()
|
|
537
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
|
|
538
|
+
.subscribe(() => this.close());
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
_dispose() {
|
|
542
|
+
this._overlayRef?.dispose();
|
|
543
|
+
this._overlayRef = null;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Creates an {@link OverlayManager} bound to the current injection context.
|
|
548
|
+
* Call from a component/directive field initializer or constructor.
|
|
549
|
+
*/
|
|
550
|
+
function createOverlayManager() {
|
|
551
|
+
return new OverlayManager();
|
|
552
|
+
}
|
|
553
|
+
|
|
771
554
|
const OVERLAY_POSITION_MAP = {
|
|
772
555
|
top: {
|
|
773
556
|
originX: 'center',
|
|
@@ -910,22 +693,6 @@ const buildOverlayPositions = (position, offset) => {
|
|
|
910
693
|
}));
|
|
911
694
|
};
|
|
912
695
|
|
|
913
|
-
const isPlainObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
914
|
-
|
|
915
|
-
const mergeConfig = (defaults, overrides) => {
|
|
916
|
-
if (!overrides)
|
|
917
|
-
return defaults;
|
|
918
|
-
const result = { ...defaults };
|
|
919
|
-
for (const key in overrides) {
|
|
920
|
-
const defaultValue = defaults[key];
|
|
921
|
-
const overrideValue = overrides[key];
|
|
922
|
-
result[key] = (isPlainObject(defaultValue) && isPlainObject(overrideValue)
|
|
923
|
-
? mergeConfig(defaultValue, overrideValue)
|
|
924
|
-
: overrideValue);
|
|
925
|
-
}
|
|
926
|
-
return result;
|
|
927
|
-
};
|
|
928
|
-
|
|
929
696
|
const DEFAULT_POPOVER_CONFIG = {
|
|
930
697
|
position: 'bottom',
|
|
931
698
|
offset: { x: 0, y: 4 },
|
|
@@ -937,61 +704,35 @@ const POPOVER_CONFIG = new InjectionToken('POPOVER_CONFIG', {
|
|
|
937
704
|
|
|
938
705
|
class Popover {
|
|
939
706
|
static _counter = 0;
|
|
940
|
-
_overlay = inject(Overlay);
|
|
941
|
-
_viewContainerRef = inject(ViewContainerRef);
|
|
942
707
|
_config = inject(POPOVER_CONFIG);
|
|
943
|
-
|
|
708
|
+
_overlay = createOverlayManager();
|
|
944
709
|
_templateRef = viewChild.required('content');
|
|
945
|
-
_overlayRef = null;
|
|
946
|
-
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
947
710
|
id = `tls-popover-${++Popover._counter}`;
|
|
948
|
-
isOpen = this.
|
|
711
|
+
isOpen = this._overlay.isOpen;
|
|
949
712
|
position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
950
713
|
offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
|
|
951
714
|
ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
952
715
|
_positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
|
|
953
716
|
// Public methods
|
|
954
717
|
open(trigger) {
|
|
955
|
-
if (this._overlayRef)
|
|
956
|
-
return;
|
|
957
718
|
const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
|
|
958
|
-
|
|
959
|
-
.
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
this._overlayRef = this._overlay.create({
|
|
963
|
-
positionStrategy,
|
|
964
|
-
scrollStrategy: this._overlay.scrollStrategies.reposition(),
|
|
965
|
-
hasBackdrop: true,
|
|
966
|
-
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
719
|
+
this._overlay.open({
|
|
720
|
+
content: this._templateRef(),
|
|
721
|
+
origin,
|
|
722
|
+
positions: this._positions(),
|
|
967
723
|
});
|
|
968
|
-
this._overlayRef
|
|
969
|
-
.backdropClick()
|
|
970
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
971
|
-
.subscribe(() => this.close());
|
|
972
|
-
this._overlayRef.attach(new TemplatePortal(this._templateRef(), this._viewContainerRef));
|
|
973
|
-
this._isOpen.set(true);
|
|
974
724
|
}
|
|
975
725
|
close() {
|
|
976
|
-
|
|
977
|
-
return;
|
|
978
|
-
this._overlayRef.dispose();
|
|
979
|
-
this._overlayRef = null;
|
|
980
|
-
this._isOpen.set(false);
|
|
726
|
+
this._overlay.close();
|
|
981
727
|
}
|
|
982
728
|
toggle(trigger) {
|
|
983
|
-
if (this.
|
|
729
|
+
if (this.isOpen()) {
|
|
984
730
|
this.close();
|
|
985
731
|
}
|
|
986
732
|
else {
|
|
987
733
|
this.open(trigger);
|
|
988
734
|
}
|
|
989
735
|
}
|
|
990
|
-
// Lifecycle
|
|
991
|
-
ngOnDestroy() {
|
|
992
|
-
if (this._overlayRef)
|
|
993
|
-
this._overlayRef.dispose();
|
|
994
|
-
}
|
|
995
736
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Popover, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
996
737
|
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: `
|
|
997
738
|
<ng-template #content>
|
|
@@ -1624,14 +1365,10 @@ const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
|
1624
1365
|
|
|
1625
1366
|
class Select extends ValueFormControl {
|
|
1626
1367
|
_config = inject(SELECT_CONFIG);
|
|
1627
|
-
_overlay =
|
|
1628
|
-
_viewContainerRef = inject(ViewContainerRef);
|
|
1629
|
-
_destroyRef = inject(DestroyRef);
|
|
1368
|
+
_overlay = createOverlayManager();
|
|
1630
1369
|
_triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "_triggerElement" }] : []));
|
|
1631
1370
|
_panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "_panelTemplate" }] : []));
|
|
1632
|
-
|
|
1633
|
-
_portal = null;
|
|
1634
|
-
value = model(undefined, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1371
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1635
1372
|
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
1636
1373
|
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1637
1374
|
optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
|
|
@@ -1642,7 +1379,7 @@ class Select extends ValueFormControl {
|
|
|
1642
1379
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1643
1380
|
tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
|
|
1644
1381
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
|
|
1645
|
-
isOpen =
|
|
1382
|
+
isOpen = this._overlay.isOpen;
|
|
1646
1383
|
activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
1647
1384
|
normalizedOptions = computed(() => {
|
|
1648
1385
|
const options = this.options();
|
|
@@ -1686,44 +1423,29 @@ class Select extends ValueFormControl {
|
|
|
1686
1423
|
const panelTemplate = this._panelTemplate();
|
|
1687
1424
|
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
1688
1425
|
return;
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
panelClass: 'tls-select-panel',
|
|
1709
|
-
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
1710
|
-
});
|
|
1711
|
-
this._overlayRef
|
|
1712
|
-
.backdropClick()
|
|
1713
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
1714
|
-
.subscribe(() => this.close());
|
|
1715
|
-
}
|
|
1716
|
-
this._portal ??= new TemplatePortal(panelTemplate, this._viewContainerRef);
|
|
1717
|
-
this._overlayRef.updateSize({ minWidth: triggerElement.nativeElement.offsetWidth });
|
|
1718
|
-
this._overlayRef.attach(this._portal);
|
|
1719
|
-
this.isOpen.set(true);
|
|
1426
|
+
this._overlay.open({
|
|
1427
|
+
content: panelTemplate,
|
|
1428
|
+
origin: triggerElement,
|
|
1429
|
+
positions: [
|
|
1430
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
1431
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
1432
|
+
],
|
|
1433
|
+
flexibleDimensions: false,
|
|
1434
|
+
push: false,
|
|
1435
|
+
panelClass: 'tls-select-panel',
|
|
1436
|
+
// Select handles Escape itself via the trigger's keydown handler.
|
|
1437
|
+
closeOnEscape: false,
|
|
1438
|
+
minWidth: triggerElement.nativeElement.offsetWidth,
|
|
1439
|
+
reuse: true,
|
|
1440
|
+
onClose: () => {
|
|
1441
|
+
this.activeIndex.set(-1);
|
|
1442
|
+
this._triggerElement()?.nativeElement.focus();
|
|
1443
|
+
},
|
|
1444
|
+
});
|
|
1720
1445
|
this.activeIndex.set(this.normalizedOptions().findIndex(option => option.value === this.value()));
|
|
1721
1446
|
}
|
|
1722
1447
|
close() {
|
|
1723
|
-
this.
|
|
1724
|
-
this.isOpen.set(false);
|
|
1725
|
-
this.activeIndex.set(-1);
|
|
1726
|
-
this._triggerElement()?.nativeElement.focus();
|
|
1448
|
+
this._overlay.close();
|
|
1727
1449
|
}
|
|
1728
1450
|
toggle() {
|
|
1729
1451
|
if (this.isOpen()) {
|
|
@@ -1740,7 +1462,7 @@ class Select extends ValueFormControl {
|
|
|
1740
1462
|
this.close();
|
|
1741
1463
|
}
|
|
1742
1464
|
clear() {
|
|
1743
|
-
this.value.set(
|
|
1465
|
+
this.value.set(null);
|
|
1744
1466
|
}
|
|
1745
1467
|
onOptionHover(index, disabled) {
|
|
1746
1468
|
if (!disabled)
|
|
@@ -1803,11 +1525,6 @@ class Select extends ValueFormControl {
|
|
|
1803
1525
|
next += direction;
|
|
1804
1526
|
}
|
|
1805
1527
|
}
|
|
1806
|
-
// Lifecycle
|
|
1807
|
-
ngOnDestroy() {
|
|
1808
|
-
if (this._overlayRef)
|
|
1809
|
-
this._overlayRef.dispose();
|
|
1810
|
-
}
|
|
1811
1528
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1812
1529
|
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" });
|
|
1813
1530
|
}
|
|
@@ -1868,6 +1585,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1868
1585
|
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Switch) }], template: "<input\n type=\"checkbox\"\n class=\"tls-switch-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n/>\n<div class=\"tls-switch-handle\"></div>\n" }]
|
|
1869
1586
|
}], propDecorators: { 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 }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
1870
1587
|
|
|
1588
|
+
const DEFAULT_TEXTAREA_CONFIG = {
|
|
1589
|
+
size: 'md',
|
|
1590
|
+
placeholder: '',
|
|
1591
|
+
fluid: false,
|
|
1592
|
+
rows: 3,
|
|
1593
|
+
resize: 'vertical',
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
const TEXTAREA_CONFIG = new InjectionToken('TEXTAREA_CONFIG', {
|
|
1597
|
+
factory: () => DEFAULT_TEXTAREA_CONFIG,
|
|
1598
|
+
});
|
|
1599
|
+
|
|
1600
|
+
class Textarea extends ValueFormControl {
|
|
1601
|
+
_config = inject(TEXTAREA_CONFIG);
|
|
1602
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1603
|
+
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
1604
|
+
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1605
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1606
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1607
|
+
rows = input(this._config.rows, { ...(ngDevMode ? { debugName: "rows" } : {}), transform: numberAttribute });
|
|
1608
|
+
resize = input(this._config.resize, ...(ngDevMode ? [{ debugName: "resize" }] : []));
|
|
1609
|
+
classes = computed(() => {
|
|
1610
|
+
const array = [this.CLASS_NAME];
|
|
1611
|
+
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
1612
|
+
if (this.fluid())
|
|
1613
|
+
array.push(`${this.CLASS_NAME}--fluid`);
|
|
1614
|
+
return array.concat(this.controlClasses());
|
|
1615
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
1616
|
+
// Protected methods
|
|
1617
|
+
onInput(event) {
|
|
1618
|
+
const target = event.target;
|
|
1619
|
+
this.value.set(target.value);
|
|
1620
|
+
}
|
|
1621
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Textarea, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1622
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Textarea, isStandalone: true, selector: "tls-textarea", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, resize: { classPropertyName: "resize", publicName: "resize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { classAttribute: "tls-textarea" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], usesInheritance: true, ngImport: i0, template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"resize()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] });
|
|
1623
|
+
}
|
|
1624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Textarea, decorators: [{
|
|
1625
|
+
type: Component,
|
|
1626
|
+
args: [{ selector: 'tls-textarea', host: { class: 'tls-textarea' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"resize()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] }]
|
|
1627
|
+
}], propDecorators: { 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 }] }], 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 }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }] } });
|
|
1628
|
+
|
|
1871
1629
|
class IconService {
|
|
1872
1630
|
_http = inject(HttpClient);
|
|
1873
1631
|
_sanitizer = inject(DomSanitizer);
|
|
@@ -2038,6 +1796,160 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
2038
1796
|
}]
|
|
2039
1797
|
}], 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 }] }] } });
|
|
2040
1798
|
|
|
1799
|
+
class MenuItemComponent {
|
|
1800
|
+
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
|
|
1801
|
+
templateRef = viewChild.required('template');
|
|
1802
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1803
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: MenuItemComponent, isStandalone: true, selector: "tls-menu-item", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null } }, host: { styleAttribute: "display: none" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["template"], descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #template><ng-content /></ng-template>`, isInline: true });
|
|
1804
|
+
}
|
|
1805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItemComponent, decorators: [{
|
|
1806
|
+
type: Component,
|
|
1807
|
+
args: [{
|
|
1808
|
+
selector: 'tls-menu-item',
|
|
1809
|
+
template: `<ng-template #template><ng-content /></ng-template>`,
|
|
1810
|
+
host: { style: 'display: none' },
|
|
1811
|
+
}]
|
|
1812
|
+
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], templateRef: [{ type: i0.ViewChild, args: ['template', { isSignal: true }] }] } });
|
|
1813
|
+
|
|
1814
|
+
const DEFAULT_MENU_CONFIG = {
|
|
1815
|
+
position: 'bottom-start',
|
|
1816
|
+
offset: { x: 0, y: 4 },
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
const MENU_CONFIG = new InjectionToken('MENU_CONFIG', {
|
|
1820
|
+
factory: () => DEFAULT_MENU_CONFIG,
|
|
1821
|
+
});
|
|
1822
|
+
|
|
1823
|
+
class Menu {
|
|
1824
|
+
static _counter = 0;
|
|
1825
|
+
_config = inject(MENU_CONFIG);
|
|
1826
|
+
_overlay = createOverlayManager();
|
|
1827
|
+
_panelRef = viewChild.required('panel');
|
|
1828
|
+
_customItems = contentChildren(MenuItemComponent, ...(ngDevMode ? [{ debugName: "_customItems" }] : []));
|
|
1829
|
+
customTemplates = computed(() => {
|
|
1830
|
+
const map = new Map();
|
|
1831
|
+
for (const item of this._customItems()) {
|
|
1832
|
+
map.set(item.key(), item.templateRef());
|
|
1833
|
+
}
|
|
1834
|
+
return map;
|
|
1835
|
+
}, ...(ngDevMode ? [{ debugName: "customTemplates" }] : []));
|
|
1836
|
+
itemTemplate = contentChild('itemTemplate', ...(ngDevMode ? [{ debugName: "itemTemplate" }] : []));
|
|
1837
|
+
labelTemplate = contentChild('labelTemplate', ...(ngDevMode ? [{ debugName: "labelTemplate" }] : []));
|
|
1838
|
+
dividerTemplate = contentChild('dividerTemplate', ...(ngDevMode ? [{ debugName: "dividerTemplate" }] : []));
|
|
1839
|
+
iconTemplate = contentChild('iconTemplate', ...(ngDevMode ? [{ debugName: "iconTemplate" }] : []));
|
|
1840
|
+
id = `tls-menu-${++Menu._counter}`;
|
|
1841
|
+
// Inputs
|
|
1842
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1843
|
+
position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
1844
|
+
offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
|
|
1845
|
+
ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
1846
|
+
inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : {}), transform: booleanAttribute });
|
|
1847
|
+
_positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
|
|
1848
|
+
// An inline menu is always "open" (rendered in place); otherwise reflect the overlay.
|
|
1849
|
+
isOpen = computed(() => this.inline() || this._overlay.isOpen(), ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1850
|
+
constructor() {
|
|
1851
|
+
if (isDevMode()) {
|
|
1852
|
+
effect(() => {
|
|
1853
|
+
const templates = this.customTemplates();
|
|
1854
|
+
for (const item of this.items()) {
|
|
1855
|
+
if (item.type === 'custom' && !templates.has(item.key)) {
|
|
1856
|
+
console.warn(`[tls-menu] No <tls-menu-item key="${item.key}"> found for custom item. The slot will be skipped.`);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
// Public methods
|
|
1863
|
+
open(trigger) {
|
|
1864
|
+
if (this.inline())
|
|
1865
|
+
return;
|
|
1866
|
+
const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
|
|
1867
|
+
this._overlay.open({
|
|
1868
|
+
content: this._panelRef(),
|
|
1869
|
+
origin,
|
|
1870
|
+
positions: this._positions(),
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
openAtPoint(x, y) {
|
|
1874
|
+
if (this.inline())
|
|
1875
|
+
return;
|
|
1876
|
+
this._overlay.open({
|
|
1877
|
+
content: this._panelRef(),
|
|
1878
|
+
origin: { x, y },
|
|
1879
|
+
positions: this._positions(),
|
|
1880
|
+
scrollStrategy: 'close',
|
|
1881
|
+
hasBackdrop: false,
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
close() {
|
|
1885
|
+
this._overlay.close();
|
|
1886
|
+
}
|
|
1887
|
+
toggle(trigger) {
|
|
1888
|
+
if (this._overlay.isOpen()) {
|
|
1889
|
+
this.close();
|
|
1890
|
+
}
|
|
1891
|
+
else {
|
|
1892
|
+
this.open(trigger);
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
// Protected
|
|
1896
|
+
onItemClick(item) {
|
|
1897
|
+
item.action?.();
|
|
1898
|
+
this.close();
|
|
1899
|
+
}
|
|
1900
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Menu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1901
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Menu, isStandalone: true, selector: "tls-menu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, 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 }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "_customItems", predicate: MenuItemComponent, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["labelTemplate"], descendants: true, isSignal: true }, { propertyName: "dividerTemplate", first: true, predicate: ["dividerTemplate"], descendants: true, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ["iconTemplate"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_panelRef", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #panel>\n <div\n class=\"tls-menu\"\n [id]=\"id\"\n role=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (item of items(); track $index) {\n @switch (item.type) {\n @case ('item') {\n @let actionItem = item;\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem }\" />\n } @else {\n <button\n role=\"menuitem\"\n class=\"tls-menu__item\"\n [disabled]=\"actionItem.disabled ?? false\"\n (click)=\"onItemClick(actionItem)\"\n >\n @if (actionItem.icon) {\n @if (iconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\" />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n }\n }\n <span class=\"tls-menu__item-label\">{{ actionItem.label }}</span>\n @if (actionItem.shortcut) {\n <kbd class=\"tls-menu__item-shortcut\">{{ actionItem.shortcut }}</kbd>\n }\n </button>\n }\n }\n @case ('label') {\n @let labelItem = item;\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: labelItem }\" />\n } @else {\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ labelItem.label }}</span>\n }\n }\n @case ('divider') {\n @if (dividerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" aria-hidden=\"true\" />\n }\n }\n @case ('custom') {\n @if (customTemplates().get(item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n }\n }\n }\n </div>\n</ng-template>\n\n@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"panel\" />\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["iconSrc", "alt", "allowedSources"] }] });
|
|
1902
|
+
}
|
|
1903
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Menu, decorators: [{
|
|
1904
|
+
type: Component,
|
|
1905
|
+
args: [{ selector: 'tls-menu', imports: [NgTemplateOutlet, Icon], template: "<ng-template #panel>\n <div\n class=\"tls-menu\"\n [id]=\"id\"\n role=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (item of items(); track $index) {\n @switch (item.type) {\n @case ('item') {\n @let actionItem = item;\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem }\" />\n } @else {\n <button\n role=\"menuitem\"\n class=\"tls-menu__item\"\n [disabled]=\"actionItem.disabled ?? false\"\n (click)=\"onItemClick(actionItem)\"\n >\n @if (actionItem.icon) {\n @if (iconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\" />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n }\n }\n <span class=\"tls-menu__item-label\">{{ actionItem.label }}</span>\n @if (actionItem.shortcut) {\n <kbd class=\"tls-menu__item-shortcut\">{{ actionItem.shortcut }}</kbd>\n }\n </button>\n }\n }\n @case ('label') {\n @let labelItem = item;\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: labelItem }\" />\n } @else {\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ labelItem.label }}</span>\n }\n }\n @case ('divider') {\n @if (dividerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" aria-hidden=\"true\" />\n }\n }\n @case ('custom') {\n @if (customTemplates().get(item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n }\n }\n }\n </div>\n</ng-template>\n\n@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"panel\" />\n}\n" }]
|
|
1906
|
+
}], ctorParameters: () => [], propDecorators: { _panelRef: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], _customItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MenuItemComponent), { isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: ['itemTemplate', { isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: ['labelTemplate', { isSignal: true }] }], dividerTemplate: [{ type: i0.ContentChild, args: ['dividerTemplate', { isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: ['iconTemplate', { isSignal: true }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], 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 }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }] } });
|
|
1907
|
+
|
|
1908
|
+
class MenuTriggerDirective {
|
|
1909
|
+
menu = input.required({ ...(ngDevMode ? { debugName: "menu" } : {}), alias: 'tlsMenuTrigger' });
|
|
1910
|
+
isOpen = computed(() => this.menu().isOpen(), ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1911
|
+
menuId = computed(() => this.menu().id, ...(ngDevMode ? [{ debugName: "menuId" }] : []));
|
|
1912
|
+
// Protected methods
|
|
1913
|
+
onClick(event) {
|
|
1914
|
+
this.menu().toggle(event);
|
|
1915
|
+
}
|
|
1916
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1917
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: MenuTriggerDirective, isStandalone: true, selector: "[tlsMenuTrigger]", inputs: { menu: { classPropertyName: "menu", publicName: "tlsMenuTrigger", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.aria-haspopup": "\"menu\"", "attr.aria-expanded": "isOpen()", "attr.aria-controls": "menuId()" } }, ngImport: i0 });
|
|
1918
|
+
}
|
|
1919
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuTriggerDirective, decorators: [{
|
|
1920
|
+
type: Directive,
|
|
1921
|
+
args: [{
|
|
1922
|
+
selector: '[tlsMenuTrigger]',
|
|
1923
|
+
host: {
|
|
1924
|
+
'(click)': 'onClick($event)',
|
|
1925
|
+
'[attr.aria-haspopup]': '"menu"',
|
|
1926
|
+
'[attr.aria-expanded]': 'isOpen()',
|
|
1927
|
+
'[attr.aria-controls]': 'menuId()',
|
|
1928
|
+
},
|
|
1929
|
+
}]
|
|
1930
|
+
}], propDecorators: { menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsMenuTrigger", required: true }] }] } });
|
|
1931
|
+
|
|
1932
|
+
class ContextMenuDirective {
|
|
1933
|
+
menu = input.required({ ...(ngDevMode ? { debugName: "menu" } : {}), alias: 'tlsContextMenu' });
|
|
1934
|
+
// Protected methods
|
|
1935
|
+
onContextMenu(event) {
|
|
1936
|
+
event.preventDefault();
|
|
1937
|
+
this.menu().close();
|
|
1938
|
+
this.menu().openAtPoint(event.clientX, event.clientY);
|
|
1939
|
+
}
|
|
1940
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ContextMenuDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1941
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ContextMenuDirective, isStandalone: true, selector: "[tlsContextMenu]", inputs: { menu: { classPropertyName: "menu", publicName: "tlsContextMenu", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "contextmenu": "onContextMenu($event)" } }, ngImport: i0 });
|
|
1942
|
+
}
|
|
1943
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ContextMenuDirective, decorators: [{
|
|
1944
|
+
type: Directive,
|
|
1945
|
+
args: [{
|
|
1946
|
+
selector: '[tlsContextMenu]',
|
|
1947
|
+
host: {
|
|
1948
|
+
'(contextmenu)': 'onContextMenu($event)',
|
|
1949
|
+
},
|
|
1950
|
+
}]
|
|
1951
|
+
}], propDecorators: { menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsContextMenu", required: true }] }] } });
|
|
1952
|
+
|
|
2041
1953
|
const DEFAULT_PAGINATION_CONFIG = {
|
|
2042
1954
|
size: 'md',
|
|
2043
1955
|
pageSize: 10,
|
|
@@ -2710,77 +2622,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
2710
2622
|
|
|
2711
2623
|
// Features
|
|
2712
2624
|
|
|
2713
|
-
const provideThalassicChartConfig = (config) => {
|
|
2714
|
-
return makeEnvironmentProviders([
|
|
2715
|
-
{
|
|
2716
|
-
provide: CHART_CONFIG,
|
|
2717
|
-
useValue: mergeConfig(DEFAULT_CHART_CONFIG, config),
|
|
2718
|
-
},
|
|
2719
|
-
]);
|
|
2720
|
-
};
|
|
2721
|
-
|
|
2722
2625
|
const provideThalassicUIConfig = (config) => {
|
|
2723
2626
|
return makeEnvironmentProviders([
|
|
2724
2627
|
// Components
|
|
2725
2628
|
{
|
|
2726
2629
|
provide: ALERT_CONFIG,
|
|
2727
|
-
useValue:
|
|
2630
|
+
useValue: deepMerge(DEFAULT_ALERT_CONFIG, config.components.alert),
|
|
2728
2631
|
},
|
|
2729
2632
|
{
|
|
2730
2633
|
provide: BUTTON_CONFIG,
|
|
2731
|
-
useValue:
|
|
2634
|
+
useValue: deepMerge(DEFAULT_BUTTON_CONFIG, config.components.button),
|
|
2732
2635
|
},
|
|
2733
2636
|
{
|
|
2734
2637
|
provide: DATE_TIME_PICKER_CONFIG,
|
|
2735
|
-
useValue:
|
|
2638
|
+
useValue: deepMerge(DEFAULT_DATE_TIME_PICKER_CONFIG, config.components.dateTimePicker),
|
|
2736
2639
|
},
|
|
2737
2640
|
{
|
|
2738
2641
|
provide: DIALOG_CONFIG,
|
|
2739
|
-
useValue:
|
|
2642
|
+
useValue: deepMerge(DEFAULT_DIALOG_CONFIG, config.components.dialog),
|
|
2740
2643
|
},
|
|
2741
2644
|
{
|
|
2742
2645
|
provide: DIVIDER_CONFIG,
|
|
2743
|
-
useValue:
|
|
2646
|
+
useValue: deepMerge(DEFAULT_DIVIDER_CONFIG, config.components.divider),
|
|
2744
2647
|
},
|
|
2745
|
-
{ provide: INPUT_CONFIG, useValue:
|
|
2648
|
+
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
|
|
2746
2649
|
{
|
|
2747
2650
|
provide: PASSWORD_CONFIG,
|
|
2748
|
-
useValue:
|
|
2651
|
+
useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, config.components.password),
|
|
2749
2652
|
},
|
|
2750
2653
|
{
|
|
2751
2654
|
provide: SELECT_CONFIG,
|
|
2752
|
-
useValue:
|
|
2655
|
+
useValue: deepMerge(DEFAULT_SELECT_CONFIG, config.components.select),
|
|
2753
2656
|
},
|
|
2754
2657
|
{
|
|
2755
2658
|
provide: SWITCH_CONFIG,
|
|
2756
|
-
useValue:
|
|
2659
|
+
useValue: deepMerge(DEFAULT_SWITCH_CONFIG, config.components.switch),
|
|
2757
2660
|
},
|
|
2758
2661
|
{
|
|
2759
2662
|
provide: FORM_ITEM_CONFIG,
|
|
2760
|
-
useValue:
|
|
2663
|
+
useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
|
|
2761
2664
|
},
|
|
2762
|
-
{ provide: ICON_CONFIG, useValue:
|
|
2665
|
+
{ provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG, config.components.icon) },
|
|
2763
2666
|
{
|
|
2764
2667
|
provide: PAGINATION_CONFIG,
|
|
2765
|
-
useValue:
|
|
2668
|
+
useValue: deepMerge(DEFAULT_PAGINATION_CONFIG, config.components.pagination),
|
|
2766
2669
|
},
|
|
2767
2670
|
{
|
|
2768
2671
|
provide: POPOVER_CONFIG,
|
|
2769
|
-
useValue:
|
|
2672
|
+
useValue: deepMerge(DEFAULT_POPOVER_CONFIG, config.components.popover),
|
|
2770
2673
|
},
|
|
2771
2674
|
{
|
|
2772
2675
|
provide: SKELETON_CONFIG,
|
|
2773
|
-
useValue:
|
|
2676
|
+
useValue: deepMerge(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
|
|
2774
2677
|
},
|
|
2775
2678
|
{
|
|
2776
2679
|
provide: STEPPER_CONFIG,
|
|
2777
|
-
useValue:
|
|
2680
|
+
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, config.components.stepper),
|
|
2681
|
+
},
|
|
2682
|
+
{ provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG, config.components.table) },
|
|
2683
|
+
{ provide: TABS_CONFIG, useValue: deepMerge(DEFAULT_TABS_CONFIG, config.components.tabs) },
|
|
2684
|
+
{
|
|
2685
|
+
provide: TEXTAREA_CONFIG,
|
|
2686
|
+
useValue: deepMerge(DEFAULT_TEXTAREA_CONFIG, config.components.textarea),
|
|
2778
2687
|
},
|
|
2779
|
-
{ provide: TABLE_CONFIG, useValue: mergeConfig(DEFAULT_TABLE_CONFIG, config.components.table) },
|
|
2780
|
-
{ provide: TABS_CONFIG, useValue: mergeConfig(DEFAULT_TABS_CONFIG, config.components.tabs) },
|
|
2781
2688
|
{
|
|
2782
2689
|
provide: TOOLTIP_CONFIG,
|
|
2783
|
-
useValue:
|
|
2690
|
+
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
|
|
2784
2691
|
},
|
|
2785
2692
|
]);
|
|
2786
2693
|
};
|
|
@@ -2789,5 +2696,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2789
2696
|
* Generated bundle index. Do not edit.
|
|
2790
2697
|
*/
|
|
2791
2698
|
|
|
2792
|
-
export { ALERT_CONFIG, Alert, BUTTON_CONFIG,
|
|
2699
|
+
export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, Checkbox, ContextMenuDirective, 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_MENU_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_TEXTAREA_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, MENU_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, 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, TEXTAREA_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, TooltipDirective, provideThalassicUIConfig };
|
|
2793
2700
|
//# sourceMappingURL=thalassic-ui.mjs.map
|