@a.nemreen/dga-ui 0.3.1 → 0.3.3
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/README.md +18 -6
- package/fesm2022/a.nemreen-dga-ui-cookies.mjs +303 -0
- package/fesm2022/a.nemreen-dga-ui-date-picker.mjs +385 -0
- package/fesm2022/a.nemreen-dga-ui-header.mjs +2615 -0
- package/fesm2022/a.nemreen-dga-ui.mjs +874 -4512
- package/package.json +20 -4
- package/types/a.nemreen-dga-ui-cookies.d.ts +201 -0
- package/types/a.nemreen-dga-ui-date-picker.d.ts +207 -0
- package/types/a.nemreen-dga-ui-header.d.ts +427 -0
- package/types/a.nemreen-dga-ui.d.ts +218 -1009
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a.nemreen/dga-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "DGA Angular UI library — standalone forms, overlays, navigation, and portal shell with RTL-first Tailwind styling",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -37,19 +37,23 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
+
"files": [
|
|
41
|
+
"fesm2022",
|
|
42
|
+
"types",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
40
46
|
"peerDependencies": {
|
|
41
47
|
"@angular/common": "^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
42
48
|
"@angular/core": "^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
43
49
|
"@angular/forms": "^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
44
50
|
"@angular/platform-browser": "^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
45
|
-
"@a.nemreen/dga-tokens": "^0.2.0 || ^0.3.0"
|
|
46
|
-
"@platformscode/icons": "^0.0.11"
|
|
51
|
+
"@a.nemreen/dga-tokens": "^0.2.0 || ^0.3.0"
|
|
47
52
|
},
|
|
48
53
|
"engines": {
|
|
49
54
|
"node": ">=18"
|
|
50
55
|
},
|
|
51
56
|
"dependencies": {
|
|
52
|
-
"@platformscode/icons": "^0.0.11",
|
|
53
57
|
"tslib": "^2.3.0"
|
|
54
58
|
},
|
|
55
59
|
"sideEffects": false,
|
|
@@ -62,6 +66,18 @@
|
|
|
62
66
|
".": {
|
|
63
67
|
"types": "./types/a.nemreen-dga-ui.d.ts",
|
|
64
68
|
"default": "./fesm2022/a.nemreen-dga-ui.mjs"
|
|
69
|
+
},
|
|
70
|
+
"./cookies": {
|
|
71
|
+
"types": "./types/a.nemreen-dga-ui-cookies.d.ts",
|
|
72
|
+
"default": "./fesm2022/a.nemreen-dga-ui-cookies.mjs"
|
|
73
|
+
},
|
|
74
|
+
"./date-picker": {
|
|
75
|
+
"types": "./types/a.nemreen-dga-ui-date-picker.d.ts",
|
|
76
|
+
"default": "./fesm2022/a.nemreen-dga-ui-date-picker.mjs"
|
|
77
|
+
},
|
|
78
|
+
"./header": {
|
|
79
|
+
"types": "./types/a.nemreen-dga-ui-header.d.ts",
|
|
80
|
+
"default": "./fesm2022/a.nemreen-dga-ui-header.mjs"
|
|
65
81
|
}
|
|
66
82
|
},
|
|
67
83
|
"type": "module"
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { DgaIconName } from '@a.nemreen/dga-ui';
|
|
4
|
+
|
|
5
|
+
/** Stored consent outcome. `custom` = per-category preferences were saved. */
|
|
6
|
+
type DgaCookieConsent = 'accepted' | 'declined' | 'custom' | null;
|
|
7
|
+
/** Horizontal placement. Logical `start`/`end` follow reading direction. */
|
|
8
|
+
type DgaCookiesAlign = 'start' | 'center' | 'end';
|
|
9
|
+
/**
|
|
10
|
+
* Banner anchor on the viewport.
|
|
11
|
+
* - `start` | `center` | `end` → bottom edge + that alignment (compact)
|
|
12
|
+
* - `bottom` | `top` → that edge, centered
|
|
13
|
+
* - `bottom-start` / `top-end` / … → explicit edge + alignment
|
|
14
|
+
*/
|
|
15
|
+
type DgaCookiesPosition = DgaCookiesAlign | 'bottom' | 'top' | 'bottom-start' | 'bottom-center' | 'bottom-end' | 'top-start' | 'top-center' | 'top-end';
|
|
16
|
+
/** Optional cookie category for granular consent (GDPR-style preferences). */
|
|
17
|
+
interface DgaCookieCategory {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
/** Always enabled; toggle is disabled. */
|
|
22
|
+
required?: boolean;
|
|
23
|
+
/** Initial state when no stored preference exists (ignored when `required`). */
|
|
24
|
+
defaultEnabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
type DgaCookiePreferences = Record<string, boolean>;
|
|
27
|
+
interface DgaCookieDecision {
|
|
28
|
+
consent: Exclude<DgaCookieConsent, null>;
|
|
29
|
+
preferences: DgaCookiePreferences;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Privacy-compliant cookie consent banner.
|
|
33
|
+
* Persists choice (default 365 days); optional category preferences and GA gating.
|
|
34
|
+
*/
|
|
35
|
+
declare class DgaCookies implements OnInit {
|
|
36
|
+
private readonly destroyRef;
|
|
37
|
+
private readonly hostRef;
|
|
38
|
+
/** Original parent before body portal (restored on destroy). */
|
|
39
|
+
private portalHome;
|
|
40
|
+
readonly compact: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Viewport anchor. Use `start` / `center` / `end` for bottom placement,
|
|
43
|
+
* or compound values like `top-end`. Prefer `align` to set horizontal only.
|
|
44
|
+
*/
|
|
45
|
+
readonly position: _angular_core.InputSignal<DgaCookiesPosition>;
|
|
46
|
+
/** Horizontal alignment (`start` | `center` | `end`). Overrides `position` when set. */
|
|
47
|
+
readonly align: _angular_core.InputSignal<"" | DgaCookiesAlign>;
|
|
48
|
+
/** Auto-open delay when no consent is stored. `0` disables auto-show. */
|
|
49
|
+
readonly delayMs: _angular_core.InputSignal<number>;
|
|
50
|
+
/** When false, never auto-opens (call `show()` manually). */
|
|
51
|
+
readonly autoShow: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
52
|
+
/** Show the dismiss (X) control. Dismiss does not persist a decision. */
|
|
53
|
+
readonly dismissible: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
54
|
+
/** Show the reject / decline non-essential button. */
|
|
55
|
+
readonly showDecline: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
56
|
+
/** Show policy / terms links row. */
|
|
57
|
+
readonly showLinks: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
58
|
+
/** Show Customize when `categories` are provided. */
|
|
59
|
+
readonly showCustomize: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
60
|
+
/** Dim the page behind the banner (modal-style overlay). */
|
|
61
|
+
readonly overlay: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Prefer `overlay`. Same behavior — kept for backward compatibility.
|
|
64
|
+
*/
|
|
65
|
+
readonly blocking: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
66
|
+
/** Close the banner when the overlay backdrop is clicked (requires dismissible). */
|
|
67
|
+
readonly overlayClose: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
68
|
+
readonly termsHref: _angular_core.InputSignal<string>;
|
|
69
|
+
readonly privacyHref: _angular_core.InputSignal<string>;
|
|
70
|
+
/** Optional third policy link (cookie policy). Empty hides it. */
|
|
71
|
+
readonly cookiePolicyHref: _angular_core.InputSignal<string>;
|
|
72
|
+
readonly termsLabel: _angular_core.InputSignal<string>;
|
|
73
|
+
readonly privacyLabel: _angular_core.InputSignal<string>;
|
|
74
|
+
readonly cookiePolicyLabel: _angular_core.InputSignal<string>;
|
|
75
|
+
readonly title: _angular_core.InputSignal<string>;
|
|
76
|
+
readonly description: _angular_core.InputSignal<string>;
|
|
77
|
+
readonly acceptLabel: _angular_core.InputSignal<string>;
|
|
78
|
+
readonly declineLabel: _angular_core.InputSignal<string>;
|
|
79
|
+
readonly customizeLabel: _angular_core.InputSignal<string>;
|
|
80
|
+
readonly saveLabel: _angular_core.InputSignal<string>;
|
|
81
|
+
readonly icon: _angular_core.InputSignal<DgaIconName>;
|
|
82
|
+
/** Google Analytics IDs to disable on decline / when analytics is off. */
|
|
83
|
+
readonly gaTrackingIds: _angular_core.InputSignal<string | readonly string[]>;
|
|
84
|
+
/** Consent cookie lifetime in days. */
|
|
85
|
+
readonly consentDays: _angular_core.InputSignal<number>;
|
|
86
|
+
/** Consent cookie name (also used as localStorage key prefix). */
|
|
87
|
+
readonly consentCookieName: _angular_core.InputSignal<string>;
|
|
88
|
+
/** Extra cookies to delete when analytics/marketing is denied. */
|
|
89
|
+
readonly analyticsCookieNames: _angular_core.InputSignal<readonly string[]>;
|
|
90
|
+
/** Granular categories. When set, Customize / Save Preferences become available. */
|
|
91
|
+
readonly categories: _angular_core.InputSignal<readonly DgaCookieCategory[]>;
|
|
92
|
+
readonly accepted: _angular_core.OutputEmitterRef<void>;
|
|
93
|
+
readonly declined: _angular_core.OutputEmitterRef<void>;
|
|
94
|
+
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
95
|
+
readonly decided: _angular_core.OutputEmitterRef<"accepted" | "declined" | "custom">;
|
|
96
|
+
readonly preferencesChange: _angular_core.OutputEmitterRef<DgaCookiePreferences>;
|
|
97
|
+
readonly decision: _angular_core.OutputEmitterRef<DgaCookieDecision>;
|
|
98
|
+
/** Controls enter/exit animation state. */
|
|
99
|
+
readonly visible: _angular_core.WritableSignal<boolean>;
|
|
100
|
+
/** Keeps the panel in the DOM while exit animation plays. */
|
|
101
|
+
readonly mounted: _angular_core.WritableSignal<boolean>;
|
|
102
|
+
/** Whether the category preferences panel is expanded. */
|
|
103
|
+
readonly customizing: _angular_core.WritableSignal<boolean>;
|
|
104
|
+
/** Draft toggles while customizing. */
|
|
105
|
+
readonly draftPrefs: _angular_core.WritableSignal<DgaCookiePreferences>;
|
|
106
|
+
private readonly seq;
|
|
107
|
+
readonly titleId: string;
|
|
108
|
+
readonly bodyId: string;
|
|
109
|
+
private openTimer;
|
|
110
|
+
private closeTimer;
|
|
111
|
+
readonly copy: _angular_core.Signal<{
|
|
112
|
+
title: string;
|
|
113
|
+
body: string;
|
|
114
|
+
terms: string;
|
|
115
|
+
privacy: string;
|
|
116
|
+
cookiePolicy: string;
|
|
117
|
+
accept: string;
|
|
118
|
+
acceptAll: string;
|
|
119
|
+
decline: string;
|
|
120
|
+
customize: string;
|
|
121
|
+
save: string;
|
|
122
|
+
categories: string;
|
|
123
|
+
policies: string;
|
|
124
|
+
close: string;
|
|
125
|
+
}>;
|
|
126
|
+
readonly resolvedCategories: _angular_core.Signal<DgaCookieCategory[]>;
|
|
127
|
+
readonly resolvedLinks: _angular_core.Signal<{
|
|
128
|
+
href: string;
|
|
129
|
+
label: string;
|
|
130
|
+
}[]>;
|
|
131
|
+
/**
|
|
132
|
+
* Accept + Decline share a row; Customize / Save spans full width underneath
|
|
133
|
+
* so Arabic labels stay on one line. Actions stay pinned below the scroll body.
|
|
134
|
+
*/
|
|
135
|
+
readonly actionsClasses: _angular_core.Signal<string>;
|
|
136
|
+
/** Resolved vertical edge + horizontal align (logical start/end). */
|
|
137
|
+
readonly placement: _angular_core.Signal<{
|
|
138
|
+
edge: "top" | "bottom";
|
|
139
|
+
align: DgaCookiesAlign;
|
|
140
|
+
}>;
|
|
141
|
+
/** Whether a dimmed backdrop is shown (`overlay` or legacy `blocking`). */
|
|
142
|
+
readonly hasOverlay: _angular_core.Signal<boolean>;
|
|
143
|
+
readonly panelClasses: _angular_core.Signal<string>;
|
|
144
|
+
constructor();
|
|
145
|
+
ngOnInit(): void;
|
|
146
|
+
hasCategories(): boolean;
|
|
147
|
+
hasLinks(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Re-open the banner (e.g. from a footer Cookie Settings link).
|
|
150
|
+
* Portals to `document.body` so overflow/transform ancestors cannot clip it.
|
|
151
|
+
*/
|
|
152
|
+
show(): void;
|
|
153
|
+
/** Hide without persisting a decision. */
|
|
154
|
+
dismiss(): void;
|
|
155
|
+
/** Backdrop click — dismiss only when overlayClose + dismissible. */
|
|
156
|
+
onOverlayClick(): void;
|
|
157
|
+
openCustomize(): void;
|
|
158
|
+
onCategoryToggle(id: string, enabled: boolean): void;
|
|
159
|
+
accept(): void;
|
|
160
|
+
decline(): void;
|
|
161
|
+
savePreferences(): void;
|
|
162
|
+
private commit;
|
|
163
|
+
private buildDefaultPrefs;
|
|
164
|
+
private buildAllPrefs;
|
|
165
|
+
private readStored;
|
|
166
|
+
private hidePanel;
|
|
167
|
+
private trackingIds;
|
|
168
|
+
/** Move host to `body` so fixed positioning escapes overflow/transform ancestors. */
|
|
169
|
+
private ensureBodyPortal;
|
|
170
|
+
private restorePortal;
|
|
171
|
+
private clearTimer;
|
|
172
|
+
private clearCloseTimer;
|
|
173
|
+
static getConsent(cookieName?: string): DgaCookieConsent;
|
|
174
|
+
static getPreferences(cookieName?: string): DgaCookiePreferences | null;
|
|
175
|
+
static setConsent(value: Exclude<DgaCookieConsent, null>, options?: {
|
|
176
|
+
name?: string;
|
|
177
|
+
days?: number;
|
|
178
|
+
preferences?: DgaCookiePreferences;
|
|
179
|
+
}): void;
|
|
180
|
+
static clearConsent(cookieName?: string): void;
|
|
181
|
+
/** @internal */
|
|
182
|
+
static parseStored(raw: string | null): {
|
|
183
|
+
consent: DgaCookieConsent;
|
|
184
|
+
preferences: DgaCookiePreferences | null;
|
|
185
|
+
};
|
|
186
|
+
/** @internal */
|
|
187
|
+
static writeConsent(status: Exclude<DgaCookieConsent, null>, preferences: DgaCookiePreferences | null, opts: {
|
|
188
|
+
name: string;
|
|
189
|
+
days: number;
|
|
190
|
+
hasCategories: boolean;
|
|
191
|
+
}): void;
|
|
192
|
+
static get(name: string): string | null;
|
|
193
|
+
static set(name: string, value: string, days?: number): void;
|
|
194
|
+
static delete(name: string): void;
|
|
195
|
+
safeHref(href: string | undefined | null): string;
|
|
196
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DgaCookies, never>;
|
|
197
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DgaCookies, "dga-cookies", never, { "compact": { "alias": "compact"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "delayMs": { "alias": "delayMs"; "required": false; "isSignal": true; }; "autoShow": { "alias": "autoShow"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "showDecline": { "alias": "showDecline"; "required": false; "isSignal": true; }; "showLinks": { "alias": "showLinks"; "required": false; "isSignal": true; }; "showCustomize": { "alias": "showCustomize"; "required": false; "isSignal": true; }; "overlay": { "alias": "overlay"; "required": false; "isSignal": true; }; "blocking": { "alias": "blocking"; "required": false; "isSignal": true; }; "overlayClose": { "alias": "overlayClose"; "required": false; "isSignal": true; }; "termsHref": { "alias": "termsHref"; "required": false; "isSignal": true; }; "privacyHref": { "alias": "privacyHref"; "required": false; "isSignal": true; }; "cookiePolicyHref": { "alias": "cookiePolicyHref"; "required": false; "isSignal": true; }; "termsLabel": { "alias": "termsLabel"; "required": false; "isSignal": true; }; "privacyLabel": { "alias": "privacyLabel"; "required": false; "isSignal": true; }; "cookiePolicyLabel": { "alias": "cookiePolicyLabel"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "acceptLabel": { "alias": "acceptLabel"; "required": false; "isSignal": true; }; "declineLabel": { "alias": "declineLabel"; "required": false; "isSignal": true; }; "customizeLabel": { "alias": "customizeLabel"; "required": false; "isSignal": true; }; "saveLabel": { "alias": "saveLabel"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "gaTrackingIds": { "alias": "gaTrackingIds"; "required": false; "isSignal": true; }; "consentDays": { "alias": "consentDays"; "required": false; "isSignal": true; }; "consentCookieName": { "alias": "consentCookieName"; "required": false; "isSignal": true; }; "analyticsCookieNames": { "alias": "analyticsCookieNames"; "required": false; "isSignal": true; }; "categories": { "alias": "categories"; "required": false; "isSignal": true; }; }, { "accepted": "accepted"; "declined": "declined"; "closed": "closed"; "decided": "decided"; "preferencesChange": "preferencesChange"; "decision": "decision"; }, never, never, true, never>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export { DgaCookies };
|
|
201
|
+
export type { DgaCookieCategory, DgaCookieConsent, DgaCookieDecision, DgaCookiePreferences, DgaCookiesAlign, DgaCookiesPosition };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, DgaFormControlSize, DgaFormStatus } from '@a.nemreen/dga-ui';
|
|
3
|
+
|
|
4
|
+
/** Calendar system for date values and the picker UI. */
|
|
5
|
+
type DgaDateCalendar = 'gregorian' | 'hijri';
|
|
6
|
+
/** Picker UI mode — inferred from `format` tokens when not set explicitly. */
|
|
7
|
+
type DgaDatePickerMode = 'day' | 'month' | 'year';
|
|
8
|
+
type DgaDateLocale = 'ar' | 'en';
|
|
9
|
+
interface DgaCalendarParts {
|
|
10
|
+
year: number;
|
|
11
|
+
month: number;
|
|
12
|
+
day: number;
|
|
13
|
+
}
|
|
14
|
+
declare const DGA_HIJRI_MONTHS: {
|
|
15
|
+
readonly ar: readonly ["محرم", "صفر", "ربيع الأول", "ربيع الثاني", "جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدة", "ذو الحجة"];
|
|
16
|
+
readonly en: readonly ["Muharram", "Safar", "Rabi I", "Rabi II", "Jumada I", "Jumada II", "Rajab", "Sha'ban", "Ramadan", "Shawwal", "Dhu al-Qi'dah", "Dhu al-Hijjah"];
|
|
17
|
+
};
|
|
18
|
+
declare const DGA_GREGORIAN_MONTHS: {
|
|
19
|
+
readonly ar: readonly ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"];
|
|
20
|
+
readonly en: readonly ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
21
|
+
};
|
|
22
|
+
declare const DGA_WEEKDAYS: {
|
|
23
|
+
readonly ar: readonly ["أحد", "إثن", "ثلا", "أرب", "خمي", "جمع", "سبت"];
|
|
24
|
+
readonly en: readonly ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
25
|
+
};
|
|
26
|
+
/** Read calendar parts for a Date (UTC day). */
|
|
27
|
+
declare function dgaGetCalendarParts(date: Date, calendar: DgaDateCalendar): DgaCalendarParts;
|
|
28
|
+
/**
|
|
29
|
+
* Convert calendar parts to a Date (UTC midnight).
|
|
30
|
+
* Hijri conversion uses binary search against islamic-umalqura.
|
|
31
|
+
*/
|
|
32
|
+
declare function dgaPartsToDate(parts: DgaCalendarParts, calendar: DgaDateCalendar): Date;
|
|
33
|
+
declare function dgaDaysInMonth(year: number, month: number, calendar: DgaDateCalendar): number;
|
|
34
|
+
declare function dgaAddMonths(parts: DgaCalendarParts, delta: number, calendar: DgaDateCalendar): DgaCalendarParts;
|
|
35
|
+
/** Infer mode from format tokens (YYYY / MM / DD). */
|
|
36
|
+
declare function dgaModeFromFormat(format: string): DgaDatePickerMode;
|
|
37
|
+
declare function dgaFormatDate(date: Date, format: string, calendar: DgaDateCalendar): string;
|
|
38
|
+
declare function dgaParseDate(value: string, format: string, calendar: DgaDateCalendar): Date | null;
|
|
39
|
+
declare function dgaSameDay(a: Date | null, b: Date | null, calendar?: DgaDateCalendar): boolean;
|
|
40
|
+
declare function dgaCompareDays(a: Date | null, b: Date | null, calendar?: DgaDateCalendar): number;
|
|
41
|
+
declare function dgaClampDate(date: Date, min?: Date | null, max?: Date | null, calendar?: DgaDateCalendar): Date;
|
|
42
|
+
declare function dgaMonthNames(calendar: DgaDateCalendar, locale: 'ar' | 'en'): readonly string[];
|
|
43
|
+
/** First weekday (0=Sun) of the given calendar month. */
|
|
44
|
+
declare function dgaMonthStartWeekday(year: number, month: number, calendar: DgaDateCalendar): number;
|
|
45
|
+
declare function dgaTodayUtc(): Date;
|
|
46
|
+
/** Coerce string | Date | null to UTC date using format when string. */
|
|
47
|
+
declare function dgaCoerceDate(value: string | Date | null | undefined, format: string, calendar: DgaDateCalendar): Date | null;
|
|
48
|
+
|
|
49
|
+
interface DgaDateRangeValue {
|
|
50
|
+
start: string;
|
|
51
|
+
end: string;
|
|
52
|
+
}
|
|
53
|
+
type PanelView = DgaDatePickerMode;
|
|
54
|
+
declare class DgaDatePickerComponent implements ControlValueAccessor {
|
|
55
|
+
private readonly host;
|
|
56
|
+
private readonly destroyRef;
|
|
57
|
+
readonly inputId: string;
|
|
58
|
+
readonly panelId: string;
|
|
59
|
+
readonly valueInput: _angular_core.InputSignal<string>;
|
|
60
|
+
readonly value: _angular_core.WritableSignal<string>;
|
|
61
|
+
readonly startValue: _angular_core.ModelSignal<string>;
|
|
62
|
+
readonly endValue: _angular_core.ModelSignal<string>;
|
|
63
|
+
private onChange;
|
|
64
|
+
private onTouched;
|
|
65
|
+
readonly calendar: _angular_core.InputSignal<DgaDateCalendar>;
|
|
66
|
+
readonly range: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
67
|
+
readonly format: _angular_core.InputSignal<string>;
|
|
68
|
+
readonly mode: _angular_core.InputSignal<DgaDatePickerMode | null>;
|
|
69
|
+
readonly locale: _angular_core.InputSignal<DgaDateLocale>;
|
|
70
|
+
readonly minDate: _angular_core.InputSignal<string | Date | null>;
|
|
71
|
+
readonly maxDate: _angular_core.InputSignal<string | Date | null>;
|
|
72
|
+
readonly yearBefore: _angular_core.InputSignal<number>;
|
|
73
|
+
readonly yearAfter: _angular_core.InputSignal<number>;
|
|
74
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
75
|
+
readonly controlId: _angular_core.InputSignal<string>;
|
|
76
|
+
readonly name: _angular_core.InputSignal<string>;
|
|
77
|
+
readonly size: _angular_core.InputSignal<DgaFormControlSize>;
|
|
78
|
+
readonly disabledInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
79
|
+
private readonly cvaDisabled;
|
|
80
|
+
readonly disabled: _angular_core.Signal<boolean>;
|
|
81
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
82
|
+
readonly clearable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
83
|
+
readonly editable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
84
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
85
|
+
readonly status: _angular_core.InputSignal<DgaFormStatus>;
|
|
86
|
+
readonly rangeSeparator: _angular_core.InputSignal<string>;
|
|
87
|
+
readonly todayLabel: _angular_core.InputSignal<string>;
|
|
88
|
+
readonly clearLabel: _angular_core.InputSignal<string>;
|
|
89
|
+
readonly closeLabel: _angular_core.InputSignal<string>;
|
|
90
|
+
readonly saveLabel: _angular_core.InputSignal<string>;
|
|
91
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
92
|
+
readonly resolvedTodayLabel: _angular_core.Signal<string>;
|
|
93
|
+
readonly resolvedClearLabel: _angular_core.Signal<string>;
|
|
94
|
+
readonly resolvedCloseLabel: _angular_core.Signal<string>;
|
|
95
|
+
readonly resolvedSaveLabel: _angular_core.Signal<string>;
|
|
96
|
+
readonly valueChange: _angular_core.OutputEmitterRef<string>;
|
|
97
|
+
readonly rangeChange: _angular_core.OutputEmitterRef<DgaDateRangeValue>;
|
|
98
|
+
readonly open: _angular_core.WritableSignal<boolean>;
|
|
99
|
+
readonly panelStyle: _angular_core.WritableSignal<Record<string, string>>;
|
|
100
|
+
readonly panelView: _angular_core.WritableSignal<DgaDatePickerMode>;
|
|
101
|
+
readonly viewParts: _angular_core.WritableSignal<DgaCalendarParts>;
|
|
102
|
+
readonly draftStart: _angular_core.WritableSignal<Date | null>;
|
|
103
|
+
readonly draftEnd: _angular_core.WritableSignal<Date | null>;
|
|
104
|
+
readonly rangePickPhase: _angular_core.WritableSignal<"start" | "end">;
|
|
105
|
+
readonly typedValue: _angular_core.WritableSignal<string | null>;
|
|
106
|
+
readonly effectiveStatus: _angular_core.Signal<DgaFormStatus>;
|
|
107
|
+
readonly panelMode: _angular_core.Signal<DgaDatePickerMode>;
|
|
108
|
+
readonly labels: _angular_core.Signal<{
|
|
109
|
+
readonly today: "اليوم";
|
|
110
|
+
readonly clear: "مسح";
|
|
111
|
+
readonly close: "إغلاق";
|
|
112
|
+
readonly save: "حفظ";
|
|
113
|
+
readonly prev: "السابق";
|
|
114
|
+
readonly next: "التالي";
|
|
115
|
+
readonly calendar: "فتح التقويم";
|
|
116
|
+
readonly clearInput: "مسح التاريخ";
|
|
117
|
+
readonly month: "الشهر";
|
|
118
|
+
readonly year: "السنة";
|
|
119
|
+
readonly placeholder: "يوم/شهر/سنة";
|
|
120
|
+
readonly rangeStart: "تاريخ البداية";
|
|
121
|
+
readonly rangeEnd: "تاريخ النهاية";
|
|
122
|
+
} | {
|
|
123
|
+
readonly today: "Today";
|
|
124
|
+
readonly clear: "Clear";
|
|
125
|
+
readonly close: "Close";
|
|
126
|
+
readonly save: "Save";
|
|
127
|
+
readonly prev: "Previous";
|
|
128
|
+
readonly next: "Next";
|
|
129
|
+
readonly calendar: "Open calendar";
|
|
130
|
+
readonly clearInput: "Clear date";
|
|
131
|
+
readonly month: "Month";
|
|
132
|
+
readonly year: "Year";
|
|
133
|
+
readonly placeholder: "DD/MM/YYYY";
|
|
134
|
+
readonly rangeStart: "Start date";
|
|
135
|
+
readonly rangeEnd: "End date";
|
|
136
|
+
}>;
|
|
137
|
+
readonly resolvedPlaceholder: _angular_core.Signal<string>;
|
|
138
|
+
readonly weekdays: _angular_core.Signal<readonly ["أحد", "إثن", "ثلا", "أرب", "خمي", "جمع", "سبت"] | readonly ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]>;
|
|
139
|
+
readonly minBound: _angular_core.Signal<Date | null>;
|
|
140
|
+
readonly maxBound: _angular_core.Signal<Date | null>;
|
|
141
|
+
readonly displayValue: _angular_core.Signal<string>;
|
|
142
|
+
readonly viewYear: _angular_core.Signal<number>;
|
|
143
|
+
readonly viewMonth: _angular_core.Signal<number>;
|
|
144
|
+
readonly monthOptions: _angular_core.Signal<{
|
|
145
|
+
value: number;
|
|
146
|
+
label: string;
|
|
147
|
+
selected: boolean;
|
|
148
|
+
disabled: boolean;
|
|
149
|
+
}[]>;
|
|
150
|
+
readonly yearOptions: _angular_core.Signal<{
|
|
151
|
+
value: number;
|
|
152
|
+
selected: boolean;
|
|
153
|
+
disabled: boolean;
|
|
154
|
+
}[]>;
|
|
155
|
+
readonly dayCells: _angular_core.Signal<DayCell[]>;
|
|
156
|
+
constructor();
|
|
157
|
+
onDocumentClick(event: MouseEvent): void;
|
|
158
|
+
onEscape(): void;
|
|
159
|
+
onReposition(): void;
|
|
160
|
+
monthLabel(month: number): string;
|
|
161
|
+
togglePanel(): void;
|
|
162
|
+
openPanel(): void;
|
|
163
|
+
closePanel(restoreDraft?: boolean): void;
|
|
164
|
+
private repositionPanel;
|
|
165
|
+
navigate(delta: number): void;
|
|
166
|
+
setPanelView(view: PanelView): void;
|
|
167
|
+
selectDay(day: number): void;
|
|
168
|
+
selectMonth(month: number): void;
|
|
169
|
+
selectYear(year: number): void;
|
|
170
|
+
goToday(): void;
|
|
171
|
+
clearDraft(): void;
|
|
172
|
+
clearAll(): void;
|
|
173
|
+
save(): void;
|
|
174
|
+
onInput(raw: string): void;
|
|
175
|
+
onInputBlur(): void;
|
|
176
|
+
onInputKeydown(event: KeyboardEvent): void;
|
|
177
|
+
private applyDraftDate;
|
|
178
|
+
private draftAnchorParts;
|
|
179
|
+
private syncDraftFromModels;
|
|
180
|
+
private parseRangeFromValue;
|
|
181
|
+
private emitValues;
|
|
182
|
+
writeValue(value: string): void;
|
|
183
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
184
|
+
registerOnTouched(fn: () => void): void;
|
|
185
|
+
setDisabledState(isDisabled: boolean): void;
|
|
186
|
+
private isDateDisabled;
|
|
187
|
+
private isMonthDisabled;
|
|
188
|
+
private isYearDisabled;
|
|
189
|
+
private initialViewParts;
|
|
190
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DgaDatePickerComponent, never>;
|
|
191
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DgaDatePickerComponent, "dga-date-picker", never, { "valueInput": { "alias": "value"; "required": false; "isSignal": true; }; "startValue": { "alias": "startValue"; "required": false; "isSignal": true; }; "endValue": { "alias": "endValue"; "required": false; "isSignal": true; }; "calendar": { "alias": "calendar"; "required": false; "isSignal": true; }; "range": { "alias": "range"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "yearBefore": { "alias": "yearBefore"; "required": false; "isSignal": true; }; "yearAfter": { "alias": "yearAfter"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "invalid": { "alias": "dgaInvalid"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; "rangeSeparator": { "alias": "rangeSeparator"; "required": false; "isSignal": true; }; "todayLabel": { "alias": "todayLabel"; "required": false; "isSignal": true; }; "clearLabel": { "alias": "clearLabel"; "required": false; "isSignal": true; }; "closeLabel": { "alias": "closeLabel"; "required": false; "isSignal": true; }; "saveLabel": { "alias": "saveLabel"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "startValue": "startValueChange"; "endValue": "endValueChange"; "valueChange": "valueChange"; "rangeChange": "rangeChange"; }, never, never, true, never>;
|
|
192
|
+
}
|
|
193
|
+
interface DayCell {
|
|
194
|
+
key: string;
|
|
195
|
+
empty: boolean;
|
|
196
|
+
day?: number;
|
|
197
|
+
today?: boolean;
|
|
198
|
+
selected?: boolean;
|
|
199
|
+
inRange?: boolean;
|
|
200
|
+
rangeStart?: boolean;
|
|
201
|
+
rangeEnd?: boolean;
|
|
202
|
+
disabled?: boolean;
|
|
203
|
+
label?: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export { DGA_GREGORIAN_MONTHS, DGA_HIJRI_MONTHS, DGA_WEEKDAYS, DgaDatePickerComponent as DgaDatePicker, dgaAddMonths, dgaClampDate, dgaCoerceDate, dgaCompareDays, dgaDaysInMonth, dgaFormatDate, dgaGetCalendarParts, dgaModeFromFormat, dgaMonthNames, dgaMonthStartWeekday, dgaParseDate, dgaPartsToDate, dgaSameDay, dgaTodayUtc };
|
|
207
|
+
export type { DgaCalendarParts, DgaDateCalendar, DgaDatePickerMode, DgaDateRangeValue };
|