@tylertech/forge 3.8.2-dev.0 → 3.9.0-dev.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/custom-elements.json +10454 -10067
- package/dist/lib.js +18 -18
- package/dist/lib.js.map +3 -3
- package/dist/toolbar/forge-toolbar.css +1 -0
- package/dist/vscode.css-custom-data.json +946 -946
- package/dist/vscode.html-custom-data.json +618 -558
- package/esm/calendar/calendar-adapter.d.ts +24 -0
- package/esm/calendar/calendar-adapter.js +67 -1
- package/esm/calendar/calendar-constants.d.ts +34 -0
- package/esm/calendar/calendar-constants.js +33 -0
- package/esm/calendar/calendar-core.d.ts +60 -0
- package/esm/calendar/calendar-core.js +220 -2
- package/esm/calendar/calendar-dom-utils.d.ts +6 -0
- package/esm/calendar/calendar-dom-utils.js +36 -0
- package/esm/calendar/calendar.d.ts +40 -1
- package/esm/calendar/calendar.js +80 -2
- package/esm/calendar/core/calendar-base.d.ts +3 -0
- package/esm/calendar/core/date-range.d.ts +2 -0
- package/esm/calendar/core/date-range.js +1 -0
- package/esm/date-picker/base/base-date-picker-adapter.js +0 -3
- package/esm/date-picker/base/base-date-picker-constants.d.ts +3 -0
- package/esm/date-picker/base/base-date-picker-constants.js +3 -0
- package/esm/date-picker/base/base-date-picker-core.d.ts +15 -0
- package/esm/date-picker/base/base-date-picker-core.js +30 -0
- package/esm/date-picker/base/base-date-picker.d.ts +12 -0
- package/esm/date-picker/base/base-date-picker.js +24 -0
- package/esm/date-picker/date-picker-core.d.ts +3 -0
- package/esm/date-picker/date-picker-core.js +20 -0
- package/esm/date-range-picker/date-range-picker-constants.d.ts +3 -0
- package/esm/date-range-picker/date-range-picker-constants.js +1 -0
- package/esm/date-range-picker/date-range-picker-core.d.ts +3 -0
- package/esm/date-range-picker/date-range-picker-core.js +62 -2
- package/esm/date-range-picker/date-range-picker.d.ts +3 -0
- package/esm/date-range-picker/date-range-picker.js +3 -0
- package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
- package/esm/tabs/tab-bar/tab-bar-core.d.ts +1 -0
- package/esm/tabs/tab-bar/tab-bar-core.js +27 -30
- package/esm/toolbar/toolbar.js +1 -1
- package/package.json +1 -1
- package/sass/calendar/_mixins.scss +3 -2
- package/sass/toolbar/_core.scss +5 -0
- package/sass/toolbar/toolbar.scss +4 -0
|
@@ -18,6 +18,9 @@ export class CalendarCore {
|
|
|
18
18
|
this._month = new Date().getMonth();
|
|
19
19
|
this._year = new Date().getFullYear();
|
|
20
20
|
this._showToday = true;
|
|
21
|
+
this._showYesterday = true;
|
|
22
|
+
this._showLastSevenDays = true;
|
|
23
|
+
this._showLastThirtyDays = true;
|
|
21
24
|
this._showOtherMonths = false;
|
|
22
25
|
this._fixedHeight = false;
|
|
23
26
|
this._events = [];
|
|
@@ -40,6 +43,9 @@ export class CalendarCore {
|
|
|
40
43
|
this._showHeader = true;
|
|
41
44
|
this._clearButton = false;
|
|
42
45
|
this._todayButton = false;
|
|
46
|
+
this._yesterdayButton = false;
|
|
47
|
+
this._lastSevenDaysButton = false;
|
|
48
|
+
this._lastThirtyDaysButton = false;
|
|
43
49
|
// Menu
|
|
44
50
|
this._view = 'date';
|
|
45
51
|
this._menuAnimation = 'scale';
|
|
@@ -66,6 +72,9 @@ export class CalendarCore {
|
|
|
66
72
|
this._preventFocusListener = evt => evt.preventDefault();
|
|
67
73
|
this._previousButtonListener = () => this._onPreviousButtonClicked();
|
|
68
74
|
this._todayButtonListener = () => this._onTodayClicked();
|
|
75
|
+
this._yesterdayButtonListener = () => this._onYesterdayClicked();
|
|
76
|
+
this._lastSevenDaysButtonListener = () => this._onLastSevenDaysClicked();
|
|
77
|
+
this._lastThirtyDaysButtonListener = () => this._onLastThirtyDaysClicked();
|
|
69
78
|
this._yearButtonListener = () => this._onYearButtonClicked();
|
|
70
79
|
}
|
|
71
80
|
initialize() {
|
|
@@ -77,6 +86,9 @@ export class CalendarCore {
|
|
|
77
86
|
this._applyFixedHeight();
|
|
78
87
|
this._applyReadOnly();
|
|
79
88
|
this._applyShowToday();
|
|
89
|
+
this._applyShowYesterday();
|
|
90
|
+
this._applyShowLastSevenDays();
|
|
91
|
+
this._applyShowLastThirtyDays();
|
|
80
92
|
this._applyPreventFocus();
|
|
81
93
|
this._applyShowHeader();
|
|
82
94
|
this._applyMonth();
|
|
@@ -86,6 +98,9 @@ export class CalendarCore {
|
|
|
86
98
|
this._applyLocale();
|
|
87
99
|
this._applyClearButton();
|
|
88
100
|
this._applyTodayButton();
|
|
101
|
+
this._applyYesterdayButton();
|
|
102
|
+
this._applyLastSevenDaysButton();
|
|
103
|
+
this._applyLastThirtyDaysButton();
|
|
89
104
|
this._applyFirstDayOfWeek();
|
|
90
105
|
this._applyShowOtherMonths();
|
|
91
106
|
this._createDateView();
|
|
@@ -415,6 +430,15 @@ export class CalendarCore {
|
|
|
415
430
|
_onTodayClicked() {
|
|
416
431
|
this.today();
|
|
417
432
|
}
|
|
433
|
+
_onYesterdayClicked() {
|
|
434
|
+
this.yesterday();
|
|
435
|
+
}
|
|
436
|
+
_onLastSevenDaysClicked() {
|
|
437
|
+
this.lastSevenDays();
|
|
438
|
+
}
|
|
439
|
+
_onLastThirtyDaysClicked() {
|
|
440
|
+
this.lastThirtyDays();
|
|
441
|
+
}
|
|
418
442
|
/** Attempts to the month and year of the value in single mode, then emits a selection event */
|
|
419
443
|
_trySetValueMonthAndYear(month, year, type = 'date') {
|
|
420
444
|
if (!this.selectionFollowsMonth || this._mode !== 'single' || !this._value?.length) {
|
|
@@ -1360,7 +1384,7 @@ export class CalendarCore {
|
|
|
1360
1384
|
if (!this._clearButton) {
|
|
1361
1385
|
this._adapter.unregisterClearButtonListener(this._clearButtonListener);
|
|
1362
1386
|
this._adapter.removeClearButton();
|
|
1363
|
-
if (!this._todayButton) {
|
|
1387
|
+
if (!this._todayButton && !this._yesterdayButton && !this._lastSevenDaysButton && !this._lastThirtyDaysButton) {
|
|
1364
1388
|
this._adapter.removeFooter();
|
|
1365
1389
|
}
|
|
1366
1390
|
}
|
|
@@ -1657,7 +1681,7 @@ export class CalendarCore {
|
|
|
1657
1681
|
if (!this._todayButton) {
|
|
1658
1682
|
this._adapter.unregisterTodayButtonListener(this._todayButtonListener);
|
|
1659
1683
|
this._adapter.removeTodayButton();
|
|
1660
|
-
if (!this._clearButton) {
|
|
1684
|
+
if (!this._clearButton && !this._yesterdayButton && !this._lastSevenDaysButton && !this._lastThirtyDaysButton) {
|
|
1661
1685
|
this._adapter.removeFooter();
|
|
1662
1686
|
}
|
|
1663
1687
|
}
|
|
@@ -1667,6 +1691,63 @@ export class CalendarCore {
|
|
|
1667
1691
|
this._adapter.registerTodayButtonListener(this._todayButtonListener);
|
|
1668
1692
|
}
|
|
1669
1693
|
}
|
|
1694
|
+
_applyShowYesterday() {
|
|
1695
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.SHOW_YESTERDAY, this._showYesterday);
|
|
1696
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.SHOW_YESTERDAY, this._showYesterday);
|
|
1697
|
+
}
|
|
1698
|
+
_applyYesterdayButton() {
|
|
1699
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.YESTERDAY_BUTTON, true, this._yesterdayButton.toString());
|
|
1700
|
+
if (!this._yesterdayButton) {
|
|
1701
|
+
this._adapter.unregisterYesterdayButtonListener(this._yesterdayButtonListener);
|
|
1702
|
+
this._adapter.removeYesterdayButton();
|
|
1703
|
+
if (!this._clearButton && !this._todayButton && !this._lastSevenDaysButton && !this._lastThirtyDaysButton) {
|
|
1704
|
+
this._adapter.removeFooter();
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
else {
|
|
1708
|
+
this._adapter.setFooter();
|
|
1709
|
+
this._adapter.setYesterdayButton();
|
|
1710
|
+
this._adapter.registerYesterdayButtonListener(this._yesterdayButtonListener);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
_applyShowLastSevenDays() {
|
|
1714
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.SHOW_LAST_SEVEN_DAYS, this._showLastSevenDays);
|
|
1715
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.SHOW_LAST_SEVEN_DAYS, this._showLastSevenDays);
|
|
1716
|
+
}
|
|
1717
|
+
_applyLastSevenDaysButton() {
|
|
1718
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.LAST_SEVEN_DAYS_BUTTON, true, this._lastSevenDaysButton.toString());
|
|
1719
|
+
if (!this._lastSevenDaysButton) {
|
|
1720
|
+
this._adapter.unregisterLastSevenDaysButtonListener(this._lastSevenDaysButtonListener);
|
|
1721
|
+
this._adapter.removeLastSevenDaysButton();
|
|
1722
|
+
if (!this._clearButton && !this._todayButton && !this._yesterdayButton) {
|
|
1723
|
+
this._adapter.removeFooter();
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
else {
|
|
1727
|
+
this._adapter.setFooter();
|
|
1728
|
+
this._adapter.setLastSevenDaysButton();
|
|
1729
|
+
this._adapter.registerLastSevenDaysButtonListener(this._lastSevenDaysButtonListener);
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
_applyShowLastThirtyDays() {
|
|
1733
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.SHOW_LAST_THIRTY_DAYS, this._showLastThirtyDays);
|
|
1734
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.SHOW_LAST_THIRTY_DAYS, this._showLastThirtyDays);
|
|
1735
|
+
}
|
|
1736
|
+
_applyLastThirtyDaysButton() {
|
|
1737
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.LAST_THIRTY_DAYS_BUTTON, true, this._lastThirtyDaysButton.toString());
|
|
1738
|
+
if (!this._lastThirtyDaysButton) {
|
|
1739
|
+
this._adapter.unregisterLastThirtyDaysButtonListener(this._lastThirtyDaysButtonListener);
|
|
1740
|
+
this._adapter.removeLastThirtyDaysButton();
|
|
1741
|
+
if (!this._clearButton && !this._todayButton && !this._yesterdayButton && !this.lastSevenDaysButton) {
|
|
1742
|
+
this._adapter.removeFooter();
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
else {
|
|
1746
|
+
this._adapter.setFooter();
|
|
1747
|
+
this._adapter.setLastThirtyDaysButton();
|
|
1748
|
+
this._adapter.registerLastThirtyDaysButtonListener(this._lastThirtyDaysButtonListener);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1670
1751
|
_applyTooltipBuilder() {
|
|
1671
1752
|
if (this._view === 'date') {
|
|
1672
1753
|
this._dates.forEach(d => {
|
|
@@ -2065,6 +2146,99 @@ export class CalendarCore {
|
|
|
2065
2146
|
set todayCallback(value) {
|
|
2066
2147
|
this._todayCallback = value;
|
|
2067
2148
|
}
|
|
2149
|
+
/** Get/set show yesterday */
|
|
2150
|
+
get showYesterday() {
|
|
2151
|
+
return this._showYesterday;
|
|
2152
|
+
}
|
|
2153
|
+
set showYesterday(value) {
|
|
2154
|
+
if (this._showYesterday !== value) {
|
|
2155
|
+
this._showYesterday = value;
|
|
2156
|
+
if (this._isInitialized) {
|
|
2157
|
+
this._applyShowYesterday();
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
/** Get/set whether to show the yesterday button */
|
|
2162
|
+
get yesterdayButton() {
|
|
2163
|
+
return this._yesterdayButton;
|
|
2164
|
+
}
|
|
2165
|
+
set yesterdayButton(value) {
|
|
2166
|
+
if (this._yesterdayButton !== value) {
|
|
2167
|
+
this._yesterdayButton = value;
|
|
2168
|
+
if (this._isInitialized) {
|
|
2169
|
+
this._applyYesterdayButton();
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
/* Get/set the yesterday button callback */
|
|
2174
|
+
get yesterdayCallback() {
|
|
2175
|
+
return this._yesterdayCallback;
|
|
2176
|
+
}
|
|
2177
|
+
set yesterdayCallback(value) {
|
|
2178
|
+
this._yesterdayCallback = value;
|
|
2179
|
+
}
|
|
2180
|
+
/** Get/set show last seven days */
|
|
2181
|
+
get showLastSevenDays() {
|
|
2182
|
+
return this._showLastSevenDays;
|
|
2183
|
+
}
|
|
2184
|
+
set showLastSevenDays(value) {
|
|
2185
|
+
if (this._showLastSevenDays !== value) {
|
|
2186
|
+
this._showLastSevenDays = value;
|
|
2187
|
+
if (this._isInitialized) {
|
|
2188
|
+
this._applyShowLastSevenDays();
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
/** Get/set whether to show the last seven days button */
|
|
2193
|
+
get lastSevenDaysButton() {
|
|
2194
|
+
return this._lastSevenDaysButton;
|
|
2195
|
+
}
|
|
2196
|
+
set lastSevenDaysButton(value) {
|
|
2197
|
+
if (this._lastSevenDaysButton !== value) {
|
|
2198
|
+
this._lastSevenDaysButton = value;
|
|
2199
|
+
if (this._isInitialized) {
|
|
2200
|
+
this._applyLastSevenDaysButton();
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
/* Get/set the last seven days button callback */
|
|
2205
|
+
get lastSevenDaysCallback() {
|
|
2206
|
+
return this._lastSevenDaysCallback;
|
|
2207
|
+
}
|
|
2208
|
+
set lastSevenDaysCallback(value) {
|
|
2209
|
+
this._lastSevenDaysCallback = value;
|
|
2210
|
+
}
|
|
2211
|
+
/** Get/set show last thirty days */
|
|
2212
|
+
get showLastThirtyDays() {
|
|
2213
|
+
return this._showLastThirtyDays;
|
|
2214
|
+
}
|
|
2215
|
+
set showLastThirtyDays(value) {
|
|
2216
|
+
if (this._showLastThirtyDays !== value) {
|
|
2217
|
+
this._showLastThirtyDays = value;
|
|
2218
|
+
if (this._isInitialized) {
|
|
2219
|
+
this._applyShowLastThirtyDays();
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
/** Get/set whether to show the last thirty days button */
|
|
2224
|
+
get lastThirtyDaysButton() {
|
|
2225
|
+
return this._lastThirtyDaysButton;
|
|
2226
|
+
}
|
|
2227
|
+
set lastThirtyDaysButton(value) {
|
|
2228
|
+
if (this._lastThirtyDaysButton !== value) {
|
|
2229
|
+
this._lastThirtyDaysButton = value;
|
|
2230
|
+
if (this._isInitialized) {
|
|
2231
|
+
this._applyLastThirtyDaysButton();
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
/* Get/set the last thirty days button callback */
|
|
2236
|
+
get lastThirtyDaysCallback() {
|
|
2237
|
+
return this._lastThirtyDaysCallback;
|
|
2238
|
+
}
|
|
2239
|
+
set lastThirtyDaysCallback(value) {
|
|
2240
|
+
this._lastThirtyDaysCallback = value;
|
|
2241
|
+
}
|
|
2068
2242
|
/** Get/set the tooltip builder */
|
|
2069
2243
|
get tooltipBuilder() {
|
|
2070
2244
|
return this._tooltipBuilder;
|
|
@@ -2213,11 +2387,55 @@ export class CalendarCore {
|
|
|
2213
2387
|
today() {
|
|
2214
2388
|
const today = new Date();
|
|
2215
2389
|
today.setHours(0, 0, 0, 0);
|
|
2390
|
+
const endOfToday = new Date();
|
|
2391
|
+
endOfToday.setHours(23, 59, 59, 0);
|
|
2216
2392
|
this._goToDate(today, true);
|
|
2217
2393
|
if (this._todayCallback) {
|
|
2218
2394
|
this._todayCallback();
|
|
2219
2395
|
}
|
|
2220
2396
|
}
|
|
2397
|
+
/** Go to yesterday */
|
|
2398
|
+
yesterday() {
|
|
2399
|
+
const today = new Date();
|
|
2400
|
+
const yesterdayFrom = new Date(today.setDate(today.getDate() - 1));
|
|
2401
|
+
yesterdayFrom.setHours(0, 0, 0, 0);
|
|
2402
|
+
const yesterdayTo = new Date(yesterdayFrom);
|
|
2403
|
+
yesterdayTo.setHours(23, 59, 59, 0);
|
|
2404
|
+
const dateRange = [yesterdayFrom, yesterdayTo];
|
|
2405
|
+
this._adapter.setRange(dateRange);
|
|
2406
|
+
this._goToDate(yesterdayFrom, true);
|
|
2407
|
+
if (this._yesterdayCallback) {
|
|
2408
|
+
this._yesterdayCallback();
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
/** Go to last seven days */
|
|
2412
|
+
lastSevenDays() {
|
|
2413
|
+
const today = new Date();
|
|
2414
|
+
const lastSevenDaysFrom = new Date(today.setDate(today.getDate() - 7));
|
|
2415
|
+
lastSevenDaysFrom.setHours(0, 0, 0, 0);
|
|
2416
|
+
const lastSevenDaysTo = new Date();
|
|
2417
|
+
lastSevenDaysTo.setHours(23, 59, 59, 0);
|
|
2418
|
+
const dateRange = [lastSevenDaysFrom, lastSevenDaysTo];
|
|
2419
|
+
this._adapter.setRange(dateRange);
|
|
2420
|
+
this._applyValue(dateRange);
|
|
2421
|
+
if (this._lastSevenDaysCallback) {
|
|
2422
|
+
this._lastSevenDaysCallback();
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
/** Go to last thirty days */
|
|
2426
|
+
lastThirtyDays() {
|
|
2427
|
+
const today = new Date();
|
|
2428
|
+
const lastThirtyDaysFrom = new Date(today.setDate(today.getDate() - 30));
|
|
2429
|
+
lastThirtyDaysFrom.setHours(0, 0, 0, 0);
|
|
2430
|
+
const lastThirtyDaysTo = new Date();
|
|
2431
|
+
lastThirtyDaysTo.setHours(23, 59, 59, 0);
|
|
2432
|
+
const dateRange = [lastThirtyDaysFrom, lastThirtyDaysTo];
|
|
2433
|
+
this._adapter.setRange(dateRange);
|
|
2434
|
+
this._applyValue(dateRange);
|
|
2435
|
+
if (this._lastThirtyDaysCallback) {
|
|
2436
|
+
this._lastThirtyDaysCallback();
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2221
2439
|
/** Toggles a date selected or unselected */
|
|
2222
2440
|
toggleDate(date, force) {
|
|
2223
2441
|
this._onDateSelected(date);
|
|
@@ -38,6 +38,12 @@ export declare function getFooter(): HTMLElement;
|
|
|
38
38
|
export declare function getClearButton(): HTMLElement;
|
|
39
39
|
/** Returns a today button. */
|
|
40
40
|
export declare function getTodayButton(): HTMLElement;
|
|
41
|
+
/** Returns a yesterday button. */
|
|
42
|
+
export declare function getYesterdayButton(): HTMLElement;
|
|
43
|
+
/** Returns a last seven days button. */
|
|
44
|
+
export declare function getLastSevenDaysButton(): HTMLElement;
|
|
45
|
+
/** Returns a last thirty days button. */
|
|
46
|
+
export declare function getLastThirtyDaysButton(): HTMLElement;
|
|
41
47
|
/** Checks whether an event originated from a date element, returning the element if it did. */
|
|
42
48
|
export declare function eventIncludesDate(evt: Event, includeDisabled?: boolean): HTMLElement | null;
|
|
43
49
|
/** Checks whether an event originated from an element with the given id, returning the element if it did. */
|
|
@@ -270,6 +270,42 @@ export function getTodayButton() {
|
|
|
270
270
|
todayButton.appendChild(slot);
|
|
271
271
|
return todayButton;
|
|
272
272
|
}
|
|
273
|
+
/** Returns a yesterday button. */
|
|
274
|
+
export function getYesterdayButton() {
|
|
275
|
+
const yesterdayButton = document.createElement('forge-button');
|
|
276
|
+
yesterdayButton.id = CALENDAR_CONSTANTS.ids.YESTERDAY_BUTTON;
|
|
277
|
+
yesterdayButton.setAttribute('part', CALENDAR_CONSTANTS.parts.YESTERDAY_BUTTON);
|
|
278
|
+
yesterdayButton.type = 'button';
|
|
279
|
+
const slot = document.createElement('slot');
|
|
280
|
+
slot.name = CALENDAR_CONSTANTS.slots.YESTERDAY_BUTTON_TEXT;
|
|
281
|
+
slot.innerText = CALENDAR_CONSTANTS.strings.DEFAULT_YESTERDAY_BUTTON_TEXT;
|
|
282
|
+
yesterdayButton.appendChild(slot);
|
|
283
|
+
return yesterdayButton;
|
|
284
|
+
}
|
|
285
|
+
/** Returns a last seven days button. */
|
|
286
|
+
export function getLastSevenDaysButton() {
|
|
287
|
+
const lastSevenDaysButton = document.createElement('forge-button');
|
|
288
|
+
lastSevenDaysButton.id = CALENDAR_CONSTANTS.ids.LAST_SEVEN_DAYS_BUTTON;
|
|
289
|
+
lastSevenDaysButton.setAttribute('part', CALENDAR_CONSTANTS.parts.LAST_SEVEN_DAYS_BUTTON);
|
|
290
|
+
lastSevenDaysButton.type = 'button';
|
|
291
|
+
const slot = document.createElement('slot');
|
|
292
|
+
slot.name = CALENDAR_CONSTANTS.slots.LAST_SEVEN_DAYS_BUTTON_TEXT;
|
|
293
|
+
slot.innerText = CALENDAR_CONSTANTS.strings.DEFAULT_LAST_SEVEN_DAYS_BUTTON_TEXT;
|
|
294
|
+
lastSevenDaysButton.appendChild(slot);
|
|
295
|
+
return lastSevenDaysButton;
|
|
296
|
+
}
|
|
297
|
+
/** Returns a last thirty days button. */
|
|
298
|
+
export function getLastThirtyDaysButton() {
|
|
299
|
+
const lastThirtyDaysButton = document.createElement('forge-button');
|
|
300
|
+
lastThirtyDaysButton.id = CALENDAR_CONSTANTS.ids.LAST_THIRTY_DAYS_BUTTON;
|
|
301
|
+
lastThirtyDaysButton.setAttribute('part', CALENDAR_CONSTANTS.parts.LAST_THIRTY_DAYS_BUTTON);
|
|
302
|
+
lastThirtyDaysButton.type = 'button';
|
|
303
|
+
const slot = document.createElement('slot');
|
|
304
|
+
slot.name = CALENDAR_CONSTANTS.slots.LAST_THIRTY_DAYS_BUTTON_TEXT;
|
|
305
|
+
slot.innerText = CALENDAR_CONSTANTS.strings.DEFAULT_LAST_THIRTY_DAYS_BUTTON_TEXT;
|
|
306
|
+
lastThirtyDaysButton.appendChild(slot);
|
|
307
|
+
return lastThirtyDaysButton;
|
|
308
|
+
}
|
|
273
309
|
/** Checks whether an event originated from a date element, returning the element if it did. */
|
|
274
310
|
export function eventIncludesDate(evt, includeDisabled) {
|
|
275
311
|
const element = getEventPath(evt).find(p => p.classList && p.classList.contains(CALENDAR_CONSTANTS.classes.DATE));
|
|
@@ -17,11 +17,20 @@ export interface ICalendarComponent extends ICalendarBase, IBaseComponent {
|
|
|
17
17
|
menuAnimation: CalendarMenuAnimationType;
|
|
18
18
|
clearButton: boolean;
|
|
19
19
|
todayButton: boolean;
|
|
20
|
+
yesterdayButton: boolean;
|
|
21
|
+
lastSevenDaysButton: boolean;
|
|
22
|
+
lastThirtyDaysButton: boolean;
|
|
20
23
|
clearCallback: (() => void) | undefined;
|
|
21
24
|
todayCallback: (() => void) | undefined;
|
|
25
|
+
yesterdayCallback: (() => void) | undefined;
|
|
26
|
+
lastSevenDaysCallback: (() => void) | undefined;
|
|
27
|
+
lastThirtyDaysCallback: (() => void) | undefined;
|
|
22
28
|
tooltipBuilder: CalendarTooltipBuilder | undefined;
|
|
23
29
|
clear(): void;
|
|
24
30
|
today(): void;
|
|
31
|
+
yesterday(): void;
|
|
32
|
+
lastSevenDays(): void;
|
|
33
|
+
lastThirtyDays(): void;
|
|
25
34
|
selectDate(date: Date, setFocus?: boolean): void;
|
|
26
35
|
deselectDate(date: Date): void;
|
|
27
36
|
toggleDate(date: Date, force?: boolean): void;
|
|
@@ -74,6 +83,15 @@ declare global {
|
|
|
74
83
|
* @property {boolean} [showToday=true] - Whether to show the today button.
|
|
75
84
|
* @property {boolean} [todayButton=false] - Whether to show a button to select today.
|
|
76
85
|
* @property {() => void | undefined} todayCallback - Callback function to call when the today button is clicked.
|
|
86
|
+
* @property {boolean} [showYesterday=true] - Whether to show the yesterday button.
|
|
87
|
+
* @property {boolean} [yesterdayButton=false] - Whether to show a button to select yesterday.
|
|
88
|
+
* @property {() => void | undefined} yesterdayCallback - Callback function to call when the yesterday button is clicked.
|
|
89
|
+
* @property {boolean} [showLastSevenDays=true] - Whether to show the last seven days button.
|
|
90
|
+
* @property {boolean} [lastSevenDaysButton=false] - Whether to show a button to select last seven days.
|
|
91
|
+
* @property {() => void | undefined} lastSevenDaysCallback - Callback function to call when the last seven days button is clicked.
|
|
92
|
+
* @property {boolean} [showLastThirtyDays=true] - Whether to show the last thirty days button.
|
|
93
|
+
* @property {boolean} [lastThirtyDaysButton=false] - Whether to show a button to select last thirty days.
|
|
94
|
+
* @property {() => void | undefined} lastThirtyDaysCallback - Callback function to call when the last thirty days button is clicked.
|
|
77
95
|
* @property {CalendarTooltipBuilder | undefined} tooltipBuilder - Function to build the tooltip content.
|
|
78
96
|
* @property {Date | Date[] | DateRange | null | undefined} [value=[]] - The selected date(s).
|
|
79
97
|
* @property {CalendarView} [view="date"] - The view of the calendar.
|
|
@@ -99,7 +117,13 @@ declare global {
|
|
|
99
117
|
* @attribute {boolean} [show-header=true] - Whether to show the header.
|
|
100
118
|
* @attribute {boolean} [show-other-months=false] - Whether to show days from other months.
|
|
101
119
|
* @attribute {boolean} [show-today=true] - Whether to show the today button.
|
|
102
|
-
* @attribute {boolean} [today-button=
|
|
120
|
+
* @attribute {boolean} [today-button=false] - Whether to show a button to select today.
|
|
121
|
+
* @attribute {boolean} [show-yesterday=true] - Whether to show the yesterday button.
|
|
122
|
+
* @attribute {boolean} [yesterday-button=false] - Whether to show a button to select yesterday.
|
|
123
|
+
* @attribute {boolean} [show-last-seven-days=true] - Whether to show the last seven days button.
|
|
124
|
+
* @attribute {boolean} [last-seven-days-button=false] - Whether to show a button to select last seven days.
|
|
125
|
+
* @attribute {boolean} [show-last-thirty-days=true] - Whether to show the last thirty days button.
|
|
126
|
+
* @attribute {boolean} [last-thirty-days-button=false] - Whether to show a button to select last thirty days.
|
|
103
127
|
* @attribute {CalendarView} [view="date"] - The view of the calendar.
|
|
104
128
|
* @attribute {number} [year=<current year>] - The year to display.
|
|
105
129
|
* @attribute {string} [year-range="-50:+50"] - The range of years to display.
|
|
@@ -110,6 +134,9 @@ declare global {
|
|
|
110
134
|
* @fires {CustomEvent<CalendarView>} forge-calendar-view-change - Event fired when the view changes.
|
|
111
135
|
*
|
|
112
136
|
* @slot today-button-text - Text to display in the today button.
|
|
137
|
+
* @slot yesterday-button-text - Text to display in the yesterday button.
|
|
138
|
+
* @slot last-seven-days-button-text - Text to display in the last seven days button.
|
|
139
|
+
* @slot last-thirty-days-button-text - Text to display in the last thirty days button.
|
|
113
140
|
* @slot clear-button-text - Text to display in the clear button.
|
|
114
141
|
* @slot next-month-button-text - Text to display in the next month button's tooltip.
|
|
115
142
|
* @slot previous-month-button-text - Text to display in the previous month button's tooltip.
|
|
@@ -156,6 +183,15 @@ export declare class CalendarComponent extends BaseComponent implements ICalenda
|
|
|
156
183
|
showToday: boolean;
|
|
157
184
|
todayButton: boolean;
|
|
158
185
|
todayCallback: (() => void) | undefined;
|
|
186
|
+
showYesterday: boolean;
|
|
187
|
+
yesterdayButton: boolean;
|
|
188
|
+
yesterdayCallback: (() => void) | undefined;
|
|
189
|
+
showLastSevenDays: boolean;
|
|
190
|
+
lastSevenDaysButton: boolean;
|
|
191
|
+
lastSevenDaysCallback: (() => void) | undefined;
|
|
192
|
+
showLastThirtyDays: boolean;
|
|
193
|
+
lastThirtyDaysButton: boolean;
|
|
194
|
+
lastThirtyDaysCallback: (() => void) | undefined;
|
|
159
195
|
tooltipBuilder: CalendarTooltipBuilder | undefined;
|
|
160
196
|
value: Date | Date[] | DateRange | null | undefined;
|
|
161
197
|
view: CalendarView;
|
|
@@ -194,6 +230,9 @@ export declare class CalendarComponent extends BaseComponent implements ICalenda
|
|
|
194
230
|
* Sets the calendar to today.
|
|
195
231
|
*/
|
|
196
232
|
today(): void;
|
|
233
|
+
yesterday(): void;
|
|
234
|
+
lastSevenDays(): void;
|
|
235
|
+
lastThirtyDays(): void;
|
|
197
236
|
/**
|
|
198
237
|
* Toggles a date selection.
|
|
199
238
|
*/
|
package/esm/calendar/calendar.js
CHANGED
|
@@ -18,7 +18,7 @@ import { StateLayerComponent } from '../state-layer';
|
|
|
18
18
|
import { FocusIndicatorComponent } from '../focus-indicator';
|
|
19
19
|
import { BaseComponent } from '../core/base/base-component';
|
|
20
20
|
const template = '<template><div class=\"forge-calendar\" part=\"root\"><div id=\"view\" class=\"forge-calendar__view\" part=\"view\"><div id=\"date-view\" class=\"forge-calendar__date-view\" role=\"grid\" part=\"date-view\"><div role=\"rowgroup\" part=\"date-view-container\"><div id=\"day-row\" class=\"forge-calendar__date-view__row\" role=\"row\" part=\"date-view-row\"></div></div><div id=\"date-grid\" class=\"forge-calendar__date-grid\" role=\"rowgroup\" part=\"date-grid-container\"></div></div><forge-calendar-menu id=\"menu\" part=\"calendar-menu\"></forge-calendar-menu></div></div></template>';
|
|
21
|
-
const styles = '.forge-calendar{width:var(--forge-calendar-width,100%);height:fit-content;position:relative}.forge-calendar__header{padding:var(--forge-calendar-controls-padding,0);display:flex;align-items:center;justify-content:space-between}.forge-calendar__footer{padding:var(--forge-calendar-controls-padding,0);display:
|
|
21
|
+
const styles = '.forge-calendar{width:var(--forge-calendar-width,100%);height:fit-content;position:relative}.forge-calendar__header{padding:var(--forge-calendar-controls-padding,0);display:flex;align-items:center;justify-content:space-between}.forge-calendar__footer{padding:var(--forge-calendar-controls-padding,0);display:grid;grid-template-columns:33% 33% 33%;grid-auto-flow:row;justify-content:space-between}.forge-calendar__view{position:relative}.forge-calendar__date-view{display:block}.forge-calendar__date-view__row{display:grid;grid-template-columns:repeat(7,1fr)}.forge-calendar__date-grid{display:grid}.forge-calendar__day{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label2-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-label2-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .8125)));font-weight:var(--forge-typography-label2-font-weight,400);line-height:var(--forge-typography-label2-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label2-letter-spacing, .0096153846em);text-transform:var(--forge-typography-label2-text-transform,inherit);text-decoration:var(--forge-typography-label2-text-decoration,inherit);display:flex;justify-content:center;align-items:center;min-width:0;padding:0;font-weight:700;user-select:none}.forge-calendar__day::after{float:left;padding-top:100%;content:\"\"}.forge-calendar__date{margin-top:var(--forge-calendar-row-gap,2px);min-width:0;padding:0;border-radius:50%;position:relative;outline:0;cursor:default;user-select:none}.forge-calendar__date::after{float:left;padding-top:100%;content:\"\"}.forge-calendar__date forge-focus-indicator{--forge-focus-indicator-shape:50%}.forge-calendar__date__inner{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-body1-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-body1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-font-size-scale, .875)));font-weight:var(--forge-typography-body1-font-weight,400);line-height:var(--forge-typography-body1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-line-height-scale, 1.125)));letter-spacing:var(--forge-typography-body1-letter-spacing, .0357142857em);text-transform:var(--forge-typography-body1-text-transform,inherit);text-decoration:var(--forge-typography-body1-text-decoration,inherit);position:absolute;width:calc(100% - 2px);height:calc(100% - 2px);top:calc(2px / 2);left:calc(2px / 2);display:flex;justify-content:center;align-items:center;border-radius:inherit;box-sizing:border-box}.forge-calendar--show-today .forge-calendar__date--today:not([disabled]){color:var(--forge-theme-primary,#3f51b5);border-color:var(--forge-theme-primary,#3f51b5)}.forge-calendar--show-today .forge-calendar__date--today .forge-calendar__date__inner{border-color:inherit;border-width:1px;border-style:solid;font-weight:700}.forge-calendar--show-today .forge-calendar__date--today.forge-calendar__date--selected{color:var(--forge-theme-on-primary,#fff)}.forge-calendar:not(.forge-calendar--readonly) .forge-calendar__date:not([disabled]){cursor:pointer}.forge-calendar__date--selected:not([disabled]) .forge-calendar__date__inner{background-color:var(--forge-theme-primary,#3f51b5);color:var(--forge-theme-on-primary,#fff)}.forge-calendar__date--selected[disabled] .forge-calendar__date__inner{background-color:var(--forge-theme-primary-container-minimum,#f7f8fc);color:var(--forge-theme-text-low,rgba(0,0,0,.38))}.forge-calendar__date--selected forge-focus-indicator{--forge-focus-indicator-color:var(--forge-theme-primary-container)}.forge-calendar__date[disabled]{color:var(--forge-theme-text-low,rgba(0,0,0,.38))}.forge-calendar__date-spacer{pointer-events:none}.forge-calendar--fixed-height .forge-calendar__date-spacer{margin-top:var(--forge-calendar-row-gap,2px)}.forge-calendar--fixed-height .forge-calendar__date-spacer::after{float:left;padding-top:100%;content:\"\"}.forge-calendar__range:not(.forge-calendar__date-spacer) .forge-calendar__range__target{background-color:var(--forge-theme-primary,#3f51b5);position:absolute;width:100%;height:100%;opacity:.14;border-radius:0}.forge-calendar__range:not(.forge-calendar__date-spacer).forge-calendar__range--start .forge-calendar__range__target{border-top-left-radius:50%;border-bottom-left-radius:50%}.forge-calendar__range:not(.forge-calendar__date-spacer).forge-calendar__range--end .forge-calendar__range__target{border-top-right-radius:50%;border-bottom-right-radius:50%}.forge-calendar__range:not(.forge-calendar__range--start):first-of-type .forge-calendar__range__target{border-top-left-radius:4px;border-bottom-left-radius:4px}.forge-calendar__range:not(.forge-calendar__range--end):last-of-type .forge-calendar__range__target{border-top-right-radius:4px;border-bottom-right-radius:4px}.forge-calendar--allow-single-date-range .forge-calendar__range--start.forge-calendar__range--end .forge-calendar__range__target{transition:transform .2s;transform:scale(1.15);transform-origin:center}.forge-calendar__event{font-size:var(--forge-calendar-event-dot-size, 12px)}.forge-calendar__event[data-event-theme=primary]{color:var(--forge-calendar-theme-event-primary-accent,#3f51b5)}.forge-calendar__event[data-event-theme=secondary]{color:var(--forge-calendar-theme-event-secondary-accent,#ffc107)}.forge-calendar__event[data-event-theme=blue]{color:var(--forge-calendar-theme-event-blue-accent,#2196f3)}.forge-calendar__event[data-event-theme=light-green]{color:var(--forge-calendar-theme-event-light-green-accent,#8bc34a)}.forge-calendar__event[data-event-theme=cyan]{color:var(--forge-calendar-theme-event-cyan-accent,#00bcd4)}.forge-calendar__event[data-event-theme=teal]{color:var(--forge-calendar-theme-event-teal-accent,#009688)}.forge-calendar__event[data-event-theme=orange]{color:var(--forge-calendar-theme-event-orange-accent,#ff9800)}.forge-calendar__event[data-event-theme=blue-grey]{color:var(--forge-calendar-theme-event-blue-grey-accent,#607d8b)}.forge-calendar__event[data-event-theme=grey]{color:var(--forge-calendar-theme-event-grey-accent,#9e9e9e)}.forge-calendar__event[data-event-theme=red]{color:var(--forge-calendar-theme-event-red-accent,#f44336)}.forge-calendar__event[data-event-theme=pink]{color:var(--forge-calendar-theme-event-pink-accent,#e91e63)}.forge-calendar__event[data-event-theme=purple]{color:var(--forge-calendar-theme-event-purple-accent,#9c27b0)}.forge-calendar__event[data-event-theme=light-blue]{color:var(--forge-calendar-theme-event-light-blue-accent,#03a9f4)}.forge-calendar__event[data-event-theme=deep-purple]{color:var(--forge-calendar-theme-event-deep-purple-accent,#673ab7)}.forge-calendar__event[data-event-theme=green]{color:var(--forge-calendar-theme-event-green-accent,#4caf50)}.forge-calendar__event[data-event-theme=lime]{color:var(--forge-calendar-theme-event-lime-accent,#cddc39)}.forge-calendar__event[data-event-theme=yellow]{color:var(--forge-calendar-theme-event-yellow-accent,#ffeb3b)}.forge-calendar__event[data-event-theme=brown]{color:var(--forge-calendar-theme-event-brown-accent,#795548)}.forge-calendar__event[data-event-theme=deep-orange]{color:var(--forge-calendar-theme-event-deep-orange-accent,#ff5722)}.forge-calendar__date[disabled] .forge-calendar__event{opacity:.14}.forge-calendar__event--overflow{background-color:var(--forge-theme-surface,#fff);color:var(--forge-theme-on-surface,#000);border-radius:50%}.forge-calendar__event__wrapper{display:flex;justify-content:center;gap:2px;position:absolute;bottom:0;left:0;width:100%;padding-bottom:2px;pointer-events:none}.forge-calendar__date-spacer .forge-calendar__event__wrapper{display:none}.forge-calendar--rtl .forge-calendar__header forge-icon-button forge-icon{transform:rotate(180deg)}#accessible-header{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:fixed;width:1px;outline:0;-webkit-appearance:none;-moz-appearance:none}#month-button forge-icon{transition:transform .2s}.forge-calendar--month-menu-open #month-button forge-icon{transform:rotate(180deg)}#year-button forge-icon{transition:transform .2s}.forge-calendar--year-menu-open #year-button forge-icon{transform:rotate(180deg)}:host{--forge-calendar-event-stroke-color:var(--forge-theme-surface, #ffffff);display:inline-block}:host([hidden]){display:none}:host([forge-popover-context=true]){--forge-calendar-event-stroke-color:var(--forge-theme-surface-bright, #ffffff)}';
|
|
22
22
|
/**
|
|
23
23
|
* @tag forge-calendar
|
|
24
24
|
*
|
|
@@ -52,6 +52,15 @@ const styles = '.forge-calendar{width:var(--forge-calendar-width,100%);height:fi
|
|
|
52
52
|
* @property {boolean} [showToday=true] - Whether to show the today button.
|
|
53
53
|
* @property {boolean} [todayButton=false] - Whether to show a button to select today.
|
|
54
54
|
* @property {() => void | undefined} todayCallback - Callback function to call when the today button is clicked.
|
|
55
|
+
* @property {boolean} [showYesterday=true] - Whether to show the yesterday button.
|
|
56
|
+
* @property {boolean} [yesterdayButton=false] - Whether to show a button to select yesterday.
|
|
57
|
+
* @property {() => void | undefined} yesterdayCallback - Callback function to call when the yesterday button is clicked.
|
|
58
|
+
* @property {boolean} [showLastSevenDays=true] - Whether to show the last seven days button.
|
|
59
|
+
* @property {boolean} [lastSevenDaysButton=false] - Whether to show a button to select last seven days.
|
|
60
|
+
* @property {() => void | undefined} lastSevenDaysCallback - Callback function to call when the last seven days button is clicked.
|
|
61
|
+
* @property {boolean} [showLastThirtyDays=true] - Whether to show the last thirty days button.
|
|
62
|
+
* @property {boolean} [lastThirtyDaysButton=false] - Whether to show a button to select last thirty days.
|
|
63
|
+
* @property {() => void | undefined} lastThirtyDaysCallback - Callback function to call when the last thirty days button is clicked.
|
|
55
64
|
* @property {CalendarTooltipBuilder | undefined} tooltipBuilder - Function to build the tooltip content.
|
|
56
65
|
* @property {Date | Date[] | DateRange | null | undefined} [value=[]] - The selected date(s).
|
|
57
66
|
* @property {CalendarView} [view="date"] - The view of the calendar.
|
|
@@ -77,7 +86,13 @@ const styles = '.forge-calendar{width:var(--forge-calendar-width,100%);height:fi
|
|
|
77
86
|
* @attribute {boolean} [show-header=true] - Whether to show the header.
|
|
78
87
|
* @attribute {boolean} [show-other-months=false] - Whether to show days from other months.
|
|
79
88
|
* @attribute {boolean} [show-today=true] - Whether to show the today button.
|
|
80
|
-
* @attribute {boolean} [today-button=
|
|
89
|
+
* @attribute {boolean} [today-button=false] - Whether to show a button to select today.
|
|
90
|
+
* @attribute {boolean} [show-yesterday=true] - Whether to show the yesterday button.
|
|
91
|
+
* @attribute {boolean} [yesterday-button=false] - Whether to show a button to select yesterday.
|
|
92
|
+
* @attribute {boolean} [show-last-seven-days=true] - Whether to show the last seven days button.
|
|
93
|
+
* @attribute {boolean} [last-seven-days-button=false] - Whether to show a button to select last seven days.
|
|
94
|
+
* @attribute {boolean} [show-last-thirty-days=true] - Whether to show the last thirty days button.
|
|
95
|
+
* @attribute {boolean} [last-thirty-days-button=false] - Whether to show a button to select last thirty days.
|
|
81
96
|
* @attribute {CalendarView} [view="date"] - The view of the calendar.
|
|
82
97
|
* @attribute {number} [year=<current year>] - The year to display.
|
|
83
98
|
* @attribute {string} [year-range="-50:+50"] - The range of years to display.
|
|
@@ -88,6 +103,9 @@ const styles = '.forge-calendar{width:var(--forge-calendar-width,100%);height:fi
|
|
|
88
103
|
* @fires {CustomEvent<CalendarView>} forge-calendar-view-change - Event fired when the view changes.
|
|
89
104
|
*
|
|
90
105
|
* @slot today-button-text - Text to display in the today button.
|
|
106
|
+
* @slot yesterday-button-text - Text to display in the yesterday button.
|
|
107
|
+
* @slot last-seven-days-button-text - Text to display in the last seven days button.
|
|
108
|
+
* @slot last-thirty-days-button-text - Text to display in the last thirty days button.
|
|
91
109
|
* @slot clear-button-text - Text to display in the clear button.
|
|
92
110
|
* @slot next-month-button-text - Text to display in the next month button's tooltip.
|
|
93
111
|
* @slot previous-month-button-text - Text to display in the previous month button's tooltip.
|
|
@@ -118,6 +136,12 @@ let CalendarComponent = class CalendarComponent extends BaseComponent {
|
|
|
118
136
|
CALENDAR_CONSTANTS.attributes.SHOW_OTHER_MONTHS,
|
|
119
137
|
CALENDAR_CONSTANTS.attributes.SHOW_TODAY,
|
|
120
138
|
CALENDAR_CONSTANTS.attributes.TODAY_BUTTON,
|
|
139
|
+
CALENDAR_CONSTANTS.attributes.SHOW_YESTERDAY,
|
|
140
|
+
CALENDAR_CONSTANTS.attributes.YESTERDAY_BUTTON,
|
|
141
|
+
CALENDAR_CONSTANTS.attributes.SHOW_LAST_SEVEN_DAYS,
|
|
142
|
+
CALENDAR_CONSTANTS.attributes.LAST_SEVEN_DAYS_BUTTON,
|
|
143
|
+
CALENDAR_CONSTANTS.attributes.SHOW_LAST_THIRTY_DAYS,
|
|
144
|
+
CALENDAR_CONSTANTS.attributes.LAST_THIRTY_DAYS_BUTTON,
|
|
121
145
|
CALENDAR_CONSTANTS.attributes.VIEW,
|
|
122
146
|
CALENDAR_CONSTANTS.attributes.YEAR,
|
|
123
147
|
CALENDAR_CONSTANTS.attributes.YEAR_RANGE
|
|
@@ -200,6 +224,24 @@ let CalendarComponent = class CalendarComponent extends BaseComponent {
|
|
|
200
224
|
case CALENDAR_CONSTANTS.attributes.TODAY_BUTTON:
|
|
201
225
|
this.todayButton = coerceBoolean(newValue);
|
|
202
226
|
break;
|
|
227
|
+
case CALENDAR_CONSTANTS.attributes.SHOW_YESTERDAY:
|
|
228
|
+
this.showYesterday = coerceBoolean(newValue);
|
|
229
|
+
break;
|
|
230
|
+
case CALENDAR_CONSTANTS.attributes.YESTERDAY_BUTTON:
|
|
231
|
+
this.yesterdayButton = coerceBoolean(newValue);
|
|
232
|
+
break;
|
|
233
|
+
case CALENDAR_CONSTANTS.attributes.SHOW_LAST_SEVEN_DAYS:
|
|
234
|
+
this.showLastSevenDays = coerceBoolean(newValue);
|
|
235
|
+
break;
|
|
236
|
+
case CALENDAR_CONSTANTS.attributes.LAST_SEVEN_DAYS_BUTTON:
|
|
237
|
+
this.lastSevenDaysButton = coerceBoolean(newValue);
|
|
238
|
+
break;
|
|
239
|
+
case CALENDAR_CONSTANTS.attributes.SHOW_LAST_THIRTY_DAYS:
|
|
240
|
+
this.showLastThirtyDays = coerceBoolean(newValue);
|
|
241
|
+
break;
|
|
242
|
+
case CALENDAR_CONSTANTS.attributes.LAST_THIRTY_DAYS_BUTTON:
|
|
243
|
+
this.lastThirtyDaysButton = coerceBoolean(newValue);
|
|
244
|
+
break;
|
|
203
245
|
case CALENDAR_CONSTANTS.attributes.VIEW:
|
|
204
246
|
this.view = newValue;
|
|
205
247
|
break;
|
|
@@ -259,6 +301,15 @@ let CalendarComponent = class CalendarComponent extends BaseComponent {
|
|
|
259
301
|
today() {
|
|
260
302
|
this._core.today();
|
|
261
303
|
}
|
|
304
|
+
yesterday() {
|
|
305
|
+
this._core.yesterday();
|
|
306
|
+
}
|
|
307
|
+
lastSevenDays() {
|
|
308
|
+
this._core.lastSevenDays();
|
|
309
|
+
}
|
|
310
|
+
lastThirtyDays() {
|
|
311
|
+
this._core.lastThirtyDays();
|
|
312
|
+
}
|
|
262
313
|
/**
|
|
263
314
|
* Toggles a date selection.
|
|
264
315
|
*/
|
|
@@ -356,6 +407,33 @@ __decorate([
|
|
|
356
407
|
__decorate([
|
|
357
408
|
coreProperty()
|
|
358
409
|
], CalendarComponent.prototype, "todayCallback", void 0);
|
|
410
|
+
__decorate([
|
|
411
|
+
coreProperty()
|
|
412
|
+
], CalendarComponent.prototype, "showYesterday", void 0);
|
|
413
|
+
__decorate([
|
|
414
|
+
coreProperty()
|
|
415
|
+
], CalendarComponent.prototype, "yesterdayButton", void 0);
|
|
416
|
+
__decorate([
|
|
417
|
+
coreProperty()
|
|
418
|
+
], CalendarComponent.prototype, "yesterdayCallback", void 0);
|
|
419
|
+
__decorate([
|
|
420
|
+
coreProperty()
|
|
421
|
+
], CalendarComponent.prototype, "showLastSevenDays", void 0);
|
|
422
|
+
__decorate([
|
|
423
|
+
coreProperty()
|
|
424
|
+
], CalendarComponent.prototype, "lastSevenDaysButton", void 0);
|
|
425
|
+
__decorate([
|
|
426
|
+
coreProperty()
|
|
427
|
+
], CalendarComponent.prototype, "lastSevenDaysCallback", void 0);
|
|
428
|
+
__decorate([
|
|
429
|
+
coreProperty()
|
|
430
|
+
], CalendarComponent.prototype, "showLastThirtyDays", void 0);
|
|
431
|
+
__decorate([
|
|
432
|
+
coreProperty()
|
|
433
|
+
], CalendarComponent.prototype, "lastThirtyDaysButton", void 0);
|
|
434
|
+
__decorate([
|
|
435
|
+
coreProperty()
|
|
436
|
+
], CalendarComponent.prototype, "lastThirtyDaysCallback", void 0);
|
|
359
437
|
__decorate([
|
|
360
438
|
coreProperty()
|
|
361
439
|
], CalendarComponent.prototype, "tooltipBuilder", void 0);
|
|
@@ -22,6 +22,9 @@ export interface ICalendarBase {
|
|
|
22
22
|
readonly: boolean;
|
|
23
23
|
showOtherMonths: boolean;
|
|
24
24
|
showToday: boolean;
|
|
25
|
+
showYesterday: boolean;
|
|
26
|
+
showLastSevenDays: boolean;
|
|
27
|
+
showLastThirtyDays: boolean;
|
|
25
28
|
value: Date | Date[] | DateRange | null | undefined;
|
|
26
29
|
weekendDays: DayOfWeek[] | null | undefined;
|
|
27
30
|
year: number;
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
export interface IDateRange {
|
|
7
7
|
from?: Date;
|
|
8
8
|
to?: Date;
|
|
9
|
+
rangeName?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare class DateRange implements IDateRange {
|
|
11
12
|
from?: Date;
|
|
12
13
|
to?: Date;
|
|
14
|
+
rangeName?: string;
|
|
13
15
|
constructor(range?: IDateRange | null);
|
|
14
16
|
copy(): DateRange;
|
|
15
17
|
}
|
|
@@ -173,9 +173,6 @@ export class BaseDatePickerAdapter extends BaseAdapter {
|
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
const iconButtonElement = this._createToggleElement();
|
|
176
|
-
// if (textField.density === 'extra-small') {
|
|
177
|
-
// iconButtonElement.density = 'small';
|
|
178
|
-
// }
|
|
179
176
|
textField.appendChild(iconButtonElement);
|
|
180
177
|
this._toggleElement = iconButtonElement;
|
|
181
178
|
}
|