@adaptabletools/adaptable 13.0.4 → 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.
Files changed (45) hide show
  1. package/README.md +3 -3
  2. package/bundle.cjs.js +193 -193
  3. package/package.json +1 -1
  4. package/publishTimestamp.d.ts +1 -1
  5. package/publishTimestamp.js +1 -1
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
  7. package/src/AdaptableOptions/GeneralOptions.d.ts +33 -5
  8. package/src/Api/AdaptableApi.d.ts +5 -0
  9. package/src/Api/CalendarApi.d.ts +29 -0
  10. package/src/Api/CalendarApi.js +2 -0
  11. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
  12. package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
  13. package/src/Api/Implementation/CalendarApiImpl.d.ts +9 -0
  14. package/src/Api/Implementation/CalendarApiImpl.js +55 -0
  15. package/src/Api/Implementation/InternalApiImpl.d.ts +1 -0
  16. package/src/Api/Implementation/InternalApiImpl.js +8 -0
  17. package/src/Api/Implementation/LayoutApiImpl.d.ts +7 -0
  18. package/src/Api/Implementation/LayoutApiImpl.js +15 -0
  19. package/src/Api/Implementation/QueryApiImpl.js +3 -8
  20. package/src/Api/InternalApi.d.ts +1 -0
  21. package/src/Api/LayoutApi.d.ts +11 -0
  22. package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
  23. package/src/PredefinedConfig/Common/AdaptablePredicate.js +55 -41
  24. package/src/PredefinedConfig/StyledColumnState.d.ts +16 -24
  25. package/src/Redux/ActionsReducers/PopupRedux.js +10 -2
  26. package/src/Strategy/FilterModule.js +2 -2
  27. package/src/Strategy/LayoutModule.d.ts +3 -0
  28. package/src/Strategy/LayoutModule.js +98 -4
  29. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -1
  30. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +1 -0
  31. package/src/View/Components/Popups/WindowPopups/windowFactory.js +4 -1
  32. package/src/View/Layout/PivotDetailsPopoup.d.ts +3 -0
  33. package/src/View/Layout/PivotDetailsPopoup.js +43 -0
  34. package/src/View/Layout/Wizard/LayoutWizard.js +6 -1
  35. package/src/View/Layout/Wizard/sections/SortSection.js +1 -4
  36. package/src/agGrid/Adaptable.d.ts +1 -0
  37. package/src/agGrid/Adaptable.js +3 -6
  38. package/src/components/Modal/index.js +0 -2
  39. package/src/metamodel/adaptable.metamodel.d.ts +53 -23
  40. package/src/metamodel/adaptable.metamodel.js +1 -1
  41. package/src/types.d.ts +3 -2
  42. package/version.d.ts +1 -1
  43. package/version.js +1 -1
  44. package/src/Utilities/Helpers/CalendarHelper.d.ts +0 -25
  45. package/src/Utilities/Helpers/CalendarHelper.js +0 -342
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "13.0.4",
3
+ "version": "13.0.5",
4
4
  "description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1666692312615;
1
+ declare const _default: 1667157994936;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1666692312615;
3
+ exports.default = 1667157994936;
@@ -221,6 +221,7 @@ export interface IAdaptable {
221
221
  canHaveSparklines(): boolean;
222
222
  showCharts(charts: ChartModel[]): ChartRef[];
223
223
  getChartModels(): ChartModel[];
224
+ getRowModel(): GridOptions['rowModelType'];
224
225
  getCurrentIPPStyle(): IPPStyle;
225
226
  getDefaultIPPStyle(): IPPStyle;
226
227
  getRowCount(): number;
@@ -38,12 +38,10 @@ export interface GeneralOptions {
38
38
  */
39
39
  alternativeModuleNames?: AlternativeModuleName[];
40
40
  /**
41
- * Calendar to use for calculating Holidays & Working Days
42
- *
43
- * @defaultValue 'United Kingdom'
44
- * @gridInfoItem
41
+ * Holidays - used to determine Working Days
42
+ * @defaultValue null
45
43
  */
46
- currentCalendar?: string;
44
+ holidays?: Holidays;
47
45
  /**
48
46
  * English variant to use in UI labels
49
47
  *
@@ -120,3 +118,33 @@ export interface UnbalancedGroupsKeyContext extends BaseContext {
120
118
  */
121
119
  params: KeyCreatorParams;
122
120
  }
121
+ /**
122
+ * Holidays - can be list or function (latter takes preference)
123
+ */
124
+ export interface Holidays {
125
+ /**
126
+ * Holidays provided as valid ISO date strings
127
+ */
128
+ list?: string[];
129
+ /**
130
+ * Function which returns true if given date is a holiday
131
+ */
132
+ isHoliday?: (holidayContext: HolidayContext) => boolean;
133
+ }
134
+ /**
135
+ * Context used for isHoliday function
136
+ */
137
+ export interface HolidayContext {
138
+ /**
139
+ * Date being checked
140
+ */
141
+ dateToCheck: Date;
142
+ /**
143
+ * Name of Current User
144
+ */
145
+ userName: string;
146
+ /**
147
+ * Id of current AdapTable instance
148
+ */
149
+ adaptableId: string;
150
+ }
@@ -1,6 +1,7 @@
1
1
  import { AlertApi } from './AlertApi';
2
2
  import { PluginsApi } from './PluginsApi';
3
3
  import { BulkUpdateApi } from './BulkUpdateApi';
4
+ import { CalendarApi } from './CalendarApi';
4
5
  import { CalculatedColumnApi } from './CalculatedColumnApi';
5
6
  import { CellSummaryApi } from './CellSummaryApi';
6
7
  import { ConfigApi } from './ConfigApi';
@@ -61,6 +62,10 @@ export interface AdaptableApi {
61
62
  * Provides access to the Bulk Update Module
62
63
  */
63
64
  bulkUpdateApi: BulkUpdateApi;
65
+ /**
66
+ * Functions for managing Holidays
67
+ */
68
+ calendarApi: CalendarApi;
64
69
  /**
65
70
  * Provides access to the Calculated Column Module
66
71
  */
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Calendar, Holiday and Working Day related functions, using supplied Calendars in General Options
3
+ **/
4
+ export interface CalendarApi {
5
+ /**
6
+ * Returns the next Working Day
7
+ */
8
+ getNextWorkingDay(): Date;
9
+ /**
10
+ * Returns the previous Working Day
11
+ */
12
+ getPreviousWorkingDay(): Date;
13
+ /**
14
+ * Checks if given date is a Working Day
15
+ * @param dateToCheck Date To Check
16
+ */
17
+ isWorkingDay(dateToCheck: Date): boolean;
18
+ /**
19
+ * Checks if given data is a Holiday
20
+ * @param dateToCheck Date to Check
21
+ */
22
+ isHoliday(dateToCheck: Date): boolean;
23
+ /**
24
+ * Returns true if both Dates are the same, ignoring the time portions
25
+ * @param date1 1st Date
26
+ * @param date2 2nd Date
27
+ */
28
+ isSameDay(date1: Date, date2: Date): boolean;
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,6 +2,7 @@ import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
2
2
  import { AdaptableApi, SettingsPanelApi } from '../../types';
3
3
  import { AlertApi } from '../AlertApi';
4
4
  import { BulkUpdateApi } from '../BulkUpdateApi';
5
+ import { CalendarApi } from '../CalendarApi';
5
6
  import { CalculatedColumnApi } from '../CalculatedColumnApi';
6
7
  import { CellSummaryApi } from '../CellSummaryApi';
7
8
  import { ConfigApi } from '../ConfigApi';
@@ -47,6 +48,7 @@ export declare class AdaptableApiImpl implements AdaptableApi {
47
48
  flashingCellApi: FlashingCellApi;
48
49
  predicateApi: PredicateApi;
49
50
  bulkUpdateApi: BulkUpdateApi;
51
+ calendarApi: CalendarApi;
50
52
  calculatedColumnApi: CalculatedColumnApi;
51
53
  cellSummaryApi: CellSummaryApi;
52
54
  columnApi: ColumnApi;
@@ -41,6 +41,7 @@ const ChartingApiImpl_1 = require("./ChartingApiImpl");
41
41
  const SettingsPanelApiImpl_1 = require("./SettingsPanelApiImpl");
42
42
  const ActionApiImpl_1 = require("./ActionApiImpl");
43
43
  const StyledColumnApiImpl_1 = require("./StyledColumnApiImpl");
44
+ const CalendarApiImpl_1 = require("./CalendarApiImpl");
44
45
  class AdaptableApiImpl {
45
46
  constructor(adaptable) {
46
47
  this.adaptable = adaptable;
@@ -53,6 +54,7 @@ class AdaptableApiImpl {
53
54
  this.predicateApi = new PredicateApiImpl_1.PredicateApiImpl(adaptable);
54
55
  this.pluginsApi = new PluginsApiImpl_1.PluginsApiImpl(adaptable);
55
56
  this.bulkUpdateApi = new BulkUpdateApiImpl_1.BulkUpdateApiImpl(adaptable);
57
+ this.calendarApi = new CalendarApiImpl_1.CalendarApiImpl(adaptable);
56
58
  this.calculatedColumnApi = new CalculatedColumnApiImpl_1.CalculatedColumnApiImpl(adaptable);
57
59
  this.cellSummaryApi = new CellSummaryApiImpl_1.CellSummaryApiImpl(adaptable);
58
60
  this.columnApi = new ColumnApiImpl_1.ColumnApiImpl(adaptable);
@@ -0,0 +1,9 @@
1
+ import { ApiBase } from './ApiBase';
2
+ import { CalendarApi } from '../CalendarApi';
3
+ export declare class CalendarApiImpl extends ApiBase implements CalendarApi {
4
+ getNextWorkingDay(): Date;
5
+ getPreviousWorkingDay(): Date;
6
+ isWorkingDay(dateToCheck: Date): boolean;
7
+ isHoliday(dateToCheck: Date): boolean;
8
+ isSameDay(firstDateToCheck: Date, secondDateToCheck: Date): boolean;
9
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CalendarApiImpl = void 0;
4
+ const ApiBase_1 = require("./ApiBase");
5
+ class CalendarApiImpl extends ApiBase_1.ApiBase {
6
+ getNextWorkingDay() {
7
+ let counterDate = new Date();
8
+ let isWorkingDay = false;
9
+ while (!isWorkingDay) {
10
+ counterDate.setDate(counterDate.getDate() + 1);
11
+ isWorkingDay = this.isWorkingDay(counterDate);
12
+ }
13
+ return counterDate;
14
+ }
15
+ getPreviousWorkingDay() {
16
+ let counterDate = new Date();
17
+ let isWorkingDay = false;
18
+ while (!isWorkingDay) {
19
+ counterDate.setDate(counterDate.getDate() - 1);
20
+ isWorkingDay = this.isWorkingDay(counterDate);
21
+ }
22
+ return counterDate;
23
+ }
24
+ isWorkingDay(dateToCheck) {
25
+ const holidays = this.getGeneralOptions().holidays;
26
+ if (holidays.isHoliday) {
27
+ const context = {
28
+ dateToCheck: dateToCheck,
29
+ userName: this.getOptions().userName,
30
+ adaptableId: this.getOptions().adaptableId,
31
+ };
32
+ if (holidays.isHoliday(context)) {
33
+ return false;
34
+ }
35
+ }
36
+ if (Array.isArray(holidays.list)) {
37
+ for (let holiday of holidays.list) {
38
+ let holidayDate = new Date(holiday);
39
+ if (holidayDate.setHours(0, 0, 0, 0) == dateToCheck.setHours(0, 0, 0, 0)) {
40
+ return false;
41
+ }
42
+ }
43
+ }
44
+ return dateToCheck.getDay() != 0 && dateToCheck.getDay() != 6;
45
+ }
46
+ isHoliday(dateToCheck) {
47
+ return !this.isWorkingDay(dateToCheck);
48
+ }
49
+ isSameDay(firstDateToCheck, secondDateToCheck) {
50
+ return (firstDateToCheck.getFullYear() === secondDateToCheck.getFullYear() &&
51
+ firstDateToCheck.getMonth() === secondDateToCheck.getMonth() &&
52
+ firstDateToCheck.getDate() === secondDateToCheck.getDate());
53
+ }
54
+ }
55
+ exports.CalendarApiImpl = CalendarApiImpl;
@@ -60,6 +60,7 @@ export declare class InternalApiImpl extends ApiBase implements InternalApi {
60
60
  showPopupScreen(module: AdaptableModule, componentName: string, popupParams?: ModuleParams, popupProps?: {
61
61
  [key: string]: any;
62
62
  }): void;
63
+ showPopupWindow(id: string, title: string, icon: string, popupProps: any): void;
63
64
  hidePopupScreen(): void;
64
65
  setColumns(columns: AdaptableColumn[]): void;
65
66
  setSettingPanelModuleMenuItems(menuItems: AdaptableMenuItem[]): void;
@@ -146,6 +146,14 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
146
146
  showPopupScreen(module, componentName, popupParams, popupProps) {
147
147
  this.dispatchAction(PopupRedux.PopupShowScreen(module, componentName, popupParams, popupProps));
148
148
  }
149
+ showPopupWindow(id, title, icon, popupProps) {
150
+ this.dispatchAction(PopupRedux.PopupShowWindow({
151
+ Id: id,
152
+ Title: title,
153
+ Icon: icon,
154
+ PopupProps: popupProps,
155
+ }));
156
+ }
149
157
  hidePopupScreen() {
150
158
  this.dispatchAction(PopupRedux.PopupHideScreen());
151
159
  }
@@ -45,4 +45,11 @@ export declare class LayoutApiImpl extends ApiBase implements LayoutApi {
45
45
  removeColumnFromCurrentLayout(columnId: string): void;
46
46
  removeColumnFromAllLayouts(columnId: string): void;
47
47
  removeColumnFromLayout(columnId: string, layoutName: string): void;
48
+ getLayoutSupportedFeatures(): {
49
+ RowGroupedColumns: boolean;
50
+ AggregationColumns: boolean;
51
+ PivotColumns: boolean;
52
+ ColumnFilters: boolean;
53
+ ColumnSorts: boolean;
54
+ };
48
55
  }
@@ -334,5 +334,20 @@ class LayoutApiImpl extends ApiBase_1.ApiBase {
334
334
  }
335
335
  }
336
336
  }
337
+ getLayoutSupportedFeatures() {
338
+ const layoutSupportedFeatures = {
339
+ RowGroupedColumns: true,
340
+ AggregationColumns: true,
341
+ PivotColumns: true,
342
+ ColumnFilters: true,
343
+ ColumnSorts: true,
344
+ };
345
+ if (this.adaptable.getRowModel() === 'viewport') {
346
+ layoutSupportedFeatures.RowGroupedColumns = false;
347
+ layoutSupportedFeatures.AggregationColumns = false;
348
+ layoutSupportedFeatures.PivotColumns = false;
349
+ }
350
+ return layoutSupportedFeatures;
351
+ }
337
352
  }
338
353
  exports.LayoutApiImpl = LayoutApiImpl;
@@ -79,14 +79,9 @@ class QueryApiImpl extends ApiBase_1.ApiBase {
79
79
  }
80
80
  expandCurrentQuery(query) {
81
81
  const preparedQuery = query !== null && query !== void 0 ? query : this.getCurrentQuery();
82
- this.dispatchAction(PopupRedux.PopupShowWindow({
83
- Id: windowFactory_1.WINDOW_QUERY_EDITOR,
84
- Title: 'Current Query',
85
- Icon: 'query',
86
- PopupProps: {
87
- value: preparedQuery,
88
- },
89
- }));
82
+ this.getAdaptableApi().internalApi.showPopupWindow(windowFactory_1.WINDOW_QUERY_EDITOR, 'Current Query', 'query', {
83
+ value: preparedQuery,
84
+ });
90
85
  }
91
86
  fireQueryRunEvent() {
92
87
  if (this.adaptable.isLive) {
@@ -63,6 +63,7 @@ export interface InternalApi {
63
63
  showPopupScreen(module: AdaptableModule, componentName: string, popupParams?: ModuleParams, popupProps?: {
64
64
  [key: string]: any;
65
65
  }): void;
66
+ showPopupWindow(Id: string, Title: string, Icon: string, PopupProps: any): void;
66
67
  isDocumentationLinksDisplayed(): boolean;
67
68
  hidePopupScreen(): void;
68
69
  setColumns(columns: AdaptableColumn[]): void;
@@ -203,4 +203,15 @@ export interface LayoutApi {
203
203
  * Useful when `autoSaveLayouts=true`
204
204
  */
205
205
  areDraftAndCurrentLayoutEqual(): boolean;
206
+ /**
207
+ * Returns whant the layout supports.
208
+ * This takes into account the data-source.
209
+ */
210
+ getLayoutSupportedFeatures(): {
211
+ RowGroupedColumns: boolean;
212
+ AggregationColumns: boolean;
213
+ PivotColumns: boolean;
214
+ ColumnFilters: boolean;
215
+ ColumnSorts: boolean;
216
+ };
206
217
  }
@@ -103,7 +103,7 @@ export interface PredicateDefHandlerParams {
103
103
  export interface PredicateDefToStringParams {
104
104
  inputs: any[];
105
105
  }
106
- export declare type ModuleScope = 'filter' | 'alert' | 'conditionalstyle' | 'flashingcell' | 'formatColumn';
106
+ export declare type ModuleScope = 'filter' | 'alert' | 'flashingcell' | 'formatColumn';
107
107
  /**
108
108
  * Array of Predicate Defs which are shipped by AdapTable
109
109
  */