ngx-strata 0.5.2 → 0.6.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/assets/icons/calendar.svg +1 -0
- package/assets/styles/components/modal.scss +13 -3
- package/dist/strata/strata.css +1 -1
- package/fesm2022/ngx-strata.mjs +1304 -4
- package/fesm2022/ngx-strata.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/ngx-strata/SKILL.md +5 -0
- package/skills/ngx-strata/components/action-menu.md +1 -0
- package/skills/ngx-strata/components/calendar.md +86 -0
- package/skills/ngx-strata/components/date-range-picker.md +53 -0
- package/skills/ngx-strata/components/datepicker.md +66 -0
- package/skills/ngx-strata/components/icon.md +1 -1
- package/skills/ngx-strata/components/time-picker.md +37 -0
- package/types/ngx-strata.d.ts +297 -23
package/fesm2022/ngx-strata.mjs
CHANGED
|
@@ -96,6 +96,10 @@ const baseIconConfigs = [
|
|
|
96
96
|
name: 'check',
|
|
97
97
|
url: 'assets/icons/check.svg'
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
name: 'calendar',
|
|
101
|
+
url: 'assets/icons/calendar.svg'
|
|
102
|
+
}
|
|
99
103
|
];
|
|
100
104
|
|
|
101
105
|
const provideBaseIcons = () => {
|
|
@@ -1313,6 +1317,8 @@ class StrataActionMenuComponent {
|
|
|
1313
1317
|
...(ngDevMode ? [{ debugName: "actionMenuItems" }] : /* istanbul ignore next */ []));
|
|
1314
1318
|
placement = input('bottom-end', /* @ts-ignore */
|
|
1315
1319
|
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
1320
|
+
buttonSize = input('md', /* @ts-ignore */
|
|
1321
|
+
...(ngDevMode ? [{ debugName: "buttonSize" }] : /* istanbul ignore next */ []));
|
|
1316
1322
|
closeOnOutsideClick = input(true, /* @ts-ignore */
|
|
1317
1323
|
...(ngDevMode ? [{ debugName: "closeOnOutsideClick" }] : /* istanbul ignore next */ []));
|
|
1318
1324
|
elementRef = inject(ElementRef);
|
|
@@ -1364,17 +1370,17 @@ class StrataActionMenuComponent {
|
|
|
1364
1370
|
});
|
|
1365
1371
|
}
|
|
1366
1372
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataActionMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1367
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataActionMenuComponent, isStandalone: true, selector: "st-action-menu", inputs: { placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsideClick: { classPropertyName: "closeOnOutsideClick", publicName: "closeOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "projectedButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "actionMenuItems", predicate: StrataActionMenuItemComponent, isSignal: true }], viewQueries: [{ propertyName: "defaultButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div [stOverlay]=\"menu\" [overlayOpen]=\"menuOpen()\" [overlayPlacement]=\"placement()\">\n <ng-content select=\"button[stButton]\"></ng-content>\n @if (!projectedButton()) {\n <button stButton><st-icon name=\"more\"></st-icon></button>\n }\n</div>\n\n<ng-template #menu>\n <st-card [padding]=\"false\" class=\"action-menu-card\"><ng-content select=\"st-action-menu-item\"></ng-content></st-card>\n</ng-template>\n", styles: ["st-card{width:fit-content}\n"], dependencies: [{ kind: "component", type: StrataCardComponent, selector: "st-card", inputs: ["elevated", "selectable", "padding", "variant"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }] });
|
|
1373
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataActionMenuComponent, isStandalone: true, selector: "st-action-menu", inputs: { placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, buttonSize: { classPropertyName: "buttonSize", publicName: "buttonSize", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsideClick: { classPropertyName: "closeOnOutsideClick", publicName: "closeOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "projectedButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "actionMenuItems", predicate: StrataActionMenuItemComponent, isSignal: true }], viewQueries: [{ propertyName: "defaultButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div [stOverlay]=\"menu\" [overlayOpen]=\"menuOpen()\" [overlayPlacement]=\"placement()\">\n <ng-content select=\"button[stButton]\"></ng-content>\n @if (!projectedButton()) {\n <button stButton [size]=\"buttonSize()\"><st-icon name=\"more\"></st-icon></button>\n }\n</div>\n\n<ng-template #menu>\n <st-card [padding]=\"false\" class=\"action-menu-card\"><ng-content select=\"st-action-menu-item\"></ng-content></st-card>\n</ng-template>\n", styles: ["st-card{width:fit-content}\n"], dependencies: [{ kind: "component", type: StrataCardComponent, selector: "st-card", inputs: ["elevated", "selectable", "padding", "variant"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }] });
|
|
1368
1374
|
}
|
|
1369
1375
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataActionMenuComponent, decorators: [{
|
|
1370
1376
|
type: Component,
|
|
1371
|
-
args: [{ selector: 'st-action-menu', imports: [StrataCardComponent, StrataOverlayDirective, StrataIconComponent, StrataButtonDirective], template: "<div [stOverlay]=\"menu\" [overlayOpen]=\"menuOpen()\" [overlayPlacement]=\"placement()\">\n <ng-content select=\"button[stButton]\"></ng-content>\n @if (!projectedButton()) {\n <button stButton><st-icon name=\"more\"></st-icon></button>\n }\n</div>\n\n<ng-template #menu>\n <st-card [padding]=\"false\" class=\"action-menu-card\"><ng-content select=\"st-action-menu-item\"></ng-content></st-card>\n</ng-template>\n", styles: ["st-card{width:fit-content}\n"] }]
|
|
1377
|
+
args: [{ selector: 'st-action-menu', imports: [StrataCardComponent, StrataOverlayDirective, StrataIconComponent, StrataButtonDirective], template: "<div [stOverlay]=\"menu\" [overlayOpen]=\"menuOpen()\" [overlayPlacement]=\"placement()\">\n <ng-content select=\"button[stButton]\"></ng-content>\n @if (!projectedButton()) {\n <button stButton [size]=\"buttonSize()\"><st-icon name=\"more\"></st-icon></button>\n }\n</div>\n\n<ng-template #menu>\n <st-card [padding]=\"false\" class=\"action-menu-card\"><ng-content select=\"st-action-menu-item\"></ng-content></st-card>\n</ng-template>\n", styles: ["st-card{width:fit-content}\n"] }]
|
|
1372
1378
|
}], ctorParameters: () => [], propDecorators: { projectedButton: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StrataButtonDirective), { ...{
|
|
1373
1379
|
descendants: true,
|
|
1374
1380
|
read: ElementRef
|
|
1375
1381
|
}, isSignal: true }] }], defaultButton: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataButtonDirective), { ...{
|
|
1376
1382
|
read: ElementRef
|
|
1377
|
-
}, isSignal: true }] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }], actionMenuItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataActionMenuItemComponent), { isSignal: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], closeOnOutsideClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnOutsideClick", required: false }] }] } });
|
|
1383
|
+
}, isSignal: true }] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }], actionMenuItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataActionMenuItemComponent), { isSignal: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], buttonSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonSize", required: false }] }], closeOnOutsideClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnOutsideClick", required: false }] }] } });
|
|
1378
1384
|
|
|
1379
1385
|
class StrataTextStackComponent {
|
|
1380
1386
|
overflow = input('truncate', /* @ts-ignore */
|
|
@@ -1646,6 +1652,1300 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
|
|
|
1646
1652
|
}, template: "<ng-content select=\"[stButton], st-divider\" #buttons></ng-content>\n" }]
|
|
1647
1653
|
}], propDecorators: { justification: [{ type: i0.Input, args: [{ isSignal: true, alias: "justification", required: false }] }] } });
|
|
1648
1654
|
|
|
1655
|
+
class StrataTimePickerComponent {
|
|
1656
|
+
format = input('24h', /* @ts-ignore */
|
|
1657
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
1658
|
+
showSeconds = input(false, /* @ts-ignore */
|
|
1659
|
+
...(ngDevMode ? [{ debugName: "showSeconds" }] : /* istanbul ignore next */ []));
|
|
1660
|
+
minuteStep = input(1, /* @ts-ignore */
|
|
1661
|
+
...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
|
|
1662
|
+
disabled = input(false, /* @ts-ignore */
|
|
1663
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1664
|
+
value = model(null, /* @ts-ignore */
|
|
1665
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1666
|
+
hours = signal(0, /* @ts-ignore */
|
|
1667
|
+
...(ngDevMode ? [{ debugName: "hours" }] : /* istanbul ignore next */ []));
|
|
1668
|
+
minutes = signal(0, /* @ts-ignore */
|
|
1669
|
+
...(ngDevMode ? [{ debugName: "minutes" }] : /* istanbul ignore next */ []));
|
|
1670
|
+
seconds = signal(0, /* @ts-ignore */
|
|
1671
|
+
...(ngDevMode ? [{ debugName: "seconds" }] : /* istanbul ignore next */ []));
|
|
1672
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
1673
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
1674
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
1675
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
1676
|
+
onChange = () => undefined;
|
|
1677
|
+
onTouched = () => undefined;
|
|
1678
|
+
is12h = computed(() => this.format() === '12h', /* @ts-ignore */
|
|
1679
|
+
...(ngDevMode ? [{ debugName: "is12h" }] : /* istanbul ignore next */ []));
|
|
1680
|
+
isPM = computed(() => this.hours() >= 12, /* @ts-ignore */
|
|
1681
|
+
...(ngDevMode ? [{ debugName: "isPM" }] : /* istanbul ignore next */ []));
|
|
1682
|
+
meridiem = computed(() => (this.isPM() ? 'PM' : 'AM'), /* @ts-ignore */
|
|
1683
|
+
...(ngDevMode ? [{ debugName: "meridiem" }] : /* istanbul ignore next */ []));
|
|
1684
|
+
displayHours = computed(() => {
|
|
1685
|
+
const h = this.hours();
|
|
1686
|
+
if (!this.is12h()) {
|
|
1687
|
+
return h.toString().padStart(2, '0');
|
|
1688
|
+
}
|
|
1689
|
+
const h12 = h % 12 || 12;
|
|
1690
|
+
return h12.toString().padStart(2, '0');
|
|
1691
|
+
}, /* @ts-ignore */
|
|
1692
|
+
...(ngDevMode ? [{ debugName: "displayHours" }] : /* istanbul ignore next */ []));
|
|
1693
|
+
displayMinutes = computed(() => {
|
|
1694
|
+
return this.minutes().toString().padStart(2, '0');
|
|
1695
|
+
}, /* @ts-ignore */
|
|
1696
|
+
...(ngDevMode ? [{ debugName: "displayMinutes" }] : /* istanbul ignore next */ []));
|
|
1697
|
+
displaySeconds = computed(() => {
|
|
1698
|
+
return this.seconds().toString().padStart(2, '0');
|
|
1699
|
+
}, /* @ts-ignore */
|
|
1700
|
+
...(ngDevMode ? [{ debugName: "displaySeconds" }] : /* istanbul ignore next */ []));
|
|
1701
|
+
constructor() {
|
|
1702
|
+
effect(() => {
|
|
1703
|
+
const val = this.value();
|
|
1704
|
+
this.syncFromValue(val);
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
syncFromValue(val) {
|
|
1708
|
+
if (!val) {
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
if (val instanceof Date) {
|
|
1712
|
+
this.hours.set(val.getHours());
|
|
1713
|
+
this.minutes.set(val.getMinutes());
|
|
1714
|
+
this.seconds.set(val.getSeconds());
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
if (typeof val === 'string') {
|
|
1718
|
+
const parts = val.trim().split(':');
|
|
1719
|
+
if (parts.length >= 2) {
|
|
1720
|
+
const h = parseInt(parts[0], 10) || 0;
|
|
1721
|
+
const m = parseInt(parts[1], 10) || 0;
|
|
1722
|
+
const s = parts[2] ? parseInt(parts[2], 10) || 0 : 0;
|
|
1723
|
+
this.hours.set(Math.min(23, Math.max(0, h)));
|
|
1724
|
+
this.minutes.set(Math.min(59, Math.max(0, m)));
|
|
1725
|
+
this.seconds.set(Math.min(59, Math.max(0, s)));
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
incrementHours() {
|
|
1730
|
+
if (this.effectiveDisabled())
|
|
1731
|
+
return;
|
|
1732
|
+
const current = this.hours();
|
|
1733
|
+
this.setHours((current + 1) % 24);
|
|
1734
|
+
}
|
|
1735
|
+
decrementHours() {
|
|
1736
|
+
if (this.effectiveDisabled())
|
|
1737
|
+
return;
|
|
1738
|
+
const current = this.hours();
|
|
1739
|
+
this.setHours((current - 1 + 24) % 24);
|
|
1740
|
+
}
|
|
1741
|
+
incrementMinutes() {
|
|
1742
|
+
if (this.effectiveDisabled())
|
|
1743
|
+
return;
|
|
1744
|
+
const step = Math.max(1, this.minuteStep());
|
|
1745
|
+
const current = this.minutes();
|
|
1746
|
+
const next = (Math.floor(current / step) * step + step) % 60;
|
|
1747
|
+
this.setMinutes(next);
|
|
1748
|
+
}
|
|
1749
|
+
decrementMinutes() {
|
|
1750
|
+
if (this.effectiveDisabled())
|
|
1751
|
+
return;
|
|
1752
|
+
const step = Math.max(1, this.minuteStep());
|
|
1753
|
+
const current = this.minutes();
|
|
1754
|
+
const next = (Math.ceil(current / step) * step - step + 60) % 60;
|
|
1755
|
+
this.setMinutes(next);
|
|
1756
|
+
}
|
|
1757
|
+
incrementSeconds() {
|
|
1758
|
+
if (this.effectiveDisabled())
|
|
1759
|
+
return;
|
|
1760
|
+
const current = this.seconds();
|
|
1761
|
+
this.setSeconds((current + 1) % 60);
|
|
1762
|
+
}
|
|
1763
|
+
decrementSeconds() {
|
|
1764
|
+
if (this.effectiveDisabled())
|
|
1765
|
+
return;
|
|
1766
|
+
const current = this.seconds();
|
|
1767
|
+
this.setSeconds((current - 1 + 60) % 60);
|
|
1768
|
+
}
|
|
1769
|
+
toggleMeridiem() {
|
|
1770
|
+
if (this.effectiveDisabled() || !this.is12h())
|
|
1771
|
+
return;
|
|
1772
|
+
const current = this.hours();
|
|
1773
|
+
if (current >= 12) {
|
|
1774
|
+
this.setHours(current - 12);
|
|
1775
|
+
}
|
|
1776
|
+
else {
|
|
1777
|
+
this.setHours(current + 12);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
setHours(h) {
|
|
1781
|
+
this.hours.set(h);
|
|
1782
|
+
this.emitChange();
|
|
1783
|
+
}
|
|
1784
|
+
setMinutes(m) {
|
|
1785
|
+
this.minutes.set(m);
|
|
1786
|
+
this.emitChange();
|
|
1787
|
+
}
|
|
1788
|
+
setSeconds(s) {
|
|
1789
|
+
this.seconds.set(s);
|
|
1790
|
+
this.emitChange();
|
|
1791
|
+
}
|
|
1792
|
+
emitChange() {
|
|
1793
|
+
const currentVal = this.value();
|
|
1794
|
+
let updated;
|
|
1795
|
+
if (currentVal instanceof Date) {
|
|
1796
|
+
const d = new Date(currentVal);
|
|
1797
|
+
d.setHours(this.hours(), this.minutes(), this.seconds());
|
|
1798
|
+
updated = d;
|
|
1799
|
+
}
|
|
1800
|
+
else {
|
|
1801
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
1802
|
+
updated = this.showSeconds()
|
|
1803
|
+
? `${pad(this.hours())}:${pad(this.minutes())}:${pad(this.seconds())}`
|
|
1804
|
+
: `${pad(this.hours())}:${pad(this.minutes())}`;
|
|
1805
|
+
}
|
|
1806
|
+
this.value.set(updated);
|
|
1807
|
+
this.onChange(updated);
|
|
1808
|
+
this.onTouched();
|
|
1809
|
+
}
|
|
1810
|
+
writeValue(val) {
|
|
1811
|
+
this.value.set(val);
|
|
1812
|
+
this.syncFromValue(val);
|
|
1813
|
+
}
|
|
1814
|
+
registerOnChange(fn) {
|
|
1815
|
+
this.onChange = fn;
|
|
1816
|
+
}
|
|
1817
|
+
registerOnTouched(fn) {
|
|
1818
|
+
this.onTouched = fn;
|
|
1819
|
+
}
|
|
1820
|
+
setDisabledState(isDisabled) {
|
|
1821
|
+
this.cvaDisabled.set(isDisabled);
|
|
1822
|
+
}
|
|
1823
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataTimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1824
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataTimePickerComponent, isStandalone: true, selector: "st-time-picker", inputs: { format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class.st-time-picker": "true", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null" } }, providers: [
|
|
1825
|
+
{
|
|
1826
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1827
|
+
useExisting: forwardRef(() => StrataTimePickerComponent),
|
|
1828
|
+
multi: true
|
|
1829
|
+
}
|
|
1830
|
+
], ngImport: i0, template: "<div class=\"st-time-picker-inner\">\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementHours()\"\n aria-label=\"Increment hours\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementHours()\" (keydown.arrowdown)=\"decrementHours()\">\n {{ displayHours() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementHours()\"\n aria-label=\"Decrement hours\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementMinutes()\"\n aria-label=\"Increment minutes\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementMinutes()\" (keydown.arrowdown)=\"decrementMinutes()\">\n {{ displayMinutes() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementMinutes()\"\n aria-label=\"Decrement minutes\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n @if (showSeconds()) {\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementSeconds()\"\n aria-label=\"Increment seconds\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementSeconds()\" (keydown.arrowdown)=\"decrementSeconds()\">\n {{ displaySeconds() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementSeconds()\"\n aria-label=\"Decrement seconds\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n }\n\n @if (is12h()) {\n <div class=\"st-time-col st-meridiem-col\">\n <button\n type=\"button\"\n class=\"st-meridiem-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleMeridiem()\"\n aria-label=\"Toggle AM PM\"\n >\n {{ meridiem() }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:inline-flex;align-items:center;box-sizing:border-box}:host.st-size-sm .st-time-val{min-width:34px;height:32px;font-size:var(--st-font-md);border-radius:var(--st-border-radius-sm)}:host.st-size-sm .st-time-arrow-btn{width:34px;height:20px}:host.st-size-sm .st-time-sep{font-size:var(--st-font-lg);margin:0 2px}:host.st-size-sm .st-meridiem-btn{height:32px;font-size:var(--st-font-xs);padding:0 var(--st-space-2);border-radius:var(--st-border-radius-sm)}:host.st-size-lg .st-time-val{min-width:54px;height:50px;font-size:1.5rem;border-radius:var(--st-border-radius-lg)}:host.st-size-lg .st-time-arrow-btn{width:54px;height:28px}:host.st-size-lg .st-time-sep{font-size:1.75rem;margin:0 6px}:host.st-size-lg .st-meridiem-btn{height:50px;font-size:var(--st-font-md);padding:0 var(--st-space-4);border-radius:var(--st-border-radius-lg)}:host.st-disabled{opacity:.55;pointer-events:none}.st-time-picker-inner{display:inline-flex;align-items:center;gap:var(--st-space-1);padding:0;background:transparent;border:none;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-time-col{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--st-space-1)}.st-time-arrow-btn{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);width:44px;height:24px;border-radius:var(--st-border-radius-sm);transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-time-arrow-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-time-arrow-btn:disabled{opacity:.4;cursor:not-allowed}.st-time-val{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:42px;font-family:var(--st-font-mono);font-size:var(--st-font-lg);font-weight:var(--st-font-weight-semibold);background:transparent;border:1px solid var(--st-border);border-radius:var(--st-border-radius-md);color:var(--st-color-text-primary);outline:none;cursor:default;transition:border-color var(--st-transition-fast)}.st-time-val:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}.st-time-sep{font-weight:var(--st-font-weight-bold);color:var(--st-color-text-secondary);font-size:var(--st-font-xl);margin:0 4px}.st-meridiem-col{margin-left:var(--st-space-1)}.st-meridiem-btn{background:transparent;border:1px solid var(--st-border);color:var(--st-color-text-primary);border-radius:var(--st-border-radius-md);height:42px;font-size:var(--st-font-sm);font-weight:var(--st-font-weight-semibold);padding:0 var(--st-space-3);cursor:pointer;transition:background var(--st-transition-fast),border-color var(--st-transition-fast)}.st-meridiem-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));border-color:var(--st-color-border-strong)}.st-meridiem-btn:disabled{opacity:.4;cursor:not-allowed}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }] });
|
|
1831
|
+
}
|
|
1832
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataTimePickerComponent, decorators: [{
|
|
1833
|
+
type: Component,
|
|
1834
|
+
args: [{ selector: 'st-time-picker', imports: [CommonModule, StrataIconComponent], providers: [
|
|
1835
|
+
{
|
|
1836
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1837
|
+
useExisting: forwardRef(() => StrataTimePickerComponent),
|
|
1838
|
+
multi: true
|
|
1839
|
+
}
|
|
1840
|
+
], host: {
|
|
1841
|
+
'[class.st-time-picker]': 'true',
|
|
1842
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
1843
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null'
|
|
1844
|
+
}, template: "<div class=\"st-time-picker-inner\">\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementHours()\"\n aria-label=\"Increment hours\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementHours()\" (keydown.arrowdown)=\"decrementHours()\">\n {{ displayHours() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementHours()\"\n aria-label=\"Decrement hours\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementMinutes()\"\n aria-label=\"Increment minutes\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementMinutes()\" (keydown.arrowdown)=\"decrementMinutes()\">\n {{ displayMinutes() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementMinutes()\"\n aria-label=\"Decrement minutes\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n @if (showSeconds()) {\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementSeconds()\"\n aria-label=\"Increment seconds\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementSeconds()\" (keydown.arrowdown)=\"decrementSeconds()\">\n {{ displaySeconds() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementSeconds()\"\n aria-label=\"Decrement seconds\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n }\n\n @if (is12h()) {\n <div class=\"st-time-col st-meridiem-col\">\n <button\n type=\"button\"\n class=\"st-meridiem-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleMeridiem()\"\n aria-label=\"Toggle AM PM\"\n >\n {{ meridiem() }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:inline-flex;align-items:center;box-sizing:border-box}:host.st-size-sm .st-time-val{min-width:34px;height:32px;font-size:var(--st-font-md);border-radius:var(--st-border-radius-sm)}:host.st-size-sm .st-time-arrow-btn{width:34px;height:20px}:host.st-size-sm .st-time-sep{font-size:var(--st-font-lg);margin:0 2px}:host.st-size-sm .st-meridiem-btn{height:32px;font-size:var(--st-font-xs);padding:0 var(--st-space-2);border-radius:var(--st-border-radius-sm)}:host.st-size-lg .st-time-val{min-width:54px;height:50px;font-size:1.5rem;border-radius:var(--st-border-radius-lg)}:host.st-size-lg .st-time-arrow-btn{width:54px;height:28px}:host.st-size-lg .st-time-sep{font-size:1.75rem;margin:0 6px}:host.st-size-lg .st-meridiem-btn{height:50px;font-size:var(--st-font-md);padding:0 var(--st-space-4);border-radius:var(--st-border-radius-lg)}:host.st-disabled{opacity:.55;pointer-events:none}.st-time-picker-inner{display:inline-flex;align-items:center;gap:var(--st-space-1);padding:0;background:transparent;border:none;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-time-col{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--st-space-1)}.st-time-arrow-btn{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);width:44px;height:24px;border-radius:var(--st-border-radius-sm);transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-time-arrow-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-time-arrow-btn:disabled{opacity:.4;cursor:not-allowed}.st-time-val{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:42px;font-family:var(--st-font-mono);font-size:var(--st-font-lg);font-weight:var(--st-font-weight-semibold);background:transparent;border:1px solid var(--st-border);border-radius:var(--st-border-radius-md);color:var(--st-color-text-primary);outline:none;cursor:default;transition:border-color var(--st-transition-fast)}.st-time-val:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}.st-time-sep{font-weight:var(--st-font-weight-bold);color:var(--st-color-text-secondary);font-size:var(--st-font-xl);margin:0 4px}.st-meridiem-col{margin-left:var(--st-space-1)}.st-meridiem-btn{background:transparent;border:1px solid var(--st-border);color:var(--st-color-text-primary);border-radius:var(--st-border-radius-md);height:42px;font-size:var(--st-font-sm);font-weight:var(--st-font-weight-semibold);padding:0 var(--st-space-3);cursor:pointer;transition:background var(--st-transition-fast),border-color var(--st-transition-fast)}.st-meridiem-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));border-color:var(--st-color-border-strong)}.st-meridiem-btn:disabled{opacity:.4;cursor:not-allowed}\n"] }]
|
|
1845
|
+
}], ctorParameters: () => [], propDecorators: { format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1846
|
+
|
|
1847
|
+
function isSameDay(a, b) {
|
|
1848
|
+
if (!a || !b)
|
|
1849
|
+
return false;
|
|
1850
|
+
return (a.getFullYear() === b.getFullYear() &&
|
|
1851
|
+
a.getMonth() === b.getMonth() &&
|
|
1852
|
+
a.getDate() === b.getDate());
|
|
1853
|
+
}
|
|
1854
|
+
function isSameMonth(a, b) {
|
|
1855
|
+
if (!a || !b)
|
|
1856
|
+
return false;
|
|
1857
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
|
|
1858
|
+
}
|
|
1859
|
+
function isSameYear(a, b) {
|
|
1860
|
+
if (!a || !b)
|
|
1861
|
+
return false;
|
|
1862
|
+
return a.getFullYear() === b.getFullYear();
|
|
1863
|
+
}
|
|
1864
|
+
function isBeforeDay(a, b) {
|
|
1865
|
+
const aDate = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime();
|
|
1866
|
+
const bDate = new Date(b.getFullYear(), b.getMonth(), b.getDate()).getTime();
|
|
1867
|
+
return aDate < bDate;
|
|
1868
|
+
}
|
|
1869
|
+
function isAfterDay(a, b) {
|
|
1870
|
+
const aDate = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime();
|
|
1871
|
+
const bDate = new Date(b.getFullYear(), b.getMonth(), b.getDate()).getTime();
|
|
1872
|
+
return aDate > bDate;
|
|
1873
|
+
}
|
|
1874
|
+
function isWithinDayRange(date, start, end) {
|
|
1875
|
+
if (!start || !end)
|
|
1876
|
+
return false;
|
|
1877
|
+
const target = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
|
|
1878
|
+
const s = new Date(start.getFullYear(), start.getMonth(), start.getDate()).getTime();
|
|
1879
|
+
const e = new Date(end.getFullYear(), end.getMonth(), end.getDate()).getTime();
|
|
1880
|
+
const min = Math.min(s, e);
|
|
1881
|
+
const max = Math.max(s, e);
|
|
1882
|
+
return target >= min && target <= max;
|
|
1883
|
+
}
|
|
1884
|
+
function startOfDay(date) {
|
|
1885
|
+
const result = new Date(date);
|
|
1886
|
+
result.setHours(0, 0, 0, 0);
|
|
1887
|
+
return result;
|
|
1888
|
+
}
|
|
1889
|
+
function endOfDay(date) {
|
|
1890
|
+
const result = new Date(date);
|
|
1891
|
+
result.setHours(23, 59, 59, 999);
|
|
1892
|
+
return result;
|
|
1893
|
+
}
|
|
1894
|
+
function startOfMonth(date) {
|
|
1895
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
1896
|
+
}
|
|
1897
|
+
function endOfMonth(date) {
|
|
1898
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
1899
|
+
}
|
|
1900
|
+
function addDays(date, amount) {
|
|
1901
|
+
const result = new Date(date);
|
|
1902
|
+
result.setDate(result.getDate() + amount);
|
|
1903
|
+
return result;
|
|
1904
|
+
}
|
|
1905
|
+
function addMonths(date, amount) {
|
|
1906
|
+
const result = new Date(date);
|
|
1907
|
+
const targetMonth = result.getMonth() + amount;
|
|
1908
|
+
result.setMonth(targetMonth);
|
|
1909
|
+
return result;
|
|
1910
|
+
}
|
|
1911
|
+
function addYears(date, amount) {
|
|
1912
|
+
const result = new Date(date);
|
|
1913
|
+
result.setFullYear(result.getFullYear() + amount);
|
|
1914
|
+
return result;
|
|
1915
|
+
}
|
|
1916
|
+
function getDayOfWeek(date) {
|
|
1917
|
+
return (date.getDay() + 6) % 7;
|
|
1918
|
+
}
|
|
1919
|
+
function isWeekend(date) {
|
|
1920
|
+
const day = getDayOfWeek(date);
|
|
1921
|
+
return day === 5 || day === 6;
|
|
1922
|
+
}
|
|
1923
|
+
function disableWeekends(date) {
|
|
1924
|
+
return isWeekend(date);
|
|
1925
|
+
}
|
|
1926
|
+
function disablePastDates(date) {
|
|
1927
|
+
const today = startOfDay(new Date());
|
|
1928
|
+
return isBeforeDay(date, today);
|
|
1929
|
+
}
|
|
1930
|
+
function disableFutureDates(date) {
|
|
1931
|
+
const today = endOfDay(new Date());
|
|
1932
|
+
return isAfterDay(date, today);
|
|
1933
|
+
}
|
|
1934
|
+
function disableDaysOfWeek(days) {
|
|
1935
|
+
return (date) => days.includes(getDayOfWeek(date));
|
|
1936
|
+
}
|
|
1937
|
+
function disableDateRange(startDate, endDate) {
|
|
1938
|
+
return (date) => isWithinDayRange(date, startDate, endDate);
|
|
1939
|
+
}
|
|
1940
|
+
function getDaysInMonth(year, month) {
|
|
1941
|
+
return new Date(year, month + 1, 0).getDate();
|
|
1942
|
+
}
|
|
1943
|
+
function getLocaleDefaultDateFormat(locale) {
|
|
1944
|
+
try {
|
|
1945
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, {
|
|
1946
|
+
year: 'numeric',
|
|
1947
|
+
month: '2-digit',
|
|
1948
|
+
day: '2-digit'
|
|
1949
|
+
});
|
|
1950
|
+
const parts = formatter.formatToParts(new Date(2024, 11, 31));
|
|
1951
|
+
const order = parts
|
|
1952
|
+
.filter((p) => p.type === 'year' || p.type === 'month' || p.type === 'day')
|
|
1953
|
+
.map((p) => p.type);
|
|
1954
|
+
const sep = (parts.find((p) => p.type === 'literal' && p.value.trim() !== '') || { value: '/' }).value;
|
|
1955
|
+
const tokens = { year: 'YYYY', month: 'MM', day: 'DD' };
|
|
1956
|
+
return order.map((t) => tokens[t]).join(sep);
|
|
1957
|
+
}
|
|
1958
|
+
catch {
|
|
1959
|
+
return 'YYYY-MM-DD';
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
function formatMonthTitle(date, locale) {
|
|
1963
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, { month: 'long' });
|
|
1964
|
+
const str = formatter.format(date);
|
|
1965
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1966
|
+
}
|
|
1967
|
+
function getMonthNames(locale, format = 'short') {
|
|
1968
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, { month: format });
|
|
1969
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
1970
|
+
const date = new Date(2024, i, 1);
|
|
1971
|
+
const name = formatter.format(date);
|
|
1972
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
function getWeekdayNames(locale, firstDayOfWeek = 0, format = 'short') {
|
|
1976
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, { weekday: format });
|
|
1977
|
+
const daysFromMonday = Array.from({ length: 7 }, (_, i) => {
|
|
1978
|
+
const date = new Date(2024, 0, 1 + i);
|
|
1979
|
+
const name = formatter.format(date);
|
|
1980
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
1981
|
+
});
|
|
1982
|
+
const offset = ((firstDayOfWeek % 7) + 7) % 7;
|
|
1983
|
+
return [...daysFromMonday.slice(offset), ...daysFromMonday.slice(0, offset)];
|
|
1984
|
+
}
|
|
1985
|
+
function createCalendarGrid(viewDate, firstDayOfWeek = 0) {
|
|
1986
|
+
const year = viewDate.getFullYear();
|
|
1987
|
+
const month = viewDate.getMonth();
|
|
1988
|
+
const firstDayOfMonth = new Date(year, month, 1);
|
|
1989
|
+
const startingDay = (getDayOfWeek(firstDayOfMonth) - (firstDayOfWeek % 7) + 7) % 7;
|
|
1990
|
+
const startDate = new Date(year, month, 1 - startingDay);
|
|
1991
|
+
const days = [];
|
|
1992
|
+
for (let i = 0; i < 42; i++) {
|
|
1993
|
+
const current = new Date(startDate);
|
|
1994
|
+
current.setDate(startDate.getDate() + i);
|
|
1995
|
+
days.push(current);
|
|
1996
|
+
}
|
|
1997
|
+
return days;
|
|
1998
|
+
}
|
|
1999
|
+
function formatDate(date, formatStr = 'YYYY-MM-DD') {
|
|
2000
|
+
if (!date || isNaN(date.getTime()))
|
|
2001
|
+
return '';
|
|
2002
|
+
const year = date.getFullYear();
|
|
2003
|
+
const month = date.getMonth() + 1;
|
|
2004
|
+
const day = date.getDate();
|
|
2005
|
+
const hours24 = date.getHours();
|
|
2006
|
+
const hours12 = hours24 % 12 || 12;
|
|
2007
|
+
const minutes = date.getMinutes();
|
|
2008
|
+
const seconds = date.getSeconds();
|
|
2009
|
+
const isPM = hours24 >= 12;
|
|
2010
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
2011
|
+
return formatStr
|
|
2012
|
+
.replace(/YYYY/g, year.toString())
|
|
2013
|
+
.replace(/YY/g, (year % 100).toString().padStart(2, '0'))
|
|
2014
|
+
.replace(/MM/g, pad(month))
|
|
2015
|
+
.replace(/\bM\b/g, month.toString())
|
|
2016
|
+
.replace(/DD/g, pad(day))
|
|
2017
|
+
.replace(/\bD\b/g, day.toString())
|
|
2018
|
+
.replace(/HH/g, pad(hours24))
|
|
2019
|
+
.replace(/\bH\b/g, hours24.toString())
|
|
2020
|
+
.replace(/hh/g, pad(hours12))
|
|
2021
|
+
.replace(/\bh\b/g, hours12.toString())
|
|
2022
|
+
.replace(/mm/g, pad(minutes))
|
|
2023
|
+
.replace(/\bm\b/g, minutes.toString())
|
|
2024
|
+
.replace(/ss/g, pad(seconds))
|
|
2025
|
+
.replace(/\bs\b/g, seconds.toString())
|
|
2026
|
+
.replace(/A/g, isPM ? 'PM' : 'AM')
|
|
2027
|
+
.replace(/a/g, isPM ? 'pm' : 'am');
|
|
2028
|
+
}
|
|
2029
|
+
function parseDate(str, formatStr = 'YYYY-MM-DD') {
|
|
2030
|
+
if (!str || !str.trim())
|
|
2031
|
+
return null;
|
|
2032
|
+
const trimmed = str.trim();
|
|
2033
|
+
const tokenMap = {
|
|
2034
|
+
YYYY: '(?<year>\\d{4})',
|
|
2035
|
+
YY: '(?<shortYear>\\d{2})',
|
|
2036
|
+
MM: '(?<month>\\d{1,2})',
|
|
2037
|
+
M: '(?<month>\\d{1,2})',
|
|
2038
|
+
DD: '(?<day>\\d{1,2})',
|
|
2039
|
+
D: '(?<day>\\d{1,2})',
|
|
2040
|
+
HH: '(?<hours24>\\d{1,2})',
|
|
2041
|
+
H: '(?<hours24>\\d{1,2})',
|
|
2042
|
+
hh: '(?<hours12>\\d{1,2})',
|
|
2043
|
+
h: '(?<hours12>\\d{1,2})',
|
|
2044
|
+
mm: '(?<minutes>\\d{1,2})',
|
|
2045
|
+
m: '(?<minutes>\\d{1,2})',
|
|
2046
|
+
ss: '(?<seconds>\\d{1,2})',
|
|
2047
|
+
s: '(?<seconds>\\d{1,2})',
|
|
2048
|
+
A: '(?<meridiem>AM|PM|am|pm)',
|
|
2049
|
+
a: '(?<meridiem>AM|PM|am|pm)'
|
|
2050
|
+
};
|
|
2051
|
+
const tokenPattern = /YYYY|YY|MM|\bM\b|DD|\bD\b|HH|\bH\b|hh|\bh\b|mm|\bm\b|ss|\bs\b|A|a/g;
|
|
2052
|
+
let lastIndex = 0;
|
|
2053
|
+
let regexSource = '^';
|
|
2054
|
+
let match;
|
|
2055
|
+
while ((match = tokenPattern.exec(formatStr)) !== null) {
|
|
2056
|
+
const literal = formatStr.slice(lastIndex, match.index);
|
|
2057
|
+
regexSource += literal.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2058
|
+
const token = match[0];
|
|
2059
|
+
regexSource += tokenMap[token] || token;
|
|
2060
|
+
lastIndex = tokenPattern.lastIndex;
|
|
2061
|
+
}
|
|
2062
|
+
const trailingLiteral = formatStr.slice(lastIndex);
|
|
2063
|
+
regexSource += trailingLiteral.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '$';
|
|
2064
|
+
const reg = new RegExp(regexSource, 'i');
|
|
2065
|
+
const resultMatch = reg.exec(trimmed);
|
|
2066
|
+
if (!resultMatch || !resultMatch.groups) {
|
|
2067
|
+
const fallback = new Date(trimmed);
|
|
2068
|
+
return isNaN(fallback.getTime()) ? null : fallback;
|
|
2069
|
+
}
|
|
2070
|
+
const groups = resultMatch.groups;
|
|
2071
|
+
const year = groups['year']
|
|
2072
|
+
? parseInt(groups['year'], 10)
|
|
2073
|
+
: groups['shortYear']
|
|
2074
|
+
? 2000 + parseInt(groups['shortYear'], 10)
|
|
2075
|
+
: new Date().getFullYear();
|
|
2076
|
+
const month = groups['month'] ? parseInt(groups['month'], 10) - 1 : 0;
|
|
2077
|
+
const day = groups['day'] ? parseInt(groups['day'], 10) : 1;
|
|
2078
|
+
let hours = 0;
|
|
2079
|
+
if (groups['hours24']) {
|
|
2080
|
+
hours = parseInt(groups['hours24'], 10);
|
|
2081
|
+
}
|
|
2082
|
+
else if (groups['hours12']) {
|
|
2083
|
+
hours = parseInt(groups['hours12'], 10);
|
|
2084
|
+
const meridiem = (groups['meridiem'] || '').toUpperCase();
|
|
2085
|
+
if (meridiem === 'PM' && hours < 12)
|
|
2086
|
+
hours += 12;
|
|
2087
|
+
if (meridiem === 'AM' && hours === 12)
|
|
2088
|
+
hours = 0;
|
|
2089
|
+
}
|
|
2090
|
+
const minutes = groups['minutes'] ? parseInt(groups['minutes'], 10) : 0;
|
|
2091
|
+
const seconds = groups['seconds'] ? parseInt(groups['seconds'], 10) : 0;
|
|
2092
|
+
const result = new Date(year, month, day, hours, minutes, seconds);
|
|
2093
|
+
if (result.getFullYear() !== year ||
|
|
2094
|
+
result.getMonth() !== month ||
|
|
2095
|
+
result.getDate() !== day) {
|
|
2096
|
+
return null;
|
|
2097
|
+
}
|
|
2098
|
+
return result;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
class StrataCalendarComponent {
|
|
2102
|
+
mode = input('single', /* @ts-ignore */
|
|
2103
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
2104
|
+
size = input('md', /* @ts-ignore */
|
|
2105
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2106
|
+
locale = input(undefined, /* @ts-ignore */
|
|
2107
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
2108
|
+
value = model(null, /* @ts-ignore */
|
|
2109
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2110
|
+
rangeValue = model(null, /* @ts-ignore */
|
|
2111
|
+
...(ngDevMode ? [{ debugName: "rangeValue" }] : /* istanbul ignore next */ []));
|
|
2112
|
+
viewDate = model(new Date(), /* @ts-ignore */
|
|
2113
|
+
...(ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []));
|
|
2114
|
+
minDate = input(null, /* @ts-ignore */
|
|
2115
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
2116
|
+
maxDate = input(null, /* @ts-ignore */
|
|
2117
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
2118
|
+
disabledDates = input(null, /* @ts-ignore */
|
|
2119
|
+
...(ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
2120
|
+
firstDayOfWeek = input(0, /* @ts-ignore */
|
|
2121
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
2122
|
+
showAdjacentMonths = input(true, /* @ts-ignore */
|
|
2123
|
+
...(ngDevMode ? [{ debugName: "showAdjacentMonths" }] : /* istanbul ignore next */ []));
|
|
2124
|
+
disabled = input(false, /* @ts-ignore */
|
|
2125
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2126
|
+
dateSelected = output();
|
|
2127
|
+
rangeSelected = output();
|
|
2128
|
+
view = signal('days', /* @ts-ignore */
|
|
2129
|
+
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
2130
|
+
hoverDate = signal(null, /* @ts-ignore */
|
|
2131
|
+
...(ngDevMode ? [{ debugName: "hoverDate" }] : /* istanbul ignore next */ []));
|
|
2132
|
+
focusedDate = signal(new Date(), /* @ts-ignore */
|
|
2133
|
+
...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
|
|
2134
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
2135
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
2136
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
2137
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
2138
|
+
onChange = () => undefined;
|
|
2139
|
+
onTouched = () => undefined;
|
|
2140
|
+
ngOnInit() {
|
|
2141
|
+
if (this.mode() === 'single') {
|
|
2142
|
+
const v = this.value();
|
|
2143
|
+
if (v && !isNaN(v.getTime())) {
|
|
2144
|
+
this.viewDate.set(new Date(v));
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
weekdays = computed(() => {
|
|
2149
|
+
return getWeekdayNames(this.locale(), this.firstDayOfWeek(), 'short');
|
|
2150
|
+
}, /* @ts-ignore */
|
|
2151
|
+
...(ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []));
|
|
2152
|
+
currentMonthName = computed(() => {
|
|
2153
|
+
return formatMonthTitle(this.viewDate(), this.locale());
|
|
2154
|
+
}, /* @ts-ignore */
|
|
2155
|
+
...(ngDevMode ? [{ debugName: "currentMonthName" }] : /* istanbul ignore next */ []));
|
|
2156
|
+
currentYear = computed(() => {
|
|
2157
|
+
return this.viewDate().getFullYear();
|
|
2158
|
+
}, /* @ts-ignore */
|
|
2159
|
+
...(ngDevMode ? [{ debugName: "currentYear" }] : /* istanbul ignore next */ []));
|
|
2160
|
+
yearRangeStart = computed(() => {
|
|
2161
|
+
const y = this.viewDate().getFullYear();
|
|
2162
|
+
return Math.floor(y / 12) * 12;
|
|
2163
|
+
}, /* @ts-ignore */
|
|
2164
|
+
...(ngDevMode ? [{ debugName: "yearRangeStart" }] : /* istanbul ignore next */ []));
|
|
2165
|
+
yearsList = computed(() => {
|
|
2166
|
+
const start = this.yearRangeStart();
|
|
2167
|
+
const list = [];
|
|
2168
|
+
for (let i = 0; i < 12; i++) {
|
|
2169
|
+
list.push(start + i);
|
|
2170
|
+
}
|
|
2171
|
+
return list;
|
|
2172
|
+
}, /* @ts-ignore */
|
|
2173
|
+
...(ngDevMode ? [{ debugName: "yearsList" }] : /* istanbul ignore next */ []));
|
|
2174
|
+
monthsList = computed(() => {
|
|
2175
|
+
return getMonthNames(this.locale(), 'short');
|
|
2176
|
+
}, /* @ts-ignore */
|
|
2177
|
+
...(ngDevMode ? [{ debugName: "monthsList" }] : /* istanbul ignore next */ []));
|
|
2178
|
+
calendarGrid = computed(() => {
|
|
2179
|
+
const vDate = this.viewDate();
|
|
2180
|
+
const rawGrid = createCalendarGrid(vDate, this.firstDayOfWeek());
|
|
2181
|
+
const today = new Date();
|
|
2182
|
+
const min = this.minDate();
|
|
2183
|
+
const max = this.maxDate();
|
|
2184
|
+
const disabledProp = this.disabledDates();
|
|
2185
|
+
const selectedVal = this.value();
|
|
2186
|
+
const range = this.rangeValue();
|
|
2187
|
+
const hover = this.hoverDate();
|
|
2188
|
+
const isRangeMode = this.mode() === 'range';
|
|
2189
|
+
return rawGrid.map((d) => {
|
|
2190
|
+
const isCurrentMonth = isSameMonth(d, vDate);
|
|
2191
|
+
const isToday = isSameDay(d, today);
|
|
2192
|
+
let isDisabled = false;
|
|
2193
|
+
if (min && isBeforeDay(d, min)) {
|
|
2194
|
+
isDisabled = true;
|
|
2195
|
+
}
|
|
2196
|
+
if (max && isAfterDay(d, max)) {
|
|
2197
|
+
isDisabled = true;
|
|
2198
|
+
}
|
|
2199
|
+
if (disabledProp) {
|
|
2200
|
+
if (typeof disabledProp === 'function') {
|
|
2201
|
+
isDisabled = isDisabled || disabledProp(d);
|
|
2202
|
+
}
|
|
2203
|
+
else if (Array.isArray(disabledProp)) {
|
|
2204
|
+
isDisabled = isDisabled || disabledProp.some((disabledD) => isSameDay(disabledD, d));
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
let isSelected = false;
|
|
2208
|
+
let isRangeStart = false;
|
|
2209
|
+
let isRangeEnd = false;
|
|
2210
|
+
let isInRange = false;
|
|
2211
|
+
let isRangeHover = false;
|
|
2212
|
+
if (!isRangeMode) {
|
|
2213
|
+
isSelected = isSameDay(d, selectedVal);
|
|
2214
|
+
}
|
|
2215
|
+
else {
|
|
2216
|
+
const rStart = range?.start;
|
|
2217
|
+
const rEnd = range?.end;
|
|
2218
|
+
if (rStart && rEnd) {
|
|
2219
|
+
isRangeStart = isSameDay(d, rStart);
|
|
2220
|
+
isRangeEnd = isSameDay(d, rEnd);
|
|
2221
|
+
isInRange = isWithinDayRange(d, rStart, rEnd) && !isRangeStart && !isRangeEnd;
|
|
2222
|
+
isSelected = isRangeStart || isRangeEnd;
|
|
2223
|
+
}
|
|
2224
|
+
else if (rStart && !rEnd) {
|
|
2225
|
+
if (!hover || isSameDay(rStart, hover)) {
|
|
2226
|
+
isRangeStart = isSameDay(d, rStart);
|
|
2227
|
+
isRangeEnd = isSameDay(d, rStart);
|
|
2228
|
+
isSelected = isRangeStart;
|
|
2229
|
+
}
|
|
2230
|
+
else {
|
|
2231
|
+
const isHoverBefore = isBeforeDay(hover, rStart);
|
|
2232
|
+
const actualStart = isHoverBefore ? hover : rStart;
|
|
2233
|
+
const actualEnd = isHoverBefore ? rStart : hover;
|
|
2234
|
+
isRangeStart = isSameDay(d, actualStart);
|
|
2235
|
+
isRangeEnd = isSameDay(d, actualEnd);
|
|
2236
|
+
isInRange = isWithinDayRange(d, actualStart, actualEnd) && !isRangeStart && !isRangeEnd;
|
|
2237
|
+
isRangeHover = isInRange;
|
|
2238
|
+
isSelected = isRangeStart || isRangeEnd;
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
return {
|
|
2243
|
+
date: d,
|
|
2244
|
+
dayNumber: d.getDate(),
|
|
2245
|
+
isCurrentMonth,
|
|
2246
|
+
isToday,
|
|
2247
|
+
isSelected,
|
|
2248
|
+
isDisabled,
|
|
2249
|
+
isRangeStart,
|
|
2250
|
+
isRangeEnd,
|
|
2251
|
+
isInRange,
|
|
2252
|
+
isRangeHover
|
|
2253
|
+
};
|
|
2254
|
+
});
|
|
2255
|
+
}, /* @ts-ignore */
|
|
2256
|
+
...(ngDevMode ? [{ debugName: "calendarGrid" }] : /* istanbul ignore next */ []));
|
|
2257
|
+
onPrevClick() {
|
|
2258
|
+
if (this.effectiveDisabled())
|
|
2259
|
+
return;
|
|
2260
|
+
const current = this.viewDate();
|
|
2261
|
+
const v = this.view();
|
|
2262
|
+
if (v === 'days') {
|
|
2263
|
+
this.viewDate.set(addMonths(current, -1));
|
|
2264
|
+
}
|
|
2265
|
+
else if (v === 'months') {
|
|
2266
|
+
this.viewDate.set(addYears(current, -1));
|
|
2267
|
+
}
|
|
2268
|
+
else if (v === 'years') {
|
|
2269
|
+
this.viewDate.set(addYears(current, -12));
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
onNextClick() {
|
|
2273
|
+
if (this.effectiveDisabled())
|
|
2274
|
+
return;
|
|
2275
|
+
const current = this.viewDate();
|
|
2276
|
+
const v = this.view();
|
|
2277
|
+
if (v === 'days') {
|
|
2278
|
+
this.viewDate.set(addMonths(current, 1));
|
|
2279
|
+
}
|
|
2280
|
+
else if (v === 'months') {
|
|
2281
|
+
this.viewDate.set(addYears(current, 1));
|
|
2282
|
+
}
|
|
2283
|
+
else if (v === 'years') {
|
|
2284
|
+
this.viewDate.set(addYears(current, 12));
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
toggleView() {
|
|
2288
|
+
if (this.effectiveDisabled())
|
|
2289
|
+
return;
|
|
2290
|
+
const v = this.view();
|
|
2291
|
+
if (v === 'days') {
|
|
2292
|
+
this.view.set('months');
|
|
2293
|
+
}
|
|
2294
|
+
else if (v === 'months') {
|
|
2295
|
+
this.view.set('years');
|
|
2296
|
+
}
|
|
2297
|
+
else {
|
|
2298
|
+
this.view.set('days');
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
selectMonth(monthIndex) {
|
|
2302
|
+
if (this.effectiveDisabled())
|
|
2303
|
+
return;
|
|
2304
|
+
const current = this.viewDate();
|
|
2305
|
+
const next = new Date(current.getFullYear(), monthIndex, 1);
|
|
2306
|
+
this.viewDate.set(next);
|
|
2307
|
+
this.view.set('days');
|
|
2308
|
+
}
|
|
2309
|
+
selectYear(year) {
|
|
2310
|
+
if (this.effectiveDisabled())
|
|
2311
|
+
return;
|
|
2312
|
+
const current = this.viewDate();
|
|
2313
|
+
const next = new Date(year, current.getMonth(), 1);
|
|
2314
|
+
this.viewDate.set(next);
|
|
2315
|
+
this.view.set('months');
|
|
2316
|
+
}
|
|
2317
|
+
onDayClick(cell) {
|
|
2318
|
+
if (this.effectiveDisabled() || cell.isDisabled)
|
|
2319
|
+
return;
|
|
2320
|
+
if (!cell.isCurrentMonth) {
|
|
2321
|
+
this.viewDate.set(cell.date);
|
|
2322
|
+
}
|
|
2323
|
+
if (this.mode() === 'single') {
|
|
2324
|
+
const selected = new Date(cell.date);
|
|
2325
|
+
this.value.set(selected);
|
|
2326
|
+
this.dateSelected.emit(selected);
|
|
2327
|
+
this.onChange(selected);
|
|
2328
|
+
this.onTouched();
|
|
2329
|
+
}
|
|
2330
|
+
else {
|
|
2331
|
+
const currentRange = this.rangeValue();
|
|
2332
|
+
if (!currentRange || !currentRange.start || (currentRange.start && currentRange.end)) {
|
|
2333
|
+
const nextRange = { start: new Date(cell.date), end: null };
|
|
2334
|
+
this.rangeValue.set(nextRange);
|
|
2335
|
+
this.rangeSelected.emit(nextRange);
|
|
2336
|
+
this.onChange(nextRange);
|
|
2337
|
+
}
|
|
2338
|
+
else {
|
|
2339
|
+
let start = currentRange.start;
|
|
2340
|
+
let end = new Date(cell.date);
|
|
2341
|
+
if (isBeforeDay(end, start)) {
|
|
2342
|
+
const temp = start;
|
|
2343
|
+
start = end;
|
|
2344
|
+
end = temp;
|
|
2345
|
+
}
|
|
2346
|
+
const nextRange = { start, end };
|
|
2347
|
+
this.rangeValue.set(nextRange);
|
|
2348
|
+
this.rangeSelected.emit(nextRange);
|
|
2349
|
+
this.onChange(nextRange);
|
|
2350
|
+
this.onTouched();
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
onDayHover(cell) {
|
|
2355
|
+
if (this.mode() === 'range' && this.rangeValue()?.start && !this.rangeValue()?.end) {
|
|
2356
|
+
this.hoverDate.set(cell.date);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
onDayKeyDown(event, cell) {
|
|
2360
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
2361
|
+
event.preventDefault();
|
|
2362
|
+
this.onDayClick(cell);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
writeValue(val) {
|
|
2366
|
+
if (this.mode() === 'single') {
|
|
2367
|
+
const d = val instanceof Date ? val : null;
|
|
2368
|
+
this.value.set(d);
|
|
2369
|
+
if (d) {
|
|
2370
|
+
this.viewDate.set(new Date(d));
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
else {
|
|
2374
|
+
const range = val && typeof val === 'object' && 'start' in val ? val : null;
|
|
2375
|
+
this.rangeValue.set(range);
|
|
2376
|
+
if (range?.start) {
|
|
2377
|
+
this.viewDate.set(new Date(range.start));
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
registerOnChange(fn) {
|
|
2382
|
+
this.onChange = fn;
|
|
2383
|
+
}
|
|
2384
|
+
registerOnTouched(fn) {
|
|
2385
|
+
this.onTouched = fn;
|
|
2386
|
+
}
|
|
2387
|
+
setDisabledState(isDisabled) {
|
|
2388
|
+
this.cvaDisabled.set(isDisabled);
|
|
2389
|
+
}
|
|
2390
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2391
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataCalendarComponent, isStandalone: true, selector: "st-calendar", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rangeValue: { classPropertyName: "rangeValue", publicName: "rangeValue", isSignal: true, isRequired: false, transformFunction: null }, viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, showAdjacentMonths: { classPropertyName: "showAdjacentMonths", publicName: "showAdjacentMonths", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", rangeValue: "rangeValueChange", viewDate: "viewDateChange", dateSelected: "dateSelected", rangeSelected: "rangeSelected" }, host: { properties: { "class.st-calendar": "true", "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null" } }, providers: [
|
|
2392
|
+
{
|
|
2393
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2394
|
+
useExisting: forwardRef(() => StrataCalendarComponent),
|
|
2395
|
+
multi: true
|
|
2396
|
+
}
|
|
2397
|
+
], ngImport: i0, template: "<div class=\"st-calendar-container\">\n <div class=\"st-calendar-header\">\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onPrevClick()\"\n aria-label=\"Previous\"\n >\n <st-icon name=\"arrow-left\" size=\"sm\"></st-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-title-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleView()\"\n >\n @if (view() === 'days') {\n {{ currentMonthName() }} {{ currentYear() }}\n } @else if (view() === 'months') {\n {{ currentYear() }}\n } @else {\n {{ yearRangeStart() }} - {{ yearRangeStart() + 11 }}\n }\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNextClick()\"\n aria-label=\"Next\"\n >\n <st-icon name=\"arrow-right\" size=\"sm\"></st-icon>\n </button>\n </div>\n\n <div class=\"st-calendar-body\">\n @if (view() === 'days') {\n <div class=\"st-calendar-weekdays\" role=\"row\">\n @for (day of weekdays(); track day) {\n <span class=\"st-calendar-weekday\" role=\"columnheader\">{{ day }}</span>\n }\n </div>\n\n <div class=\"st-calendar-days-grid\" role=\"grid\">\n @for (cell of calendarGrid(); track cell.date.toISOString()) {\n <button\n type=\"button\"\n class=\"st-calendar-day\"\n [class.st-adjacent]=\"!cell.isCurrentMonth\"\n [class.st-today]=\"cell.isToday\"\n [class.st-selected]=\"cell.isSelected\"\n [class.st-range-start]=\"cell.isRangeStart\"\n [class.st-range-end]=\"cell.isRangeEnd\"\n [class.st-in-range]=\"cell.isInRange\"\n [class.st-range-hover]=\"cell.isRangeHover\"\n [disabled]=\"cell.isDisabled || effectiveDisabled()\"\n [attr.aria-selected]=\"cell.isSelected\"\n [attr.aria-disabled]=\"cell.isDisabled\"\n (click)=\"onDayClick(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n (keydown)=\"onDayKeyDown($event, cell)\"\n >\n <span class=\"st-day-content\">{{ cell.dayNumber }}</span>\n </button>\n }\n </div>\n } @else if (view() === 'months') {\n <div class=\"st-calendar-grid-months\">\n @for (m of monthsList(); track m; let i = $index) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getMonth() === i\"\n (click)=\"selectMonth(i)\"\n >\n {{ m }}\n </button>\n }\n </div>\n } @else {\n <div class=\"st-calendar-grid-years\">\n @for (y of yearsList(); track y) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getFullYear() === y\"\n (click)=\"selectYear(y)\"\n >\n {{ y }}\n </button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{--st-cal-size: 36px;display:inline-block;box-sizing:border-box}:host.st-size-sm{--st-cal-size: 30px}:host.st-size-lg{--st-cal-size: 42px}:host.st-disabled{opacity:.55;pointer-events:none}.st-calendar-container{display:flex;flex-direction:column;background:transparent;width:calc(var(--st-cal-size) * 7);box-sizing:border-box;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-calendar-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--st-space-2)}.st-cal-title-btn{background:transparent;border:none;font:inherit;font-weight:var(--st-font-weight-semibold);font-size:var(--st-font-md);color:var(--st-color-text-primary);padding:var(--st-space-1) var(--st-space-2);border-radius:var(--st-border-radius-sm);cursor:pointer;transition:background var(--st-transition-fast)}.st-cal-title-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-cal-title-btn:disabled{opacity:.5;cursor:not-allowed}.st-cal-nav-btn{background:transparent;border:none;width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--st-border-radius-sm);color:var(--st-color-text-secondary);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-cal-nav-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-cal-nav-btn:disabled{opacity:.3;cursor:not-allowed}.st-calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;margin-bottom:var(--st-space-1)}.st-calendar-weekday{font-size:.75rem;font-weight:var(--st-font-weight-semibold);text-transform:uppercase;letter-spacing:.05em;color:var(--st-color-text-tertiary);height:24px;display:flex;align-items:center;justify-content:center}.st-calendar-days-grid{display:grid;grid-template-columns:repeat(7,1fr);row-gap:2px}.st-calendar-day{appearance:none;background:transparent;border:none;border-radius:var(--st-border-radius-md);height:var(--st-cal-size);width:100%;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative;outline:none;padding:0;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-day:hover:not(:disabled):not(.st-selected):not(.st-range-start):not(.st-range-end){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-day:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);z-index:2}.st-calendar-day.st-adjacent{color:var(--st-color-text-tertiary);opacity:.45}.st-calendar-day.st-today:after{content:\"\";position:absolute;bottom:3px;width:4px;height:4px;border-radius:var(--st-border-radius-full);background:var(--st-color-accent-default)}.st-calendar-day.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md)}.st-calendar-day.st-range-start{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md) 0 0 var(--st-border-radius-md)}.st-calendar-day.st-range-end{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:0 var(--st-border-radius-md) var(--st-border-radius-md) 0}.st-calendar-day.st-range-start.st-range-end{border-radius:var(--st-border-radius-md)}.st-calendar-day.st-in-range,.st-calendar-day.st-range-hover{background:var(--st-color-accent-subtle);color:var(--st-color-accent-text, var(--st-color-text-primary));border-radius:0}.st-calendar-day:disabled{opacity:.3;cursor:not-allowed}.st-calendar-grid-months,.st-calendar-grid-years{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--st-space-2);padding:var(--st-space-2) 0}.st-calendar-choice-btn{background:transparent;border:none;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);height:40px;border-radius:var(--st-border-radius-md);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-choice-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-choice-btn.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }] });
|
|
2398
|
+
}
|
|
2399
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataCalendarComponent, decorators: [{
|
|
2400
|
+
type: Component,
|
|
2401
|
+
args: [{ selector: 'st-calendar', imports: [
|
|
2402
|
+
CommonModule,
|
|
2403
|
+
StrataIconComponent
|
|
2404
|
+
], providers: [
|
|
2405
|
+
{
|
|
2406
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2407
|
+
useExisting: forwardRef(() => StrataCalendarComponent),
|
|
2408
|
+
multi: true
|
|
2409
|
+
}
|
|
2410
|
+
], host: {
|
|
2411
|
+
'[class.st-calendar]': 'true',
|
|
2412
|
+
'[class.st-size-sm]': 'size() === "sm"',
|
|
2413
|
+
'[class.st-size-md]': 'size() === "md"',
|
|
2414
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
2415
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null'
|
|
2416
|
+
}, template: "<div class=\"st-calendar-container\">\n <div class=\"st-calendar-header\">\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onPrevClick()\"\n aria-label=\"Previous\"\n >\n <st-icon name=\"arrow-left\" size=\"sm\"></st-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-title-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleView()\"\n >\n @if (view() === 'days') {\n {{ currentMonthName() }} {{ currentYear() }}\n } @else if (view() === 'months') {\n {{ currentYear() }}\n } @else {\n {{ yearRangeStart() }} - {{ yearRangeStart() + 11 }}\n }\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNextClick()\"\n aria-label=\"Next\"\n >\n <st-icon name=\"arrow-right\" size=\"sm\"></st-icon>\n </button>\n </div>\n\n <div class=\"st-calendar-body\">\n @if (view() === 'days') {\n <div class=\"st-calendar-weekdays\" role=\"row\">\n @for (day of weekdays(); track day) {\n <span class=\"st-calendar-weekday\" role=\"columnheader\">{{ day }}</span>\n }\n </div>\n\n <div class=\"st-calendar-days-grid\" role=\"grid\">\n @for (cell of calendarGrid(); track cell.date.toISOString()) {\n <button\n type=\"button\"\n class=\"st-calendar-day\"\n [class.st-adjacent]=\"!cell.isCurrentMonth\"\n [class.st-today]=\"cell.isToday\"\n [class.st-selected]=\"cell.isSelected\"\n [class.st-range-start]=\"cell.isRangeStart\"\n [class.st-range-end]=\"cell.isRangeEnd\"\n [class.st-in-range]=\"cell.isInRange\"\n [class.st-range-hover]=\"cell.isRangeHover\"\n [disabled]=\"cell.isDisabled || effectiveDisabled()\"\n [attr.aria-selected]=\"cell.isSelected\"\n [attr.aria-disabled]=\"cell.isDisabled\"\n (click)=\"onDayClick(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n (keydown)=\"onDayKeyDown($event, cell)\"\n >\n <span class=\"st-day-content\">{{ cell.dayNumber }}</span>\n </button>\n }\n </div>\n } @else if (view() === 'months') {\n <div class=\"st-calendar-grid-months\">\n @for (m of monthsList(); track m; let i = $index) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getMonth() === i\"\n (click)=\"selectMonth(i)\"\n >\n {{ m }}\n </button>\n }\n </div>\n } @else {\n <div class=\"st-calendar-grid-years\">\n @for (y of yearsList(); track y) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getFullYear() === y\"\n (click)=\"selectYear(y)\"\n >\n {{ y }}\n </button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{--st-cal-size: 36px;display:inline-block;box-sizing:border-box}:host.st-size-sm{--st-cal-size: 30px}:host.st-size-lg{--st-cal-size: 42px}:host.st-disabled{opacity:.55;pointer-events:none}.st-calendar-container{display:flex;flex-direction:column;background:transparent;width:calc(var(--st-cal-size) * 7);box-sizing:border-box;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-calendar-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--st-space-2)}.st-cal-title-btn{background:transparent;border:none;font:inherit;font-weight:var(--st-font-weight-semibold);font-size:var(--st-font-md);color:var(--st-color-text-primary);padding:var(--st-space-1) var(--st-space-2);border-radius:var(--st-border-radius-sm);cursor:pointer;transition:background var(--st-transition-fast)}.st-cal-title-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-cal-title-btn:disabled{opacity:.5;cursor:not-allowed}.st-cal-nav-btn{background:transparent;border:none;width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--st-border-radius-sm);color:var(--st-color-text-secondary);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-cal-nav-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-cal-nav-btn:disabled{opacity:.3;cursor:not-allowed}.st-calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;margin-bottom:var(--st-space-1)}.st-calendar-weekday{font-size:.75rem;font-weight:var(--st-font-weight-semibold);text-transform:uppercase;letter-spacing:.05em;color:var(--st-color-text-tertiary);height:24px;display:flex;align-items:center;justify-content:center}.st-calendar-days-grid{display:grid;grid-template-columns:repeat(7,1fr);row-gap:2px}.st-calendar-day{appearance:none;background:transparent;border:none;border-radius:var(--st-border-radius-md);height:var(--st-cal-size);width:100%;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative;outline:none;padding:0;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-day:hover:not(:disabled):not(.st-selected):not(.st-range-start):not(.st-range-end){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-day:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);z-index:2}.st-calendar-day.st-adjacent{color:var(--st-color-text-tertiary);opacity:.45}.st-calendar-day.st-today:after{content:\"\";position:absolute;bottom:3px;width:4px;height:4px;border-radius:var(--st-border-radius-full);background:var(--st-color-accent-default)}.st-calendar-day.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md)}.st-calendar-day.st-range-start{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md) 0 0 var(--st-border-radius-md)}.st-calendar-day.st-range-end{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:0 var(--st-border-radius-md) var(--st-border-radius-md) 0}.st-calendar-day.st-range-start.st-range-end{border-radius:var(--st-border-radius-md)}.st-calendar-day.st-in-range,.st-calendar-day.st-range-hover{background:var(--st-color-accent-subtle);color:var(--st-color-accent-text, var(--st-color-text-primary));border-radius:0}.st-calendar-day:disabled{opacity:.3;cursor:not-allowed}.st-calendar-grid-months,.st-calendar-grid-years{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--st-space-2);padding:var(--st-space-2) 0}.st-calendar-choice-btn{background:transparent;border:none;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);height:40px;border-radius:var(--st-border-radius-md);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-choice-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-choice-btn.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold)}\n"] }]
|
|
2417
|
+
}], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], rangeValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "rangeValue", required: false }] }, { type: i0.Output, args: ["rangeValueChange"] }], viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: false }] }, { type: i0.Output, args: ["viewDateChange"] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], showAdjacentMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAdjacentMonths", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dateSelected: [{ type: i0.Output, args: ["dateSelected"] }], rangeSelected: [{ type: i0.Output, args: ["rangeSelected"] }] } });
|
|
2418
|
+
|
|
2419
|
+
let nextUniqueDatePickerId = 0;
|
|
2420
|
+
class StrataDatePickerComponent {
|
|
2421
|
+
defaultId = `st-datepicker-${nextUniqueDatePickerId++}`;
|
|
2422
|
+
label = input(undefined, /* @ts-ignore */
|
|
2423
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2424
|
+
id = input(undefined, /* @ts-ignore */
|
|
2425
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2426
|
+
name = input(undefined, /* @ts-ignore */
|
|
2427
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2428
|
+
placeholder = input('Select date', /* @ts-ignore */
|
|
2429
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2430
|
+
format = input(undefined, /* @ts-ignore */
|
|
2431
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
2432
|
+
size = input('md', /* @ts-ignore */
|
|
2433
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2434
|
+
placement = input('bottom-start', /* @ts-ignore */
|
|
2435
|
+
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
2436
|
+
locale = input(undefined, /* @ts-ignore */
|
|
2437
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
2438
|
+
calendarSize = computed(() => (this.size() === 'sm' ? 'sm' : 'md'), /* @ts-ignore */
|
|
2439
|
+
...(ngDevMode ? [{ debugName: "calendarSize" }] : /* istanbul ignore next */ []));
|
|
2440
|
+
clearable = input(true, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2441
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2442
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2443
|
+
fullWidth = input(false, { ...(ngDevMode ? { debugName: "fullWidth" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2444
|
+
showTime = input(false, { ...(ngDevMode ? { debugName: "showTime" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2445
|
+
timeFormat = input('24h', /* @ts-ignore */
|
|
2446
|
+
...(ngDevMode ? [{ debugName: "timeFormat" }] : /* istanbul ignore next */ []));
|
|
2447
|
+
showSeconds = input(false, { ...(ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2448
|
+
minuteStep = input(1, /* @ts-ignore */
|
|
2449
|
+
...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
|
|
2450
|
+
state = input(undefined, /* @ts-ignore */
|
|
2451
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
2452
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2453
|
+
message = input(undefined, /* @ts-ignore */
|
|
2454
|
+
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
2455
|
+
colorMessage = input(true, { ...(ngDevMode ? { debugName: "colorMessage" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2456
|
+
minDate = input(null, /* @ts-ignore */
|
|
2457
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
2458
|
+
maxDate = input(null, /* @ts-ignore */
|
|
2459
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
2460
|
+
disabledDates = input(null, /* @ts-ignore */
|
|
2461
|
+
...(ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
2462
|
+
firstDayOfWeek = input(0, /* @ts-ignore */
|
|
2463
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
2464
|
+
value = model(null, /* @ts-ignore */
|
|
2465
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2466
|
+
dateSelected = output();
|
|
2467
|
+
open = signal(false, /* @ts-ignore */
|
|
2468
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
2469
|
+
textInputValue = signal('', /* @ts-ignore */
|
|
2470
|
+
...(ngDevMode ? [{ debugName: "textInputValue" }] : /* istanbul ignore next */ []));
|
|
2471
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
2472
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
2473
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
2474
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
2475
|
+
effectiveId = computed(() => this.id() ?? this.name() ?? this.defaultId, /* @ts-ignore */
|
|
2476
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
2477
|
+
effectiveState = computed(() => {
|
|
2478
|
+
if (this.error()) {
|
|
2479
|
+
return 'error';
|
|
2480
|
+
}
|
|
2481
|
+
return this.state() ?? 'default';
|
|
2482
|
+
}, /* @ts-ignore */
|
|
2483
|
+
...(ngDevMode ? [{ debugName: "effectiveState" }] : /* istanbul ignore next */ []));
|
|
2484
|
+
isMessageError = computed(() => this.effectiveState() === 'error' && this.colorMessage(), /* @ts-ignore */
|
|
2485
|
+
...(ngDevMode ? [{ debugName: "isMessageError" }] : /* istanbul ignore next */ []));
|
|
2486
|
+
isMessageSuccess = computed(() => this.effectiveState() === 'success' && this.colorMessage(), /* @ts-ignore */
|
|
2487
|
+
...(ngDevMode ? [{ debugName: "isMessageSuccess" }] : /* istanbul ignore next */ []));
|
|
2488
|
+
isMessageWarning = computed(() => this.effectiveState() === 'warning' && this.colorMessage(), /* @ts-ignore */
|
|
2489
|
+
...(ngDevMode ? [{ debugName: "isMessageWarning" }] : /* istanbul ignore next */ []));
|
|
2490
|
+
onChange = () => undefined;
|
|
2491
|
+
onTouched = () => undefined;
|
|
2492
|
+
overlayDirective = viewChild(StrataOverlayDirective, /* @ts-ignore */
|
|
2493
|
+
...(ngDevMode ? [{ debugName: "overlayDirective" }] : /* istanbul ignore next */ []));
|
|
2494
|
+
elementRef = inject(ElementRef);
|
|
2495
|
+
renderer = inject(Renderer2);
|
|
2496
|
+
destroyRef = inject(DestroyRef);
|
|
2497
|
+
constructor() {
|
|
2498
|
+
const unlisten = this.renderer.listen('document', 'pointerdown', (event) => {
|
|
2499
|
+
if (!this.open())
|
|
2500
|
+
return;
|
|
2501
|
+
const target = event.target;
|
|
2502
|
+
if (!target)
|
|
2503
|
+
return;
|
|
2504
|
+
const hostEl = this.elementRef.nativeElement;
|
|
2505
|
+
const overlayEl = this.overlayDirective()?.getOverlayElement();
|
|
2506
|
+
if (hostEl.contains(target) || (overlayEl && overlayEl.contains(target))) {
|
|
2507
|
+
return;
|
|
2508
|
+
}
|
|
2509
|
+
this.open.set(false);
|
|
2510
|
+
});
|
|
2511
|
+
this.destroyRef.onDestroy(() => unlisten());
|
|
2512
|
+
}
|
|
2513
|
+
toggle(event) {
|
|
2514
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
2515
|
+
return;
|
|
2516
|
+
if (event) {
|
|
2517
|
+
event.preventDefault();
|
|
2518
|
+
event.stopPropagation();
|
|
2519
|
+
}
|
|
2520
|
+
this.open.set(!this.open());
|
|
2521
|
+
}
|
|
2522
|
+
onInputTextChange(value) {
|
|
2523
|
+
this.textInputValue.set(value);
|
|
2524
|
+
if (!value.trim()) {
|
|
2525
|
+
this.updateDateValue(null);
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2528
|
+
const parsed = parseDate(value, this.effectiveFormat());
|
|
2529
|
+
if (parsed) {
|
|
2530
|
+
this.updateDateValue(parsed);
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
onInputBlur() {
|
|
2534
|
+
this.onTouched();
|
|
2535
|
+
const val = this.value();
|
|
2536
|
+
if (val) {
|
|
2537
|
+
this.textInputValue.set(formatDate(val, this.effectiveFormat()));
|
|
2538
|
+
}
|
|
2539
|
+
else {
|
|
2540
|
+
this.textInputValue.set('');
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
onCalendarDateSelected(date) {
|
|
2544
|
+
const prev = this.value();
|
|
2545
|
+
if (prev && this.showTime()) {
|
|
2546
|
+
date.setHours(prev.getHours(), prev.getMinutes(), prev.getSeconds());
|
|
2547
|
+
}
|
|
2548
|
+
this.updateDateValue(date);
|
|
2549
|
+
if (!this.showTime()) {
|
|
2550
|
+
this.open.set(false);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
onTimeSelected(val) {
|
|
2554
|
+
if (!val)
|
|
2555
|
+
return;
|
|
2556
|
+
const current = this.value() || new Date();
|
|
2557
|
+
const nextDate = new Date(current);
|
|
2558
|
+
if (val instanceof Date) {
|
|
2559
|
+
nextDate.setHours(val.getHours(), val.getMinutes(), val.getSeconds());
|
|
2560
|
+
}
|
|
2561
|
+
else {
|
|
2562
|
+
const parts = val.split(':');
|
|
2563
|
+
nextDate.setHours(parseInt(parts[0], 10) || 0);
|
|
2564
|
+
nextDate.setMinutes(parseInt(parts[1], 10) || 0);
|
|
2565
|
+
if (parts[2]) {
|
|
2566
|
+
nextDate.setSeconds(parseInt(parts[2], 10) || 0);
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
this.updateDateValue(nextDate);
|
|
2570
|
+
}
|
|
2571
|
+
clear(event) {
|
|
2572
|
+
event.stopPropagation();
|
|
2573
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
2574
|
+
return;
|
|
2575
|
+
this.updateDateValue(null);
|
|
2576
|
+
}
|
|
2577
|
+
effectiveFormat() {
|
|
2578
|
+
const explicit = this.format();
|
|
2579
|
+
const base = explicit || getLocaleDefaultDateFormat(this.locale());
|
|
2580
|
+
if (this.showTime()) {
|
|
2581
|
+
return this.timeFormat() === '12h'
|
|
2582
|
+
? this.showSeconds()
|
|
2583
|
+
? `${base} hh:mm:ss A`
|
|
2584
|
+
: `${base} hh:mm A`
|
|
2585
|
+
: this.showSeconds()
|
|
2586
|
+
? `${base} HH:mm:ss`
|
|
2587
|
+
: `${base} HH:mm`;
|
|
2588
|
+
}
|
|
2589
|
+
return base;
|
|
2590
|
+
}
|
|
2591
|
+
updateDateValue(date) {
|
|
2592
|
+
this.value.set(date);
|
|
2593
|
+
this.textInputValue.set(formatDate(date, this.effectiveFormat()));
|
|
2594
|
+
this.dateSelected.emit(date);
|
|
2595
|
+
this.onChange(date);
|
|
2596
|
+
this.onTouched();
|
|
2597
|
+
}
|
|
2598
|
+
writeValue(val) {
|
|
2599
|
+
let d = null;
|
|
2600
|
+
if (val instanceof Date) {
|
|
2601
|
+
d = val;
|
|
2602
|
+
}
|
|
2603
|
+
else if (typeof val === 'string') {
|
|
2604
|
+
d = parseDate(val, this.effectiveFormat());
|
|
2605
|
+
}
|
|
2606
|
+
this.value.set(d);
|
|
2607
|
+
this.textInputValue.set(formatDate(d, this.effectiveFormat()));
|
|
2608
|
+
}
|
|
2609
|
+
registerOnChange(fn) {
|
|
2610
|
+
this.onChange = fn;
|
|
2611
|
+
}
|
|
2612
|
+
registerOnTouched(fn) {
|
|
2613
|
+
this.onTouched = fn;
|
|
2614
|
+
}
|
|
2615
|
+
setDisabledState(isDisabled) {
|
|
2616
|
+
this.cvaDisabled.set(isDisabled);
|
|
2617
|
+
}
|
|
2618
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2619
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataDatePickerComponent, isStandalone: true, selector: "st-datepicker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", 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 }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, colorMessage: { classPropertyName: "colorMessage", publicName: "colorMessage", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", dateSelected: "dateSelected" }, host: { properties: { "class.st-datepicker": "true", "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-size-lg": "size() === \"lg\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null", "class.st-state-error": "effectiveState() === \"error\"", "class.st-state-success": "effectiveState() === \"success\"", "class.st-state-warning": "effectiveState() === \"warning\"", "class.st-error": "effectiveState() === \"error\"", "attr.aria-invalid": "effectiveState() === \"error\" ? \"true\" : null" } }, providers: [
|
|
2620
|
+
{
|
|
2621
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2622
|
+
useExisting: forwardRef(() => StrataDatePickerComponent),
|
|
2623
|
+
multi: true
|
|
2624
|
+
}
|
|
2625
|
+
], viewQueries: [{ propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"calendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #calendarOverlay>\n <div class=\"st-datepicker-dropdown\" [class.st-datepicker-with-time]=\"showTime()\">\n <st-calendar\n mode=\"single\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [value]=\"value()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (dateSelected)=\"onCalendarDateSelected($event)\"\n ></st-calendar>\n @if (showTime()) {\n <div class=\"st-datepicker-time-side\">\n <st-time-picker\n [value]=\"value()\"\n [format]=\"timeFormat()\"\n [showSeconds]=\"showSeconds()\"\n [minuteStep]=\"minuteStep()\"\n [disabled]=\"effectiveDisabled()\"\n (valueChange)=\"onTimeSelected($event)\"\n ></st-time-picker>\n </div>\n }\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-datepicker-dropdown{border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);background-color:var(--st-color-bg-raised);box-shadow:var(--st-shadow-2);padding:var(--st-space-3);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-datepicker-dropdown.st-datepicker-with-time{display:flex;align-items:stretch;gap:0;padding:0}.st-datepicker-dropdown.st-datepicker-with-time>st-calendar{padding:var(--st-space-3)}.st-datepicker-time-side{display:flex;align-items:center;justify-content:center;padding:var(--st-space-3) var(--st-space-4);border-left:1px solid var(--st-border-subtle)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataCalendarComponent, selector: "st-calendar", inputs: ["mode", "size", "locale", "value", "rangeValue", "viewDate", "minDate", "maxDate", "disabledDates", "firstDayOfWeek", "showAdjacentMonths", "disabled"], outputs: ["valueChange", "rangeValueChange", "viewDateChange", "dateSelected", "rangeSelected"] }, { kind: "component", type: StrataTimePickerComponent, selector: "st-time-picker", inputs: ["format", "showSeconds", "minuteStep", "disabled", "value"], outputs: ["valueChange"] }] });
|
|
2626
|
+
}
|
|
2627
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDatePickerComponent, decorators: [{
|
|
2628
|
+
type: Component,
|
|
2629
|
+
args: [{ selector: 'st-datepicker', imports: [
|
|
2630
|
+
CommonModule,
|
|
2631
|
+
FormsModule,
|
|
2632
|
+
StrataIconComponent,
|
|
2633
|
+
StrataOverlayDirective,
|
|
2634
|
+
StrataCalendarComponent,
|
|
2635
|
+
StrataTimePickerComponent
|
|
2636
|
+
], providers: [
|
|
2637
|
+
{
|
|
2638
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2639
|
+
useExisting: forwardRef(() => StrataDatePickerComponent),
|
|
2640
|
+
multi: true
|
|
2641
|
+
}
|
|
2642
|
+
], host: {
|
|
2643
|
+
'[class.st-datepicker]': 'true',
|
|
2644
|
+
'[class.st-size-sm]': 'size() === "sm"',
|
|
2645
|
+
'[class.st-size-md]': 'size() === "md"',
|
|
2646
|
+
'[class.st-size-lg]': 'size() === "lg"',
|
|
2647
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
2648
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null',
|
|
2649
|
+
'[class.st-state-error]': 'effectiveState() === "error"',
|
|
2650
|
+
'[class.st-state-success]': 'effectiveState() === "success"',
|
|
2651
|
+
'[class.st-state-warning]': 'effectiveState() === "warning"',
|
|
2652
|
+
'[class.st-error]': 'effectiveState() === "error"',
|
|
2653
|
+
'[attr.aria-invalid]': 'effectiveState() === "error" ? "true" : null'
|
|
2654
|
+
}, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"calendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #calendarOverlay>\n <div class=\"st-datepicker-dropdown\" [class.st-datepicker-with-time]=\"showTime()\">\n <st-calendar\n mode=\"single\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [value]=\"value()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (dateSelected)=\"onCalendarDateSelected($event)\"\n ></st-calendar>\n @if (showTime()) {\n <div class=\"st-datepicker-time-side\">\n <st-time-picker\n [value]=\"value()\"\n [format]=\"timeFormat()\"\n [showSeconds]=\"showSeconds()\"\n [minuteStep]=\"minuteStep()\"\n [disabled]=\"effectiveDisabled()\"\n (valueChange)=\"onTimeSelected($event)\"\n ></st-time-picker>\n </div>\n }\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-datepicker-dropdown{border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);background-color:var(--st-color-bg-raised);box-shadow:var(--st-shadow-2);padding:var(--st-space-3);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-datepicker-dropdown.st-datepicker-with-time{display:flex;align-items:stretch;gap:0;padding:0}.st-datepicker-dropdown.st-datepicker-with-time>st-calendar{padding:var(--st-space-3)}.st-datepicker-time-side{display:flex;align-items:center;justify-content:center;padding:var(--st-space-3) var(--st-space-4);border-left:1px solid var(--st-border-subtle)}\n"] }]
|
|
2655
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], colorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorMessage", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], dateSelected: [{ type: i0.Output, args: ["dateSelected"] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }] } });
|
|
2656
|
+
|
|
2657
|
+
let nextUniqueDateRangePickerId = 0;
|
|
2658
|
+
const DEFAULT_DATE_RANGE_PRESETS = [
|
|
2659
|
+
{
|
|
2660
|
+
label: 'Today',
|
|
2661
|
+
getRange: () => {
|
|
2662
|
+
const now = new Date();
|
|
2663
|
+
return { start: now, end: now };
|
|
2664
|
+
}
|
|
2665
|
+
},
|
|
2666
|
+
{
|
|
2667
|
+
label: 'Yesterday',
|
|
2668
|
+
getRange: () => {
|
|
2669
|
+
const yesterday = addDays(new Date(), -1);
|
|
2670
|
+
return { start: yesterday, end: yesterday };
|
|
2671
|
+
}
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
label: 'Last 7 Days',
|
|
2675
|
+
getRange: () => {
|
|
2676
|
+
const now = new Date();
|
|
2677
|
+
return { start: addDays(now, -6), end: now };
|
|
2678
|
+
}
|
|
2679
|
+
},
|
|
2680
|
+
{
|
|
2681
|
+
label: 'Last 30 Days',
|
|
2682
|
+
getRange: () => {
|
|
2683
|
+
const now = new Date();
|
|
2684
|
+
return { start: addDays(now, -29), end: now };
|
|
2685
|
+
}
|
|
2686
|
+
},
|
|
2687
|
+
{
|
|
2688
|
+
label: 'This Month',
|
|
2689
|
+
getRange: () => {
|
|
2690
|
+
const now = new Date();
|
|
2691
|
+
return { start: startOfMonth(now), end: endOfMonth(now) };
|
|
2692
|
+
}
|
|
2693
|
+
},
|
|
2694
|
+
{
|
|
2695
|
+
label: 'Last Month',
|
|
2696
|
+
getRange: () => {
|
|
2697
|
+
const prevMonth = addMonths(new Date(), -1);
|
|
2698
|
+
return { start: startOfMonth(prevMonth), end: endOfMonth(prevMonth) };
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
];
|
|
2702
|
+
class StrataDateRangePickerComponent {
|
|
2703
|
+
defaultId = `st-daterange-${nextUniqueDateRangePickerId++}`;
|
|
2704
|
+
label = input(undefined, /* @ts-ignore */
|
|
2705
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2706
|
+
id = input(undefined, /* @ts-ignore */
|
|
2707
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2708
|
+
name = input(undefined, /* @ts-ignore */
|
|
2709
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2710
|
+
placeholder = input('Start date – End date', /* @ts-ignore */
|
|
2711
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2712
|
+
separator = input(' – ', /* @ts-ignore */
|
|
2713
|
+
...(ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []));
|
|
2714
|
+
format = input(undefined, /* @ts-ignore */
|
|
2715
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
2716
|
+
size = input('md', /* @ts-ignore */
|
|
2717
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2718
|
+
placement = input('bottom-start', /* @ts-ignore */
|
|
2719
|
+
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
2720
|
+
locale = input(undefined, /* @ts-ignore */
|
|
2721
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
2722
|
+
calendarSize = computed(() => (this.size() === 'sm' ? 'sm' : 'md'), /* @ts-ignore */
|
|
2723
|
+
...(ngDevMode ? [{ debugName: "calendarSize" }] : /* istanbul ignore next */ []));
|
|
2724
|
+
numberOfMonths = input(2, /* @ts-ignore */
|
|
2725
|
+
...(ngDevMode ? [{ debugName: "numberOfMonths" }] : /* istanbul ignore next */ []));
|
|
2726
|
+
showPresets = input(true, { ...(ngDevMode ? { debugName: "showPresets" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2727
|
+
presets = input(DEFAULT_DATE_RANGE_PRESETS, /* @ts-ignore */
|
|
2728
|
+
...(ngDevMode ? [{ debugName: "presets" }] : /* istanbul ignore next */ []));
|
|
2729
|
+
clearable = input(true, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2730
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2731
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2732
|
+
fullWidth = input(false, { ...(ngDevMode ? { debugName: "fullWidth" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2733
|
+
state = input(undefined, /* @ts-ignore */
|
|
2734
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
2735
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2736
|
+
message = input(undefined, /* @ts-ignore */
|
|
2737
|
+
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
2738
|
+
colorMessage = input(true, { ...(ngDevMode ? { debugName: "colorMessage" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2739
|
+
minDate = input(null, /* @ts-ignore */
|
|
2740
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
2741
|
+
maxDate = input(null, /* @ts-ignore */
|
|
2742
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
2743
|
+
disabledDates = input(null, /* @ts-ignore */
|
|
2744
|
+
...(ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
2745
|
+
firstDayOfWeek = input(0, /* @ts-ignore */
|
|
2746
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
2747
|
+
initialViewDate = input(null, /* @ts-ignore */
|
|
2748
|
+
...(ngDevMode ? [{ debugName: "initialViewDate" }] : /* istanbul ignore next */ []));
|
|
2749
|
+
value = model(null, /* @ts-ignore */
|
|
2750
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2751
|
+
rangeSelected = output();
|
|
2752
|
+
open = signal(false, /* @ts-ignore */
|
|
2753
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
2754
|
+
textInputValue = signal('', /* @ts-ignore */
|
|
2755
|
+
...(ngDevMode ? [{ debugName: "textInputValue" }] : /* istanbul ignore next */ []));
|
|
2756
|
+
calendarViewDate = signal(new Date(), /* @ts-ignore */
|
|
2757
|
+
...(ngDevMode ? [{ debugName: "calendarViewDate" }] : /* istanbul ignore next */ []));
|
|
2758
|
+
secondCalendarViewDate = computed(() => {
|
|
2759
|
+
return addMonths(this.calendarViewDate(), 1);
|
|
2760
|
+
}, /* @ts-ignore */
|
|
2761
|
+
...(ngDevMode ? [{ debugName: "secondCalendarViewDate" }] : /* istanbul ignore next */ []));
|
|
2762
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
2763
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
2764
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
2765
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
2766
|
+
effectiveId = computed(() => this.id() ?? this.name() ?? this.defaultId, /* @ts-ignore */
|
|
2767
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
2768
|
+
effectiveState = computed(() => {
|
|
2769
|
+
if (this.error()) {
|
|
2770
|
+
return 'error';
|
|
2771
|
+
}
|
|
2772
|
+
return this.state() ?? 'default';
|
|
2773
|
+
}, /* @ts-ignore */
|
|
2774
|
+
...(ngDevMode ? [{ debugName: "effectiveState" }] : /* istanbul ignore next */ []));
|
|
2775
|
+
isMessageError = computed(() => this.effectiveState() === 'error' && this.colorMessage(), /* @ts-ignore */
|
|
2776
|
+
...(ngDevMode ? [{ debugName: "isMessageError" }] : /* istanbul ignore next */ []));
|
|
2777
|
+
isMessageSuccess = computed(() => this.effectiveState() === 'success' && this.colorMessage(), /* @ts-ignore */
|
|
2778
|
+
...(ngDevMode ? [{ debugName: "isMessageSuccess" }] : /* istanbul ignore next */ []));
|
|
2779
|
+
isMessageWarning = computed(() => this.effectiveState() === 'warning' && this.colorMessage(), /* @ts-ignore */
|
|
2780
|
+
...(ngDevMode ? [{ debugName: "isMessageWarning" }] : /* istanbul ignore next */ []));
|
|
2781
|
+
onChange = () => undefined;
|
|
2782
|
+
onTouched = () => undefined;
|
|
2783
|
+
overlayDirective = viewChild(StrataOverlayDirective, /* @ts-ignore */
|
|
2784
|
+
...(ngDevMode ? [{ debugName: "overlayDirective" }] : /* istanbul ignore next */ []));
|
|
2785
|
+
elementRef = inject(ElementRef);
|
|
2786
|
+
renderer = inject(Renderer2);
|
|
2787
|
+
destroyRef = inject(DestroyRef);
|
|
2788
|
+
get effectiveFormat() {
|
|
2789
|
+
return this.format() || getLocaleDefaultDateFormat(this.locale());
|
|
2790
|
+
}
|
|
2791
|
+
constructor() {
|
|
2792
|
+
const unlisten = this.renderer.listen('document', 'pointerdown', (event) => {
|
|
2793
|
+
if (!this.open())
|
|
2794
|
+
return;
|
|
2795
|
+
const target = event.target;
|
|
2796
|
+
if (!target)
|
|
2797
|
+
return;
|
|
2798
|
+
const hostEl = this.elementRef.nativeElement;
|
|
2799
|
+
const overlayEl = this.overlayDirective()?.getOverlayElement();
|
|
2800
|
+
if (hostEl.contains(target) || (overlayEl && overlayEl.contains(target))) {
|
|
2801
|
+
return;
|
|
2802
|
+
}
|
|
2803
|
+
this.open.set(false);
|
|
2804
|
+
});
|
|
2805
|
+
this.destroyRef.onDestroy(() => unlisten());
|
|
2806
|
+
effect(() => {
|
|
2807
|
+
const val = this.value();
|
|
2808
|
+
if (val && val.start && val.end) {
|
|
2809
|
+
this.textInputValue.set(`${formatDate(val.start, this.effectiveFormat)}${this.separator()}${formatDate(val.end, this.effectiveFormat)}`);
|
|
2810
|
+
this.calendarViewDate.set(new Date(val.start));
|
|
2811
|
+
}
|
|
2812
|
+
else {
|
|
2813
|
+
this.textInputValue.set('');
|
|
2814
|
+
}
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
toggle(event) {
|
|
2818
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
2819
|
+
return;
|
|
2820
|
+
if (event) {
|
|
2821
|
+
event.preventDefault();
|
|
2822
|
+
event.stopPropagation();
|
|
2823
|
+
}
|
|
2824
|
+
const opening = !this.open();
|
|
2825
|
+
if (opening) {
|
|
2826
|
+
const range = this.value();
|
|
2827
|
+
const viewDate = range?.start ?? this.initialViewDate() ?? new Date();
|
|
2828
|
+
this.calendarViewDate.set(new Date(viewDate));
|
|
2829
|
+
}
|
|
2830
|
+
this.open.set(opening);
|
|
2831
|
+
}
|
|
2832
|
+
onInputTextChange(value) {
|
|
2833
|
+
this.textInputValue.set(value);
|
|
2834
|
+
if (!value.trim()) {
|
|
2835
|
+
this.updateRangeValue(null);
|
|
2836
|
+
return;
|
|
2837
|
+
}
|
|
2838
|
+
const parts = value.split(this.separator());
|
|
2839
|
+
if (parts.length === 2) {
|
|
2840
|
+
const s = parseDate(parts[0], this.effectiveFormat);
|
|
2841
|
+
const e = parseDate(parts[1], this.effectiveFormat);
|
|
2842
|
+
if (s && e) {
|
|
2843
|
+
this.updateRangeValue({ start: s, end: e });
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
onInputBlur() {
|
|
2848
|
+
this.onTouched();
|
|
2849
|
+
const val = this.value();
|
|
2850
|
+
if (val && val.start && val.end) {
|
|
2851
|
+
this.textInputValue.set(`${formatDate(val.start, this.effectiveFormat)}${this.separator()}${formatDate(val.end, this.effectiveFormat)}`);
|
|
2852
|
+
}
|
|
2853
|
+
else {
|
|
2854
|
+
this.textInputValue.set('');
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
onCalendarRangeSelected(range) {
|
|
2858
|
+
this.value.set(range);
|
|
2859
|
+
if (range.start && range.end) {
|
|
2860
|
+
this.textInputValue.set(`${formatDate(range.start, this.effectiveFormat)}${this.separator()}${formatDate(range.end, this.effectiveFormat)}`);
|
|
2861
|
+
this.rangeSelected.emit(range);
|
|
2862
|
+
this.onChange(range);
|
|
2863
|
+
this.onTouched();
|
|
2864
|
+
this.open.set(false);
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
onSecondCalendarViewDateChange(date) {
|
|
2868
|
+
this.calendarViewDate.set(addMonths(date, -1));
|
|
2869
|
+
}
|
|
2870
|
+
applyPreset(preset) {
|
|
2871
|
+
const range = preset.getRange();
|
|
2872
|
+
this.updateRangeValue(range);
|
|
2873
|
+
this.open.set(false);
|
|
2874
|
+
}
|
|
2875
|
+
clear(event) {
|
|
2876
|
+
event.stopPropagation();
|
|
2877
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
2878
|
+
return;
|
|
2879
|
+
this.updateRangeValue(null);
|
|
2880
|
+
}
|
|
2881
|
+
updateRangeValue(range) {
|
|
2882
|
+
this.value.set(range);
|
|
2883
|
+
if (range && range.start && range.end) {
|
|
2884
|
+
this.textInputValue.set(`${formatDate(range.start, this.effectiveFormat)}${this.separator()}${formatDate(range.end, this.effectiveFormat)}`);
|
|
2885
|
+
}
|
|
2886
|
+
else {
|
|
2887
|
+
this.textInputValue.set('');
|
|
2888
|
+
}
|
|
2889
|
+
this.rangeSelected.emit(range);
|
|
2890
|
+
this.onChange(range);
|
|
2891
|
+
this.onTouched();
|
|
2892
|
+
}
|
|
2893
|
+
writeValue(val) {
|
|
2894
|
+
this.value.set(val);
|
|
2895
|
+
if (val && val.start && val.end) {
|
|
2896
|
+
this.textInputValue.set(`${formatDate(val.start, this.effectiveFormat)}${this.separator()}${formatDate(val.end, this.effectiveFormat)}`);
|
|
2897
|
+
this.calendarViewDate.set(new Date(val.start));
|
|
2898
|
+
}
|
|
2899
|
+
else {
|
|
2900
|
+
this.textInputValue.set('');
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
registerOnChange(fn) {
|
|
2904
|
+
this.onChange = fn;
|
|
2905
|
+
}
|
|
2906
|
+
registerOnTouched(fn) {
|
|
2907
|
+
this.onTouched = fn;
|
|
2908
|
+
}
|
|
2909
|
+
setDisabledState(isDisabled) {
|
|
2910
|
+
this.cvaDisabled.set(isDisabled);
|
|
2911
|
+
}
|
|
2912
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2913
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataDateRangePickerComponent, isStandalone: true, selector: "st-date-range-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, numberOfMonths: { classPropertyName: "numberOfMonths", publicName: "numberOfMonths", isSignal: true, isRequired: false, transformFunction: null }, showPresets: { classPropertyName: "showPresets", publicName: "showPresets", isSignal: true, isRequired: false, transformFunction: null }, presets: { classPropertyName: "presets", publicName: "presets", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", 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 }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, colorMessage: { classPropertyName: "colorMessage", publicName: "colorMessage", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, initialViewDate: { classPropertyName: "initialViewDate", publicName: "initialViewDate", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", rangeSelected: "rangeSelected" }, host: { properties: { "class.st-date-range-picker": "true", "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-size-lg": "size() === \"lg\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null", "class.st-state-error": "effectiveState() === \"error\"", "class.st-state-success": "effectiveState() === \"success\"", "class.st-state-warning": "effectiveState() === \"warning\"", "class.st-error": "effectiveState() === \"error\"", "attr.aria-invalid": "effectiveState() === \"error\" ? \"true\" : null" } }, providers: [
|
|
2914
|
+
{
|
|
2915
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2916
|
+
useExisting: forwardRef(() => StrataDateRangePickerComponent),
|
|
2917
|
+
multi: true
|
|
2918
|
+
}
|
|
2919
|
+
], viewQueries: [{ propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"rangeCalendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date range\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #rangeCalendarOverlay>\n <div class=\"st-date-range-dropdown\">\n @if (showPresets() && presets().length > 0) {\n <div class=\"st-date-range-presets\">\n <div class=\"st-presets-title\">Presets</div>\n @for (preset of presets(); track preset.label) {\n <button\n type=\"button\"\n class=\"st-preset-btn\"\n (click)=\"applyPreset(preset)\"\n >\n {{ preset.label }}\n </button>\n }\n </div>\n }\n\n <div class=\"st-date-range-calendars\">\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"calendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"calendarViewDate.set($event)\"\n ></st-calendar>\n\n @if (numberOfMonths() >= 2) {\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"secondCalendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"onSecondCalendarViewDateChange($event)\"\n ></st-calendar>\n }\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-date-range-dropdown{display:flex;background-color:var(--st-color-bg-raised);border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);box-shadow:var(--st-shadow-2);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-date-range-presets{display:flex;flex-direction:column;padding:var(--st-space-2);border-right:1px solid var(--st-border-subtle);min-width:130px;gap:2px}.st-presets-title{font-size:.75rem;font-weight:var(--st-font-weight-semibold);color:var(--st-color-text-tertiary);padding:4px 8px;text-transform:uppercase;letter-spacing:.05em}.st-preset-btn{background:transparent;border:none;font-family:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-secondary);padding:6px 8px;border-radius:var(--st-border-radius-sm);text-align:left;cursor:pointer;transition:background-color var(--st-transition-fast),color var(--st-transition-fast)}.st-preset-btn:hover{background-color:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-date-range-calendars{display:flex;gap:var(--st-space-4);padding:var(--st-space-3)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataCalendarComponent, selector: "st-calendar", inputs: ["mode", "size", "locale", "value", "rangeValue", "viewDate", "minDate", "maxDate", "disabledDates", "firstDayOfWeek", "showAdjacentMonths", "disabled"], outputs: ["valueChange", "rangeValueChange", "viewDateChange", "dateSelected", "rangeSelected"] }] });
|
|
2920
|
+
}
|
|
2921
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDateRangePickerComponent, decorators: [{
|
|
2922
|
+
type: Component,
|
|
2923
|
+
args: [{ selector: 'st-date-range-picker', imports: [
|
|
2924
|
+
CommonModule,
|
|
2925
|
+
StrataIconComponent,
|
|
2926
|
+
StrataOverlayDirective,
|
|
2927
|
+
StrataCalendarComponent
|
|
2928
|
+
], providers: [
|
|
2929
|
+
{
|
|
2930
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2931
|
+
useExisting: forwardRef(() => StrataDateRangePickerComponent),
|
|
2932
|
+
multi: true
|
|
2933
|
+
}
|
|
2934
|
+
], host: {
|
|
2935
|
+
'[class.st-date-range-picker]': 'true',
|
|
2936
|
+
'[class.st-size-sm]': 'size() === "sm"',
|
|
2937
|
+
'[class.st-size-md]': 'size() === "md"',
|
|
2938
|
+
'[class.st-size-lg]': 'size() === "lg"',
|
|
2939
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
2940
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null',
|
|
2941
|
+
'[class.st-state-error]': 'effectiveState() === "error"',
|
|
2942
|
+
'[class.st-state-success]': 'effectiveState() === "success"',
|
|
2943
|
+
'[class.st-state-warning]': 'effectiveState() === "warning"',
|
|
2944
|
+
'[class.st-error]': 'effectiveState() === "error"',
|
|
2945
|
+
'[attr.aria-invalid]': 'effectiveState() === "error" ? "true" : null'
|
|
2946
|
+
}, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"rangeCalendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date range\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #rangeCalendarOverlay>\n <div class=\"st-date-range-dropdown\">\n @if (showPresets() && presets().length > 0) {\n <div class=\"st-date-range-presets\">\n <div class=\"st-presets-title\">Presets</div>\n @for (preset of presets(); track preset.label) {\n <button\n type=\"button\"\n class=\"st-preset-btn\"\n (click)=\"applyPreset(preset)\"\n >\n {{ preset.label }}\n </button>\n }\n </div>\n }\n\n <div class=\"st-date-range-calendars\">\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"calendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"calendarViewDate.set($event)\"\n ></st-calendar>\n\n @if (numberOfMonths() >= 2) {\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"secondCalendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"onSecondCalendarViewDateChange($event)\"\n ></st-calendar>\n }\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-date-range-dropdown{display:flex;background-color:var(--st-color-bg-raised);border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);box-shadow:var(--st-shadow-2);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-date-range-presets{display:flex;flex-direction:column;padding:var(--st-space-2);border-right:1px solid var(--st-border-subtle);min-width:130px;gap:2px}.st-presets-title{font-size:.75rem;font-weight:var(--st-font-weight-semibold);color:var(--st-color-text-tertiary);padding:4px 8px;text-transform:uppercase;letter-spacing:.05em}.st-preset-btn{background:transparent;border:none;font-family:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-secondary);padding:6px 8px;border-radius:var(--st-border-radius-sm);text-align:left;cursor:pointer;transition:background-color var(--st-transition-fast),color var(--st-transition-fast)}.st-preset-btn:hover{background-color:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-date-range-calendars{display:flex;gap:var(--st-space-4);padding:var(--st-space-3)}\n"] }]
|
|
2947
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], numberOfMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "numberOfMonths", required: false }] }], showPresets: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPresets", required: false }] }], presets: [{ type: i0.Input, args: [{ isSignal: true, alias: "presets", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], colorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorMessage", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], initialViewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialViewDate", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], rangeSelected: [{ type: i0.Output, args: ["rangeSelected"] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }] } });
|
|
2948
|
+
|
|
1649
2949
|
class StrataDividerComponent {
|
|
1650
2950
|
label = input(/* @ts-ignore */
|
|
1651
2951
|
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -5345,5 +6645,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
|
|
|
5345
6645
|
* Generated bundle index. Do not edit.
|
|
5346
6646
|
*/
|
|
5347
6647
|
|
|
5348
|
-
export { BreakpointService, CapitalizePipe, DEFAULT_DURATION, DEFAULT_THEME, DarkmodeService, DeviceService, HotkeyService, HttpIconLoader, IconLoader, IconRegistry, IconRegistryService, ModalService, NotificationService, STRATA_CONFIG, StrataAccordionGroupComponent, StrataAccordionItemComponent, StrataActionMenuComponent, StrataActionMenuItemComponent, StrataActivatableDirective, StrataAlertComponent, StrataAlertContentComponent, StrataAutoResizeDirective, StrataAvatarComponent, StrataAvatarStackComponent, StrataBadgeComponent, StrataBreadcrumbComponent, StrataBreadcrumbItemComponent, StrataButtonDirective, StrataButtonGroupComponent, StrataCardComponent, StrataCheckboxComponent, StrataDividerComponent, StrataFileUploadComponent, StrataIconComponent, StrataImageCropperComponent, StrataInputFieldComponent, StrataItemComponent, StrataItemListComponent, StrataKbdComponent, StrataMessageStateComponent, StrataModalBodyComponent, StrataModalComponent, StrataModalContainerComponent, StrataModalFooterComponent, StrataModalHeaderComponent, StrataModalRef, StrataNativeInputRefDirective, StrataNotificationComponent, StrataNotificationContainerComponent, StrataNumberDisplayComponent, StrataNumberStepperComponent, StrataOtpComponent, StrataOverlayDirective, StrataPaginationComponent, StrataProgressLinearComponent, StrataProgressRadialComponent, StrataRadioComponent, StrataRadioGroupComponent, StrataSegmentedControlComponent, StrataSegmentedControlItemComponent, StrataSelectItemComponent, StrataSelectTriggerDirective, StrataShellComponent, StrataSidemenuComponent, StrataSidemenuItemDirective, StrataSidemenuItemGroupComponent, StrataSidemenuSectionComponent, StrataSingleSelectComponent, StrataSkeletonComponent, StrataSliderComponent, StrataSpinnerComponent, StrataStepComponent, StrataStepperComponent, StrataTabItemComponent, StrataTabsComponent, StrataTagComponent, StrataTextStackComponent, StrataThemeDirective, StrataToggleComponent, StrataTooltipDirective, getDefaultShortcutLabels, isApplePlatform, provideBaseIcons, provideIcons, provideStrata, resolveIsApple };
|
|
6648
|
+
export { BreakpointService, CapitalizePipe, DEFAULT_DATE_RANGE_PRESETS, DEFAULT_DURATION, DEFAULT_THEME, DarkmodeService, DeviceService, HotkeyService, HttpIconLoader, IconLoader, IconRegistry, IconRegistryService, ModalService, NotificationService, STRATA_CONFIG, StrataAccordionGroupComponent, StrataAccordionItemComponent, StrataActionMenuComponent, StrataActionMenuItemComponent, StrataActivatableDirective, StrataAlertComponent, StrataAlertContentComponent, StrataAutoResizeDirective, StrataAvatarComponent, StrataAvatarStackComponent, StrataBadgeComponent, StrataBreadcrumbComponent, StrataBreadcrumbItemComponent, StrataButtonDirective, StrataButtonGroupComponent, StrataCalendarComponent, StrataCardComponent, StrataCheckboxComponent, StrataDatePickerComponent, StrataDateRangePickerComponent, StrataDividerComponent, StrataFileUploadComponent, StrataIconComponent, StrataImageCropperComponent, StrataInputFieldComponent, StrataItemComponent, StrataItemListComponent, StrataKbdComponent, StrataMessageStateComponent, StrataModalBodyComponent, StrataModalComponent, StrataModalContainerComponent, StrataModalFooterComponent, StrataModalHeaderComponent, StrataModalRef, StrataNativeInputRefDirective, StrataNotificationComponent, StrataNotificationContainerComponent, StrataNumberDisplayComponent, StrataNumberStepperComponent, StrataOtpComponent, StrataOverlayDirective, StrataPaginationComponent, StrataProgressLinearComponent, StrataProgressRadialComponent, StrataRadioComponent, StrataRadioGroupComponent, StrataSegmentedControlComponent, StrataSegmentedControlItemComponent, StrataSelectItemComponent, StrataSelectTriggerDirective, StrataShellComponent, StrataSidemenuComponent, StrataSidemenuItemDirective, StrataSidemenuItemGroupComponent, StrataSidemenuSectionComponent, StrataSingleSelectComponent, StrataSkeletonComponent, StrataSliderComponent, StrataSpinnerComponent, StrataStepComponent, StrataStepperComponent, StrataTabItemComponent, StrataTabsComponent, StrataTagComponent, StrataTextStackComponent, StrataThemeDirective, StrataTimePickerComponent, StrataToggleComponent, StrataTooltipDirective, addDays, addMonths, addYears, createCalendarGrid, disableDateRange, disableDaysOfWeek, disableFutureDates, disablePastDates, disableWeekends, endOfDay, endOfMonth, formatDate, formatMonthTitle, getDayOfWeek, getDaysInMonth, getDefaultShortcutLabels, getLocaleDefaultDateFormat, getMonthNames, getWeekdayNames, isAfterDay, isApplePlatform, isBeforeDay, isSameDay, isSameMonth, isSameYear, isWeekend, isWithinDayRange, parseDate, provideBaseIcons, provideIcons, provideStrata, resolveIsApple, startOfDay, startOfMonth };
|
|
5349
6649
|
//# sourceMappingURL=ngx-strata.mjs.map
|