@thalassic/ui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/thalassic-ui.mjs +880 -204
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +429 -70
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive,
|
|
3
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
-
import { RouterLink } from '@angular/router';
|
|
2
|
+
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, signal, contentChild, model, effect, forwardRef, Injectable, ViewContainerRef, DestroyRef, viewChild, output, viewChildren, numberAttribute, contentChildren, isDevMode, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { LocationStrategy, NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { RouterLink, Router } from '@angular/router';
|
|
5
5
|
import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
|
|
6
6
|
import { CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
|
|
7
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';
|
|
@@ -122,6 +122,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
122
122
|
class Button extends ButtonBase {
|
|
123
123
|
// Injections
|
|
124
124
|
_routerLink = inject(RouterLink, { optional: true });
|
|
125
|
+
_router = inject(Router, { optional: true });
|
|
126
|
+
_locationStrategy = inject(LocationStrategy, { optional: true });
|
|
125
127
|
APPLY_HOST_CLASSES = false;
|
|
126
128
|
// Inputs
|
|
127
129
|
/** The text label displayed inside the button. Takes priority over projected content. */
|
|
@@ -132,14 +134,55 @@ class Button extends ButtonBase {
|
|
|
132
134
|
tabindex = input('0', ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
|
|
133
135
|
// Computed
|
|
134
136
|
isLink = computed(() => Boolean(this._routerLink || this.href()), ...(ngDevMode ? [{ debugName: "isLink" }] : []));
|
|
137
|
+
/**
|
|
138
|
+
* Resolved URL placed on the inner anchor so the browser treats it as a real link
|
|
139
|
+
* (enables "Open in new tab", middle-click, status-bar preview, etc.). An explicit
|
|
140
|
+
* `href` wins; otherwise the URL is derived from the host `routerLink`.
|
|
141
|
+
*/
|
|
142
|
+
linkHref = computed(() => {
|
|
143
|
+
if (this.disabled())
|
|
144
|
+
return null;
|
|
145
|
+
const explicitHref = this.href();
|
|
146
|
+
if (explicitHref)
|
|
147
|
+
return explicitHref;
|
|
148
|
+
const urlTree = this._routerLink?.urlTree;
|
|
149
|
+
if (!urlTree || !this._router)
|
|
150
|
+
return null;
|
|
151
|
+
const serialized = this._router.serializeUrl(urlTree);
|
|
152
|
+
return this._locationStrategy?.prepareExternalUrl(serialized) ?? serialized;
|
|
153
|
+
}, ...(ngDevMode ? [{ debugName: "linkHref" }] : []));
|
|
154
|
+
// Protected methods
|
|
155
|
+
/**
|
|
156
|
+
* Keeps navigation correct when the host carries a `routerLink` while the inner anchor
|
|
157
|
+
* exposes a real `href`:
|
|
158
|
+
* - modified / non-primary clicks bubble to the browser so it can open a new tab, and
|
|
159
|
+
* are stopped from reaching the host RouterLink to avoid a duplicate in-app navigation;
|
|
160
|
+
* - a plain left click defers to the host RouterLink for SPA navigation, so the anchor's
|
|
161
|
+
* own full-page navigation is prevented.
|
|
162
|
+
*/
|
|
163
|
+
onLinkClick(event) {
|
|
164
|
+
if (this.disabled()) {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
event.stopPropagation();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
// Pure href links (no routerLink) navigate natively — nothing to coordinate.
|
|
170
|
+
if (!this._routerLink)
|
|
171
|
+
return;
|
|
172
|
+
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
|
|
173
|
+
event.stopPropagation();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
}
|
|
135
178
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Button, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
136
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Button, isStandalone: true, selector: "tls-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"
|
|
179
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Button, isStandalone: true, selector: "tls-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"linkHref()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-disabled]=\"disabled()\"\n (click)=\"onLinkClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </a>\n} @else {\n <button\n role=\"button\"\n [class]=\"classes()\"\n [type]=\"type()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled()\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </button>\n}\n\n<!-- Content -->\n<ng-template #contentTemplate>\n @if (label() && !icon()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n</ng-template>\n\n<ng-template #projectedContentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:fit-content;display:inline-block}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
137
180
|
}
|
|
138
181
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Button, decorators: [{
|
|
139
182
|
type: Component,
|
|
140
183
|
args: [{ selector: 'tls-button', imports: [NgTemplateOutlet], host: {
|
|
141
184
|
'[tabindex]': '-1',
|
|
142
|
-
}, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"
|
|
185
|
+
}, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"linkHref()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-disabled]=\"disabled()\"\n (click)=\"onLinkClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </a>\n} @else {\n <button\n role=\"button\"\n [class]=\"classes()\"\n [type]=\"type()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled()\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </button>\n}\n\n<!-- Content -->\n<ng-template #contentTemplate>\n @if (label() && !icon()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n</ng-template>\n\n<ng-template #projectedContentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:fit-content;display:inline-block}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}\n"] }]
|
|
143
186
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
144
187
|
|
|
145
188
|
class ButtonDirective extends ButtonBase {
|
|
@@ -153,6 +196,204 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
153
196
|
}]
|
|
154
197
|
}] });
|
|
155
198
|
|
|
199
|
+
const DEFAULT_CHIP_CONFIG = {
|
|
200
|
+
color: 'primary',
|
|
201
|
+
variant: 'filled',
|
|
202
|
+
size: 'md',
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const CHIP_CONFIG = new InjectionToken('CHIP_CONFIG', {
|
|
206
|
+
factory: () => DEFAULT_CHIP_CONFIG,
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
class Chip {
|
|
210
|
+
_config = inject(CHIP_CONFIG);
|
|
211
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
212
|
+
color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
213
|
+
variant = input(this._config.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
214
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
215
|
+
rounded = input(false, { ...(ngDevMode ? { debugName: "rounded" } : {}), transform: booleanAttribute });
|
|
216
|
+
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : {}), transform: booleanAttribute });
|
|
217
|
+
context = signal({
|
|
218
|
+
checked: false,
|
|
219
|
+
disabled: false,
|
|
220
|
+
readonly: false,
|
|
221
|
+
touched: false,
|
|
222
|
+
dirty: false,
|
|
223
|
+
invalid: false,
|
|
224
|
+
pending: false,
|
|
225
|
+
}, ...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
226
|
+
startIconTemplate = contentChild('startIcon', ...(ngDevMode ? [{ debugName: "startIconTemplate" }] : []));
|
|
227
|
+
endIconTemplate = contentChild('endIcon', ...(ngDevMode ? [{ debugName: "endIconTemplate" }] : []));
|
|
228
|
+
classes = computed(() => {
|
|
229
|
+
const className = 'tls-chip';
|
|
230
|
+
const array = [className];
|
|
231
|
+
array.push(`${className}--${this.color()}`);
|
|
232
|
+
array.push(`${className}--${this.variant()}`);
|
|
233
|
+
array.push(`${className}--${this.size()}`);
|
|
234
|
+
if (this.rounded())
|
|
235
|
+
array.push(`${className}--rounded`);
|
|
236
|
+
if (this.icon())
|
|
237
|
+
array.push(`${className}--icon`);
|
|
238
|
+
return array;
|
|
239
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
240
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
241
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Chip, isStandalone: true, selector: "tls-chip", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "endIconTemplate", first: true, predicate: ["endIcon"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
242
|
+
}
|
|
243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chip, decorators: [{
|
|
244
|
+
type: Component,
|
|
245
|
+
args: [{ selector: 'tls-chip', imports: [NgTemplateOutlet], host: {
|
|
246
|
+
'[class]': 'classes()',
|
|
247
|
+
}, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n" }]
|
|
248
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], endIconTemplate: [{ type: i0.ContentChild, args: ['endIcon', { isSignal: true }] }] } });
|
|
249
|
+
|
|
250
|
+
const FORM_CONTROL = new InjectionToken('FORM_CONTROL');
|
|
251
|
+
class FormControl {
|
|
252
|
+
// Models
|
|
253
|
+
touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : []));
|
|
254
|
+
// Inputs
|
|
255
|
+
name = input('', ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
256
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
257
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
258
|
+
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : {}), transform: booleanAttribute });
|
|
259
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : {}), transform: booleanAttribute });
|
|
260
|
+
pending = input(false, { ...(ngDevMode ? { debugName: "pending" } : {}), transform: booleanAttribute });
|
|
261
|
+
dirty = input(false, { ...(ngDevMode ? { debugName: "dirty" } : {}), transform: booleanAttribute });
|
|
262
|
+
errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : []));
|
|
263
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
|
|
264
|
+
CLASS_NAME = 'tls-form-control';
|
|
265
|
+
notInteractive = computed(() => this.disabled() || this.readonly(), ...(ngDevMode ? [{ debugName: "notInteractive" }] : []));
|
|
266
|
+
controlClasses = computed(() => this.baseControlClasses(), ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
|
|
267
|
+
// Protected methods
|
|
268
|
+
baseControlClasses() {
|
|
269
|
+
const className = this.CLASS_NAME;
|
|
270
|
+
const array = [className];
|
|
271
|
+
if (this.disabled())
|
|
272
|
+
array.push(`${className}--disabled`);
|
|
273
|
+
if (this.readonly())
|
|
274
|
+
array.push(`${className}--readonly`);
|
|
275
|
+
if (this.invalid())
|
|
276
|
+
array.push(`${className}--invalid`);
|
|
277
|
+
if (this.pending())
|
|
278
|
+
array.push(`${className}--pending`);
|
|
279
|
+
if (this.touched())
|
|
280
|
+
array.push(`${className}--touched`);
|
|
281
|
+
if (this.dirty())
|
|
282
|
+
array.push(`${className}--dirty`);
|
|
283
|
+
return array;
|
|
284
|
+
}
|
|
285
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
286
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: FormControl, isStandalone: true, inputs: { touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange" }, ngImport: i0 });
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, decorators: [{
|
|
289
|
+
type: Directive
|
|
290
|
+
}], propDecorators: { touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }] } });
|
|
291
|
+
|
|
292
|
+
class CheckboxFormControl extends FormControl {
|
|
293
|
+
controlClasses = computed(() => {
|
|
294
|
+
const classes = this.baseControlClasses();
|
|
295
|
+
if (this.checked())
|
|
296
|
+
classes.push(`${this.CLASS_NAME}--checked`);
|
|
297
|
+
return classes;
|
|
298
|
+
}, ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
|
|
299
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
300
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: CheckboxFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
|
|
301
|
+
}
|
|
302
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, decorators: [{
|
|
303
|
+
type: Directive
|
|
304
|
+
}] });
|
|
305
|
+
|
|
306
|
+
function normalizeOptions(options, keys) {
|
|
307
|
+
return options.map(option => {
|
|
308
|
+
if (typeof option === 'string' || typeof option === 'number') {
|
|
309
|
+
return { value: option, label: String(option), disabled: false };
|
|
310
|
+
}
|
|
311
|
+
const typed = option;
|
|
312
|
+
return {
|
|
313
|
+
value: (keys.value ? typed[keys.value] : typed),
|
|
314
|
+
label: String(keys.label ? typed[keys.label] : typed),
|
|
315
|
+
disabled: Boolean(keys.disabled ? typed[keys.disabled] : false),
|
|
316
|
+
};
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
class ValueFormControl extends FormControl {
|
|
321
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
322
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: ValueFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
|
|
323
|
+
}
|
|
324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, decorators: [{
|
|
325
|
+
type: Directive
|
|
326
|
+
}] });
|
|
327
|
+
|
|
328
|
+
const DEFAULT_CHIP_CONTROL_CONFIG = {
|
|
329
|
+
checkedColor: undefined,
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const CHIP_CONTROL_CONFIG = new InjectionToken('CHIP_CONTROL_CONFIG', {
|
|
333
|
+
factory: () => DEFAULT_CHIP_CONTROL_CONFIG,
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
class ChipControl extends CheckboxFormControl {
|
|
337
|
+
CLASS_NAME = 'tls-chip';
|
|
338
|
+
_config = inject(CHIP_CONTROL_CONFIG);
|
|
339
|
+
_chip = inject(Chip);
|
|
340
|
+
checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
|
|
341
|
+
checkedColor = input(this._config.checkedColor, ...(ngDevMode ? [{ debugName: "checkedColor" }] : []));
|
|
342
|
+
hostClasses = computed(() => {
|
|
343
|
+
const classes = ['tls-chip--control'];
|
|
344
|
+
if (this.checked()) {
|
|
345
|
+
classes.push('tls-chip--checked');
|
|
346
|
+
const color = this.checkedColor();
|
|
347
|
+
if (color)
|
|
348
|
+
classes.push(`tls-chip--checked-${color}`);
|
|
349
|
+
}
|
|
350
|
+
if (this.disabled())
|
|
351
|
+
classes.push('tls-chip--disabled');
|
|
352
|
+
return classes;
|
|
353
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
354
|
+
constructor() {
|
|
355
|
+
super();
|
|
356
|
+
effect(() => this._chip.context.set({
|
|
357
|
+
checked: this.checked(),
|
|
358
|
+
disabled: this.disabled(),
|
|
359
|
+
readonly: this.readonly(),
|
|
360
|
+
touched: this.touched(),
|
|
361
|
+
dirty: this.dirty(),
|
|
362
|
+
invalid: this.invalid(),
|
|
363
|
+
pending: this.pending(),
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
366
|
+
toggle() {
|
|
367
|
+
if (this.notInteractive())
|
|
368
|
+
return;
|
|
369
|
+
this.checked.update(prev => !prev);
|
|
370
|
+
}
|
|
371
|
+
onKeyboardToggle(event) {
|
|
372
|
+
event.preventDefault();
|
|
373
|
+
this.toggle();
|
|
374
|
+
}
|
|
375
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
376
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ChipControl, isStandalone: true, selector: "tls-chip[tlsChipControl]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "click": "toggle()", "blur": "touched.set(true)", "keydown.space": "onKeyboardToggle($event)", "keydown.enter": "onKeyboardToggle($event)" }, properties: { "class": "hostClasses()", "tabindex": "disabled() ? -1 : 0", "attr.aria-checked": "checked()", "attr.aria-disabled": "disabled()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipControl) }], usesInheritance: true, ngImport: i0 });
|
|
377
|
+
}
|
|
378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipControl, decorators: [{
|
|
379
|
+
type: Directive,
|
|
380
|
+
args: [{
|
|
381
|
+
selector: 'tls-chip[tlsChipControl]',
|
|
382
|
+
host: {
|
|
383
|
+
role: 'checkbox',
|
|
384
|
+
'[class]': 'hostClasses()',
|
|
385
|
+
'[tabindex]': 'disabled() ? -1 : 0',
|
|
386
|
+
'[attr.aria-checked]': 'checked()',
|
|
387
|
+
'[attr.aria-disabled]': 'disabled()',
|
|
388
|
+
'(click)': 'toggle()',
|
|
389
|
+
'(blur)': 'touched.set(true)',
|
|
390
|
+
'(keydown.space)': 'onKeyboardToggle($event)',
|
|
391
|
+
'(keydown.enter)': 'onKeyboardToggle($event)',
|
|
392
|
+
},
|
|
393
|
+
providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipControl) }],
|
|
394
|
+
}]
|
|
395
|
+
}], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], checkedColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedColor", required: false }] }] } });
|
|
396
|
+
|
|
156
397
|
const DEFAULT_DIALOG_CONFIG = {
|
|
157
398
|
size: 'md',
|
|
158
399
|
closeable: true,
|
|
@@ -255,6 +496,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
255
496
|
}, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n" }]
|
|
256
497
|
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], flush: [{ type: i0.Input, args: [{ isSignal: true, alias: "flush", required: false }] }] } });
|
|
257
498
|
|
|
499
|
+
class FormControlAddon {
|
|
500
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlAddon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
501
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: FormControlAddon, isStandalone: true, selector: "tls-form-control-addon", host: { classAttribute: "tls-form-control-addon" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
502
|
+
}
|
|
503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlAddon, decorators: [{
|
|
504
|
+
type: Component,
|
|
505
|
+
args: [{
|
|
506
|
+
selector: 'tls-form-control-addon',
|
|
507
|
+
imports: [],
|
|
508
|
+
template: '<ng-content></ng-content>',
|
|
509
|
+
host: {
|
|
510
|
+
class: 'tls-form-control-addon',
|
|
511
|
+
},
|
|
512
|
+
}]
|
|
513
|
+
}] });
|
|
514
|
+
|
|
515
|
+
const DEFAULT_FORM_CONTROL_GROUP_CONFIG = {
|
|
516
|
+
size: 'md',
|
|
517
|
+
fluid: false,
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
const FORM_CONTROL_GROUP_CONFIG = new InjectionToken('FORM_CONTROL_GROUP_CONFIG', {
|
|
521
|
+
factory: () => DEFAULT_FORM_CONTROL_GROUP_CONFIG,
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
class FormControlGroup {
|
|
525
|
+
_config = inject(FORM_CONTROL_GROUP_CONFIG);
|
|
526
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
527
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
528
|
+
hostClasses = computed(() => {
|
|
529
|
+
const className = 'tls-form-control-group';
|
|
530
|
+
const array = [className];
|
|
531
|
+
array.push(`${className}--${this.size()}`);
|
|
532
|
+
if (this.fluid())
|
|
533
|
+
array.push(`${className}--fluid`);
|
|
534
|
+
return array;
|
|
535
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
536
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
537
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: FormControlGroup, isStandalone: true, selector: "tls-form-control-group", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
538
|
+
}
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlGroup, decorators: [{
|
|
540
|
+
type: Component,
|
|
541
|
+
args: [{
|
|
542
|
+
selector: 'tls-form-control-group',
|
|
543
|
+
imports: [],
|
|
544
|
+
template: '<ng-content></ng-content>',
|
|
545
|
+
host: {
|
|
546
|
+
'[class]': 'hostClasses()',
|
|
547
|
+
},
|
|
548
|
+
}]
|
|
549
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }] } });
|
|
550
|
+
|
|
258
551
|
const DEFAULT_FORM_ITEM_ERROR_MESSAGES = {
|
|
259
552
|
required: () => 'This field is required',
|
|
260
553
|
email: () => 'Enter a valid email address',
|
|
@@ -283,70 +576,6 @@ const DEFAULT_FORM_ITEM_CONFIG = {
|
|
|
283
576
|
errorMessages: DEFAULT_FORM_ITEM_ERROR_MESSAGES,
|
|
284
577
|
};
|
|
285
578
|
|
|
286
|
-
const FORM_CONTROL = new InjectionToken('FORM_CONTROL');
|
|
287
|
-
class FormControl {
|
|
288
|
-
// Models
|
|
289
|
-
touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : []));
|
|
290
|
-
// Inputs
|
|
291
|
-
name = input('', ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
292
|
-
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
293
|
-
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
294
|
-
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : {}), transform: booleanAttribute });
|
|
295
|
-
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : {}), transform: booleanAttribute });
|
|
296
|
-
pending = input(false, { ...(ngDevMode ? { debugName: "pending" } : {}), transform: booleanAttribute });
|
|
297
|
-
dirty = input(false, { ...(ngDevMode ? { debugName: "dirty" } : {}), transform: booleanAttribute });
|
|
298
|
-
errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : []));
|
|
299
|
-
required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
|
|
300
|
-
CLASS_NAME = 'tls-form-control';
|
|
301
|
-
notInteractive = computed(() => this.disabled() || this.readonly(), ...(ngDevMode ? [{ debugName: "notInteractive" }] : []));
|
|
302
|
-
controlClasses = computed(() => this.baseControlClasses(), ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
|
|
303
|
-
// Protected methods
|
|
304
|
-
baseControlClasses() {
|
|
305
|
-
const className = this.CLASS_NAME;
|
|
306
|
-
const array = [className];
|
|
307
|
-
if (this.disabled())
|
|
308
|
-
array.push(`${className}--disabled`);
|
|
309
|
-
if (this.readonly())
|
|
310
|
-
array.push(`${className}--readonly`);
|
|
311
|
-
if (this.invalid())
|
|
312
|
-
array.push(`${className}--invalid`);
|
|
313
|
-
if (this.pending())
|
|
314
|
-
array.push(`${className}--pending`);
|
|
315
|
-
if (this.touched())
|
|
316
|
-
array.push(`${className}--touched`);
|
|
317
|
-
if (this.dirty())
|
|
318
|
-
array.push(`${className}--dirty`);
|
|
319
|
-
return array;
|
|
320
|
-
}
|
|
321
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
322
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: FormControl, isStandalone: true, inputs: { touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange" }, ngImport: i0 });
|
|
323
|
-
}
|
|
324
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, decorators: [{
|
|
325
|
-
type: Directive
|
|
326
|
-
}], propDecorators: { touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }] } });
|
|
327
|
-
|
|
328
|
-
class CheckboxFormControl extends FormControl {
|
|
329
|
-
controlClasses = computed(() => {
|
|
330
|
-
const classes = this.baseControlClasses();
|
|
331
|
-
if (this.checked())
|
|
332
|
-
classes.push(`${this.CLASS_NAME}--checked`);
|
|
333
|
-
return classes;
|
|
334
|
-
}, ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
|
|
335
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
336
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: CheckboxFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
|
|
337
|
-
}
|
|
338
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, decorators: [{
|
|
339
|
-
type: Directive
|
|
340
|
-
}] });
|
|
341
|
-
|
|
342
|
-
class ValueFormControl extends FormControl {
|
|
343
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
344
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: ValueFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
|
|
345
|
-
}
|
|
346
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, decorators: [{
|
|
347
|
-
type: Directive
|
|
348
|
-
}] });
|
|
349
|
-
|
|
350
579
|
const FORM_ITEM_CONFIG = new InjectionToken('FORM_ITEM_CONFIG', {
|
|
351
580
|
factory: () => DEFAULT_FORM_ITEM_CONFIG,
|
|
352
581
|
});
|
|
@@ -1015,53 +1244,266 @@ class DateTimePicker extends ValueFormControl {
|
|
|
1015
1244
|
onViewDateChange(date) {
|
|
1016
1245
|
this.viewDate.set(date);
|
|
1017
1246
|
}
|
|
1018
|
-
onDaySelect(date) {
|
|
1019
|
-
if (this.notInteractive())
|
|
1247
|
+
onDaySelect(date) {
|
|
1248
|
+
if (this.notInteractive())
|
|
1249
|
+
return;
|
|
1250
|
+
this.value.set(date);
|
|
1251
|
+
if (this.mode() === 'calendar') {
|
|
1252
|
+
this.popoverComponent()?.close();
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
onMonthSelect(date) {
|
|
1256
|
+
this.viewDate.set(date);
|
|
1257
|
+
if (this.notInteractive())
|
|
1258
|
+
return;
|
|
1259
|
+
if (this.mode() === 'month-picker') {
|
|
1260
|
+
this.value.set(date);
|
|
1261
|
+
this.popoverComponent()?.close();
|
|
1262
|
+
}
|
|
1263
|
+
else if (this.mode() === 'date-time') {
|
|
1264
|
+
this.activeView.set('date-time');
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
this.activeView.set('calendar');
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
onYearSelect(date) {
|
|
1271
|
+
this.viewDate.set(date);
|
|
1272
|
+
if (this.notInteractive())
|
|
1273
|
+
return;
|
|
1274
|
+
if (this.mode() === 'year-picker') {
|
|
1275
|
+
this.value.set(date);
|
|
1276
|
+
this.popoverComponent()?.close();
|
|
1277
|
+
}
|
|
1278
|
+
else {
|
|
1279
|
+
this.activeView.set('month-picker');
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
onTimeChange(date) {
|
|
1283
|
+
if (this.notInteractive())
|
|
1284
|
+
return;
|
|
1285
|
+
this.value.set(date);
|
|
1286
|
+
}
|
|
1287
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1288
|
+
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"] }] });
|
|
1289
|
+
}
|
|
1290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, decorators: [{
|
|
1291
|
+
type: Component,
|
|
1292
|
+
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" }]
|
|
1293
|
+
}], 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 }] }] } });
|
|
1294
|
+
|
|
1295
|
+
const DEFAULT_CHIP_INPUT_CONFIG = {
|
|
1296
|
+
size: 'md',
|
|
1297
|
+
placeholder: '',
|
|
1298
|
+
fluid: false,
|
|
1299
|
+
separator: ['Enter'],
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
const CHIP_INPUT_CONFIG = new InjectionToken('CHIP_INPUT_CONFIG', {
|
|
1303
|
+
factory: () => DEFAULT_CHIP_INPUT_CONFIG,
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
class ChipInput extends ValueFormControl {
|
|
1307
|
+
_config = inject(CHIP_INPUT_CONFIG);
|
|
1308
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1309
|
+
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1310
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1311
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1312
|
+
separator = input(this._config.separator, ...(ngDevMode ? [{ debugName: "separator" }] : []));
|
|
1313
|
+
inputValue = signal('', ...(ngDevMode ? [{ debugName: "inputValue" }] : []));
|
|
1314
|
+
classes = computed(() => {
|
|
1315
|
+
const className = this.CLASS_NAME;
|
|
1316
|
+
const array = [className, `${className}--${this.size()}`];
|
|
1317
|
+
if (this.fluid())
|
|
1318
|
+
array.push(`${className}--fluid`);
|
|
1319
|
+
return array.concat(this.controlClasses());
|
|
1320
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
1321
|
+
onKeydown(event) {
|
|
1322
|
+
if (this.notInteractive())
|
|
1323
|
+
return;
|
|
1324
|
+
if (this.separator().includes(event.key)) {
|
|
1325
|
+
event.preventDefault();
|
|
1326
|
+
this._addChip();
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
if (event.key === 'Backspace' && !this.inputValue()) {
|
|
1330
|
+
this.value.update(chips => chips.slice(0, -1));
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
removeChip(index) {
|
|
1334
|
+
if (this.notInteractive())
|
|
1335
|
+
return;
|
|
1336
|
+
this.value.update(chips => chips.filter((_chip, chipIndex) => chipIndex !== index));
|
|
1337
|
+
}
|
|
1338
|
+
_addChip() {
|
|
1339
|
+
const text = this.inputValue().trim();
|
|
1340
|
+
if (!text || this.notInteractive())
|
|
1341
|
+
return;
|
|
1342
|
+
this.value.update(chips => [...chips, text]);
|
|
1343
|
+
this.inputValue.set('');
|
|
1344
|
+
}
|
|
1345
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1346
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ChipInput, isStandalone: true, selector: "tls-chip-input", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], usesInheritance: true, ngImport: i0, template: "@for (chip of value(); track $index; let index = $index) {\n <tls-chip size=\"sm\" variant=\"filled\" color=\"primary\" [label]=\"chip\">\n <ng-template #endIcon>\n <button\n type=\"button\"\n class=\"tls-chip-input__remove\"\n [attr.aria-label]=\"'Remove ' + chip\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeChip(index)\"\n >\u00D7</button>\n </ng-template>\n </tls-chip>\n}\n<input\n class=\"tls-chip-input__field\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"inputValue()\"\n (input)=\"inputValue.set($any($event.target).value)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"touched.set(true)\"\n/>\n", dependencies: [{ kind: "component", type: Chip, selector: "tls-chip", inputs: ["label", "color", "variant", "size", "rounded", "icon"] }] });
|
|
1347
|
+
}
|
|
1348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipInput, decorators: [{
|
|
1349
|
+
type: Component,
|
|
1350
|
+
args: [{ selector: 'tls-chip-input', imports: [Chip], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], host: { '[class]': 'classes()' }, template: "@for (chip of value(); track $index; let index = $index) {\n <tls-chip size=\"sm\" variant=\"filled\" color=\"primary\" [label]=\"chip\">\n <ng-template #endIcon>\n <button\n type=\"button\"\n class=\"tls-chip-input__remove\"\n [attr.aria-label]=\"'Remove ' + chip\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeChip(index)\"\n >\u00D7</button>\n </ng-template>\n </tls-chip>\n}\n<input\n class=\"tls-chip-input__field\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"inputValue()\"\n (input)=\"inputValue.set($any($event.target).value)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"touched.set(true)\"\n/>\n" }]
|
|
1351
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], 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 }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }] } });
|
|
1352
|
+
|
|
1353
|
+
const DEFAULT_FILE_UPLOADER_CONFIG = {
|
|
1354
|
+
multiple: false,
|
|
1355
|
+
accept: '',
|
|
1356
|
+
fluid: false,
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
const FILE_UPLOADER_CONFIG = new InjectionToken('FILE_UPLOADER_CONFIG', { factory: () => DEFAULT_FILE_UPLOADER_CONFIG });
|
|
1360
|
+
|
|
1361
|
+
function normalizeAccept(value) {
|
|
1362
|
+
return Array.isArray(value) ? value.join(',') : value;
|
|
1363
|
+
}
|
|
1364
|
+
class FileUploader extends ValueFormControl {
|
|
1365
|
+
_config = inject(FILE_UPLOADER_CONFIG);
|
|
1366
|
+
CLASS_NAME = 'tls-file-uploader';
|
|
1367
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1368
|
+
multiple = input(this._config.multiple, { ...(ngDevMode ? { debugName: "multiple" } : {}), transform: booleanAttribute });
|
|
1369
|
+
accept = input(normalizeAccept(this._config.accept), { ...(ngDevMode ? { debugName: "accept" } : {}), transform: normalizeAccept });
|
|
1370
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1371
|
+
fileInput = viewChild.required('fileInput');
|
|
1372
|
+
dragState = signal('idle', ...(ngDevMode ? [{ debugName: "dragState" }] : []));
|
|
1373
|
+
dropZoneTemplate = contentChild('dropZone', ...(ngDevMode ? [{ debugName: "dropZoneTemplate" }] : []));
|
|
1374
|
+
fileTemplate = contentChild('file', ...(ngDevMode ? [{ debugName: "fileTemplate" }] : []));
|
|
1375
|
+
classes = computed(() => {
|
|
1376
|
+
const className = this.CLASS_NAME;
|
|
1377
|
+
const array = [className];
|
|
1378
|
+
if (this.fluid())
|
|
1379
|
+
array.push(`${className}--fluid`);
|
|
1380
|
+
return array.concat(this.controlClasses());
|
|
1381
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
1382
|
+
acceptHint = computed(() => {
|
|
1383
|
+
const accept = this.accept().trim();
|
|
1384
|
+
if (!accept)
|
|
1385
|
+
return '';
|
|
1386
|
+
const labels = accept
|
|
1387
|
+
.split(',')
|
|
1388
|
+
.map(rule => rule.trim())
|
|
1389
|
+
.filter(Boolean)
|
|
1390
|
+
.map(rule => this._formatAcceptRule(rule));
|
|
1391
|
+
return [...new Set(labels)].join(', ');
|
|
1392
|
+
}, ...(ngDevMode ? [{ debugName: "acceptHint" }] : []));
|
|
1393
|
+
openFilePicker() {
|
|
1394
|
+
if (this.notInteractive())
|
|
1395
|
+
return;
|
|
1396
|
+
this.fileInput().nativeElement.click();
|
|
1397
|
+
}
|
|
1398
|
+
onFilesSelected(event) {
|
|
1399
|
+
const target = event.target;
|
|
1400
|
+
if (!target.files)
|
|
1401
|
+
return;
|
|
1402
|
+
this._addFiles(Array.from(target.files));
|
|
1403
|
+
target.value = '';
|
|
1404
|
+
}
|
|
1405
|
+
onDropZoneKeydown(event) {
|
|
1406
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
1407
|
+
return;
|
|
1408
|
+
event.preventDefault();
|
|
1409
|
+
this.openFilePicker();
|
|
1410
|
+
}
|
|
1411
|
+
onDragOver(event) {
|
|
1412
|
+
event.preventDefault();
|
|
1413
|
+
if (this.notInteractive() || !event.dataTransfer)
|
|
1020
1414
|
return;
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1415
|
+
const draggedItems = Array.from(event.dataTransfer.items).filter(item => item.kind === 'file');
|
|
1416
|
+
const rejected = draggedItems.some(item => this._isTypeRejected(item.type));
|
|
1417
|
+
event.dataTransfer.dropEffect = rejected ? 'none' : 'copy';
|
|
1418
|
+
this.dragState.set(rejected ? 'invalid' : 'valid');
|
|
1025
1419
|
}
|
|
1026
|
-
|
|
1027
|
-
this.
|
|
1028
|
-
|
|
1420
|
+
onDragLeave() {
|
|
1421
|
+
this.dragState.set('idle');
|
|
1422
|
+
}
|
|
1423
|
+
onDrop(event) {
|
|
1424
|
+
event.preventDefault();
|
|
1425
|
+
this.dragState.set('idle');
|
|
1426
|
+
if (this.notInteractive() || !event.dataTransfer)
|
|
1029
1427
|
return;
|
|
1030
|
-
|
|
1031
|
-
this.value.set(date);
|
|
1032
|
-
this.popoverComponent()?.close();
|
|
1033
|
-
}
|
|
1034
|
-
else if (this.mode() === 'date-time') {
|
|
1035
|
-
this.activeView.set('date-time');
|
|
1036
|
-
}
|
|
1037
|
-
else {
|
|
1038
|
-
this.activeView.set('calendar');
|
|
1039
|
-
}
|
|
1428
|
+
this._addFiles(Array.from(event.dataTransfer.files));
|
|
1040
1429
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1430
|
+
// Arrow function so it keeps `this` when passed through a custom file template context.
|
|
1431
|
+
removeFile = (fileIndex) => {
|
|
1043
1432
|
if (this.notInteractive())
|
|
1044
1433
|
return;
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1434
|
+
this.value.update(files => files.filter((_file, index) => index !== fileIndex));
|
|
1435
|
+
};
|
|
1436
|
+
// Private methods
|
|
1437
|
+
_addFiles(incoming) {
|
|
1438
|
+
const accepted = incoming.filter(file => this._acceptsFile(file));
|
|
1439
|
+
if (!accepted.length)
|
|
1440
|
+
return;
|
|
1441
|
+
this.touched.set(true);
|
|
1442
|
+
if (this.multiple()) {
|
|
1443
|
+
this.value.update(files => [...files, ...accepted]);
|
|
1048
1444
|
}
|
|
1049
1445
|
else {
|
|
1050
|
-
this.
|
|
1446
|
+
this.value.set(accepted.slice(0, 1));
|
|
1051
1447
|
}
|
|
1052
1448
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1449
|
+
_acceptsFile(file) {
|
|
1450
|
+
const accept = this.accept().trim();
|
|
1451
|
+
if (!accept)
|
|
1452
|
+
return true;
|
|
1453
|
+
const fileName = file.name.toLowerCase();
|
|
1454
|
+
const fileType = file.type.toLowerCase();
|
|
1455
|
+
return accept.split(',').some(rule => {
|
|
1456
|
+
const pattern = rule.trim().toLowerCase();
|
|
1457
|
+
if (!pattern)
|
|
1458
|
+
return false;
|
|
1459
|
+
if (pattern.startsWith('.'))
|
|
1460
|
+
return fileName.endsWith(pattern);
|
|
1461
|
+
if (pattern.endsWith('/*'))
|
|
1462
|
+
return fileType.startsWith(pattern.slice(0, -1));
|
|
1463
|
+
return fileType === pattern;
|
|
1464
|
+
});
|
|
1057
1465
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1466
|
+
_formatAcceptRule(rule) {
|
|
1467
|
+
if (rule.startsWith('.'))
|
|
1468
|
+
return rule.slice(1).toUpperCase();
|
|
1469
|
+
if (rule.endsWith('/*')) {
|
|
1470
|
+
const category = rule.slice(0, -2);
|
|
1471
|
+
const categoryLabels = {
|
|
1472
|
+
image: 'Images',
|
|
1473
|
+
video: 'Videos',
|
|
1474
|
+
audio: 'Audio',
|
|
1475
|
+
};
|
|
1476
|
+
if (category in categoryLabels)
|
|
1477
|
+
return categoryLabels[category];
|
|
1478
|
+
return `${category.charAt(0).toUpperCase()}${category.slice(1)}`;
|
|
1479
|
+
}
|
|
1480
|
+
const subtype = rule.includes('/') ? rule.slice(rule.indexOf('/') + 1) : rule;
|
|
1481
|
+
return subtype.toUpperCase();
|
|
1482
|
+
}
|
|
1483
|
+
// Drag-time check: only the MIME type is exposed before drop, so reject a
|
|
1484
|
+
// dragged file only when we can be certain it fails purely MIME-based rules.
|
|
1485
|
+
_isTypeRejected(type) {
|
|
1486
|
+
const accept = this.accept().trim();
|
|
1487
|
+
if (!accept)
|
|
1488
|
+
return false;
|
|
1489
|
+
const rules = accept
|
|
1490
|
+
.split(',')
|
|
1491
|
+
.map(rule => rule.trim().toLowerCase())
|
|
1492
|
+
.filter(Boolean);
|
|
1493
|
+
const hasExtensionRule = rules.some(rule => rule.startsWith('.'));
|
|
1494
|
+
if (hasExtensionRule || !type)
|
|
1495
|
+
return false;
|
|
1496
|
+
const fileType = type.toLowerCase();
|
|
1497
|
+
const matches = rules.some(rule => rule.endsWith('/*') ? fileType.startsWith(rule.slice(0, -1)) : fileType === rule);
|
|
1498
|
+
return !matches;
|
|
1499
|
+
}
|
|
1500
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FileUploader, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1501
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: FileUploader, isStandalone: true, selector: "tls-file-uploader", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileUploader) }], queries: [{ propertyName: "dropZoneTemplate", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }, { propertyName: "fileTemplate", first: true, predicate: ["file"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<input\n #fileInput\n class=\"tls-file-uploader__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n<div\n class=\"tls-file-uploader__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"multiple() ? 'Upload files' : 'Upload file'\"\n [class.tls-file-uploader__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-uploader__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-uploader__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n>\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-uploader__label\">\n @if (dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-uploader__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n</div>\n@if (value().length) {\n <ul class=\"tls-file-uploader__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-uploader__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-uploader__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-uploader__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1060
1502
|
}
|
|
1061
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type:
|
|
1503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FileUploader, decorators: [{
|
|
1062
1504
|
type: Component,
|
|
1063
|
-
args: [{ selector: 'tls-
|
|
1064
|
-
}],
|
|
1505
|
+
args: [{ selector: 'tls-file-uploader', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileUploader) }], host: { '[class]': 'classes()' }, template: "<input\n #fileInput\n class=\"tls-file-uploader__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n<div\n class=\"tls-file-uploader__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"multiple() ? 'Upload files' : 'Upload file'\"\n [class.tls-file-uploader__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-uploader__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-uploader__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n>\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-uploader__label\">\n @if (dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-uploader__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n</div>\n@if (value().length) {\n <ul class=\"tls-file-uploader__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-uploader__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-uploader__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-uploader__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n" }]
|
|
1506
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], dropZoneTemplate: [{ type: i0.ContentChild, args: ['dropZone', { isSignal: true }] }], fileTemplate: [{ type: i0.ContentChild, args: ['file', { isSignal: true }] }] } });
|
|
1065
1507
|
|
|
1066
1508
|
const DEFAULT_INPUT_CONFIG = {
|
|
1067
1509
|
size: 'md',
|
|
@@ -1148,14 +1590,8 @@ class Password extends ValueFormControl {
|
|
|
1148
1590
|
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1149
1591
|
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1150
1592
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
const array = ['tls-password', groupClass];
|
|
1154
|
-
array.push(`${groupClass}--${this.size()}`);
|
|
1155
|
-
if (this.fluid())
|
|
1156
|
-
array.push(`${groupClass}--fluid`);
|
|
1157
|
-
return array;
|
|
1158
|
-
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1593
|
+
showIconTemplate = contentChild('showIcon', ...(ngDevMode ? [{ debugName: "showIconTemplate" }] : []));
|
|
1594
|
+
hideIconTemplate = contentChild('hideIcon', ...(ngDevMode ? [{ debugName: "hideIconTemplate" }] : []));
|
|
1159
1595
|
type = computed(() => (this.visible() ? 'text' : 'password'), ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
1160
1596
|
// Protected methods
|
|
1161
1597
|
onInput(event) {
|
|
@@ -1168,14 +1604,14 @@ class Password extends ValueFormControl {
|
|
|
1168
1604
|
this.visible.update(prev => !prev);
|
|
1169
1605
|
}
|
|
1170
1606
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1171
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1607
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.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: { classAttribute: "tls-password" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], queries: [{ propertyName: "showIconTemplate", first: true, predicate: ["showIcon"], descendants: true, isSignal: true }, { propertyName: "hideIconTemplate", first: true, predicate: ["hideIcon"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n <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\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Show</span>\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Hide</span>\n }\n </span>\n </button>\n</tls-form-control-group>\n", dependencies: [{ kind: "component", type: FormControlGroup, selector: "tls-form-control-group", inputs: ["size", "fluid"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1172
1608
|
}
|
|
1173
1609
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, decorators: [{
|
|
1174
1610
|
type: Component,
|
|
1175
|
-
args: [{ selector: 'tls-password', host: {
|
|
1176
|
-
|
|
1177
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<input\n
|
|
1178
|
-
}], 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 }] }] } });
|
|
1611
|
+
args: [{ selector: 'tls-password', imports: [FormControlGroup, NgTemplateOutlet], host: {
|
|
1612
|
+
class: 'tls-password',
|
|
1613
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n <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\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Show</span>\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Hide</span>\n }\n </span>\n </button>\n</tls-form-control-group>\n" }]
|
|
1614
|
+
}], 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 }] }], showIconTemplate: [{ type: i0.ContentChild, args: ['showIcon', { isSignal: true }] }], hideIconTemplate: [{ type: i0.ContentChild, args: ['hideIcon', { isSignal: true }] }] } });
|
|
1179
1615
|
|
|
1180
1616
|
// Matches strings containing only numeric digits (0–9).
|
|
1181
1617
|
// Ensures the entire input consists exclusively of numbers.
|
|
@@ -1352,78 +1788,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1352
1788
|
}, 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" }]
|
|
1353
1789
|
}], 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 }] }] } });
|
|
1354
1790
|
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
_overlay = createOverlayManager();
|
|
1369
|
-
_triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "_triggerElement" }] : []));
|
|
1370
|
-
_panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "_panelTemplate" }] : []));
|
|
1371
|
-
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1791
|
+
/**
|
|
1792
|
+
* Shared base for the single {@link Select} and {@link MultiSelect} controls.
|
|
1793
|
+
* Owns everything the two listbox-combobox controls have in common: the option
|
|
1794
|
+
* inputs, the connected overlay lifecycle, roving `aria-activedescendant`
|
|
1795
|
+
* navigation, and the keyboard handler. The per-control differences (the value
|
|
1796
|
+
* shape, the selected-state check, how the trigger label is built and what a
|
|
1797
|
+
* commit does) are expressed through the abstract members below.
|
|
1798
|
+
*/
|
|
1799
|
+
class AbstractSelect extends ValueFormControl {
|
|
1800
|
+
overlay = createOverlayManager();
|
|
1801
|
+
triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "triggerElement" }] : []));
|
|
1802
|
+
panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "panelTemplate" }] : []));
|
|
1803
|
+
// Shared inputs (config-independent)
|
|
1372
1804
|
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
1373
1805
|
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1374
1806
|
optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
|
|
1375
1807
|
optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
|
|
1376
1808
|
optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
|
|
1377
|
-
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1378
|
-
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1379
|
-
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1380
1809
|
tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
|
|
1381
|
-
|
|
1382
|
-
isOpen = this._overlay.isOpen;
|
|
1810
|
+
isOpen = this.overlay.isOpen;
|
|
1383
1811
|
activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
1384
|
-
normalizedOptions = computed(() => {
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
value: (optionValue ? typedOption[optionValue] : typedOption),
|
|
1396
|
-
label: String(optionLabel ? typedOption[optionLabel] : typedOption),
|
|
1397
|
-
disabled: Boolean(optionDisabled ? typedOption[optionDisabled] : false),
|
|
1398
|
-
};
|
|
1399
|
-
});
|
|
1400
|
-
}, ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
|
|
1401
|
-
hasValue = computed(() => {
|
|
1402
|
-
const value = this.value();
|
|
1403
|
-
return value !== null && value !== undefined && value !== '';
|
|
1404
|
-
}, ...(ngDevMode ? [{ debugName: "hasValue" }] : []));
|
|
1405
|
-
selectedLabel = computed(() => {
|
|
1406
|
-
if (!this.hasValue())
|
|
1407
|
-
return '';
|
|
1408
|
-
return this.normalizedOptions().find(option => option.value === this.value())?.label ?? '';
|
|
1409
|
-
}, ...(ngDevMode ? [{ debugName: "selectedLabel" }] : []));
|
|
1410
|
-
// Classes
|
|
1812
|
+
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
1813
|
+
label: this.optionLabel(),
|
|
1814
|
+
value: this.optionValue(),
|
|
1815
|
+
disabled: this.optionDisabled(),
|
|
1816
|
+
}), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
|
|
1817
|
+
activeDescendantId = computed(() => {
|
|
1818
|
+
const index = this.activeIndex();
|
|
1819
|
+
if (index < 0)
|
|
1820
|
+
return null;
|
|
1821
|
+
return this.optionId(index);
|
|
1822
|
+
}, ...(ngDevMode ? [{ debugName: "activeDescendantId" }] : []));
|
|
1411
1823
|
hostClasses = computed(() => {
|
|
1412
|
-
const array = [
|
|
1824
|
+
const array = [this.hostClassBase];
|
|
1413
1825
|
if (this.isOpen())
|
|
1414
|
-
array.push(
|
|
1826
|
+
array.push(`${this.hostClassBase}--open`);
|
|
1415
1827
|
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
1416
1828
|
if (this.fluid())
|
|
1417
1829
|
array.push(`${this.CLASS_NAME}--fluid`);
|
|
1418
1830
|
return array.concat(this.controlClasses());
|
|
1419
1831
|
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
1832
|
+
get listboxId() {
|
|
1833
|
+
return `${this.uniqueId}-listbox`;
|
|
1834
|
+
}
|
|
1420
1835
|
// Protected methods
|
|
1421
1836
|
open() {
|
|
1422
|
-
const triggerElement = this.
|
|
1423
|
-
const panelTemplate = this.
|
|
1837
|
+
const triggerElement = this.triggerElement();
|
|
1838
|
+
const panelTemplate = this.panelTemplate();
|
|
1424
1839
|
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
1425
1840
|
return;
|
|
1426
|
-
this.
|
|
1841
|
+
this.overlay.open({
|
|
1427
1842
|
content: panelTemplate,
|
|
1428
1843
|
origin: triggerElement,
|
|
1429
1844
|
positions: [
|
|
@@ -1432,20 +1847,22 @@ class Select extends ValueFormControl {
|
|
|
1432
1847
|
],
|
|
1433
1848
|
flexibleDimensions: false,
|
|
1434
1849
|
push: false,
|
|
1435
|
-
panelClass:
|
|
1436
|
-
//
|
|
1850
|
+
panelClass: this.panelClass,
|
|
1851
|
+
// The control handles Escape itself via the trigger's keydown handler.
|
|
1437
1852
|
closeOnEscape: false,
|
|
1438
1853
|
minWidth: triggerElement.nativeElement.offsetWidth,
|
|
1439
1854
|
reuse: true,
|
|
1440
1855
|
onClose: () => {
|
|
1441
1856
|
this.activeIndex.set(-1);
|
|
1442
|
-
this.
|
|
1857
|
+
const trigger = this.triggerElement();
|
|
1858
|
+
if (trigger)
|
|
1859
|
+
trigger.nativeElement.focus();
|
|
1443
1860
|
},
|
|
1444
1861
|
});
|
|
1445
|
-
this.activeIndex.set(this.
|
|
1862
|
+
this.activeIndex.set(this.getInitialActiveIndex());
|
|
1446
1863
|
}
|
|
1447
1864
|
close() {
|
|
1448
|
-
this.
|
|
1865
|
+
this.overlay.close();
|
|
1449
1866
|
}
|
|
1450
1867
|
toggle() {
|
|
1451
1868
|
if (this.isOpen()) {
|
|
@@ -1455,15 +1872,6 @@ class Select extends ValueFormControl {
|
|
|
1455
1872
|
this.open();
|
|
1456
1873
|
}
|
|
1457
1874
|
}
|
|
1458
|
-
select(option) {
|
|
1459
|
-
if (option.disabled)
|
|
1460
|
-
return;
|
|
1461
|
-
this.value.set(option.value);
|
|
1462
|
-
this.close();
|
|
1463
|
-
}
|
|
1464
|
-
clear() {
|
|
1465
|
-
this.value.set(null);
|
|
1466
|
-
}
|
|
1467
1875
|
onOptionHover(index, disabled) {
|
|
1468
1876
|
if (!disabled)
|
|
1469
1877
|
this.activeIndex.set(index);
|
|
@@ -1472,7 +1880,7 @@ class Select extends ValueFormControl {
|
|
|
1472
1880
|
if (event.key === 'ArrowDown') {
|
|
1473
1881
|
event.preventDefault();
|
|
1474
1882
|
if (this.isOpen()) {
|
|
1475
|
-
this.
|
|
1883
|
+
this.moveActive(1);
|
|
1476
1884
|
}
|
|
1477
1885
|
else {
|
|
1478
1886
|
this.open();
|
|
@@ -1481,7 +1889,7 @@ class Select extends ValueFormControl {
|
|
|
1481
1889
|
else if (event.key === 'ArrowUp') {
|
|
1482
1890
|
event.preventDefault();
|
|
1483
1891
|
if (this.isOpen()) {
|
|
1484
|
-
this.
|
|
1892
|
+
this.moveActive(-1);
|
|
1485
1893
|
}
|
|
1486
1894
|
else {
|
|
1487
1895
|
this.open();
|
|
@@ -1495,7 +1903,19 @@ class Select extends ValueFormControl {
|
|
|
1495
1903
|
}
|
|
1496
1904
|
const active = this.normalizedOptions()[this.activeIndex()];
|
|
1497
1905
|
if (active && !active.disabled)
|
|
1498
|
-
this.
|
|
1906
|
+
this.commitActiveOption(active);
|
|
1907
|
+
}
|
|
1908
|
+
else if (event.key === 'Home') {
|
|
1909
|
+
if (!this.isOpen())
|
|
1910
|
+
return;
|
|
1911
|
+
event.preventDefault();
|
|
1912
|
+
this.moveActiveToEdge(1);
|
|
1913
|
+
}
|
|
1914
|
+
else if (event.key === 'End') {
|
|
1915
|
+
if (!this.isOpen())
|
|
1916
|
+
return;
|
|
1917
|
+
event.preventDefault();
|
|
1918
|
+
this.moveActiveToEdge(-1);
|
|
1499
1919
|
}
|
|
1500
1920
|
else if (event.key === 'Escape') {
|
|
1501
1921
|
event.preventDefault();
|
|
@@ -1513,8 +1933,11 @@ class Select extends ValueFormControl {
|
|
|
1513
1933
|
this.clear();
|
|
1514
1934
|
}
|
|
1515
1935
|
}
|
|
1936
|
+
optionId(index) {
|
|
1937
|
+
return `${this.uniqueId}-option-${index}`;
|
|
1938
|
+
}
|
|
1516
1939
|
// Private methods
|
|
1517
|
-
|
|
1940
|
+
moveActive(direction) {
|
|
1518
1941
|
const options = this.normalizedOptions();
|
|
1519
1942
|
let next = this.activeIndex() + direction;
|
|
1520
1943
|
while (next >= 0 && next < options.length) {
|
|
@@ -1525,15 +1948,155 @@ class Select extends ValueFormControl {
|
|
|
1525
1948
|
next += direction;
|
|
1526
1949
|
}
|
|
1527
1950
|
}
|
|
1951
|
+
moveActiveToEdge(direction) {
|
|
1952
|
+
const options = this.normalizedOptions();
|
|
1953
|
+
let next = direction === 1 ? 0 : options.length - 1;
|
|
1954
|
+
while (next >= 0 && next < options.length) {
|
|
1955
|
+
if (!options[next].disabled) {
|
|
1956
|
+
this.activeIndex.set(next);
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
next += direction;
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AbstractSelect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1963
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.1", type: AbstractSelect, isStandalone: true, inputs: { 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 }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, 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 });
|
|
1964
|
+
}
|
|
1965
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AbstractSelect, decorators: [{
|
|
1966
|
+
type: Directive
|
|
1967
|
+
}], propDecorators: { triggerElement: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], panelTemplate: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], 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 }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
1968
|
+
|
|
1969
|
+
const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
1970
|
+
size: 'md',
|
|
1971
|
+
placeholder: '',
|
|
1972
|
+
fluid: false,
|
|
1973
|
+
clearable: false,
|
|
1974
|
+
maxLabels: 2,
|
|
1975
|
+
};
|
|
1976
|
+
|
|
1977
|
+
const MULTI_SELECT_CONFIG = new InjectionToken('MULTI_SELECT_CONFIG', {
|
|
1978
|
+
factory: () => DEFAULT_MULTI_SELECT_CONFIG,
|
|
1979
|
+
});
|
|
1980
|
+
|
|
1981
|
+
class MultiSelect extends AbstractSelect {
|
|
1982
|
+
static _nextUniqueId = 0;
|
|
1983
|
+
_config = inject(MULTI_SELECT_CONFIG);
|
|
1984
|
+
uniqueId = `tls-multi-select-${MultiSelect._nextUniqueId++}`;
|
|
1985
|
+
hostClassBase = 'tls-multi-select';
|
|
1986
|
+
panelClass = 'tls-multi-select-panel';
|
|
1987
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1988
|
+
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1989
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1990
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1991
|
+
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
|
|
1992
|
+
maxLabels = input(this._config.maxLabels, ...(ngDevMode ? [{ debugName: "maxLabels" }] : []));
|
|
1993
|
+
hasValue = computed(() => this.value().length > 0, ...(ngDevMode ? [{ debugName: "hasValue" }] : []));
|
|
1994
|
+
selectedValues = computed(() => new Set(this.value()), ...(ngDevMode ? [{ debugName: "selectedValues" }] : []));
|
|
1995
|
+
triggerLabel = computed(() => {
|
|
1996
|
+
const selected = this.value();
|
|
1997
|
+
if (selected.length === 0)
|
|
1998
|
+
return '';
|
|
1999
|
+
const max = this.maxLabels();
|
|
2000
|
+
if (selected.length > max)
|
|
2001
|
+
return `${selected.length} selected`;
|
|
2002
|
+
const optionMap = new Map(this.normalizedOptions().map(option => [option.value, option.label]));
|
|
2003
|
+
return selected.map(value => optionMap.get(value) ?? String(value)).join(', ');
|
|
2004
|
+
}, ...(ngDevMode ? [{ debugName: "triggerLabel" }] : []));
|
|
2005
|
+
isSelected(option) {
|
|
2006
|
+
return this.selectedValues().has(option.value);
|
|
2007
|
+
}
|
|
2008
|
+
toggleOption(option) {
|
|
2009
|
+
if (option.disabled)
|
|
2010
|
+
return;
|
|
2011
|
+
if (this.isSelected(option)) {
|
|
2012
|
+
this.value.update(current => current.filter(item => item !== option.value));
|
|
2013
|
+
}
|
|
2014
|
+
else {
|
|
2015
|
+
this.value.update(current => [...current, option.value]);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
clear() {
|
|
2019
|
+
this.value.set([]);
|
|
2020
|
+
}
|
|
2021
|
+
getInitialActiveIndex() {
|
|
2022
|
+
const options = this.normalizedOptions();
|
|
2023
|
+
const selected = this.selectedValues();
|
|
2024
|
+
const firstSelected = options.findIndex(option => !option.disabled && selected.has(option.value));
|
|
2025
|
+
if (firstSelected !== -1)
|
|
2026
|
+
return firstSelected;
|
|
2027
|
+
return options.findIndex(option => !option.disabled);
|
|
2028
|
+
}
|
|
2029
|
+
commitActiveOption(option) {
|
|
2030
|
+
this.toggleOption(option);
|
|
2031
|
+
}
|
|
2032
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MultiSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2033
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\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-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-multi-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-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-multi-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-multi-select__panel\" role=\"listbox\" aria-multiselectable=\"true\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">{{ option.label }}</span>\n @if (isSelected(option)) {\n <svg class=\"tls-multi-select__option-check\" viewBox=\"0 0 10 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 4L3.5 6.5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n }\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
|
|
2034
|
+
}
|
|
2035
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MultiSelect, decorators: [{
|
|
2036
|
+
type: Component,
|
|
2037
|
+
args: [{ selector: 'tls-multi-select', host: {
|
|
2038
|
+
'[class]': 'hostClasses()',
|
|
2039
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\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-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-multi-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-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-multi-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-multi-select__panel\" role=\"listbox\" aria-multiselectable=\"true\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">{{ option.label }}</span>\n @if (isSelected(option)) {\n <svg class=\"tls-multi-select__option-check\" viewBox=\"0 0 10 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 4L3.5 6.5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n }\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" }]
|
|
2040
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], 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 }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLabels", required: false }] }] } });
|
|
2041
|
+
|
|
2042
|
+
const DEFAULT_SELECT_CONFIG = {
|
|
2043
|
+
size: 'md',
|
|
2044
|
+
placeholder: '',
|
|
2045
|
+
fluid: false,
|
|
2046
|
+
clearable: false,
|
|
2047
|
+
};
|
|
2048
|
+
|
|
2049
|
+
const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
2050
|
+
factory: () => DEFAULT_SELECT_CONFIG,
|
|
2051
|
+
});
|
|
2052
|
+
|
|
2053
|
+
class Select extends AbstractSelect {
|
|
2054
|
+
static _nextUniqueId = 0;
|
|
2055
|
+
_config = inject(SELECT_CONFIG);
|
|
2056
|
+
uniqueId = `tls-select-${Select._nextUniqueId++}`;
|
|
2057
|
+
hostClassBase = 'tls-select';
|
|
2058
|
+
panelClass = 'tls-select-panel';
|
|
2059
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
2060
|
+
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
2061
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
2062
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
2063
|
+
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
|
|
2064
|
+
hasValue = computed(() => {
|
|
2065
|
+
const value = this.value();
|
|
2066
|
+
return value !== null && value !== undefined && value !== '';
|
|
2067
|
+
}, ...(ngDevMode ? [{ debugName: "hasValue" }] : []));
|
|
2068
|
+
selectedLabel = computed(() => {
|
|
2069
|
+
if (!this.hasValue())
|
|
2070
|
+
return '';
|
|
2071
|
+
const selected = this.normalizedOptions().find(option => option.value === this.value());
|
|
2072
|
+
if (!selected)
|
|
2073
|
+
return '';
|
|
2074
|
+
return selected.label;
|
|
2075
|
+
}, ...(ngDevMode ? [{ debugName: "selectedLabel" }] : []));
|
|
2076
|
+
select(option) {
|
|
2077
|
+
if (option.disabled)
|
|
2078
|
+
return;
|
|
2079
|
+
this.value.set(option.value);
|
|
2080
|
+
this.close();
|
|
2081
|
+
}
|
|
2082
|
+
clear() {
|
|
2083
|
+
this.value.set(null);
|
|
2084
|
+
}
|
|
2085
|
+
getInitialActiveIndex() {
|
|
2086
|
+
return this.normalizedOptions().findIndex(option => option.value === this.value());
|
|
2087
|
+
}
|
|
2088
|
+
commitActiveOption(option) {
|
|
2089
|
+
this.select(option);
|
|
2090
|
+
}
|
|
1528
2091
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
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 },
|
|
2092
|
+
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 }, 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 }, 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) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\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\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
|
|
1530
2093
|
}
|
|
1531
2094
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, decorators: [{
|
|
1532
2095
|
type: Component,
|
|
1533
2096
|
args: [{ selector: 'tls-select', host: {
|
|
1534
2097
|
'[class]': 'hostClasses()',
|
|
1535
|
-
}, 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
|
|
1536
|
-
}], propDecorators: {
|
|
2098
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\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\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" }]
|
|
2099
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], 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 }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }] } });
|
|
1537
2100
|
|
|
1538
2101
|
const DEFAULT_SWITCH_CONFIG = {
|
|
1539
2102
|
color: 'primary',
|
|
@@ -1626,6 +2189,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1626
2189
|
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
2190
|
}], 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
2191
|
|
|
2192
|
+
const DEFAULT_TOGGLE_GROUP_CONFIG = {
|
|
2193
|
+
size: 'md',
|
|
2194
|
+
color: 'primary',
|
|
2195
|
+
orientation: 'horizontal',
|
|
2196
|
+
type: 'single',
|
|
2197
|
+
unselectable: false,
|
|
2198
|
+
};
|
|
2199
|
+
|
|
2200
|
+
const TOGGLE_GROUP_CONFIG = new InjectionToken('TOGGLE_GROUP_CONFIG', {
|
|
2201
|
+
factory: () => DEFAULT_TOGGLE_GROUP_CONFIG,
|
|
2202
|
+
});
|
|
2203
|
+
|
|
2204
|
+
class ToggleGroup extends ValueFormControl {
|
|
2205
|
+
_config = inject(TOGGLE_GROUP_CONFIG);
|
|
2206
|
+
CLASS_NAME = 'tls-toggle-group';
|
|
2207
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
2208
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2209
|
+
optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
|
|
2210
|
+
optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
|
|
2211
|
+
optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
|
|
2212
|
+
type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
2213
|
+
unselectable = input(this._config.unselectable, { ...(ngDevMode ? { debugName: "unselectable" } : {}), transform: booleanAttribute });
|
|
2214
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
2215
|
+
color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
2216
|
+
orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
|
|
2217
|
+
optionTemplate = contentChild('option', ...(ngDevMode ? [{ debugName: "optionTemplate" }] : []));
|
|
2218
|
+
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
2219
|
+
label: this.optionLabel(),
|
|
2220
|
+
value: this.optionValue(),
|
|
2221
|
+
disabled: this.optionDisabled(),
|
|
2222
|
+
}), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
|
|
2223
|
+
classes = computed(() => {
|
|
2224
|
+
const className = this.CLASS_NAME;
|
|
2225
|
+
const array = [
|
|
2226
|
+
className,
|
|
2227
|
+
`${className}--${this.size()}`,
|
|
2228
|
+
`${className}--${this.color()}`,
|
|
2229
|
+
`${className}--${this.orientation()}`,
|
|
2230
|
+
];
|
|
2231
|
+
return array.concat(this.controlClasses());
|
|
2232
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
2233
|
+
isSelected(optionValue) {
|
|
2234
|
+
return this.value().includes(optionValue);
|
|
2235
|
+
}
|
|
2236
|
+
select(option) {
|
|
2237
|
+
if (this.notInteractive() || option.disabled)
|
|
2238
|
+
return;
|
|
2239
|
+
if (this.type() === 'single') {
|
|
2240
|
+
if (this.isSelected(option.value) && !this.unselectable())
|
|
2241
|
+
return;
|
|
2242
|
+
this.value.set(this.isSelected(option.value) ? [] : [option.value]);
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
if (this.isSelected(option.value)) {
|
|
2246
|
+
this.value.update(current => current.filter(item => item !== option.value));
|
|
2247
|
+
}
|
|
2248
|
+
else {
|
|
2249
|
+
this.value.update(current => [...current, option.value]);
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2253
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "group" }, properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: option }\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2254
|
+
}
|
|
2255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, decorators: [{
|
|
2256
|
+
type: Component,
|
|
2257
|
+
args: [{ selector: 'tls-toggle-group', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], host: {
|
|
2258
|
+
role: 'group',
|
|
2259
|
+
'[class]': 'classes()',
|
|
2260
|
+
}, template: "@for (option of normalizedOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: option }\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n" }]
|
|
2261
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], 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 }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }] } });
|
|
2262
|
+
|
|
1629
2263
|
class IconService {
|
|
1630
2264
|
_http = inject(HttpClient);
|
|
1631
2265
|
_sanitizer = inject(DomSanitizer);
|
|
@@ -2036,7 +2670,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
2036
2670
|
}], 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 }] }] } });
|
|
2037
2671
|
|
|
2038
2672
|
const DEFAULT_SKELETON_CONFIG = {
|
|
2039
|
-
size:
|
|
2673
|
+
size: null,
|
|
2040
2674
|
width: null,
|
|
2041
2675
|
height: null,
|
|
2042
2676
|
radius: 8,
|
|
@@ -2073,8 +2707,8 @@ class Skeleton {
|
|
|
2073
2707
|
const rounded = this.rounded();
|
|
2074
2708
|
const radius = this.radius();
|
|
2075
2709
|
return {
|
|
2076
|
-
'--tls-skeleton-width': `${width}px
|
|
2077
|
-
'--tls-skeleton-height': `${height}px
|
|
2710
|
+
'--tls-skeleton-width': width !== null ? `${width}px` : '100%',
|
|
2711
|
+
'--tls-skeleton-height': height !== null ? `${height}px` : '100%',
|
|
2078
2712
|
'--tls-skeleton-radius': rounded ? '50%' : `${radius}px`,
|
|
2079
2713
|
'--tls-skeleton-duration': `${this.duration()}ms`,
|
|
2080
2714
|
};
|
|
@@ -2633,6 +3267,19 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2633
3267
|
provide: BUTTON_CONFIG,
|
|
2634
3268
|
useValue: deepMerge(DEFAULT_BUTTON_CONFIG, config.components.button),
|
|
2635
3269
|
},
|
|
3270
|
+
{
|
|
3271
|
+
provide: CHECKBOX_CONFIG,
|
|
3272
|
+
useValue: deepMerge(DEFAULT_CHECKBOX_CONFIG, config.components.checkbox),
|
|
3273
|
+
},
|
|
3274
|
+
{ provide: CHIP_CONFIG, useValue: deepMerge(DEFAULT_CHIP_CONFIG, config.components.chip) },
|
|
3275
|
+
{
|
|
3276
|
+
provide: CHIP_CONTROL_CONFIG,
|
|
3277
|
+
useValue: deepMerge(DEFAULT_CHIP_CONTROL_CONFIG, config.components.chipControl),
|
|
3278
|
+
},
|
|
3279
|
+
{
|
|
3280
|
+
provide: CHIP_INPUT_CONFIG,
|
|
3281
|
+
useValue: deepMerge(DEFAULT_CHIP_INPUT_CONFIG, config.components.chipInput),
|
|
3282
|
+
},
|
|
2636
3283
|
{
|
|
2637
3284
|
provide: DATE_TIME_PICKER_CONFIG,
|
|
2638
3285
|
useValue: deepMerge(DEFAULT_DATE_TIME_PICKER_CONFIG, config.components.dateTimePicker),
|
|
@@ -2645,32 +3292,53 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2645
3292
|
provide: DIVIDER_CONFIG,
|
|
2646
3293
|
useValue: deepMerge(DEFAULT_DIVIDER_CONFIG, config.components.divider),
|
|
2647
3294
|
},
|
|
2648
|
-
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
|
|
2649
|
-
{
|
|
2650
|
-
provide: PASSWORD_CONFIG,
|
|
2651
|
-
useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, config.components.password),
|
|
2652
|
-
},
|
|
2653
3295
|
{
|
|
2654
|
-
provide:
|
|
2655
|
-
useValue: deepMerge(
|
|
3296
|
+
provide: FILE_UPLOADER_CONFIG,
|
|
3297
|
+
useValue: deepMerge(DEFAULT_FILE_UPLOADER_CONFIG, config.components.fileUploader),
|
|
2656
3298
|
},
|
|
2657
3299
|
{
|
|
2658
|
-
provide:
|
|
2659
|
-
useValue: deepMerge(
|
|
3300
|
+
provide: FORM_CONTROL_GROUP_CONFIG,
|
|
3301
|
+
useValue: deepMerge(DEFAULT_FORM_CONTROL_GROUP_CONFIG, config.components.formControlGroup),
|
|
2660
3302
|
},
|
|
2661
3303
|
{
|
|
2662
3304
|
provide: FORM_ITEM_CONFIG,
|
|
2663
3305
|
useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
|
|
2664
3306
|
},
|
|
2665
3307
|
{ provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG, config.components.icon) },
|
|
3308
|
+
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
|
|
3309
|
+
{
|
|
3310
|
+
provide: LOADER_CONFIG,
|
|
3311
|
+
useValue: deepMerge(DEFAULT_LOADER_CONFIG, config.components.loader),
|
|
3312
|
+
},
|
|
3313
|
+
{ provide: MENU_CONFIG, useValue: deepMerge(DEFAULT_MENU_CONFIG, config.components.menu) },
|
|
3314
|
+
{
|
|
3315
|
+
provide: MULTI_SELECT_CONFIG,
|
|
3316
|
+
useValue: deepMerge(DEFAULT_MULTI_SELECT_CONFIG, config.components.multiSelect),
|
|
3317
|
+
},
|
|
2666
3318
|
{
|
|
2667
3319
|
provide: PAGINATION_CONFIG,
|
|
2668
3320
|
useValue: deepMerge(DEFAULT_PAGINATION_CONFIG, config.components.pagination),
|
|
2669
3321
|
},
|
|
3322
|
+
{
|
|
3323
|
+
provide: PASSWORD_CONFIG,
|
|
3324
|
+
useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, config.components.password),
|
|
3325
|
+
},
|
|
3326
|
+
{
|
|
3327
|
+
provide: PIN_INPUT_CONFIG,
|
|
3328
|
+
useValue: deepMerge(DEFAULT_PIN_INPUT_CONFIG, config.components.pinInput),
|
|
3329
|
+
},
|
|
2670
3330
|
{
|
|
2671
3331
|
provide: POPOVER_CONFIG,
|
|
2672
3332
|
useValue: deepMerge(DEFAULT_POPOVER_CONFIG, config.components.popover),
|
|
2673
3333
|
},
|
|
3334
|
+
{
|
|
3335
|
+
provide: RADIO_BUTTON_CONFIG,
|
|
3336
|
+
useValue: deepMerge(DEFAULT_RADIO_BUTTON_CONFIG, config.components.radioButton),
|
|
3337
|
+
},
|
|
3338
|
+
{
|
|
3339
|
+
provide: SELECT_CONFIG,
|
|
3340
|
+
useValue: deepMerge(DEFAULT_SELECT_CONFIG, config.components.select),
|
|
3341
|
+
},
|
|
2674
3342
|
{
|
|
2675
3343
|
provide: SKELETON_CONFIG,
|
|
2676
3344
|
useValue: deepMerge(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
|
|
@@ -2679,12 +3347,20 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2679
3347
|
provide: STEPPER_CONFIG,
|
|
2680
3348
|
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, config.components.stepper),
|
|
2681
3349
|
},
|
|
3350
|
+
{
|
|
3351
|
+
provide: SWITCH_CONFIG,
|
|
3352
|
+
useValue: deepMerge(DEFAULT_SWITCH_CONFIG, config.components.switch),
|
|
3353
|
+
},
|
|
2682
3354
|
{ provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG, config.components.table) },
|
|
2683
3355
|
{ provide: TABS_CONFIG, useValue: deepMerge(DEFAULT_TABS_CONFIG, config.components.tabs) },
|
|
2684
3356
|
{
|
|
2685
3357
|
provide: TEXTAREA_CONFIG,
|
|
2686
3358
|
useValue: deepMerge(DEFAULT_TEXTAREA_CONFIG, config.components.textarea),
|
|
2687
3359
|
},
|
|
3360
|
+
{
|
|
3361
|
+
provide: TOGGLE_GROUP_CONFIG,
|
|
3362
|
+
useValue: deepMerge(DEFAULT_TOGGLE_GROUP_CONFIG, config.components.toggleGroup),
|
|
3363
|
+
},
|
|
2688
3364
|
{
|
|
2689
3365
|
provide: TOOLTIP_CONFIG,
|
|
2690
3366
|
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
|
|
@@ -2696,5 +3372,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2696
3372
|
* Generated bundle index. Do not edit.
|
|
2697
3373
|
*/
|
|
2698
3374
|
|
|
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 };
|
|
3375
|
+
export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_INPUT_CONFIG, Checkbox, Chip, ChipControl, ChipInput, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FILE_UPLOADER_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_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_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FILE_UPLOADER_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileUploader, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, 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, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, ToggleGroup, TooltipDirective, provideThalassicUIConfig };
|
|
2700
3376
|
//# sourceMappingURL=thalassic-ui.mjs.map
|