@adaptabletools/adaptable 13.0.4-canary.2 → 13.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bundle.cjs.js +193 -193
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/ActionOptions.d.ts +1 -5
- package/src/AdaptableOptions/GeneralOptions.d.ts +33 -5
- package/src/Api/AdaptableApi.d.ts +5 -0
- package/src/Api/CalendarApi.d.ts +29 -0
- package/src/Api/CalendarApi.js +2 -0
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
- package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
- package/src/Api/Implementation/CalendarApiImpl.d.ts +9 -0
- package/src/Api/Implementation/CalendarApiImpl.js +55 -0
- package/src/Api/Implementation/InternalApiImpl.d.ts +1 -0
- package/src/Api/Implementation/InternalApiImpl.js +8 -0
- package/src/Api/Implementation/LayoutApiImpl.d.ts +7 -0
- package/src/Api/Implementation/LayoutApiImpl.js +15 -0
- package/src/Api/Implementation/QueryApiImpl.js +3 -8
- package/src/Api/InternalApi.d.ts +1 -0
- package/src/Api/LayoutApi.d.ts +11 -0
- package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +55 -41
- package/src/PredefinedConfig/StyledColumnState.d.ts +16 -24
- package/src/Redux/ActionsReducers/PopupRedux.js +10 -2
- package/src/Strategy/FilterModule.js +2 -2
- package/src/Strategy/LayoutModule.d.ts +3 -0
- package/src/Strategy/LayoutModule.js +98 -4
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -2
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +18 -15
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +1 -0
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +4 -1
- package/src/View/Layout/PivotDetailsPopoup.d.ts +3 -0
- package/src/View/Layout/PivotDetailsPopoup.js +43 -0
- package/src/View/Layout/Wizard/LayoutWizard.js +6 -1
- package/src/View/Layout/Wizard/sections/SortSection.js +1 -4
- package/src/agGrid/Adaptable.d.ts +1 -0
- package/src/agGrid/Adaptable.js +10 -13
- package/src/components/Modal/index.js +0 -2
- package/src/metamodel/adaptable.metamodel.d.ts +53 -23
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +3 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/Utilities/Helpers/CalendarHelper.d.ts +0 -25
- package/src/Utilities/Helpers/CalendarHelper.js +0 -342
package/src/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type { DashboardOptions, CustomToolbar, DashboardButtonContext, CustomToo
|
|
|
15
15
|
export type { EditOptions, ValidationResult, SmartEditCustomOperation, SmartEditOperation, SmartEditOperationContext, } from './AdaptableOptions/EditOptions';
|
|
16
16
|
export type { ActionRowFormOptions, ActionRowParamContext, FormFieldLabelContext, CreateActionRowContext, EditActionRowContext, ActionColumnContext, ActionColumn, ActionColumnSettings, ActionOptions, ActionRowContext, ActionRowButtonType, ActionRowButtonCustomConfigurationContext, } from './AdaptableOptions/ActionOptions';
|
|
17
17
|
export type { ExportOptions, SystemExportDestination, SystemExportDestinations, CustomDestination, ServerReport, DataFormatType, ExportFormContext, ReportContext, } from './AdaptableOptions/ExportOptions';
|
|
18
|
-
export type { GeneralOptions, ColumnValuesComparer, DataSet, DataSetFormContext, UnbalancedGroupsKeyContext, } from './AdaptableOptions/GeneralOptions';
|
|
18
|
+
export type { GeneralOptions, ColumnValuesComparer, DataSet, DataSetFormContext, UnbalancedGroupsKeyContext, Holidays, HolidayContext, } from './AdaptableOptions/GeneralOptions';
|
|
19
19
|
export type { Glue42PluginOptions } from './AdaptableOptions/Glue42PluginOptions';
|
|
20
20
|
export type { IPushPullPluginOptions } from './AdaptableOptions/IPushPullPluginOptions';
|
|
21
21
|
export type { LayoutOptions, LayoutViewOptions, LayoutTagOptions, LayoutAvailableContext, AutoGenerateTagsForLayoutsContext, LayoutAssociatedObject, } from './AdaptableOptions/LayoutOptions';
|
|
@@ -45,6 +45,7 @@ export type { AdaptableApi } from './Api/AdaptableApi';
|
|
|
45
45
|
export type { AlertApi } from './Api/AlertApi';
|
|
46
46
|
export type { ApplicationApi } from './Api/ApplicationApi';
|
|
47
47
|
export type { BulkUpdateApi } from './Api/BulkUpdateApi';
|
|
48
|
+
export type { CalendarApi } from './Api/CalendarApi';
|
|
48
49
|
export type { CalculatedColumnApi } from './Api/CalculatedColumnApi';
|
|
49
50
|
export type { CellSummaryApi } from './Api/CellSummaryApi';
|
|
50
51
|
export type { ColumnApi } from './Api/ColumnApi';
|
|
@@ -153,7 +154,7 @@ export type { DashboardState, DashboardTab, AdaptableCoordinate, } from './Prede
|
|
|
153
154
|
export type { ExportState, Report, ReportData, ReportSchedule, SystemReportName, SystemReportNames, ReportRowScope, ReportColumnScope, } from './PredefinedConfig/ExportState';
|
|
154
155
|
export type { ColumnFilter, ColumnFilterPredicate, SystemFilterPredicateIds, SystemFilterPredicateId, } from './PredefinedConfig/Common/ColumnFilter';
|
|
155
156
|
export type { FormatColumn, FormatColumnState, FormatColumnRule, FormatColumnPredicate, SystemFormatColumnPredicateId, } from './PredefinedConfig/FormatColumnState';
|
|
156
|
-
export type { StyledColumn, StyledColumnState, PercentBarStyle, GradientStyle, CellColorRange, ColumnComparison, CellTextOptions, CellTextOption, } from './PredefinedConfig/StyledColumnState';
|
|
157
|
+
export type { StyledColumn, StyledColumnState, PercentBarStyle, GradientStyle, CellColorRange, ColumnComparison, CellTextOptions, CellTextOption, NumericStyledColumn, RangeValueType, } from './PredefinedConfig/StyledColumnState';
|
|
157
158
|
export type { FreeTextColumn, FreeTextColumnState, FreeTextStoredValue, FreeTextColumnSettings, } from './PredefinedConfig/FreeTextColumnState';
|
|
158
159
|
export type { StatusBarState, AdaptableStatusBar } from './PredefinedConfig/StatusBarState';
|
|
159
160
|
export type { Glue42Report, Glue42Schedule, Glue42State } from './PredefinedConfig/Glue42State';
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "13.0.
|
|
1
|
+
declare const _default: "13.0.5";
|
|
2
2
|
export default _default;
|
package/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = '13.0.
|
|
3
|
+
exports.default = '13.0.5'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare const TODAY = "Today";
|
|
2
|
-
export declare const YESTERDAY = "Yesterday";
|
|
3
|
-
export declare const TOMORROW = "Tomorrow";
|
|
4
|
-
export declare const PREVIOUS_WORK_DAY = "Previous Work Day";
|
|
5
|
-
export declare const NEXT_WORK_DAY = "Next Work Day";
|
|
6
|
-
export interface Calendar {
|
|
7
|
-
Name: string;
|
|
8
|
-
YearName: Number;
|
|
9
|
-
CalendarEntries: CalendarEntry[];
|
|
10
|
-
}
|
|
11
|
-
export interface CalendarEntry {
|
|
12
|
-
HolidayName: string;
|
|
13
|
-
HolidayDate: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function getDynamicDate(dynamicDateName: string): Date;
|
|
16
|
-
export declare function getNextWorkingDay(days?: number): Date;
|
|
17
|
-
export declare function getPreviousWorkingDay(days?: number): Date;
|
|
18
|
-
export declare function isNotWorkingDay(dateToCheck: Date): Boolean;
|
|
19
|
-
export declare const CalendarHelper: {
|
|
20
|
-
getDynamicDate: typeof getDynamicDate;
|
|
21
|
-
getNextWorkingDay: typeof getNextWorkingDay;
|
|
22
|
-
getPreviousWorkingDay: typeof getPreviousWorkingDay;
|
|
23
|
-
isNotWorkingDay: typeof isNotWorkingDay;
|
|
24
|
-
};
|
|
25
|
-
export default CalendarHelper;
|
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CalendarHelper = exports.isNotWorkingDay = exports.getPreviousWorkingDay = exports.getNextWorkingDay = exports.getDynamicDate = exports.NEXT_WORK_DAY = exports.PREVIOUS_WORK_DAY = exports.TOMORROW = exports.YESTERDAY = exports.TODAY = void 0;
|
|
4
|
-
exports.TODAY = 'Today';
|
|
5
|
-
exports.YESTERDAY = 'Yesterday';
|
|
6
|
-
exports.TOMORROW = 'Tomorrow';
|
|
7
|
-
exports.PREVIOUS_WORK_DAY = 'Previous Work Day';
|
|
8
|
-
exports.NEXT_WORK_DAY = 'Next Work Day';
|
|
9
|
-
function getAvailableCalendars() {
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
Name: 'United Kingdom',
|
|
13
|
-
YearName: 2020,
|
|
14
|
-
CalendarEntries: [
|
|
15
|
-
{
|
|
16
|
-
HolidayName: "New Year's Day",
|
|
17
|
-
HolidayDate: new Date('January 01, 2020').toJSON(),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
HolidayName: 'Good Friday',
|
|
21
|
-
HolidayDate: new Date('April 10, 2020').toJSON(),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
HolidayName: 'Easter Monday',
|
|
25
|
-
HolidayDate: new Date('April 13, 2020').toJSON(),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
HolidayName: 'Early May Bank Holiday',
|
|
29
|
-
HolidayDate: new Date('May 8 2020').toJSON(),
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
HolidayName: 'Spring Bank Holiday',
|
|
33
|
-
HolidayDate: new Date('May 25, 2020').toJSON(),
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
HolidayName: 'Summer Bank Holiday',
|
|
37
|
-
HolidayDate: new Date('August 31, 2020').toJSON(),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
HolidayName: 'Christmas Day',
|
|
41
|
-
HolidayDate: new Date('December 25, 2020').toJSON(),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
HolidayName: 'Boxing Day',
|
|
45
|
-
HolidayDate: new Date('December 28, 2020').toJSON(),
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
Name: 'Germany',
|
|
51
|
-
YearName: 2020,
|
|
52
|
-
CalendarEntries: [
|
|
53
|
-
{
|
|
54
|
-
HolidayName: "New Year's Day",
|
|
55
|
-
HolidayDate: new Date('January 01, 2020').toJSON(),
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
HolidayName: 'Good Friday',
|
|
59
|
-
HolidayDate: new Date('April 10, 2020').toJSON(),
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
HolidayName: 'Easter Monday',
|
|
63
|
-
HolidayDate: new Date('April 13, 2020').toJSON(),
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
HolidayName: 'Labour Day',
|
|
67
|
-
HolidayDate: new Date('May 01 2020').toJSON(),
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
HolidayName: 'Ascension Day',
|
|
71
|
-
HolidayDate: new Date('May 21 2020').toJSON(),
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
HolidayName: 'Whit Monday',
|
|
75
|
-
HolidayDate: new Date('June 01, 2020').toJSON(),
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
HolidayName: 'German Unity Day',
|
|
79
|
-
HolidayDate: new Date('October 03, 2020').toJSON(),
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
HolidayName: 'Christmas Day',
|
|
83
|
-
HolidayDate: new Date('December 25, 2020').toJSON(),
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
HolidayName: "St Stephen's Day",
|
|
87
|
-
HolidayDate: new Date('December 26, 2020').toJSON(),
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
Name: 'France',
|
|
93
|
-
YearName: 2020,
|
|
94
|
-
CalendarEntries: [
|
|
95
|
-
{
|
|
96
|
-
HolidayName: 'New Years Day',
|
|
97
|
-
HolidayDate: new Date('January 01, 2020').toJSON(),
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
HolidayName: 'Easter Monday',
|
|
101
|
-
HolidayDate: new Date('April 13, 2020').toJSON(),
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
HolidayName: 'Labour Day',
|
|
105
|
-
HolidayDate: new Date('May 01, 2020').toJSON(),
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
HolidayName: 'VE Day',
|
|
109
|
-
HolidayDate: new Date('May 08, 2020').toJSON(),
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
HolidayName: 'Ascension Day',
|
|
113
|
-
HolidayDate: new Date('May 21, 2020').toJSON(),
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
HolidayName: 'Whitmonday',
|
|
117
|
-
HolidayDate: new Date('June 01, 2020').toJSON(),
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
HolidayName: 'Bastille Day',
|
|
121
|
-
HolidayDate: new Date('July 14, 2020').toJSON(),
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
HolidayName: 'Assumption Day',
|
|
125
|
-
HolidayDate: new Date('August 15, 2020').toJSON(),
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
HolidayName: 'All Saints Day',
|
|
129
|
-
HolidayDate: new Date('November 01, 2020').toJSON(),
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
HolidayName: 'Armistice Day',
|
|
133
|
-
HolidayDate: new Date('November 11, 2020').toJSON(),
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
HolidayName: 'Christmas Day',
|
|
137
|
-
HolidayDate: new Date('December 25, 2020').toJSON(),
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
Name: 'United States',
|
|
143
|
-
YearName: 2020,
|
|
144
|
-
CalendarEntries: [
|
|
145
|
-
{
|
|
146
|
-
HolidayName: 'New Years Day',
|
|
147
|
-
HolidayDate: new Date('January 01, 2020').toJSON(),
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
HolidayName: 'Martin Luther King Day',
|
|
151
|
-
HolidayDate: new Date('January 20, 2020').toJSON(),
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
HolidayName: 'Presidents Day',
|
|
155
|
-
HolidayDate: new Date('February 17, 2020').toJSON(),
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
HolidayName: 'Memorial Day',
|
|
159
|
-
HolidayDate: new Date('May 25, 2020').toJSON(),
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
HolidayName: 'Independence Day',
|
|
163
|
-
HolidayDate: new Date('July 03, 2020').toJSON(),
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
HolidayName: 'Labour Day',
|
|
167
|
-
HolidayDate: new Date('September 07, 2020').toJSON(),
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
HolidayName: 'Columbus Day',
|
|
171
|
-
HolidayDate: new Date('October 12, 2020').toJSON(),
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
HolidayName: 'Veterans Day',
|
|
175
|
-
HolidayDate: new Date('November 11, 2020').toJSON(),
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
HolidayName: 'Thanksgiving Day',
|
|
179
|
-
HolidayDate: new Date('November 26, 2020').toJSON(),
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
HolidayName: 'Christmas Day',
|
|
183
|
-
HolidayDate: new Date('December 25, 2020').toJSON(),
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
Name: 'Canada',
|
|
189
|
-
YearName: 2020,
|
|
190
|
-
CalendarEntries: [
|
|
191
|
-
{
|
|
192
|
-
HolidayName: 'New Years Day',
|
|
193
|
-
HolidayDate: new Date('January 01, 2020').toJSON(),
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
HolidayName: 'Good Friday',
|
|
197
|
-
HolidayDate: new Date('April 10, 2020').toJSON(),
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
HolidayName: 'Victoria Day',
|
|
201
|
-
HolidayDate: new Date('May 18, 2020').toJSON(),
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
HolidayName: 'Canada Day',
|
|
205
|
-
HolidayDate: new Date('July 01, 2020').toJSON(),
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
HolidayName: 'Labour Day',
|
|
209
|
-
HolidayDate: new Date('September 07, 2020').toJSON(),
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
HolidayName: 'Thanksgiving',
|
|
213
|
-
HolidayDate: new Date('October 12, 2020').toJSON(),
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
HolidayName: 'Rememberance Day',
|
|
217
|
-
HolidayDate: new Date('November 11, 2020').toJSON(),
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
HolidayName: 'Christmas Day',
|
|
221
|
-
HolidayDate: new Date('December 25, 2020').toJSON(),
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
HolidayName: 'Boxing Day',
|
|
225
|
-
HolidayDate: new Date('December 26, 2020').toJSON(),
|
|
226
|
-
},
|
|
227
|
-
],
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
Name: 'Singapore',
|
|
231
|
-
YearName: 2020,
|
|
232
|
-
CalendarEntries: [
|
|
233
|
-
{
|
|
234
|
-
HolidayName: 'New Years Day',
|
|
235
|
-
HolidayDate: new Date('January 01, 2020').toJSON(),
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
HolidayName: 'Chinese New Year',
|
|
239
|
-
HolidayDate: new Date('January 25, 2020').toJSON(),
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
HolidayName: 'Good Friday',
|
|
243
|
-
HolidayDate: new Date('April 10, 2020').toJSON(),
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
HolidayName: 'Labour Day',
|
|
247
|
-
HolidayDate: new Date('May 01, 2020').toJSON(),
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
HolidayName: 'Vesak Day',
|
|
251
|
-
HolidayDate: new Date('May 07, 2020').toJSON(),
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
HolidayName: 'National Day',
|
|
255
|
-
HolidayDate: new Date('August 09, 2020').toJSON(),
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
HolidayName: 'Hari Raya Haji',
|
|
259
|
-
HolidayDate: new Date('August 10, 2020').toJSON(),
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
HolidayName: 'Deewali',
|
|
263
|
-
HolidayDate: new Date('November 14, 2020').toJSON(),
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
HolidayName: 'Christmas Day',
|
|
267
|
-
HolidayDate: new Date('December 25, 2020').toJSON(),
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
},
|
|
271
|
-
];
|
|
272
|
-
}
|
|
273
|
-
function getDynamicDate(dynamicDateName) {
|
|
274
|
-
// eventually we should use some kind of enum? or class that holds this
|
|
275
|
-
let dynamicDate;
|
|
276
|
-
if (dynamicDateName == exports.TODAY) {
|
|
277
|
-
dynamicDate = new Date();
|
|
278
|
-
}
|
|
279
|
-
else if (dynamicDateName == exports.YESTERDAY) {
|
|
280
|
-
dynamicDate = new Date();
|
|
281
|
-
dynamicDate.setDate(dynamicDate.getDate() - 1);
|
|
282
|
-
}
|
|
283
|
-
else if (dynamicDateName == exports.TOMORROW) {
|
|
284
|
-
dynamicDate = new Date();
|
|
285
|
-
dynamicDate.setDate(dynamicDate.getDate() + 1);
|
|
286
|
-
}
|
|
287
|
-
else if (dynamicDateName == exports.PREVIOUS_WORK_DAY) {
|
|
288
|
-
dynamicDate = this.getPreviousWorkingDay(1);
|
|
289
|
-
}
|
|
290
|
-
else if (dynamicDateName == exports.NEXT_WORK_DAY) {
|
|
291
|
-
dynamicDate = this.getNextWorkingDay(1);
|
|
292
|
-
}
|
|
293
|
-
return dynamicDate;
|
|
294
|
-
}
|
|
295
|
-
exports.getDynamicDate = getDynamicDate;
|
|
296
|
-
function getNextWorkingDay(days = 1) {
|
|
297
|
-
let count = 0;
|
|
298
|
-
let counterDate = new Date();
|
|
299
|
-
while (count < days) {
|
|
300
|
-
counterDate.setDate(counterDate.getDate() + 1);
|
|
301
|
-
if (isNotWorkingDay(counterDate)) {
|
|
302
|
-
count++;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return counterDate;
|
|
306
|
-
}
|
|
307
|
-
exports.getNextWorkingDay = getNextWorkingDay;
|
|
308
|
-
function getPreviousWorkingDay(days = 1) {
|
|
309
|
-
let count = 0;
|
|
310
|
-
let counterDate = new Date();
|
|
311
|
-
while (count < days) {
|
|
312
|
-
counterDate.setDate(counterDate.getDate() - 1);
|
|
313
|
-
if (isNotWorkingDay(counterDate)) {
|
|
314
|
-
count++;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return counterDate;
|
|
318
|
-
}
|
|
319
|
-
exports.getPreviousWorkingDay = getPreviousWorkingDay;
|
|
320
|
-
// pretty sure this can be improved as pretty expensive - though rarely used to be honest
|
|
321
|
-
function isNotWorkingDay(dateToCheck) {
|
|
322
|
-
/*
|
|
323
|
-
// Removing lookups to current calendar until we decide what to do
|
|
324
|
-
let currentCalendar: string = this.getGeneralOptions().currentCalendar;
|
|
325
|
-
let currentHoliday = getAvailableCalendars().find((c) => c.Name == currentCalendar);
|
|
326
|
-
for (let holiday of currentHoliday.CalendarEntries) {
|
|
327
|
-
let holidayDate = new Date(holiday.HolidayDate);
|
|
328
|
-
if (holidayDate.setHours(0, 0, 0, 0) == dateToCheck.setHours(0, 0, 0, 0)) {
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
*/
|
|
333
|
-
return dateToCheck.getDay() != 0 && dateToCheck.getDay() != 6;
|
|
334
|
-
}
|
|
335
|
-
exports.isNotWorkingDay = isNotWorkingDay;
|
|
336
|
-
exports.CalendarHelper = {
|
|
337
|
-
getDynamicDate,
|
|
338
|
-
getNextWorkingDay,
|
|
339
|
-
getPreviousWorkingDay,
|
|
340
|
-
isNotWorkingDay,
|
|
341
|
-
};
|
|
342
|
-
exports.default = exports.CalendarHelper;
|