@spartan-ng/brain 0.0.1-alpha.502 → 0.0.1-alpha.503
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/button/README.md +3 -0
- package/button/index.d.ts +8 -0
- package/button/lib/brn-button.d.ts +14 -0
- package/calendar/index.d.ts +5 -2
- package/calendar/lib/brn-calendar-cell-button.d.ts +3 -0
- package/calendar/lib/brn-calendar.d.ts +21 -0
- package/calendar/lib/brn-calendar.token.d.ts +3 -0
- package/calendar/lib/mode/brn-calendar-multiple.d.ts +21 -0
- package/calendar/lib/mode/brn-calendar-range.d.ts +84 -0
- package/date-time/index.d.ts +1 -0
- package/date-time/lib/date-adapter.d.ts +8 -0
- package/date-time/lib/utc-date-adapter.d.ts +28 -0
- package/fesm2022/spartan-ng-brain-button.mjs +59 -0
- package/fesm2022/spartan-ng-brain-button.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-calendar.mjs +286 -5
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-date-time.mjs +95 -1
- package/fesm2022/spartan-ng-brain-date-time.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-switch.mjs +2 -2
- package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
- package/package.json +5 -1
- package/switch/lib/brn-switch.d.ts +1 -1
package/button/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./lib/brn-button";
|
|
3
|
+
export * from './lib/brn-button';
|
|
4
|
+
export declare class BrnButtonModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnButtonModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<BrnButtonModule, never, [typeof i1.BrnButton], [typeof i1.BrnButton]>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<BrnButtonModule>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class BrnButton implements OnDestroy {
|
|
4
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
5
|
+
protected readonly _isAnchor: import("@angular/core").WritableSignal<boolean>;
|
|
6
|
+
private readonly _ngZone;
|
|
7
|
+
private readonly _elementRef;
|
|
8
|
+
private readonly _renderer;
|
|
9
|
+
private readonly _cleanupClick;
|
|
10
|
+
constructor();
|
|
11
|
+
ngOnDestroy(): void;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnButton, never>;
|
|
13
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnButton, "a[brnButton], button[brnButton]", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
14
|
+
}
|
package/calendar/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { BrnCalendarPreviousButton } from './lib/brn-calendar-previous-button';
|
|
|
8
8
|
import { BrnCalendarWeek } from './lib/brn-calendar-week';
|
|
9
9
|
import { BrnCalendarWeekday } from './lib/brn-calendar-weekday';
|
|
10
10
|
import { BrnCalendarMulti } from './lib/mode/brn-calendar-multiple';
|
|
11
|
+
import { BrnCalendarRange } from './lib/mode/brn-calendar-range';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
13
|
import * as i1 from "./lib/brn-calendar-cell-button";
|
|
13
14
|
import * as i2 from "./lib/brn-calendar-grid";
|
|
@@ -19,6 +20,7 @@ import * as i7 from "./lib/brn-calendar-weekday";
|
|
|
19
20
|
import * as i8 from "./lib/brn-calendar";
|
|
20
21
|
import * as i9 from "./lib/brn-calendar-cell";
|
|
21
22
|
import * as i10 from "./lib/mode/brn-calendar-multiple";
|
|
23
|
+
import * as i11 from "./lib/mode/brn-calendar-range";
|
|
22
24
|
export * from './lib/brn-calendar';
|
|
23
25
|
export * from './lib/brn-calendar-cell';
|
|
24
26
|
export * from './lib/brn-calendar-cell-button';
|
|
@@ -31,9 +33,10 @@ export * from './lib/brn-calendar-weekday';
|
|
|
31
33
|
export * from './lib/brn-calendar.token';
|
|
32
34
|
export * from './lib/i18n/calendar-i18n';
|
|
33
35
|
export * from './lib/mode/brn-calendar-multiple';
|
|
34
|
-
export
|
|
36
|
+
export * from './lib/mode/brn-calendar-range';
|
|
37
|
+
export declare const BrnCalendarImports: readonly [typeof BrnCalendarCellButton, typeof BrnCalendarGrid, typeof BrnCalendarHeader, typeof BrnCalendarNextButton, typeof BrnCalendarPreviousButton, typeof BrnCalendarWeek, typeof BrnCalendarWeekday, typeof BrnCalendar, typeof BrnCalendarCell, typeof BrnCalendarMulti, typeof BrnCalendarRange];
|
|
35
38
|
export declare class BrnCalendarModule {
|
|
36
39
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCalendarModule, never>;
|
|
37
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<BrnCalendarModule, never, [typeof i1.BrnCalendarCellButton, typeof i2.BrnCalendarGrid, typeof i3.BrnCalendarHeader, typeof i4.BrnCalendarNextButton, typeof i5.BrnCalendarPreviousButton, typeof i6.BrnCalendarWeek, typeof i7.BrnCalendarWeekday, typeof i8.BrnCalendar, typeof i9.BrnCalendarCell, typeof i10.BrnCalendarMulti], [typeof i1.BrnCalendarCellButton, typeof i2.BrnCalendarGrid, typeof i3.BrnCalendarHeader, typeof i4.BrnCalendarNextButton, typeof i5.BrnCalendarPreviousButton, typeof i6.BrnCalendarWeek, typeof i7.BrnCalendarWeekday, typeof i8.BrnCalendar, typeof i9.BrnCalendarCell, typeof i10.BrnCalendarMulti]>;
|
|
40
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<BrnCalendarModule, never, [typeof i1.BrnCalendarCellButton, typeof i2.BrnCalendarGrid, typeof i3.BrnCalendarHeader, typeof i4.BrnCalendarNextButton, typeof i5.BrnCalendarPreviousButton, typeof i6.BrnCalendarWeek, typeof i7.BrnCalendarWeekday, typeof i8.BrnCalendar, typeof i9.BrnCalendarCell, typeof i10.BrnCalendarMulti, typeof i11.BrnCalendarRange], [typeof i1.BrnCalendarCellButton, typeof i2.BrnCalendarGrid, typeof i3.BrnCalendarHeader, typeof i4.BrnCalendarNextButton, typeof i5.BrnCalendarPreviousButton, typeof i6.BrnCalendarWeek, typeof i7.BrnCalendarWeekday, typeof i8.BrnCalendar, typeof i9.BrnCalendarCell, typeof i10.BrnCalendarMulti, typeof i11.BrnCalendarRange]>;
|
|
38
41
|
static ɵinj: i0.ɵɵInjectorDeclaration<BrnCalendarModule>;
|
|
39
42
|
}
|
|
@@ -10,6 +10,9 @@ export declare class BrnCalendarCellButton<T> {
|
|
|
10
10
|
readonly date: import("@angular/core").InputSignal<T>;
|
|
11
11
|
/** Whether this date is currently selected */
|
|
12
12
|
readonly selected: import("@angular/core").Signal<boolean>;
|
|
13
|
+
readonly start: import("@angular/core").Signal<boolean>;
|
|
14
|
+
readonly end: import("@angular/core").Signal<boolean>;
|
|
15
|
+
readonly betweenRange: import("@angular/core").Signal<boolean>;
|
|
13
16
|
/** Whether this date is focusable */
|
|
14
17
|
readonly focusable: import("@angular/core").Signal<boolean>;
|
|
15
18
|
readonly outside: import("@angular/core").Signal<boolean>;
|
|
@@ -52,6 +52,27 @@ export declare class BrnCalendar<T> implements BrnCalendarBase<T> {
|
|
|
52
52
|
selectDate(date: T): void;
|
|
53
53
|
/** @internal Set the focused date */
|
|
54
54
|
setFocusedDate(date: T): void;
|
|
55
|
+
/**
|
|
56
|
+
* Determine if a date is the start of a range. In a date picker, this is always false.
|
|
57
|
+
* @param date The date to check.
|
|
58
|
+
* @returns Always false.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
isStartOfRange(_: T): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Determine if a date is the end of a range. In a date picker, this is always false.
|
|
64
|
+
* @param date The date to check.
|
|
65
|
+
* @returns Always false.
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
isEndOfRange(_: T): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Determine if a date is between the start and end dates. In a date picker, this is always false.
|
|
71
|
+
* @param date The date to check.
|
|
72
|
+
* @returns True if the date is between the start and end dates, false otherwise.
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
isBetweenRange(_: T): boolean;
|
|
55
76
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCalendar<any>, never>;
|
|
56
77
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCalendar<any>, "[brnCalendar]", never, { "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "date": { "alias": "date"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "dateDisabled"; "required": false; "isSignal": true; }; "weekStartsOn": { "alias": "weekStartsOn"; "required": false; "isSignal": true; }; "defaultFocusedDate": { "alias": "defaultFocusedDate"; "required": false; "isSignal": true; }; }, { "date": "dateChange"; }, ["header", "_cells"], never, true, never>;
|
|
57
78
|
}
|
|
@@ -6,6 +6,9 @@ export interface BrnCalendarBase<T> {
|
|
|
6
6
|
constrainDate: (date: T) => T;
|
|
7
7
|
isDateDisabled: (date: T) => boolean;
|
|
8
8
|
setFocusedDate: (date: T) => void;
|
|
9
|
+
isStartOfRange: (date: T) => boolean;
|
|
10
|
+
isEndOfRange: (date: T) => boolean;
|
|
11
|
+
isBetweenRange: (date: T) => boolean;
|
|
9
12
|
disabled: Signal<boolean>;
|
|
10
13
|
focusedDate: Signal<T>;
|
|
11
14
|
header: Signal<BrnCalendarHeader | undefined>;
|
|
@@ -5,6 +5,27 @@ import { BrnCalendarHeader } from '../brn-calendar-header';
|
|
|
5
5
|
import { BrnCalendarBase } from '../brn-calendar.token';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export declare class BrnCalendarMulti<T> implements BrnCalendarBase<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Determine if a date is the start of a range. In a date picker, this is always false.
|
|
10
|
+
* @param date The date to check.
|
|
11
|
+
* @returns Always false.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
isStartOfRange(_: T): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Determine if a date is the end of a range. In a date picker, this is always false.
|
|
17
|
+
* @param date The date to check.
|
|
18
|
+
* @returns Always false.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
isEndOfRange(_: T): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Determine if a date is between the start and end dates. In a date picker, this is always false.
|
|
24
|
+
* @param date The date to check.
|
|
25
|
+
* @returns True if the date is between the start and end dates, false otherwise.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
isBetweenRange(_: T): boolean;
|
|
8
29
|
protected readonly _dateAdapter: import("@spartan-ng/brain/date-time").BrnDateAdapter<T>;
|
|
9
30
|
/** Access the change detector */
|
|
10
31
|
private readonly _changeDetector;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { Weekday } from '../brn-calendar';
|
|
3
|
+
import { BrnCalendarCellButton } from '../brn-calendar-cell-button';
|
|
4
|
+
import { BrnCalendarHeader } from '../brn-calendar-header';
|
|
5
|
+
import { BrnCalendarBase } from '../brn-calendar.token';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class BrnCalendarRange<T> implements BrnCalendarBase<T> {
|
|
8
|
+
protected readonly _dateAdapter: import("@spartan-ng/brain/date-time").BrnDateAdapter<T>;
|
|
9
|
+
/** Access the change detector */
|
|
10
|
+
private readonly _changeDetector;
|
|
11
|
+
/** Access the injector */
|
|
12
|
+
private readonly _injector;
|
|
13
|
+
/** The minimum date that can be selected.*/
|
|
14
|
+
readonly min: import("@angular/core").InputSignal<T | undefined>;
|
|
15
|
+
/** The maximum date that can be selected. */
|
|
16
|
+
readonly max: import("@angular/core").InputSignal<T | undefined>;
|
|
17
|
+
/** Determine if the date picker is disabled. */
|
|
18
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
19
|
+
/** Whether a specific date is disabled. */
|
|
20
|
+
readonly dateDisabled: import("@angular/core").InputSignal<(date: T) => boolean>;
|
|
21
|
+
/** The day the week starts on */
|
|
22
|
+
readonly weekStartsOn: import("@angular/core").InputSignalWithTransform<Weekday, NumberInput>;
|
|
23
|
+
/** The default focused date. */
|
|
24
|
+
readonly defaultFocusedDate: import("@angular/core").InputSignal<T | undefined>;
|
|
25
|
+
/** @internal Access the header */
|
|
26
|
+
readonly header: import("@angular/core").Signal<BrnCalendarHeader | undefined>;
|
|
27
|
+
/** Store the cells */
|
|
28
|
+
protected readonly _cells: import("@angular/core").Signal<readonly BrnCalendarCellButton<T>[]>;
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
* The internal state of the component.
|
|
32
|
+
*/
|
|
33
|
+
readonly state: import("@angular/core").Signal<{
|
|
34
|
+
focusedDate: import("@angular/core").WritableSignal<T>;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* The focused date.
|
|
38
|
+
*/
|
|
39
|
+
readonly focusedDate: import("@angular/core").Signal<T>;
|
|
40
|
+
/**
|
|
41
|
+
* The selected start date
|
|
42
|
+
*/
|
|
43
|
+
readonly startDate: import("@angular/core").ModelSignal<T | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* The selected end date
|
|
46
|
+
*/
|
|
47
|
+
readonly endDate: import("@angular/core").ModelSignal<T | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Get all the days to display, this is the days of the current month
|
|
50
|
+
* and the days of the previous and next month to fill the grid.
|
|
51
|
+
*/
|
|
52
|
+
readonly days: import("@angular/core").Signal<T[]>;
|
|
53
|
+
isSelected(date: T): boolean;
|
|
54
|
+
selectDate(date: T): void;
|
|
55
|
+
/** @internal Constrain a date to the min and max boundaries */
|
|
56
|
+
constrainDate(date: T): T;
|
|
57
|
+
/** @internal Determine if a date is disabled */
|
|
58
|
+
isDateDisabled(date: T): boolean;
|
|
59
|
+
/** @internal Set the focused date */
|
|
60
|
+
setFocusedDate(date: T): void;
|
|
61
|
+
/**
|
|
62
|
+
* Determine if a date is the start of a range.
|
|
63
|
+
* @param date The date to check.
|
|
64
|
+
* @returns Always false.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
isStartOfRange(date: T): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Determine if a date is the end of a range.
|
|
70
|
+
* @param date The date to check.
|
|
71
|
+
* @returns Always false.
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
isEndOfRange(date: T): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Determine if a date is between the start and end dates.
|
|
77
|
+
* @param date The date to check.
|
|
78
|
+
* @returns True if the date is between the start and end dates, false otherwise.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
isBetweenRange(date: T): boolean;
|
|
82
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCalendarRange<any>, never>;
|
|
83
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCalendarRange<any>, "[brnCalendarRange]", never, { "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "dateDisabled"; "required": false; "isSignal": true; }; "weekStartsOn": { "alias": "weekStartsOn"; "required": false; "isSignal": true; }; "defaultFocusedDate": { "alias": "defaultFocusedDate"; "required": false; "isSignal": true; }; "startDate": { "alias": "startDate"; "required": false; "isSignal": true; }; "endDate": { "alias": "endDate"; "required": false; "isSignal": true; }; }, { "startDate": "startDateChange"; "endDate": "endDateChange"; }, ["header", "_cells"], never, true, never>;
|
|
84
|
+
}
|
package/date-time/index.d.ts
CHANGED
|
@@ -176,3 +176,11 @@ export declare function injectDateAdapter<T>(): BrnDateAdapter<T>;
|
|
|
176
176
|
* Provide the DateAdapter instance
|
|
177
177
|
*/
|
|
178
178
|
export declare function provideDateAdapter<T>(adapter: Type<BrnDateAdapter<T>>): ClassProvider;
|
|
179
|
+
/**
|
|
180
|
+
* Provide the native date adapter
|
|
181
|
+
*/
|
|
182
|
+
export declare function provideNativeDateAdapter(): ClassProvider;
|
|
183
|
+
/**
|
|
184
|
+
* Provide the UTC date adapter
|
|
185
|
+
*/
|
|
186
|
+
export declare function provideUtcDateAdapter(): ClassProvider;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BrnDateAdapter, BrnDateUnits, BrnDuration } from './date-adapter';
|
|
2
|
+
export declare class BrnUtcDateAdapter implements BrnDateAdapter<Date> {
|
|
3
|
+
create({ day, hour, minute, month, second, year, millisecond }: BrnDateUnits): Date;
|
|
4
|
+
now(): Date;
|
|
5
|
+
set(date: Date, values: BrnDateUnits): Date;
|
|
6
|
+
add(date: Date, duration: BrnDuration): Date;
|
|
7
|
+
subtract(date: Date, duration: BrnDuration): Date;
|
|
8
|
+
compare(a: Date, b: Date): number;
|
|
9
|
+
isEqual(a: Date, b: Date): boolean;
|
|
10
|
+
isBefore(a: Date, b: Date): boolean;
|
|
11
|
+
isAfter(a: Date, b: Date): boolean;
|
|
12
|
+
isSameDay(a: Date, b: Date): boolean;
|
|
13
|
+
isSameMonth(a: Date, b: Date): boolean;
|
|
14
|
+
isSameYear(a: Date, b: Date): boolean;
|
|
15
|
+
getYear(date: Date): number;
|
|
16
|
+
getMonth(date: Date): number;
|
|
17
|
+
getDay(date: Date): number;
|
|
18
|
+
getDate(date: Date): number;
|
|
19
|
+
getHours(date: Date): number;
|
|
20
|
+
getMinutes(date: Date): number;
|
|
21
|
+
getSeconds(date: Date): number;
|
|
22
|
+
getMilliseconds(date: Date): number;
|
|
23
|
+
getTime(date: Date): number;
|
|
24
|
+
startOfMonth(date: Date): Date;
|
|
25
|
+
endOfMonth(date: Date): Date;
|
|
26
|
+
startOfDay(date: Date): Date;
|
|
27
|
+
endOfDay(date: Date): Date;
|
|
28
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, signal, inject, NgZone, ElementRef, Renderer2, Directive, NgModule } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class BrnButton {
|
|
5
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
6
|
+
_isAnchor = signal(false);
|
|
7
|
+
_ngZone = inject(NgZone);
|
|
8
|
+
_elementRef = inject(ElementRef);
|
|
9
|
+
_renderer = inject(Renderer2);
|
|
10
|
+
_cleanupClick;
|
|
11
|
+
constructor() {
|
|
12
|
+
const element = this._elementRef.nativeElement;
|
|
13
|
+
this._isAnchor.set(element.tagName === 'A');
|
|
14
|
+
if (this._isAnchor()) {
|
|
15
|
+
this._cleanupClick = this._ngZone.runOutsideAngular(() => this._renderer.listen(element, 'click', (event) => {
|
|
16
|
+
if (this.disabled()) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
event.stopImmediatePropagation();
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
ngOnDestroy() {
|
|
24
|
+
this._cleanupClick?.();
|
|
25
|
+
}
|
|
26
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
27
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnButton, isStandalone: true, selector: "a[brnButton], button[brnButton]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.tabindex": "disabled() ? -1 : undefined", "attr.disabled": "!_isAnchor() && disabled() || null", "attr.data-disabled": "disabled() || null" } }, ngImport: i0 });
|
|
28
|
+
}
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnButton, decorators: [{
|
|
30
|
+
type: Directive,
|
|
31
|
+
args: [{
|
|
32
|
+
selector: 'a[brnButton], button[brnButton]',
|
|
33
|
+
host: {
|
|
34
|
+
'[attr.tabindex]': 'disabled() ? -1 : undefined',
|
|
35
|
+
'[attr.disabled]': '!_isAnchor() && disabled() || null',
|
|
36
|
+
'[attr.data-disabled]': 'disabled() || null',
|
|
37
|
+
},
|
|
38
|
+
}]
|
|
39
|
+
}], ctorParameters: () => [] });
|
|
40
|
+
|
|
41
|
+
class BrnButtonModule {
|
|
42
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
43
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnButtonModule, imports: [BrnButton], exports: [BrnButton] });
|
|
44
|
+
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnButtonModule });
|
|
45
|
+
}
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnButtonModule, decorators: [{
|
|
47
|
+
type: NgModule,
|
|
48
|
+
args: [{
|
|
49
|
+
imports: [BrnButton],
|
|
50
|
+
exports: [BrnButton],
|
|
51
|
+
}]
|
|
52
|
+
}] });
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Generated bundle index. Do not edit.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export { BrnButton, BrnButtonModule };
|
|
59
|
+
//# sourceMappingURL=spartan-ng-brain-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-button.mjs","sources":["../../../../libs/brain/button/src/lib/brn-button.ts","../../../../libs/brain/button/src/index.ts","../../../../libs/brain/button/src/spartan-ng-brain-button.ts"],"sourcesContent":["import {\n\tbooleanAttribute,\n\tDirective,\n\tElementRef,\n\tinject,\n\tinput,\n\tNgZone,\n\tOnDestroy,\n\tRenderer2,\n\tsignal,\n} from '@angular/core';\n\n@Directive({\n\tselector: 'a[brnButton], button[brnButton]',\n\thost: {\n\t\t'[attr.tabindex]': 'disabled() ? -1 : undefined',\n\t\t'[attr.disabled]': '!_isAnchor() && disabled() || null',\n\t\t'[attr.data-disabled]': 'disabled() || null',\n\t},\n})\nexport class BrnButton implements OnDestroy {\n\tpublic readonly disabled = input(false, { transform: booleanAttribute });\n\n\tprotected readonly _isAnchor = signal(false);\n\n\tprivate readonly _ngZone = inject(NgZone);\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _renderer = inject(Renderer2);\n\tprivate readonly _cleanupClick: (() => void) | undefined;\n\n\tconstructor() {\n\t\tconst element = this._elementRef.nativeElement;\n\t\tthis._isAnchor.set(element.tagName === 'A');\n\t\tif (this._isAnchor()) {\n\t\t\tthis._cleanupClick = this._ngZone.runOutsideAngular(() =>\n\t\t\t\tthis._renderer.listen(element, 'click', (event: Event) => {\n\t\t\t\t\tif (this.disabled()) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopImmediatePropagation();\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis._cleanupClick?.();\n\t}\n}\n","import { NgModule } from '@angular/core';\nimport { BrnButton } from './lib/brn-button';\n\nexport * from './lib/brn-button';\n\n@NgModule({\n\timports: [BrnButton],\n\texports: [BrnButton],\n})\nexport class BrnButtonModule {}\n","/**\n * Generated bundle index. Do not edit.\n */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