@spartan-ng/brain 0.0.1-alpha.514 → 0.0.1-alpha.516
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/index.d.ts +2 -0
- package/calendar/index.d.ts +8 -2
- package/calendar/lib/brn-calendar-month-select.d.ts +17 -0
- package/calendar/lib/brn-calendar-year-select.d.ts +16 -0
- package/calendar/lib/i18n/calendar-i18n.d.ts +4 -0
- package/dialog/lib/brn-dialog.service.d.ts +1 -0
- package/fesm2022/spartan-ng-brain-button.mjs +4 -3
- package/fesm2022/spartan-ng-brain-button.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-calendar.mjs +147 -57
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-dialog.mjs +6 -2
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-label.mjs +4 -3
- package/fesm2022/spartan-ng-brain-label.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle-group.mjs +5 -4
- package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle.mjs +4 -3
- package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -1
- package/label/index.d.ts +2 -0
- package/package.json +5 -5
- package/toggle/index.d.ts +2 -0
- package/toggle-group/index.d.ts +7 -4
package/button/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { BrnButton } from './lib/brn-button';
|
|
1
2
|
import * as i0 from "@angular/core";
|
|
2
3
|
import * as i1 from "./lib/brn-button";
|
|
3
4
|
export * from './lib/brn-button';
|
|
5
|
+
export declare const BrnButtonImports: readonly [typeof BrnButton];
|
|
4
6
|
export declare class BrnButtonModule {
|
|
5
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnButtonModule, never>;
|
|
6
8
|
static ɵmod: i0.ɵɵNgModuleDeclaration<BrnButtonModule, never, [typeof i1.BrnButton], [typeof i1.BrnButton]>;
|
package/calendar/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BrnCalendarMonthSelect } from './lib/brn-calendar-month-select';
|
|
1
2
|
import { BrnCalendar } from './lib/brn-calendar';
|
|
2
3
|
import { BrnCalendarCell } from './lib/brn-calendar-cell';
|
|
3
4
|
import { BrnCalendarCellButton } from './lib/brn-calendar-cell-button';
|
|
@@ -7,6 +8,7 @@ import { BrnCalendarNextButton } from './lib/brn-calendar-next-button';
|
|
|
7
8
|
import { BrnCalendarPreviousButton } from './lib/brn-calendar-previous-button';
|
|
8
9
|
import { BrnCalendarWeek } from './lib/brn-calendar-week';
|
|
9
10
|
import { BrnCalendarWeekday } from './lib/brn-calendar-weekday';
|
|
11
|
+
import { BrnCalendarYearSelect } from './lib/brn-calendar-year-select';
|
|
10
12
|
import { BrnCalendarMulti } from './lib/mode/brn-calendar-multiple';
|
|
11
13
|
import { BrnCalendarRange } from './lib/mode/brn-calendar-range';
|
|
12
14
|
import * as i0 from "@angular/core";
|
|
@@ -21,22 +23,26 @@ import * as i8 from "./lib/brn-calendar";
|
|
|
21
23
|
import * as i9 from "./lib/brn-calendar-cell";
|
|
22
24
|
import * as i10 from "./lib/mode/brn-calendar-multiple";
|
|
23
25
|
import * as i11 from "./lib/mode/brn-calendar-range";
|
|
26
|
+
import * as i12 from "./lib/brn-calendar-month-select";
|
|
27
|
+
import * as i13 from "./lib/brn-calendar-year-select";
|
|
24
28
|
export * from './lib/brn-calendar';
|
|
25
29
|
export * from './lib/brn-calendar-cell';
|
|
26
30
|
export * from './lib/brn-calendar-cell-button';
|
|
27
31
|
export * from './lib/brn-calendar-grid';
|
|
28
32
|
export * from './lib/brn-calendar-header';
|
|
33
|
+
export * from './lib/brn-calendar-month-select';
|
|
29
34
|
export * from './lib/brn-calendar-next-button';
|
|
30
35
|
export * from './lib/brn-calendar-previous-button';
|
|
31
36
|
export * from './lib/brn-calendar-week';
|
|
32
37
|
export * from './lib/brn-calendar-weekday';
|
|
38
|
+
export * from './lib/brn-calendar-year-select';
|
|
33
39
|
export * from './lib/brn-calendar.token';
|
|
34
40
|
export * from './lib/i18n/calendar-i18n';
|
|
35
41
|
export * from './lib/mode/brn-calendar-multiple';
|
|
36
42
|
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];
|
|
43
|
+
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, typeof BrnCalendarMonthSelect, typeof BrnCalendarYearSelect];
|
|
38
44
|
export declare class BrnCalendarModule {
|
|
39
45
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCalendarModule, never>;
|
|
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]>;
|
|
46
|
+
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 i12.BrnCalendarMonthSelect, typeof i13.BrnCalendarYearSelect], [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 i12.BrnCalendarMonthSelect, typeof i13.BrnCalendarYearSelect]>;
|
|
41
47
|
static ɵinj: i0.ɵɵInjectorDeclaration<BrnCalendarModule>;
|
|
42
48
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class BrnCalendarMonthSelect {
|
|
3
|
+
/** Access the select */
|
|
4
|
+
private readonly _select;
|
|
5
|
+
/** Access the calendar */
|
|
6
|
+
private readonly _calendar;
|
|
7
|
+
/** Access the date adapter */
|
|
8
|
+
private readonly _dateAdapter;
|
|
9
|
+
/** Access the calendar i18n */
|
|
10
|
+
protected readonly _i18n: import("./i18n/calendar-i18n").BrnCalendarI18nService;
|
|
11
|
+
protected readonly _selectedMonth: import("@angular/core").Signal<string>;
|
|
12
|
+
/** Focus selected month */
|
|
13
|
+
protected monthSelected(selectedMonth: string): void;
|
|
14
|
+
constructor();
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCalendarMonthSelect, never>;
|
|
16
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCalendarMonthSelect, "brn-select[brnCalendarMonthSelect]", never, {}, {}, never, never, true, never>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class BrnCalendarYearSelect {
|
|
3
|
+
/** Access the select */
|
|
4
|
+
private readonly _select;
|
|
5
|
+
/** Access the calendar */
|
|
6
|
+
private readonly _calendar;
|
|
7
|
+
/** Access the date adapter */
|
|
8
|
+
private readonly _dateAdapter;
|
|
9
|
+
/** Access the calendar i18n */
|
|
10
|
+
protected readonly _i18n: import("./i18n/calendar-i18n").BrnCalendarI18nService;
|
|
11
|
+
/** Focus selected year */
|
|
12
|
+
protected yearSelected(year: number): void;
|
|
13
|
+
constructor();
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCalendarYearSelect, never>;
|
|
15
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCalendarYearSelect, "brn-select[brnCalendarYearSelect]", never, {}, {}, never, never, true, never>;
|
|
16
|
+
}
|
|
@@ -4,9 +4,13 @@ export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
4
4
|
interface BrnCalendarI18n {
|
|
5
5
|
formatWeekdayName: (index: number) => string;
|
|
6
6
|
formatHeader: (month: number, year: number) => string;
|
|
7
|
+
formatYear: (year: number) => string;
|
|
8
|
+
formatMonth: (month: number) => string;
|
|
7
9
|
labelPrevious: () => string;
|
|
8
10
|
labelNext: () => string;
|
|
9
11
|
labelWeekday: (index: number) => string;
|
|
12
|
+
months: () => [string, string, string, string, string, string, string, string, string, string, string, string];
|
|
13
|
+
years: (startYear?: number, endYear?: number) => number[];
|
|
10
14
|
firstDayOfWeek: () => Weekday;
|
|
11
15
|
}
|
|
12
16
|
export declare const BrnCalendarI18nToken: InjectionToken<BrnCalendarI18nService>;
|
|
@@ -10,6 +10,7 @@ export type BrnDialogContext<T> = T & {
|
|
|
10
10
|
export declare const injectBrnDialogCtx: <T>() => BrnDialogContext<T>;
|
|
11
11
|
export declare const injectBrnDialogContext: <DialogContext = any>(options?: InjectOptions) => DialogContext;
|
|
12
12
|
export declare class BrnDialogService {
|
|
13
|
+
private readonly _overlayCloseDispatcher;
|
|
13
14
|
private readonly _cdkDialog;
|
|
14
15
|
private readonly _rendererFactory;
|
|
15
16
|
private readonly _renderer;
|
|
@@ -38,6 +38,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
38
38
|
}]
|
|
39
39
|
}], ctorParameters: () => [] });
|
|
40
40
|
|
|
41
|
+
const BrnButtonImports = [BrnButton];
|
|
41
42
|
class BrnButtonModule {
|
|
42
43
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
43
44
|
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnButtonModule, imports: [BrnButton], exports: [BrnButton] });
|
|
@@ -46,8 +47,8 @@ class BrnButtonModule {
|
|
|
46
47
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnButtonModule, decorators: [{
|
|
47
48
|
type: NgModule,
|
|
48
49
|
args: [{
|
|
49
|
-
imports: [
|
|
50
|
-
exports: [
|
|
50
|
+
imports: [...BrnButtonImports],
|
|
51
|
+
exports: [...BrnButtonImports],
|
|
51
52
|
}]
|
|
52
53
|
}] });
|
|
53
54
|
|
|
@@ -55,5 +56,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
55
56
|
* Generated bundle index. Do not edit.
|
|
56
57
|
*/
|
|
57
58
|
|
|
58
|
-
export { BrnButton, BrnButtonModule };
|
|
59
|
+
export { BrnButton, BrnButtonImports, BrnButtonModule };
|
|
59
60
|
//# sourceMappingURL=spartan-ng-brain-button.mjs.map
|
|
@@ -1 +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: [
|
|
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\nexport const BrnButtonImports = [BrnButton] as const;\n\n@NgModule({\n\timports: [...BrnButtonImports],\n\texports: [...BrnButtonImports],\n})\nexport class BrnButtonModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAoBa,SAAS,CAAA;IACL,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAErD,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;AAE3B,IAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;AACxB,IAAA,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC;AACzD,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,aAAa;AAE9B,IAAA,WAAA,GAAA;AACC,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa;QAC9C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,GAAG,CAAC;AAC3C,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE;YACrB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,MACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,KAAY,KAAI;AACxD,gBAAA,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE;oBACpB,KAAK,CAAC,cAAc,EAAE;oBACtB,KAAK,CAAC,wBAAwB,EAAE;;aAEjC,CAAC,CACF;;;IAII,WAAW,GAAA;AACjB,QAAA,IAAI,CAAC,aAAa,IAAI;;0HA1BX,SAAS,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;8GAAT,SAAS,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iCAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,EAAA,6BAAA,EAAA,eAAA,EAAA,oCAAA,EAAA,oBAAA,EAAA,oBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAT,SAAS,EAAA,UAAA,EAAA,CAAA;kBARrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,iCAAiC;AAC3C,oBAAA,IAAI,EAAE;AACL,wBAAA,iBAAiB,EAAE,6BAA6B;AAChD,wBAAA,iBAAiB,EAAE,oCAAoC;AACvD,wBAAA,sBAAsB,EAAE,oBAAoB;AAC5C,qBAAA;AACD,iBAAA;;;ACdM,MAAM,gBAAgB,GAAG,CAAC,SAAS;MAM7B,eAAe,CAAA;0HAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAAf,eAAe,EAAA,OAAA,EAAA,CANK,SAAS,CAAA,EAAA,OAAA,EAAA,CAAT,SAAS,CAAA,EAAA,CAAA;2HAM7B,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC;AAC9B,oBAAA,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC;AAC9B,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject,
|
|
2
|
+
import { InjectionToken, inject, signal, Injectable, computed, effect, Directive, ElementRef, input, ChangeDetectorRef, Injector, booleanAttribute, model, numberAttribute, contentChild, contentChildren, afterNextRender, HostListener, ViewContainerRef, TemplateRef, untracked, NgModule } from '@angular/core';
|
|
3
3
|
import { injectDateAdapter } from '@spartan-ng/brain/date-time';
|
|
4
|
+
import { BrnSelect } from '@spartan-ng/brain/select';
|
|
4
5
|
|
|
5
6
|
const BrnCalendarToken = new InjectionToken('BrnCalendarToken');
|
|
6
7
|
function provideBrnCalendar(instance) {
|
|
@@ -13,6 +14,110 @@ function injectBrnCalendar() {
|
|
|
13
14
|
return inject(BrnCalendarToken);
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
const BrnCalendarI18nToken = new InjectionToken('BrnCalendarI18nToken');
|
|
18
|
+
/**
|
|
19
|
+
* Provide the calendar i18n configuration.
|
|
20
|
+
*/
|
|
21
|
+
function provideBrnCalendarI18n(configuration) {
|
|
22
|
+
return {
|
|
23
|
+
provide: BrnCalendarI18nToken,
|
|
24
|
+
useFactory: () => {
|
|
25
|
+
const service = new BrnCalendarI18nService();
|
|
26
|
+
service.use(configuration ?? defaultCalendarI18n);
|
|
27
|
+
return service;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const defaultCalendarI18n = {
|
|
32
|
+
formatWeekdayName: (index) => {
|
|
33
|
+
const weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
34
|
+
return weekdays[index];
|
|
35
|
+
},
|
|
36
|
+
months: () => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
37
|
+
years: (startYear = 1925, endYear = new Date().getFullYear()) => Array.from({ length: endYear - startYear + 1 }, (_, i) => startYear + i),
|
|
38
|
+
formatHeader: (month, year) => {
|
|
39
|
+
return new Date(year, month).toLocaleDateString(undefined, {
|
|
40
|
+
month: 'long',
|
|
41
|
+
year: 'numeric',
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
formatMonth: (month) => {
|
|
45
|
+
return new Date(2000, month).toLocaleDateString(undefined, {
|
|
46
|
+
month: 'short',
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
formatYear: (year) => {
|
|
50
|
+
return new Date(year, 0).toLocaleDateString(undefined, {
|
|
51
|
+
year: 'numeric',
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
labelPrevious: () => 'Go to the previous month',
|
|
55
|
+
labelNext: () => 'Go to the next month',
|
|
56
|
+
labelWeekday: (index) => {
|
|
57
|
+
const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
58
|
+
return weekdays[index];
|
|
59
|
+
},
|
|
60
|
+
firstDayOfWeek: () => 0,
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Inject the calendar i18n configuration.
|
|
64
|
+
*/
|
|
65
|
+
function injectBrnCalendarI18n() {
|
|
66
|
+
return inject(BrnCalendarI18nToken, { optional: true }) ?? inject(BrnCalendarI18nService); // fallback
|
|
67
|
+
}
|
|
68
|
+
class BrnCalendarI18nService {
|
|
69
|
+
_config = signal(defaultCalendarI18n);
|
|
70
|
+
config = this._config.asReadonly();
|
|
71
|
+
use(config) {
|
|
72
|
+
this._config.set({ ...this.config(), ...config });
|
|
73
|
+
}
|
|
74
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarI18nService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
75
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarI18nService, providedIn: 'root' });
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarI18nService, decorators: [{
|
|
78
|
+
type: Injectable,
|
|
79
|
+
args: [{ providedIn: 'root' }]
|
|
80
|
+
}] });
|
|
81
|
+
|
|
82
|
+
class BrnCalendarMonthSelect {
|
|
83
|
+
/** Access the select */
|
|
84
|
+
_select = inject(BrnSelect);
|
|
85
|
+
/** Access the calendar */
|
|
86
|
+
_calendar = injectBrnCalendar();
|
|
87
|
+
/** Access the date adapter */
|
|
88
|
+
_dateAdapter = injectDateAdapter();
|
|
89
|
+
/** Access the calendar i18n */
|
|
90
|
+
_i18n = injectBrnCalendarI18n();
|
|
91
|
+
_selectedMonth = computed(() => {
|
|
92
|
+
return this._i18n.config().months()[this._dateAdapter.getMonth(this._calendar.focusedDate())];
|
|
93
|
+
});
|
|
94
|
+
/** Focus selected month */
|
|
95
|
+
monthSelected(selectedMonth) {
|
|
96
|
+
const month = this._i18n
|
|
97
|
+
.config()
|
|
98
|
+
.months()
|
|
99
|
+
.findIndex((month) => month === selectedMonth);
|
|
100
|
+
const targetDate = this._dateAdapter.set(this._calendar.state().focusedDate(), { month });
|
|
101
|
+
this._calendar.state().focusedDate.set(targetDate);
|
|
102
|
+
}
|
|
103
|
+
constructor() {
|
|
104
|
+
effect(() => {
|
|
105
|
+
this._select.writeValue(this._selectedMonth());
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarMonthSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
109
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarMonthSelect, isStandalone: true, selector: "brn-select[brnCalendarMonthSelect]", host: { listeners: { "valueChange": "monthSelected($event)" } }, ngImport: i0 });
|
|
110
|
+
}
|
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarMonthSelect, decorators: [{
|
|
112
|
+
type: Directive,
|
|
113
|
+
args: [{
|
|
114
|
+
selector: 'brn-select[brnCalendarMonthSelect]',
|
|
115
|
+
host: {
|
|
116
|
+
'(valueChange)': 'monthSelected($event)',
|
|
117
|
+
},
|
|
118
|
+
}]
|
|
119
|
+
}], ctorParameters: () => [] });
|
|
120
|
+
|
|
16
121
|
class BrnCalendarCellButton {
|
|
17
122
|
/** Access the date adapter */
|
|
18
123
|
_dateAdapter = injectDateAdapter();
|
|
@@ -190,59 +295,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
190
295
|
}]
|
|
191
296
|
}] });
|
|
192
297
|
|
|
193
|
-
const BrnCalendarI18nToken = new InjectionToken('BrnCalendarI18nToken');
|
|
194
|
-
/**
|
|
195
|
-
* Provide the calendar i18n configuration.
|
|
196
|
-
*/
|
|
197
|
-
function provideBrnCalendarI18n(configuration) {
|
|
198
|
-
return {
|
|
199
|
-
provide: BrnCalendarI18nToken,
|
|
200
|
-
useFactory: () => {
|
|
201
|
-
const service = new BrnCalendarI18nService();
|
|
202
|
-
service.use(configuration ?? defaultCalendarI18n);
|
|
203
|
-
return service;
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
const defaultCalendarI18n = {
|
|
208
|
-
formatWeekdayName: (index) => {
|
|
209
|
-
const weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
210
|
-
return weekdays[index];
|
|
211
|
-
},
|
|
212
|
-
formatHeader: (month, year) => {
|
|
213
|
-
return new Date(year, month).toLocaleDateString(undefined, {
|
|
214
|
-
month: 'long',
|
|
215
|
-
year: 'numeric',
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
labelPrevious: () => 'Go to the previous month',
|
|
219
|
-
labelNext: () => 'Go to the next month',
|
|
220
|
-
labelWeekday: (index) => {
|
|
221
|
-
const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
222
|
-
return weekdays[index];
|
|
223
|
-
},
|
|
224
|
-
firstDayOfWeek: () => 0,
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* Inject the calendar i18n configuration.
|
|
228
|
-
*/
|
|
229
|
-
function injectBrnCalendarI18n() {
|
|
230
|
-
return inject(BrnCalendarI18nToken, { optional: true }) ?? inject(BrnCalendarI18nService); // fallback
|
|
231
|
-
}
|
|
232
|
-
class BrnCalendarI18nService {
|
|
233
|
-
_config = signal(defaultCalendarI18n);
|
|
234
|
-
config = this._config.asReadonly();
|
|
235
|
-
use(config) {
|
|
236
|
-
this._config.set({ ...this.config(), ...config });
|
|
237
|
-
}
|
|
238
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarI18nService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
239
|
-
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarI18nService, providedIn: 'root' });
|
|
240
|
-
}
|
|
241
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarI18nService, decorators: [{
|
|
242
|
-
type: Injectable,
|
|
243
|
-
args: [{ providedIn: 'root' }]
|
|
244
|
-
}] });
|
|
245
|
-
|
|
246
298
|
class BrnCalendar {
|
|
247
299
|
_i18n = injectBrnCalendarI18n();
|
|
248
300
|
/** Access the date adapter */
|
|
@@ -654,6 +706,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
654
706
|
}]
|
|
655
707
|
}], ctorParameters: () => [] });
|
|
656
708
|
|
|
709
|
+
class BrnCalendarYearSelect {
|
|
710
|
+
/** Access the select */
|
|
711
|
+
_select = inject(BrnSelect);
|
|
712
|
+
/** Access the calendar */
|
|
713
|
+
_calendar = injectBrnCalendar();
|
|
714
|
+
/** Access the date adapter */
|
|
715
|
+
_dateAdapter = injectDateAdapter();
|
|
716
|
+
/** Access the calendar i18n */
|
|
717
|
+
_i18n = injectBrnCalendarI18n();
|
|
718
|
+
/** Focus selected year */
|
|
719
|
+
yearSelected(year) {
|
|
720
|
+
const targetDate = this._dateAdapter.set(this._calendar.state().focusedDate(), { year });
|
|
721
|
+
this._calendar.state().focusedDate.set(targetDate);
|
|
722
|
+
}
|
|
723
|
+
constructor() {
|
|
724
|
+
effect(() => {
|
|
725
|
+
this._select.writeValue(this._dateAdapter.getYear(this._calendar.focusedDate()));
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarYearSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
729
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarYearSelect, isStandalone: true, selector: "brn-select[brnCalendarYearSelect]", host: { listeners: { "valueChange": "yearSelected($event)" } }, ngImport: i0 });
|
|
730
|
+
}
|
|
731
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarYearSelect, decorators: [{
|
|
732
|
+
type: Directive,
|
|
733
|
+
args: [{
|
|
734
|
+
selector: 'brn-select[brnCalendarYearSelect]',
|
|
735
|
+
host: {
|
|
736
|
+
'(valueChange)': 'yearSelected($event)',
|
|
737
|
+
},
|
|
738
|
+
}]
|
|
739
|
+
}], ctorParameters: () => [] });
|
|
740
|
+
|
|
657
741
|
class BrnCalendarMulti {
|
|
658
742
|
_i18n = injectBrnCalendarI18n();
|
|
659
743
|
/**
|
|
@@ -1092,6 +1176,8 @@ const BrnCalendarImports = [
|
|
|
1092
1176
|
BrnCalendarCell,
|
|
1093
1177
|
BrnCalendarMulti,
|
|
1094
1178
|
BrnCalendarRange,
|
|
1179
|
+
BrnCalendarMonthSelect,
|
|
1180
|
+
BrnCalendarYearSelect,
|
|
1095
1181
|
];
|
|
1096
1182
|
class BrnCalendarModule {
|
|
1097
1183
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1105,7 +1191,9 @@ class BrnCalendarModule {
|
|
|
1105
1191
|
BrnCalendar,
|
|
1106
1192
|
BrnCalendarCell,
|
|
1107
1193
|
BrnCalendarMulti,
|
|
1108
|
-
BrnCalendarRange
|
|
1194
|
+
BrnCalendarRange,
|
|
1195
|
+
BrnCalendarMonthSelect,
|
|
1196
|
+
BrnCalendarYearSelect], exports: [BrnCalendarCellButton,
|
|
1109
1197
|
BrnCalendarGrid,
|
|
1110
1198
|
BrnCalendarHeader,
|
|
1111
1199
|
BrnCalendarNextButton,
|
|
@@ -1115,7 +1203,9 @@ class BrnCalendarModule {
|
|
|
1115
1203
|
BrnCalendar,
|
|
1116
1204
|
BrnCalendarCell,
|
|
1117
1205
|
BrnCalendarMulti,
|
|
1118
|
-
BrnCalendarRange
|
|
1206
|
+
BrnCalendarRange,
|
|
1207
|
+
BrnCalendarMonthSelect,
|
|
1208
|
+
BrnCalendarYearSelect] });
|
|
1119
1209
|
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule });
|
|
1120
1210
|
}
|
|
1121
1211
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule, decorators: [{
|
|
@@ -1130,5 +1220,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1130
1220
|
* Generated bundle index. Do not edit.
|
|
1131
1221
|
*/
|
|
1132
1222
|
|
|
1133
|
-
export { BrnCalendar, BrnCalendarCell, BrnCalendarCellButton, BrnCalendarGrid, BrnCalendarHeader, BrnCalendarI18nService, BrnCalendarI18nToken, BrnCalendarImports, BrnCalendarModule, BrnCalendarMulti, BrnCalendarNextButton, BrnCalendarPreviousButton, BrnCalendarRange, BrnCalendarToken, BrnCalendarWeek, BrnCalendarWeekday, injectBrnCalendar, injectBrnCalendarI18n, provideBrnCalendar, provideBrnCalendarI18n };
|
|
1223
|
+
export { BrnCalendar, BrnCalendarCell, BrnCalendarCellButton, BrnCalendarGrid, BrnCalendarHeader, BrnCalendarI18nService, BrnCalendarI18nToken, BrnCalendarImports, BrnCalendarModule, BrnCalendarMonthSelect, BrnCalendarMulti, BrnCalendarNextButton, BrnCalendarPreviousButton, BrnCalendarRange, BrnCalendarToken, BrnCalendarWeek, BrnCalendarWeekday, BrnCalendarYearSelect, injectBrnCalendar, injectBrnCalendarI18n, provideBrnCalendar, provideBrnCalendarI18n };
|
|
1134
1224
|
//# sourceMappingURL=spartan-ng-brain-calendar.mjs.map
|