@thalassic/ui 0.9.0 → 0.10.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 +645 -112
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +281 -56
|
@@ -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
|
});
|
|
@@ -1063,6 +1292,219 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1063
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" }]
|
|
1064
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 }] }] } });
|
|
1065
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)
|
|
1414
|
+
return;
|
|
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');
|
|
1419
|
+
}
|
|
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)
|
|
1427
|
+
return;
|
|
1428
|
+
this._addFiles(Array.from(event.dataTransfer.files));
|
|
1429
|
+
}
|
|
1430
|
+
// Arrow function so it keeps `this` when passed through a custom file template context.
|
|
1431
|
+
removeFile = (fileIndex) => {
|
|
1432
|
+
if (this.notInteractive())
|
|
1433
|
+
return;
|
|
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]);
|
|
1444
|
+
}
|
|
1445
|
+
else {
|
|
1446
|
+
this.value.set(accepted.slice(0, 1));
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
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
|
+
});
|
|
1465
|
+
}
|
|
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"] }] });
|
|
1502
|
+
}
|
|
1503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FileUploader, decorators: [{
|
|
1504
|
+
type: Component,
|
|
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 }] }] } });
|
|
1507
|
+
|
|
1066
1508
|
const DEFAULT_INPUT_CONFIG = {
|
|
1067
1509
|
size: 'md',
|
|
1068
1510
|
type: 'text',
|
|
@@ -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.
|
|
@@ -1381,23 +1817,11 @@ class Select extends ValueFormControl {
|
|
|
1381
1817
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
|
|
1382
1818
|
isOpen = this._overlay.isOpen;
|
|
1383
1819
|
activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
1384
|
-
normalizedOptions = computed(() => {
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
return options.map(option => {
|
|
1390
|
-
if (typeof option === 'string' || typeof option === 'number') {
|
|
1391
|
-
return { value: option, label: String(option), disabled: false };
|
|
1392
|
-
}
|
|
1393
|
-
const typedOption = option;
|
|
1394
|
-
return {
|
|
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" }] : []));
|
|
1820
|
+
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
1821
|
+
label: this.optionLabel(),
|
|
1822
|
+
value: this.optionValue(),
|
|
1823
|
+
disabled: this.optionDisabled(),
|
|
1824
|
+
}), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
|
|
1401
1825
|
hasValue = computed(() => {
|
|
1402
1826
|
const value = this.value();
|
|
1403
1827
|
return value !== null && value !== undefined && value !== '';
|
|
@@ -1626,6 +2050,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1626
2050
|
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
2051
|
}], 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
2052
|
|
|
2053
|
+
const DEFAULT_TOGGLE_GROUP_CONFIG = {
|
|
2054
|
+
size: 'md',
|
|
2055
|
+
color: 'primary',
|
|
2056
|
+
orientation: 'horizontal',
|
|
2057
|
+
type: 'single',
|
|
2058
|
+
unselectable: false,
|
|
2059
|
+
};
|
|
2060
|
+
|
|
2061
|
+
const TOGGLE_GROUP_CONFIG = new InjectionToken('TOGGLE_GROUP_CONFIG', {
|
|
2062
|
+
factory: () => DEFAULT_TOGGLE_GROUP_CONFIG,
|
|
2063
|
+
});
|
|
2064
|
+
|
|
2065
|
+
class ToggleGroup extends ValueFormControl {
|
|
2066
|
+
_config = inject(TOGGLE_GROUP_CONFIG);
|
|
2067
|
+
CLASS_NAME = 'tls-toggle-group';
|
|
2068
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
2069
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2070
|
+
optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
|
|
2071
|
+
optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
|
|
2072
|
+
optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
|
|
2073
|
+
type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
2074
|
+
unselectable = input(this._config.unselectable, { ...(ngDevMode ? { debugName: "unselectable" } : {}), transform: booleanAttribute });
|
|
2075
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
2076
|
+
color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
2077
|
+
orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
|
|
2078
|
+
optionTemplate = contentChild('option', ...(ngDevMode ? [{ debugName: "optionTemplate" }] : []));
|
|
2079
|
+
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
2080
|
+
label: this.optionLabel(),
|
|
2081
|
+
value: this.optionValue(),
|
|
2082
|
+
disabled: this.optionDisabled(),
|
|
2083
|
+
}), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
|
|
2084
|
+
classes = computed(() => {
|
|
2085
|
+
const className = this.CLASS_NAME;
|
|
2086
|
+
const array = [
|
|
2087
|
+
className,
|
|
2088
|
+
`${className}--${this.size()}`,
|
|
2089
|
+
`${className}--${this.color()}`,
|
|
2090
|
+
`${className}--${this.orientation()}`,
|
|
2091
|
+
];
|
|
2092
|
+
return array.concat(this.controlClasses());
|
|
2093
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
2094
|
+
isSelected(optionValue) {
|
|
2095
|
+
return this.value().includes(optionValue);
|
|
2096
|
+
}
|
|
2097
|
+
select(option) {
|
|
2098
|
+
if (this.notInteractive() || option.disabled)
|
|
2099
|
+
return;
|
|
2100
|
+
if (this.type() === 'single') {
|
|
2101
|
+
if (this.isSelected(option.value) && !this.unselectable())
|
|
2102
|
+
return;
|
|
2103
|
+
this.value.set(this.isSelected(option.value) ? [] : [option.value]);
|
|
2104
|
+
return;
|
|
2105
|
+
}
|
|
2106
|
+
if (this.isSelected(option.value)) {
|
|
2107
|
+
this.value.update(current => current.filter(item => item !== option.value));
|
|
2108
|
+
}
|
|
2109
|
+
else {
|
|
2110
|
+
this.value.update(current => [...current, option.value]);
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2114
|
+
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"] }] });
|
|
2115
|
+
}
|
|
2116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, decorators: [{
|
|
2117
|
+
type: Component,
|
|
2118
|
+
args: [{ selector: 'tls-toggle-group', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], host: {
|
|
2119
|
+
role: 'group',
|
|
2120
|
+
'[class]': 'classes()',
|
|
2121
|
+
}, 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" }]
|
|
2122
|
+
}], 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 }] }] } });
|
|
2123
|
+
|
|
1629
2124
|
class IconService {
|
|
1630
2125
|
_http = inject(HttpClient);
|
|
1631
2126
|
_sanitizer = inject(DomSanitizer);
|
|
@@ -2036,7 +2531,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
2036
2531
|
}], 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
2532
|
|
|
2038
2533
|
const DEFAULT_SKELETON_CONFIG = {
|
|
2039
|
-
size:
|
|
2534
|
+
size: null,
|
|
2040
2535
|
width: null,
|
|
2041
2536
|
height: null,
|
|
2042
2537
|
radius: 8,
|
|
@@ -2073,8 +2568,8 @@ class Skeleton {
|
|
|
2073
2568
|
const rounded = this.rounded();
|
|
2074
2569
|
const radius = this.radius();
|
|
2075
2570
|
return {
|
|
2076
|
-
'--tls-skeleton-width': `${width}px
|
|
2077
|
-
'--tls-skeleton-height': `${height}px
|
|
2571
|
+
'--tls-skeleton-width': width !== null ? `${width}px` : '100%',
|
|
2572
|
+
'--tls-skeleton-height': height !== null ? `${height}px` : '100%',
|
|
2078
2573
|
'--tls-skeleton-radius': rounded ? '50%' : `${radius}px`,
|
|
2079
2574
|
'--tls-skeleton-duration': `${this.duration()}ms`,
|
|
2080
2575
|
};
|
|
@@ -2633,6 +3128,19 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2633
3128
|
provide: BUTTON_CONFIG,
|
|
2634
3129
|
useValue: deepMerge(DEFAULT_BUTTON_CONFIG, config.components.button),
|
|
2635
3130
|
},
|
|
3131
|
+
{
|
|
3132
|
+
provide: CHECKBOX_CONFIG,
|
|
3133
|
+
useValue: deepMerge(DEFAULT_CHECKBOX_CONFIG, config.components.checkbox),
|
|
3134
|
+
},
|
|
3135
|
+
{ provide: CHIP_CONFIG, useValue: deepMerge(DEFAULT_CHIP_CONFIG, config.components.chip) },
|
|
3136
|
+
{
|
|
3137
|
+
provide: CHIP_CONTROL_CONFIG,
|
|
3138
|
+
useValue: deepMerge(DEFAULT_CHIP_CONTROL_CONFIG, config.components.chipControl),
|
|
3139
|
+
},
|
|
3140
|
+
{
|
|
3141
|
+
provide: CHIP_INPUT_CONFIG,
|
|
3142
|
+
useValue: deepMerge(DEFAULT_CHIP_INPUT_CONFIG, config.components.chipInput),
|
|
3143
|
+
},
|
|
2636
3144
|
{
|
|
2637
3145
|
provide: DATE_TIME_PICKER_CONFIG,
|
|
2638
3146
|
useValue: deepMerge(DEFAULT_DATE_TIME_PICKER_CONFIG, config.components.dateTimePicker),
|
|
@@ -2645,32 +3153,49 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2645
3153
|
provide: DIVIDER_CONFIG,
|
|
2646
3154
|
useValue: deepMerge(DEFAULT_DIVIDER_CONFIG, config.components.divider),
|
|
2647
3155
|
},
|
|
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
3156
|
{
|
|
2654
|
-
provide:
|
|
2655
|
-
useValue: deepMerge(
|
|
3157
|
+
provide: FILE_UPLOADER_CONFIG,
|
|
3158
|
+
useValue: deepMerge(DEFAULT_FILE_UPLOADER_CONFIG, config.components.fileUploader),
|
|
2656
3159
|
},
|
|
2657
3160
|
{
|
|
2658
|
-
provide:
|
|
2659
|
-
useValue: deepMerge(
|
|
3161
|
+
provide: FORM_CONTROL_GROUP_CONFIG,
|
|
3162
|
+
useValue: deepMerge(DEFAULT_FORM_CONTROL_GROUP_CONFIG, config.components.formControlGroup),
|
|
2660
3163
|
},
|
|
2661
3164
|
{
|
|
2662
3165
|
provide: FORM_ITEM_CONFIG,
|
|
2663
3166
|
useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
|
|
2664
3167
|
},
|
|
2665
3168
|
{ provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG, config.components.icon) },
|
|
3169
|
+
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
|
|
3170
|
+
{
|
|
3171
|
+
provide: LOADER_CONFIG,
|
|
3172
|
+
useValue: deepMerge(DEFAULT_LOADER_CONFIG, config.components.loader),
|
|
3173
|
+
},
|
|
3174
|
+
{ provide: MENU_CONFIG, useValue: deepMerge(DEFAULT_MENU_CONFIG, config.components.menu) },
|
|
2666
3175
|
{
|
|
2667
3176
|
provide: PAGINATION_CONFIG,
|
|
2668
3177
|
useValue: deepMerge(DEFAULT_PAGINATION_CONFIG, config.components.pagination),
|
|
2669
3178
|
},
|
|
3179
|
+
{
|
|
3180
|
+
provide: PASSWORD_CONFIG,
|
|
3181
|
+
useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, config.components.password),
|
|
3182
|
+
},
|
|
3183
|
+
{
|
|
3184
|
+
provide: PIN_INPUT_CONFIG,
|
|
3185
|
+
useValue: deepMerge(DEFAULT_PIN_INPUT_CONFIG, config.components.pinInput),
|
|
3186
|
+
},
|
|
2670
3187
|
{
|
|
2671
3188
|
provide: POPOVER_CONFIG,
|
|
2672
3189
|
useValue: deepMerge(DEFAULT_POPOVER_CONFIG, config.components.popover),
|
|
2673
3190
|
},
|
|
3191
|
+
{
|
|
3192
|
+
provide: RADIO_BUTTON_CONFIG,
|
|
3193
|
+
useValue: deepMerge(DEFAULT_RADIO_BUTTON_CONFIG, config.components.radioButton),
|
|
3194
|
+
},
|
|
3195
|
+
{
|
|
3196
|
+
provide: SELECT_CONFIG,
|
|
3197
|
+
useValue: deepMerge(DEFAULT_SELECT_CONFIG, config.components.select),
|
|
3198
|
+
},
|
|
2674
3199
|
{
|
|
2675
3200
|
provide: SKELETON_CONFIG,
|
|
2676
3201
|
useValue: deepMerge(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
|
|
@@ -2679,12 +3204,20 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2679
3204
|
provide: STEPPER_CONFIG,
|
|
2680
3205
|
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, config.components.stepper),
|
|
2681
3206
|
},
|
|
3207
|
+
{
|
|
3208
|
+
provide: SWITCH_CONFIG,
|
|
3209
|
+
useValue: deepMerge(DEFAULT_SWITCH_CONFIG, config.components.switch),
|
|
3210
|
+
},
|
|
2682
3211
|
{ provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG, config.components.table) },
|
|
2683
3212
|
{ provide: TABS_CONFIG, useValue: deepMerge(DEFAULT_TABS_CONFIG, config.components.tabs) },
|
|
2684
3213
|
{
|
|
2685
3214
|
provide: TEXTAREA_CONFIG,
|
|
2686
3215
|
useValue: deepMerge(DEFAULT_TEXTAREA_CONFIG, config.components.textarea),
|
|
2687
3216
|
},
|
|
3217
|
+
{
|
|
3218
|
+
provide: TOGGLE_GROUP_CONFIG,
|
|
3219
|
+
useValue: deepMerge(DEFAULT_TOGGLE_GROUP_CONFIG, config.components.toggleGroup),
|
|
3220
|
+
},
|
|
2688
3221
|
{
|
|
2689
3222
|
provide: TOOLTIP_CONFIG,
|
|
2690
3223
|
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
|
|
@@ -2696,5 +3229,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2696
3229
|
* Generated bundle index. Do not edit.
|
|
2697
3230
|
*/
|
|
2698
3231
|
|
|
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 };
|
|
3232
|
+
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_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, 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, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, ToggleGroup, TooltipDirective, provideThalassicUIConfig };
|
|
2700
3233
|
//# sourceMappingURL=thalassic-ui.mjs.map
|