@adaptabletools/adaptable-cjs 21.0.6 → 21.0.8
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/package.json +2 -1
- package/src/AdaptableOptions/DateInputOptions.d.ts +1 -1
- package/src/Api/Internal/AdaptableInternalApi.d.ts +1 -0
- package/src/Api/Internal/AdaptableInternalApi.js +9 -0
- package/src/Api/Internal/ColumnInternalApi.d.ts +1 -4
- package/src/Api/Internal/ColumnInternalApi.js +0 -12
- package/src/Api/Internal/ExportInternalApi.d.ts +1 -0
- package/src/Api/Internal/ExportInternalApi.js +3 -0
- package/src/Redux/Store/AdaptableStore.d.ts +0 -2
- package/src/Redux/Store/AdaptableStore.js +10 -10
- package/src/Utilities/Helpers/DateHelper.d.ts +0 -1
- package/src/Utilities/Helpers/DateHelper.js +29 -18
- package/src/View/Filter/FilterViewPanel.js +1 -1
- package/src/agGrid/AdaptableAgGrid.js +18 -5
- package/src/agGrid/AgGridColumnAdapter.js +61 -8
- package/src/agGrid/AgGridExportAdapter.js +21 -0
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.js +16 -1
- package/src/layout-manager/src/normalizeLayoutModel.js +8 -3
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.8",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"react-select": "5.10.1",
|
|
55
55
|
"react-toastify": "9.1.3",
|
|
56
56
|
"rebass": "^3.2.2",
|
|
57
|
+
"@types/rebass": "^4.0.10",
|
|
57
58
|
"redux": "^5.0.1",
|
|
58
59
|
"rxjs": "^7.4.0",
|
|
59
60
|
"sentence-case": "^3.0.4",
|
|
@@ -123,4 +123,5 @@ export declare class AdaptableInternalApi extends ApiBase {
|
|
|
123
123
|
findAdaptableObjectsByLookupCriteria<T extends AdaptableObjectWithScope>({ scope, tag, ids }: AdaptableObjectLookupCriteria, specificAdaptableObjects: T[]): T[];
|
|
124
124
|
buildBaseContext(): BaseContext;
|
|
125
125
|
setCellSummaryInfo(cellSummaryInfo: CellSummmaryInfo): void;
|
|
126
|
+
parseDateValue(dateValue: string | Date | number): Date | undefined;
|
|
126
127
|
}
|
|
@@ -9,6 +9,7 @@ const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Exte
|
|
|
9
9
|
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
|
|
10
10
|
const waitForCondition_1 = require("../../Utilities/waitForCondition");
|
|
11
11
|
const Icon_1 = require("../../components/Icon");
|
|
12
|
+
const DateHelper_1 = require("../../Utilities/Helpers/DateHelper");
|
|
12
13
|
class AdaptableInternalApi extends ApiBase_1.ApiBase {
|
|
13
14
|
getInternalState() {
|
|
14
15
|
return this.getAdaptableState().Internal;
|
|
@@ -443,5 +444,13 @@ class AdaptableInternalApi extends ApiBase_1.ApiBase {
|
|
|
443
444
|
setCellSummaryInfo(cellSummaryInfo) {
|
|
444
445
|
this.dispatchAction(InternalRedux.SetCellSummaryInfo(cellSummaryInfo));
|
|
445
446
|
}
|
|
447
|
+
parseDateValue(dateValue) {
|
|
448
|
+
const dateFormat = this.getUserInterfaceOptions().dateInputOptions.dateFormat;
|
|
449
|
+
if (dateFormat === 'yyyy-MM-dd') {
|
|
450
|
+
// if the format is ISO, we don't pass it so that we use the date-fns `parseISO` which is more robust
|
|
451
|
+
return (0, DateHelper_1.parseDateValue)(dateValue);
|
|
452
|
+
}
|
|
453
|
+
return (0, DateHelper_1.parseDateValue)(dateValue, dateFormat);
|
|
454
|
+
}
|
|
446
455
|
}
|
|
447
456
|
exports.AdaptableInternalApi = AdaptableInternalApi;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
|
-
import { ColDef, Column, HeaderValueGetterParams
|
|
3
|
-
import { CustomSort } from '../../AdaptableState/CustomSortState';
|
|
4
|
-
import { ColumnValuesComparer } from '../../AdaptableOptions/CustomSortOptions';
|
|
2
|
+
import { ColDef, Column, HeaderValueGetterParams } from 'ag-grid-enterprise';
|
|
5
3
|
import { AdaptableColumn, AdaptableColumnDataType } from '../../types';
|
|
6
4
|
export declare function getAutoRowGroupColumnIdFor(columnId: string): string;
|
|
7
5
|
export declare class ColumnInternalApi extends ApiBase {
|
|
@@ -29,7 +27,6 @@ export declare class ColumnInternalApi extends ApiBase {
|
|
|
29
27
|
* @param columnId columnId to look up
|
|
30
28
|
*/
|
|
31
29
|
getAgGridColumnForAdaptableColumn(columnId: string): Column;
|
|
32
|
-
getActiveColumnComparator(columnId: string, customSort?: CustomSort, customSortComparer?: ColumnValuesComparer): (valueA: any, valueB: any, nodeA?: IRowNode, nodeB?: IRowNode, isInverted?: boolean) => number | undefined;
|
|
33
30
|
isSpecialColumn(columnId: string, column?: AdaptableColumn): boolean;
|
|
34
31
|
getColumnHeaderName(params: HeaderValueGetterParams): string;
|
|
35
32
|
private buildColumnHeaderContext;
|
|
@@ -69,18 +69,6 @@ class ColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
69
69
|
getAgGridColumnForAdaptableColumn(columnId) {
|
|
70
70
|
return this._adaptable.getAgGridColumnForColumnId(columnId);
|
|
71
71
|
}
|
|
72
|
-
getActiveColumnComparator(columnId, customSort, customSortComparer) {
|
|
73
|
-
if ((!customSort || customSort?.IsSuspended) && !customSortComparer) {
|
|
74
|
-
// defaults to AG-Grid column definition comparator if no CustomSort is defined&active
|
|
75
|
-
const colDefComparator = this._adaptable.agGridColumnAdapter.getUserColDefProperty(columnId, 'comparator');
|
|
76
|
-
return colDefComparator;
|
|
77
|
-
}
|
|
78
|
-
// CustomSort Comparer function takes precedence over CustomSort SortedValues
|
|
79
|
-
const comparerFunction = customSortComparer
|
|
80
|
-
? customSortComparer.comparer
|
|
81
|
-
: this.getCustomSortApi().internalApi.getDefaultCustomSortComparer(customSort.ColumnId, customSort.SortedValues);
|
|
82
|
-
return comparerFunction;
|
|
83
|
-
}
|
|
84
72
|
isSpecialColumn(columnId, column = null) {
|
|
85
73
|
if (column) {
|
|
86
74
|
return column.isCalculatedColumn || column.isFreeTextColumn || column.isActionColumn;
|
|
@@ -14,6 +14,7 @@ export declare class ExportInternalApi extends ApiBase {
|
|
|
14
14
|
setExportInProgress(reportName: ReportNameType, reportFormat: ReportFormatType, exportDestination: ExportDestinationType): void;
|
|
15
15
|
setExportComplete(): void;
|
|
16
16
|
isVisualDataExportInProgress(): boolean;
|
|
17
|
+
isExcelExportInProgress(): boolean;
|
|
17
18
|
createSystemReport(systemReportName: SystemReportName): Report;
|
|
18
19
|
isSystemReport(reportName: ReportNameType): boolean;
|
|
19
20
|
isSystemDestination(destination: ExportDestinationType): boolean;
|
|
@@ -86,6 +86,9 @@ class ExportInternalApi extends ApiBase_1.ApiBase {
|
|
|
86
86
|
isVisualDataExportInProgress() {
|
|
87
87
|
return this.getAdaptableState().Internal.Export.inProgress?.reportFormat === 'VisualExcel';
|
|
88
88
|
}
|
|
89
|
+
isExcelExportInProgress() {
|
|
90
|
+
return this.getAdaptableState().Internal.Export.inProgress?.reportFormat === 'Excel';
|
|
91
|
+
}
|
|
89
92
|
createSystemReport(systemReportName) {
|
|
90
93
|
switch (systemReportName) {
|
|
91
94
|
case GeneralConstants_1.ALL_DATA_REPORT:
|
|
@@ -5,8 +5,6 @@ import { BaseState } from '../../AdaptableState/BaseState';
|
|
|
5
5
|
import { IAdaptableStore, LoadStoreConfig } from './Interface/IAdaptableStore';
|
|
6
6
|
type EmitterCallback = (data?: any) => any;
|
|
7
7
|
type EmitterAnyCallback = (eventName: string, data?: any) => any;
|
|
8
|
-
export declare const INIT_STATE = "INIT_STATE";
|
|
9
|
-
export declare const LOAD_STATE = "LOAD_STATE";
|
|
10
8
|
export interface ResetUserDataAction extends Redux.Action {
|
|
11
9
|
}
|
|
12
10
|
export interface InitStateAction extends Redux.Action {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdaptableStore = exports.LoadState = exports.InitState =
|
|
3
|
+
exports.AdaptableStore = exports.LoadState = exports.InitState = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const Redux = tslib_1.__importStar(require("redux"));
|
|
6
6
|
const PluginsRedux = tslib_1.__importStar(require("../ActionsReducers/PluginsRedux"));
|
|
@@ -44,13 +44,13 @@ const ThemeRedux = tslib_1.__importStar(require("../ActionsReducers/ThemeRedux")
|
|
|
44
44
|
const ToolPanelRedux = tslib_1.__importStar(require("../ActionsReducers/ToolPanelRedux"));
|
|
45
45
|
const TeamSharingState_1 = require("../../AdaptableState/TeamSharingState");
|
|
46
46
|
const buildAdaptableStateFunctionConfig_1 = require("./buildAdaptableStateFunctionConfig");
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const INIT_STATE = 'INIT_STATE';
|
|
48
|
+
const LOAD_STATE = 'LOAD_STATE';
|
|
49
49
|
const NON_PERSIST_ACTIONS = {
|
|
50
50
|
'@@INIT': true,
|
|
51
51
|
'@@redux/init': true,
|
|
52
|
-
[
|
|
53
|
-
[
|
|
52
|
+
[LOAD_STATE]: true,
|
|
53
|
+
[INIT_STATE]: true,
|
|
54
54
|
// progress indicators should NOT interfere with state management as it may lead to race conditions due to load/persist state being async
|
|
55
55
|
[PopupRedux_1.PROGRESS_INDICATOR_SHOW]: true,
|
|
56
56
|
[PopupRedux_1.PROGRESS_INDICATOR_HIDE]: true,
|
|
@@ -62,11 +62,11 @@ const NON_PERSISTENT_STORE_KEYS = [
|
|
|
62
62
|
'Plugins',
|
|
63
63
|
];
|
|
64
64
|
const InitState = () => ({
|
|
65
|
-
type:
|
|
65
|
+
type: INIT_STATE,
|
|
66
66
|
});
|
|
67
67
|
exports.InitState = InitState;
|
|
68
68
|
const LoadState = (State) => ({
|
|
69
|
-
type:
|
|
69
|
+
type: LOAD_STATE,
|
|
70
70
|
State,
|
|
71
71
|
});
|
|
72
72
|
exports.LoadState = LoadState;
|
|
@@ -167,7 +167,7 @@ class AdaptableStore {
|
|
|
167
167
|
Redux.combineReducers(rootReducerObject);
|
|
168
168
|
const rootReducerWithResetManagement = (state, action) => {
|
|
169
169
|
switch (action.type) {
|
|
170
|
-
case
|
|
170
|
+
case LOAD_STATE:
|
|
171
171
|
const { State } = action;
|
|
172
172
|
Object.keys(State).forEach((key) => {
|
|
173
173
|
state[key] = State[key];
|
|
@@ -199,7 +199,7 @@ class AdaptableStore {
|
|
|
199
199
|
});
|
|
200
200
|
};
|
|
201
201
|
// this is now VERY BADLY NAMED!
|
|
202
|
-
let rootReducer = (0, AdaptableReduxMerger_1.mergeReducer)(rootReducerWithResetManagement,
|
|
202
|
+
let rootReducer = (0, AdaptableReduxMerger_1.mergeReducer)(rootReducerWithResetManagement, LOAD_STATE);
|
|
203
203
|
const composeEnhancers = (x) => x;
|
|
204
204
|
const persistedReducer = (state, action) => {
|
|
205
205
|
if (adaptable.isDestroyed) {
|
|
@@ -1507,7 +1507,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
|
|
|
1507
1507
|
/*******************
|
|
1508
1508
|
* MANAGING STATE ACTIONS
|
|
1509
1509
|
*******************/
|
|
1510
|
-
case
|
|
1510
|
+
case INIT_STATE: {
|
|
1511
1511
|
let returnAction = next(action);
|
|
1512
1512
|
if (adaptable.isReady) {
|
|
1513
1513
|
// we need this here for when the state key is changed
|
|
@@ -8,4 +8,3 @@ export declare const isValueValidDate: (data: any) => boolean;
|
|
|
8
8
|
export declare const dateToISO: (date: Date | number | string) => string;
|
|
9
9
|
export declare const parseToISO: (date: string | Date | number, dateFormat?: string) => string;
|
|
10
10
|
export declare const parseDateValue: (dateValue: string | Date | number, dateFormat?: string) => Date | undefined;
|
|
11
|
-
export declare const parseFilterInputDate: (stringDate: string) => Date;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseDateValue = exports.parseToISO = exports.dateToISO = exports.isValueValidDate = exports.isValidDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
const FormatHelper_1 = require("./FormatHelper");
|
|
6
6
|
const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
|
|
@@ -30,6 +30,9 @@ const parseToISO = (date, dateFormat) => {
|
|
|
30
30
|
return (0, exports.isValidDate)(dateInstance) ? (0, exports.dateToISO)(dateInstance) : '';
|
|
31
31
|
};
|
|
32
32
|
exports.parseToISO = parseToISO;
|
|
33
|
+
// !!!
|
|
34
|
+
// AFL: ideally we should NEVER call directly this method, but use the AdaptableInternalApi.parseDateValue() instead
|
|
35
|
+
// we should refactor this with the first opportunity
|
|
33
36
|
const parseDateValue = (dateValue, dateFormat) => {
|
|
34
37
|
if (dateValue == undefined || (typeof dateValue === 'string' && dateValue.trim() === '')) {
|
|
35
38
|
return undefined;
|
|
@@ -37,29 +40,37 @@ const parseDateValue = (dateValue, dateFormat) => {
|
|
|
37
40
|
if (dateValue instanceof Date) {
|
|
38
41
|
return !isNaN(dateValue.getTime()) ? dateValue : undefined;
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else {
|
|
45
|
-
// typeof dateValue === 'string'
|
|
46
|
-
if (dateFormat) {
|
|
47
|
-
dateInstance = (0, date_fns_1.parse)(dateValue, dateFormat, new Date());
|
|
43
|
+
try {
|
|
44
|
+
let dateInstance;
|
|
45
|
+
if (typeof dateValue === 'number') {
|
|
46
|
+
dateInstance = new Date(dateValue);
|
|
48
47
|
}
|
|
49
48
|
else {
|
|
50
|
-
|
|
49
|
+
// typeof dateValue === 'string'
|
|
50
|
+
if (dateFormat) {
|
|
51
|
+
dateInstance = (0, date_fns_1.parse)(dateValue, dateFormat, new Date());
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
dateInstance = (0, date_fns_1.parseISO)(dateValue);
|
|
55
|
+
}
|
|
56
|
+
if (!(0, exports.isValidDate)(dateInstance)) {
|
|
57
|
+
// last chance: try to use the native Date.parse(), https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
|
|
58
|
+
dateInstance = new Date(Date.parse(dateValue));
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
61
|
if (!(0, exports.isValidDate)(dateInstance)) {
|
|
53
|
-
|
|
54
|
-
dateInstance =
|
|
62
|
+
AdaptableLogger_1.AdaptableLogger.consoleWarnBase(`Invalid date value "${dateValue}" - cannot be converted to a Date instance. Please make sure you specify adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat correctly.`);
|
|
63
|
+
dateInstance = undefined;
|
|
55
64
|
}
|
|
65
|
+
return dateInstance;
|
|
56
66
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
catch (error) {
|
|
68
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
69
|
+
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
70
|
+
AdaptableLogger_1.AdaptableLogger.consoleErrorBase(`Error parsing date value "${dateValue}": ${errorMessage}`, {
|
|
71
|
+
stack: errorStack,
|
|
72
|
+
originalError: error,
|
|
73
|
+
});
|
|
60
74
|
}
|
|
61
|
-
return dateInstance;
|
|
62
75
|
};
|
|
63
76
|
exports.parseDateValue = parseDateValue;
|
|
64
|
-
const parseFilterInputDate = (stringDate) => new Date(stringDate);
|
|
65
|
-
exports.parseFilterInputDate = parseFilterInputDate;
|
|
@@ -35,7 +35,7 @@ class FilterViewPanelComponent extends React.Component {
|
|
|
35
35
|
ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(this.props.ColumnFilters) && (React.createElement(AdaptablePopover_1.AdaptablePopover, { popupPadding: 0, className: `ab-${elementType}__Filter__info`, headerText: "", bodyText: [React.createElement(ActiveFiltersPanel_1.ActiveFiltersPanel, null)], useButton: true, showEvent: 'focus', hideEvent: "blur", popoverMinWidth: 400 })),
|
|
36
36
|
React.createElement(ButtonClear_1.ButtonClear, { "aria-label": 'Clear Filters', className: `ab-${elementType}__Filter__clear`, marginLeft: 1, marginBottom: 0, marginRight: 1, onClick: () => this.onClearFilters(), tooltip: "Clear Filters", disabled: this.props.ColumnFilters.length == 0, showText: this.props.viewType === 'ToolPanel' }, this.props.viewType === 'ToolPanel' && 'Clear'),
|
|
37
37
|
React.createElement(SimpleButton_1.default, { "aria-label": isAtLeastOneFilterActive ? 'Suspend All Filters' : 'Resume All Filters', className: (0, join_1.default)(`ab-${elementType}__Filter__suspend-button`, isAtLeastOneFilterActive && `ab-${elementType}__Filter__suspend-all`, !isAtLeastOneFilterActive && `ab-${elementType}__Filter__un-suspend-all`), disabled: !isAtLeastOneFilter, onClick: handleSuspendUnsuspendAll, tone: isAtLeastOneFilterActive ? 'neutral' : 'success', variant: "text", icon: isAtLeastOneFilterActive ? 'pause' : 'play', accessLevel: this.props.accessLevel })),
|
|
38
|
-
React.createElement(rebass_1.Flex, { alignItems: "center" }, this.props.api.filterApi.columnFilterApi.isQuickFilterAvailable() && (React.createElement(CheckBox_1.CheckBox, { className: `ab-${elementType}__Filter__active-check`, disabled: this.props.accessLevel === 'ReadOnly' ||
|
|
38
|
+
React.createElement(rebass_1.Flex, { alignItems: "center" }, this.props.api.filterApi.columnFilterApi.isQuickFilterAvailable() && (React.createElement(CheckBox_1.CheckBox, { "data-name": "quick-filter-toggle", className: `ab-${elementType}__Filter__active-check`, disabled: this.props.accessLevel === 'ReadOnly' ||
|
|
39
39
|
this.props.api.layoutApi.isCurrentLayoutPivot(), marginTop: 0, marginBottom: 0, fontSize: 2, padding: 1, checked: this.props.IsQuickFilterVisible, onChange: (checked) => {
|
|
40
40
|
checked ? this.props.onShowQuickFilterBar() : this.props.onHideQuickFilterBar();
|
|
41
41
|
} }, "Filter Bar")))));
|
|
@@ -1089,6 +1089,24 @@ You need to define at least one Layout!`);
|
|
|
1089
1089
|
color: '#aaaaaa',
|
|
1090
1090
|
pattern: 'Solid',
|
|
1091
1091
|
},
|
|
1092
|
+
},
|
|
1093
|
+
// see #EXCEL_EXPORT_DATA_TYPES
|
|
1094
|
+
{
|
|
1095
|
+
id: 'stringExcelType',
|
|
1096
|
+
dataType: 'String',
|
|
1097
|
+
}, {
|
|
1098
|
+
id: 'booleanExcelType',
|
|
1099
|
+
dataType: 'Boolean',
|
|
1100
|
+
}, {
|
|
1101
|
+
id: 'dateExcelType',
|
|
1102
|
+
dataType: 'DateTime',
|
|
1103
|
+
}, {
|
|
1104
|
+
id: 'numberExcelType',
|
|
1105
|
+
// dataType: 'Number',
|
|
1106
|
+
// AG Grid requires either dataType or numberFormat to be set for Numbers
|
|
1107
|
+
numberFormat: {
|
|
1108
|
+
format: '0.###############',
|
|
1109
|
+
},
|
|
1092
1110
|
});
|
|
1093
1111
|
this.agGridExportAdapter.originalExcelStyles = excelStyles;
|
|
1094
1112
|
this.agGridExportAdapter.DANGER_excelStyles = this.agGridExportAdapter.originalExcelStyles;
|
|
@@ -3199,11 +3217,6 @@ You need to define at least one Layout!`);
|
|
|
3199
3217
|
return this.agGridModulesAdapter.isAgGridModuleRegistered('CsvExportModule');
|
|
3200
3218
|
}
|
|
3201
3219
|
isQuickFilterAvailable() {
|
|
3202
|
-
if (this.api.layoutApi.isCurrentLayoutPivot() &&
|
|
3203
|
-
this.adaptableOptions.filterOptions.useAdaptableFiltering) {
|
|
3204
|
-
// hide completely the quick filter if pivot is enabled
|
|
3205
|
-
return false;
|
|
3206
|
-
}
|
|
3207
3220
|
return this.hasFloatingFilterOnAtLeastOneColumn(this.agGridAdapter.getAgGridApi().getColumnDefs());
|
|
3208
3221
|
}
|
|
3209
3222
|
hasFloatingFilterOnAtLeastOneColumn(columnDefs) {
|
|
@@ -174,11 +174,27 @@ class AgGridColumnAdapter {
|
|
|
174
174
|
if (!gridCell.column) {
|
|
175
175
|
return null;
|
|
176
176
|
}
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
const isExcelExport = this.adaptableApi.exportApi.internalApi.isExcelExportInProgress();
|
|
178
|
+
const isVisualDataExport = this.adaptableApi.exportApi.internalApi.isVisualDataExportInProgress();
|
|
179
|
+
if (isExcelExport || isVisualDataExport) {
|
|
180
|
+
const excelStyleClasses = [];
|
|
179
181
|
const userDefinedCellClass = typeof userCellClass === 'function' ? userCellClass(params) : userCellClass;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
if (userDefinedCellClass) {
|
|
183
|
+
if (Array.isArray(userDefinedCellClass)) {
|
|
184
|
+
excelStyleClasses.push(...userDefinedCellClass.filter(Boolean));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
excelStyleClasses.push(userDefinedCellClass);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (isVisualDataExport) {
|
|
191
|
+
const cellClassKey = AgGridExportAdapter_1.AgGridExportAdapter.getExcelClassNameForCell(colId, gridCell.primaryKeyValue, userDefinedCellClass);
|
|
192
|
+
const customCellClass = this.adaptableInstance.agGridExportAdapter.getExcelStyleIdForCellClassKey(cellClassKey);
|
|
193
|
+
if (customCellClass) {
|
|
194
|
+
excelStyleClasses.push(customCellClass);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return excelStyleClasses.length ? excelStyleClasses : null;
|
|
182
198
|
}
|
|
183
199
|
const isQuickSearchActive = this.isQuickSearchActive(gridCell);
|
|
184
200
|
const editableClassName = this.getEditableCellClass(gridCell, params);
|
|
@@ -617,7 +633,7 @@ class AgGridColumnAdapter {
|
|
|
617
633
|
const isFloatingFilterDisabled = !colDef.filter ||
|
|
618
634
|
!colDef.floatingFilter ||
|
|
619
635
|
!this.adaptableOptions.filterOptions.useAdaptableFiltering ||
|
|
620
|
-
!this.
|
|
636
|
+
!this.adaptableApi.filterApi.columnFilterApi.isQuickFilterVisible();
|
|
621
637
|
if (this.adaptableApi.columnApi.isAutoRowGroupColumn(col.getColId())) {
|
|
622
638
|
this.setColDefProperty(col, 'floatingFilter', (original_floatingFilter) => {
|
|
623
639
|
// the floating filter for the group column is "inherited" from the base column
|
|
@@ -808,10 +824,47 @@ class AgGridColumnAdapter {
|
|
|
808
824
|
}
|
|
809
825
|
setupColumnComparator({ col, colId, abColumn }) {
|
|
810
826
|
const customSort = this.adaptableApi.customSortApi.getCustomSortForColumn(colId);
|
|
811
|
-
const
|
|
827
|
+
const customSortComparer = this.adaptableApi.customSortApi.internalApi.getCustomSortComparer(abColumn.columnId);
|
|
828
|
+
const memoizedDateValues = new Map();
|
|
829
|
+
const getDateValue = (rawDateValue) => {
|
|
830
|
+
if (memoizedDateValues.has(rawDateValue)) {
|
|
831
|
+
return memoizedDateValues.get(rawDateValue);
|
|
832
|
+
}
|
|
833
|
+
const dateValue = this.adaptableApi.internalApi.parseDateValue(rawDateValue);
|
|
834
|
+
memoizedDateValues.set(rawDateValue, dateValue);
|
|
835
|
+
return dateValue;
|
|
836
|
+
};
|
|
812
837
|
const comparatorGetter = (propName) => {
|
|
813
|
-
return () => {
|
|
814
|
-
|
|
838
|
+
return (userPropertyValue) => {
|
|
839
|
+
// CustomSort Comparer function takes precedence over CustomSort SortedValues
|
|
840
|
+
if (customSortComparer) {
|
|
841
|
+
return customSortComparer.comparer;
|
|
842
|
+
}
|
|
843
|
+
if (customSort && !customSort.IsSuspended) {
|
|
844
|
+
return this.adaptableApi.customSortApi.internalApi.getDefaultCustomSortComparer(customSort.ColumnId, customSort.SortedValues);
|
|
845
|
+
}
|
|
846
|
+
if (userPropertyValue) {
|
|
847
|
+
return userPropertyValue;
|
|
848
|
+
}
|
|
849
|
+
// for DATE columns we have to use the normalised values (Date objects) to compare
|
|
850
|
+
if (abColumn.dataType === 'date') {
|
|
851
|
+
return (valueA, valueB) => {
|
|
852
|
+
const dateA = getDateValue(valueA);
|
|
853
|
+
const dateB = getDateValue(valueB);
|
|
854
|
+
if (dateA && dateB) {
|
|
855
|
+
return dateA.getTime() - dateB.getTime();
|
|
856
|
+
}
|
|
857
|
+
else if (dateA) {
|
|
858
|
+
return 1; // consider non-null dates as greater than null/undefined
|
|
859
|
+
}
|
|
860
|
+
else if (dateB) {
|
|
861
|
+
return -1; // consider non-null dates as greater than null/undefined
|
|
862
|
+
}
|
|
863
|
+
else {
|
|
864
|
+
return 0; // both are null/undefined, considered equal
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
}
|
|
815
868
|
};
|
|
816
869
|
};
|
|
817
870
|
this.setColDefProperty(col, 'comparator', comparatorGetter('comparator'));
|
|
@@ -606,6 +606,27 @@ class AgGridExportAdapter {
|
|
|
606
606
|
this.registerExcelStyle(finalCellExcelStyle, cellClassId);
|
|
607
607
|
});
|
|
608
608
|
}, forAllVisibleRowNodesDoConfig);
|
|
609
|
+
// see #EXCEL_EXPORT_DATA_TYPES
|
|
610
|
+
this.excelStylesCache['stringExcelType'] = {
|
|
611
|
+
id: 'stringExcelType',
|
|
612
|
+
dataType: 'String',
|
|
613
|
+
};
|
|
614
|
+
this.excelStylesCache['booleanExcelType'] = {
|
|
615
|
+
id: 'booleanExcelType',
|
|
616
|
+
dataType: 'Boolean',
|
|
617
|
+
};
|
|
618
|
+
this.excelStylesCache['dateExcelType'] = {
|
|
619
|
+
id: 'dateExcelType',
|
|
620
|
+
dataType: 'DateTime',
|
|
621
|
+
};
|
|
622
|
+
this.excelStylesCache['numberExcelType'] = {
|
|
623
|
+
id: 'numberExcelType',
|
|
624
|
+
// dataType: 'Number',
|
|
625
|
+
// AG Grid requires either dataType or numberFormat to be set for Numbers
|
|
626
|
+
numberFormat: {
|
|
627
|
+
format: '0.###############',
|
|
628
|
+
},
|
|
629
|
+
};
|
|
609
630
|
return Object.values(this.excelStylesCache);
|
|
610
631
|
}
|
|
611
632
|
registerExcelStyle(excelStyle, cellClassKey) {
|
package/src/env.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = {
|
|
4
4
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
5
|
-
PUBLISH_TIMESTAMP:
|
|
6
|
-
VERSION: "21.0.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1761108119347 || Date.now(),
|
|
6
|
+
VERSION: "21.0.8" || '--current-version--',
|
|
7
7
|
};
|
|
@@ -336,6 +336,8 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
336
336
|
getPivotLayoutModelFromGrid() {
|
|
337
337
|
const pivotResultColumns = this.gridApi.getPivotResultColumns() || [];
|
|
338
338
|
const pivotResultColumnsSet = new Set(pivotResultColumns.map((col) => col.getColId()));
|
|
339
|
+
const rowGroupColumns = this.gridApi.getRowGroupColumns() || [];
|
|
340
|
+
const rowGroupColumnsSet = new Set(rowGroupColumns.map((col) => col.getColId()));
|
|
339
341
|
const prevLayout = this.currentLayout;
|
|
340
342
|
const columnState = this.gridApi
|
|
341
343
|
.getColumnState()
|
|
@@ -343,6 +345,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
343
345
|
let PivotColumns = this.gridApi.getPivotColumns().map((col) => col.getColId());
|
|
344
346
|
const layout = this.getUndecidedLayoutModelFromGrid(columnState);
|
|
345
347
|
let ColumnSizing = layout.ColumnSizing || {};
|
|
348
|
+
let ColumnVisibility = { ...layout.ColumnVisibility };
|
|
346
349
|
//let's also include the column widths of the pivotResult columns
|
|
347
350
|
pivotResultColumns.forEach((col) => {
|
|
348
351
|
const colId = col.getColId();
|
|
@@ -358,6 +361,18 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
358
361
|
if (!Object.keys(ColumnSizing).length) {
|
|
359
362
|
ColumnSizing = undefined;
|
|
360
363
|
}
|
|
364
|
+
// from column visibility, let's remove all columns that are not actually in the pivot layout
|
|
365
|
+
// since having normal table columns here will break the equality check
|
|
366
|
+
// so we only want to keep the group columns and the pivot result columns
|
|
367
|
+
Object.keys(ColumnVisibility).forEach((colId) => {
|
|
368
|
+
const isInLayout = pivotResultColumnsSet.has(colId) || rowGroupColumnsSet.has(colId);
|
|
369
|
+
if (!isInLayout) {
|
|
370
|
+
delete ColumnVisibility[colId];
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
if (!Object.keys(ColumnVisibility).length) {
|
|
374
|
+
ColumnVisibility = undefined;
|
|
375
|
+
}
|
|
361
376
|
delete layout.TableColumns;
|
|
362
377
|
const pivotLayout = {
|
|
363
378
|
Name: layout.Name,
|
|
@@ -375,7 +390,7 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
|
|
|
375
390
|
ColumnPinning: layout.ColumnPinning,
|
|
376
391
|
ColumnSorts: layout.ColumnSorts,
|
|
377
392
|
ColumnSizing,
|
|
378
|
-
ColumnVisibility
|
|
393
|
+
ColumnVisibility,
|
|
379
394
|
RowGroupValues: layout.RowGroupValues,
|
|
380
395
|
ColumnGroupValues: layout.ColumnGroupValues,
|
|
381
396
|
PivotGroupedColumns: layout.RowGroupedColumns,
|
|
@@ -105,6 +105,11 @@ function normalizeTableLayoutModel(layout, options) {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
// there might be a case where there are we have an RowGroupedColumns array, but it's empty (or it's inexistent altogether)
|
|
109
|
+
// and there is no display type specified - so default it to single
|
|
110
|
+
if (!layout.RowGroupDisplayType && layout.TableColumns) {
|
|
111
|
+
layout.RowGroupDisplayType = 'single';
|
|
112
|
+
}
|
|
108
113
|
if (options?.isTree && !layout.TableColumns.includes(exports.AUTO_GROUP_COLUMN_ID__SINGLE)) {
|
|
109
114
|
layout.TableColumns.unshift(exports.AUTO_GROUP_COLUMN_ID__SINGLE);
|
|
110
115
|
}
|
|
@@ -161,9 +166,9 @@ function normalizePivotLayoutModel(layout) {
|
|
|
161
166
|
// make it an own property
|
|
162
167
|
layout.PivotColumnTotal = undefined;
|
|
163
168
|
}
|
|
164
|
-
if (layout.PivotGroupedColumns && layout.PivotGroupedColumns.length) {
|
|
165
|
-
|
|
166
|
-
}
|
|
169
|
+
// if (layout.PivotGroupedColumns && layout.PivotGroupedColumns.length) {
|
|
170
|
+
layout.RowGroupDisplayType = layout.RowGroupDisplayType || 'single';
|
|
171
|
+
// }
|
|
167
172
|
return layout;
|
|
168
173
|
}
|
|
169
174
|
exports.normalizePivotLayoutModel = normalizePivotLayoutModel;
|