@adaptabletools/adaptable 10.0.0-canary.3 → 10.0.3
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/base.css +77 -29
- package/index.css +89 -31
- package/package.json +1 -5
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +12 -2
- package/src/AdaptableOptions/AdaptableOptions.d.ts +1 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +14 -7
- package/src/AdaptableOptions/GeneralOptions.d.ts +0 -7
- package/src/AdaptableOptions/LayoutOptions.d.ts +1 -1
- package/src/AdaptableOptions/QueryLanguageOptions.d.ts +7 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +89 -4
- package/src/Api/AlertApi.d.ts +1 -1
- package/src/Api/ColumnApi.d.ts +33 -0
- package/src/Api/ConfigApi.d.ts +8 -0
- package/src/Api/DataChangeHistoryApi.d.ts +10 -4
- package/src/Api/GridApi.d.ts +34 -8
- package/src/Api/Implementation/AlertApiImpl.d.ts +1 -1
- package/src/Api/Implementation/AlertApiImpl.js +11 -4
- package/src/Api/Implementation/ColumnApiImpl.d.ts +7 -0
- package/src/Api/Implementation/ColumnApiImpl.js +37 -1
- package/src/Api/Implementation/ConfigApiImpl.d.ts +1 -1
- package/src/Api/Implementation/ConfigApiImpl.js +28 -17
- package/src/Api/Implementation/DataChangeHistoryApiImpl.d.ts +1 -0
- package/src/Api/Implementation/DataChangeHistoryApiImpl.js +3 -0
- package/src/Api/Implementation/FreeTextColumnApiImpl.js +2 -1
- package/src/Api/Implementation/GridApiImpl.d.ts +9 -0
- package/src/Api/Implementation/GridApiImpl.js +17 -1
- package/src/Api/Implementation/InternalApiImpl.d.ts +2 -0
- package/src/Api/Implementation/InternalApiImpl.js +16 -0
- package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +2 -0
- package/src/Api/Implementation/QueryLanguageApiImpl.js +3 -0
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +11 -8
- package/src/Api/Implementation/UserInterfaceApiImpl.js +57 -80
- package/src/Api/InternalApi.d.ts +2 -0
- package/src/Api/QueryLanguageApi.d.ts +5 -0
- package/src/Api/UserInterfaceApi.d.ts +14 -5
- package/src/PredefinedConfig/AlertState.d.ts +10 -0
- package/src/PredefinedConfig/CalculatedColumnState.d.ts +4 -37
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +16 -15
- package/src/PredefinedConfig/Common/DataUpdateConfig.d.ts +5 -1
- package/src/PredefinedConfig/Common/SpecialColumnSettings.d.ts +49 -0
- package/src/{AdaptableOptions/DataChangeTrackingOptions.js → PredefinedConfig/Common/SpecialColumnSettings.js} +0 -0
- package/src/PredefinedConfig/FilterState.d.ts +1 -1
- package/src/PredefinedConfig/FreeTextColumnState.d.ts +10 -0
- package/src/PredefinedConfig/Selection/GridRow.d.ts +12 -4
- package/src/PredefinedConfig/SystemState.d.ts +4 -1
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +6 -6
- package/src/Redux/ActionsReducers/SystemRedux.js +11 -11
- package/src/Redux/Store/AdaptableReduxMerger.js +7 -1
- package/src/Redux/Store/AdaptableStore.js +12 -0
- package/src/Strategy/AlertModule.js +1 -1
- package/src/Strategy/DataChangeHistoryModule.js +1 -1
- package/src/Strategy/ExportModule.d.ts +0 -2
- package/src/Strategy/ExportModule.js +58 -61
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -4
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +11 -5
- package/src/Utilities/Helpers/DateHelper.d.ts +8 -2
- package/src/Utilities/Helpers/DateHelper.js +42 -20
- package/src/Utilities/ObjectFactory.d.ts +1 -1
- package/src/Utilities/ObjectFactory.js +13 -1
- package/src/Utilities/Services/AlertService.d.ts +1 -0
- package/src/Utilities/Services/AlertService.js +5 -0
- package/src/Utilities/Services/DataService.d.ts +0 -4
- package/src/Utilities/Services/DataService.js +2 -18
- package/src/Utilities/Services/Interface/IAlertService.d.ts +2 -1
- package/src/Utilities/Services/Interface/IDataService.d.ts +0 -2
- package/src/Utilities/Services/Interface/ILicenseService.d.ts +2 -1
- package/src/Utilities/Services/LicenseService.d.ts +2 -2
- package/src/Utilities/Services/MetamodelService.js +1 -0
- package/src/Utilities/Services/ModuleService.js +31 -24
- package/src/Utilities/Services/ReportService.js +1 -1
- package/src/Utilities/Services/TeamSharingService.d.ts +1 -0
- package/src/Utilities/Services/TeamSharingService.js +4 -2
- package/src/Utilities/runIfNotResolvedIn.d.ts +8 -0
- package/src/Utilities/runIfNotResolvedIn.js +23 -0
- package/src/View/AdaptableView.js +1 -1
- package/src/View/Alert/Wizard/AlertDisplayWizardSection.js +19 -5
- package/src/View/BulkUpdate/BulkUpdatePopup.d.ts +2 -0
- package/src/View/BulkUpdate/BulkUpdatePopup.js +4 -2
- package/src/View/BulkUpdate/BulkUpdateViewPanel.d.ts +2 -0
- package/src/View/BulkUpdate/BulkUpdateViewPanel.js +3 -1
- package/src/View/Components/FilterForm/FilterForm.d.ts +3 -51
- package/src/View/Components/FilterForm/FilterForm.js +44 -23
- package/src/View/Components/FilterForm/ListBoxFilterForm.d.ts +3 -0
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +14 -5
- package/src/View/Components/FilterForm/QuickFilterForm.d.ts +3 -43
- package/src/View/Components/FilterForm/QuickFilterForm.js +64 -23
- package/src/View/Components/FilterForm/getDefaultColumnFilterPredicate.d.ts +3 -0
- package/src/View/Components/FilterForm/getDefaultColumnFilterPredicate.js +8 -0
- package/src/View/Components/Popups/AdaptablePopup.d.ts +1 -1
- package/src/View/Components/Selectors/ColumnValueSelector.d.ts +10 -2
- package/src/View/Components/Selectors/ColumnValueSelector.js +45 -13
- package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +24 -6
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +42 -32
- package/src/View/DataChangeHistory/DataChangeHistoryPopup.d.ts +5 -1
- package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +8 -5
- package/src/View/FreeTextColumn/FreeTextColumnPopup.js +3 -1
- package/src/View/FreeTextColumn/FreeTextColumnSummary.js +3 -1
- package/src/View/GridInfo/GridInfoPopup.js +4 -1
- package/src/View/Query/QueryViewPanel.js +1 -1
- package/src/View/Schedule/Wizard/ScheduleScheduleWizard.d.ts +1 -1
- package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +6 -8
- package/src/View/UIHelper.d.ts +2 -0
- package/src/View/UIHelper.js +10 -1
- package/src/agGrid/ActionColumnRenderer.d.ts +2 -1
- package/src/agGrid/ActionColumnRenderer.js +20 -3
- package/src/agGrid/Adaptable.d.ts +20 -4
- package/src/agGrid/Adaptable.js +186 -55
- package/src/components/Dashboard/Dashboard.js +1 -1
- package/src/components/DropdownButton/index.js +1 -1
- package/src/components/ExpressionEditor/index.js +2 -1
- package/src/components/Loader/Loader.d.ts +7 -0
- package/src/components/Loader/Loader.js +13 -0
- package/src/components/Loader/index.d.ts +2 -0
- package/src/components/Loader/index.js +7 -0
- package/src/components/ProgressIndicator/ProgressIndicator.d.ts +2 -0
- package/src/components/ProgressIndicator/ProgressIndicator.js +54 -0
- package/src/metamodel/adaptable.metamodel.d.ts +74 -34
- package/src/metamodel/adaptable.metamodel.js +346 -116
- package/src/parser/src/types.d.ts +11 -11
- package/src/types.d.ts +4 -4
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/AdaptableOptions/DataChangeTrackingOptions.d.ts +0 -16
- package/src/Utilities/Interface/ProgressIndicator.d.ts +0 -4
- package/src/Utilities/Interface/ProgressIndicator.js +0 -2
- package/src/View/Export/ProgressIndicator.d.ts +0 -6
- package/src/View/Export/ProgressIndicator.js +0 -25
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -416,7 +416,7 @@ class Adaptable {
|
|
|
416
416
|
this.isInitialised = true;
|
|
417
417
|
});
|
|
418
418
|
if (this.abContainerElement == null) {
|
|
419
|
-
this.abContainerElement = this.
|
|
419
|
+
this.abContainerElement = this.getAdaptableContainerElement();
|
|
420
420
|
}
|
|
421
421
|
if (this.abContainerElement != null) {
|
|
422
422
|
this.abContainerElement.innerHTML = '';
|
|
@@ -484,17 +484,19 @@ class Adaptable {
|
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
performAudit(action, oldState, newState) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
487
|
+
if (this.isInitialised) {
|
|
488
|
+
const adaptableStateChangedInfo = {
|
|
489
|
+
actionName: action.type,
|
|
490
|
+
clientTimestamp: new Date(),
|
|
491
|
+
userName: this.adaptableOptions.userName,
|
|
492
|
+
adaptableId: this.adaptableOptions.adaptableId,
|
|
493
|
+
adaptableStateKey: this.adaptableOptions.adaptableStateKey,
|
|
494
|
+
action: action,
|
|
495
|
+
oldState: oldState,
|
|
496
|
+
newState: newState,
|
|
497
|
+
};
|
|
498
|
+
this.api.eventApi.emit('AdaptableStateChanged', adaptableStateChangedInfo);
|
|
499
|
+
}
|
|
498
500
|
}
|
|
499
501
|
initializeAgGrid() {
|
|
500
502
|
var _a;
|
|
@@ -950,6 +952,26 @@ class Adaptable {
|
|
|
950
952
|
.join(' ');
|
|
951
953
|
return classNames;
|
|
952
954
|
}
|
|
955
|
+
getEditableCellClass(abColumn, params) {
|
|
956
|
+
const editableCellStyle = this.api.userInterfaceApi.getEditableCellStyle();
|
|
957
|
+
if (!(editableCellStyle === null || editableCellStyle === void 0 ? void 0 : editableCellStyle.ClassName)) {
|
|
958
|
+
return null;
|
|
959
|
+
}
|
|
960
|
+
const isCellEditable = this.api.gridApi.areCellsEditable([
|
|
961
|
+
this.getGridCellFromRowNode(params.node, abColumn.ColumnId),
|
|
962
|
+
]);
|
|
963
|
+
return isCellEditable ? editableCellStyle.ClassName : null;
|
|
964
|
+
}
|
|
965
|
+
getReadonlyCellClass(abColumn, params) {
|
|
966
|
+
const readonlyCellStyle = this.api.userInterfaceApi.getReadOnlyCellStyle();
|
|
967
|
+
if (!(readonlyCellStyle === null || readonlyCellStyle === void 0 ? void 0 : readonlyCellStyle.ClassName)) {
|
|
968
|
+
return null;
|
|
969
|
+
}
|
|
970
|
+
const isCellReadonly = !this.api.gridApi.areCellsEditable([
|
|
971
|
+
this.getGridCellFromRowNode(params.node, abColumn.ColumnId),
|
|
972
|
+
]);
|
|
973
|
+
return isCellReadonly ? readonlyCellStyle.ClassName : null;
|
|
974
|
+
}
|
|
953
975
|
isQuickSearchActive(abColumn, params) {
|
|
954
976
|
if (abColumn.IsExcludedFromQuickSearch) {
|
|
955
977
|
return false;
|
|
@@ -1023,7 +1045,7 @@ class Adaptable {
|
|
|
1023
1045
|
}
|
|
1024
1046
|
setColumnOrder(VisibleColumnList) {
|
|
1025
1047
|
const newColumnState = this.getSortedColumnStateForVisibleColumns(VisibleColumnList);
|
|
1026
|
-
this.gridOptions.columnApi.
|
|
1048
|
+
this.gridOptions.columnApi.applyColumnState({ state: newColumnState, applyOrder: true });
|
|
1027
1049
|
this.updateColumnsIntoStore();
|
|
1028
1050
|
}
|
|
1029
1051
|
persistLayout(layout) {
|
|
@@ -1177,7 +1199,7 @@ class Adaptable {
|
|
|
1177
1199
|
if (shouldUpdatePivoted) {
|
|
1178
1200
|
this.gridOptions.columnApi.setPivotMode(pivoted);
|
|
1179
1201
|
}
|
|
1180
|
-
this.gridOptions.columnApi.
|
|
1202
|
+
this.gridOptions.columnApi.applyColumnState({ state: newColState, applyOrder: true });
|
|
1181
1203
|
this.api.gridApi.setColumnSorts(layout.ColumnSorts);
|
|
1182
1204
|
this.gridOptions.columnApi.setPivotColumns(layout.PivotColumns || []);
|
|
1183
1205
|
// aggrid 25.1.0 introduced a bug such that a layout that has a grouped column, if the column has enableRowGroup: true but not rowGroup: true
|
|
@@ -1365,7 +1387,9 @@ class Adaptable {
|
|
|
1365
1387
|
isMaster: !!(node.master != null && node.master == true),
|
|
1366
1388
|
isExpanded: !!(node.expanded != null && node.expanded == true),
|
|
1367
1389
|
isGroup: !!(node.group != null && node.group == true),
|
|
1368
|
-
|
|
1390
|
+
isSelected: true,
|
|
1391
|
+
isDisplayed: node.displayed == true,
|
|
1392
|
+
rowGroupLevel: node.level,
|
|
1369
1393
|
};
|
|
1370
1394
|
const gridRow = {
|
|
1371
1395
|
primaryKeyValue: this.getPrimaryKeyValueFromRowNode(node),
|
|
@@ -1419,11 +1443,11 @@ class Adaptable {
|
|
|
1419
1443
|
cancelEdit() {
|
|
1420
1444
|
this.gridOptions.api.stopEditing(true);
|
|
1421
1445
|
}
|
|
1422
|
-
getDistinctValuesForColumn(column, visibleRowsOnly, skipRowNode) {
|
|
1446
|
+
getDistinctValuesForColumn(column, visibleRowsOnly, skipRowNode, permittedValues) {
|
|
1423
1447
|
let returnValues = [];
|
|
1424
1448
|
// this function does NOT look up for server values but actually it should...
|
|
1425
1449
|
// that is currently commented out in the column api function (previously in filter form)
|
|
1426
|
-
|
|
1450
|
+
permittedValues = permittedValues !== null && permittedValues !== void 0 ? permittedValues : this.api.userInterfaceApi.getPermittedValuesForColumn(column);
|
|
1427
1451
|
if (ArrayExtensions_1.ArrayExtensions.IsNotNull(permittedValues)) {
|
|
1428
1452
|
returnValues = permittedValues.map((pv) => {
|
|
1429
1453
|
return {
|
|
@@ -1456,6 +1480,46 @@ class Adaptable {
|
|
|
1456
1480
|
const uniqueVals = uniqBy_1.default(returnValues, 'displayValue');
|
|
1457
1481
|
return uniqueVals.slice(0, this.adaptableOptions.filterOptions.maxFilterValuesToDisplay);
|
|
1458
1482
|
}
|
|
1483
|
+
async getDistinctFilterValuesForColumn(column, visibleRowsOnly, filter, skipRowNode) {
|
|
1484
|
+
var _a;
|
|
1485
|
+
const permittedValues = (_a = this.api.userInterfaceApi.getFilterPermittedValuesForColumn(column)) !== null && _a !== void 0 ? _a : {
|
|
1486
|
+
suppressClientSideFiltering: false,
|
|
1487
|
+
values: () => undefined,
|
|
1488
|
+
};
|
|
1489
|
+
let preparedPermittedValues = undefined;
|
|
1490
|
+
try {
|
|
1491
|
+
preparedPermittedValues = await (permittedValues === null || permittedValues === void 0 ? void 0 : permittedValues.values(column, filter));
|
|
1492
|
+
}
|
|
1493
|
+
catch (error) {
|
|
1494
|
+
LoggingHelper_1.ConsoleLogError(`Failed to load filter permitted values`, column, filter, error);
|
|
1495
|
+
}
|
|
1496
|
+
return {
|
|
1497
|
+
suppressClientSideFilter: permittedValues.suppressClientSideFiltering,
|
|
1498
|
+
gridCells: this.getDistinctValuesForColumn(column, visibleRowsOnly, skipRowNode, preparedPermittedValues),
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
async getDistinctCustomSortValuesForColumn(column, visibleRowsOnly, skipRowNode) {
|
|
1502
|
+
const permittedValues = await this.api.userInterfaceApi.getCustomSortPermittedValuesForColumn(column);
|
|
1503
|
+
let preparedPermittedValues = undefined;
|
|
1504
|
+
try {
|
|
1505
|
+
preparedPermittedValues = await (permittedValues === null || permittedValues === void 0 ? void 0 : permittedValues.values(column));
|
|
1506
|
+
}
|
|
1507
|
+
catch (error) {
|
|
1508
|
+
LoggingHelper_1.ConsoleLogError(`Failed to load custom sort permitted values`, column, error);
|
|
1509
|
+
}
|
|
1510
|
+
return this.getDistinctValuesForColumn(column, visibleRowsOnly, skipRowNode, preparedPermittedValues);
|
|
1511
|
+
}
|
|
1512
|
+
async getDistinctBulkUpdateValuesForColumn(column, visibleRowsOnly, selectedGridCells, skipRowNode) {
|
|
1513
|
+
const permittedValues = await this.api.userInterfaceApi.getBulkUpdatePermittedValuesForColumn(column);
|
|
1514
|
+
let preparedPermittedValues = undefined;
|
|
1515
|
+
try {
|
|
1516
|
+
preparedPermittedValues = await (permittedValues === null || permittedValues === void 0 ? void 0 : permittedValues.values(column, selectedGridCells));
|
|
1517
|
+
}
|
|
1518
|
+
catch (error) {
|
|
1519
|
+
LoggingHelper_1.ConsoleLogError(`Failed to load bulk permitted values`, error, column, selectedGridCells);
|
|
1520
|
+
}
|
|
1521
|
+
return this.getDistinctValuesForColumn(column, visibleRowsOnly, skipRowNode, preparedPermittedValues);
|
|
1522
|
+
}
|
|
1459
1523
|
getColumnValueDisplayValuePairList(columnId, visibleRowsOnly, onlyIncludeIds) {
|
|
1460
1524
|
const returnArray = [];
|
|
1461
1525
|
let permittedMap = new Map();
|
|
@@ -1794,9 +1858,12 @@ class Adaptable {
|
|
|
1794
1858
|
];
|
|
1795
1859
|
}
|
|
1796
1860
|
getColDefsForFreeTextColumns() {
|
|
1797
|
-
|
|
1861
|
+
const specialColumnsAreFilterable = this.api.internalApi.getAdaptableOptions().filterOptions
|
|
1798
1862
|
.enableFilterOnSpecialColumns;
|
|
1863
|
+
const defaultFreeTextColumnSettings = ObjectFactory_1.CreateEmptyFreeTextColumn(specialColumnsAreFilterable)
|
|
1864
|
+
.FreeTextColumnSettings;
|
|
1799
1865
|
return this.api.freeTextColumnApi.getAllFreeTextColumn().map((freeTextColumn) => {
|
|
1866
|
+
const freeTextColumnSettings = Object.assign(Object.assign({}, defaultFreeTextColumnSettings), freeTextColumn.FreeTextColumnSettings);
|
|
1800
1867
|
const dataTypeEditor = freeTextColumn.DataType === 'Number'
|
|
1801
1868
|
? AdaptableNumberEditor_1.AdaptableNumberEditor
|
|
1802
1869
|
: freeTextColumn.DataType === 'Date'
|
|
@@ -1808,10 +1875,16 @@ class Adaptable {
|
|
|
1808
1875
|
colId: freeTextColumn.ColumnId,
|
|
1809
1876
|
editable: true,
|
|
1810
1877
|
hide: true,
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1878
|
+
width: freeTextColumnSettings.Width,
|
|
1879
|
+
enableValue: freeTextColumnSettings.Aggregatable,
|
|
1880
|
+
filter: freeTextColumnSettings.Filterable,
|
|
1881
|
+
floatingFilter: freeTextColumnSettings.Filterable,
|
|
1882
|
+
resizable: freeTextColumnSettings.Resizable,
|
|
1883
|
+
enableRowGroup: freeTextColumnSettings.Groupable,
|
|
1884
|
+
sortable: freeTextColumnSettings.Sortable,
|
|
1885
|
+
enablePivot: freeTextColumnSettings.Pivotable,
|
|
1886
|
+
suppressMenu: freeTextColumnSettings.SuppressMenu,
|
|
1887
|
+
suppressMovable: freeTextColumnSettings.SuppressMovable,
|
|
1815
1888
|
cellEditor: dataTypeEditor !== null && dataTypeEditor !== void 0 ? dataTypeEditor : (freeTextColumn.TextEditor && freeTextColumn.TextEditor == 'Large'
|
|
1816
1889
|
? 'agLargeTextCellEditor'
|
|
1817
1890
|
: 'agTextCellEditor'),
|
|
@@ -1846,15 +1919,24 @@ class Adaptable {
|
|
|
1846
1919
|
}
|
|
1847
1920
|
}
|
|
1848
1921
|
getColDefsForActionColumns() {
|
|
1922
|
+
const defaultActionColumnSettings = {
|
|
1923
|
+
resizable: true,
|
|
1924
|
+
suppressMenu: false,
|
|
1925
|
+
suppressMovable: false,
|
|
1926
|
+
};
|
|
1849
1927
|
return this.api.userInterfaceApi.getAllActionColumn().map((actionColumn) => {
|
|
1928
|
+
const actionColumnSettings = Object.assign(Object.assign({}, defaultActionColumnSettings), actionColumn.actionColumnSettings);
|
|
1850
1929
|
const newColDef = {
|
|
1851
1930
|
headerName: actionColumn.friendlyName ? actionColumn.friendlyName : actionColumn.columnId,
|
|
1852
1931
|
colId: actionColumn.columnId,
|
|
1853
|
-
editable: false,
|
|
1854
1932
|
hide: false,
|
|
1933
|
+
editable: false,
|
|
1934
|
+
width: actionColumnSettings.width,
|
|
1935
|
+
resizable: actionColumnSettings.resizable,
|
|
1936
|
+
suppressMenu: actionColumnSettings.suppressMenu,
|
|
1937
|
+
suppressMovable: actionColumnSettings.suppressMovable,
|
|
1855
1938
|
filter: false,
|
|
1856
1939
|
sortable: false,
|
|
1857
|
-
resizable: true,
|
|
1858
1940
|
enableRowGroup: false,
|
|
1859
1941
|
cellRenderer: ActionColumnRenderer_1.ActionColumnRenderer,
|
|
1860
1942
|
type: [GeneralConstants_1.AB_SPECIAL_COLUMN, 'abColDefObject'],
|
|
@@ -1881,16 +1963,17 @@ class Adaptable {
|
|
|
1881
1963
|
this.setLayout();
|
|
1882
1964
|
}
|
|
1883
1965
|
getColDefsForCalculatedColumns() {
|
|
1966
|
+
const specialColumnsAreFilterable = this.adaptableOptions.filterOptions
|
|
1967
|
+
.enableFilterOnSpecialColumns
|
|
1968
|
+
? this.adaptableOptions.filterOptions.enableFilterOnSpecialColumns
|
|
1969
|
+
: true;
|
|
1970
|
+
const defaultCalculatedColumnSettings = ObjectFactory_1.CreateEmptyCalculatedColumn(specialColumnsAreFilterable)
|
|
1971
|
+
.CalculatedColumnSettings;
|
|
1884
1972
|
return this.api.calculatedColumnApi.getAllCalculatedColumn().map((calculatedColumn) => {
|
|
1885
1973
|
var _a;
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
: true;
|
|
1890
|
-
calculatedColumn.CalculatedColumnSettings = ObjectFactory_1.CreateEmptyCalculatedColumn(filterable).CalculatedColumnSettings;
|
|
1891
|
-
}
|
|
1892
|
-
if (!calculatedColumn.CalculatedColumnSettings.DataType) {
|
|
1893
|
-
calculatedColumn.CalculatedColumnSettings.DataType = this.CalculatedColumnExpressionService.GetCalculatedColumnDataType((_a = calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.ScalarExpression);
|
|
1974
|
+
const calculatedColumnSettings = Object.assign(Object.assign({}, defaultCalculatedColumnSettings), calculatedColumn.CalculatedColumnSettings);
|
|
1975
|
+
if (!calculatedColumnSettings.DataType) {
|
|
1976
|
+
calculatedColumnSettings.DataType = this.CalculatedColumnExpressionService.GetCalculatedColumnDataType((_a = calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.ScalarExpression);
|
|
1894
1977
|
}
|
|
1895
1978
|
const newColDef = {
|
|
1896
1979
|
headerName: calculatedColumn.FriendlyName
|
|
@@ -1899,25 +1982,27 @@ class Adaptable {
|
|
|
1899
1982
|
colId: calculatedColumn.ColumnId,
|
|
1900
1983
|
hide: true,
|
|
1901
1984
|
editable: false,
|
|
1902
|
-
width:
|
|
1903
|
-
enableValue:
|
|
1904
|
-
filter:
|
|
1905
|
-
floatingFilter:
|
|
1906
|
-
resizable:
|
|
1907
|
-
enableRowGroup:
|
|
1908
|
-
sortable:
|
|
1909
|
-
enablePivot:
|
|
1985
|
+
width: calculatedColumnSettings.Width,
|
|
1986
|
+
enableValue: calculatedColumnSettings.Aggregatable,
|
|
1987
|
+
filter: calculatedColumnSettings.Filterable,
|
|
1988
|
+
floatingFilter: calculatedColumnSettings.Filterable,
|
|
1989
|
+
resizable: calculatedColumnSettings.Resizable,
|
|
1990
|
+
enableRowGroup: calculatedColumnSettings.Groupable,
|
|
1991
|
+
sortable: calculatedColumnSettings.Sortable,
|
|
1992
|
+
enablePivot: calculatedColumnSettings.Pivotable,
|
|
1993
|
+
suppressMenu: calculatedColumnSettings.SuppressMenu,
|
|
1994
|
+
suppressMovable: calculatedColumnSettings.SuppressMovable,
|
|
1910
1995
|
type: [
|
|
1911
1996
|
GeneralConstants_1.AB_SPECIAL_COLUMN,
|
|
1912
|
-
this.agGridHelper.getAgGridDataType(
|
|
1997
|
+
this.agGridHelper.getAgGridDataType(calculatedColumnSettings.DataType),
|
|
1913
1998
|
],
|
|
1914
1999
|
valueGetter: (params) => {
|
|
1915
2000
|
var _a;
|
|
1916
2001
|
return this.CalculatedColumnExpressionService.ComputeExpressionValue((_a = calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.ScalarExpression, params.node);
|
|
1917
2002
|
},
|
|
1918
2003
|
};
|
|
1919
|
-
if (
|
|
1920
|
-
|
|
2004
|
+
if (calculatedColumnSettings.ShowToolTip != null &&
|
|
2005
|
+
calculatedColumnSettings.ShowToolTip == true) {
|
|
1921
2006
|
newColDef.tooltipValueGetter = () => {
|
|
1922
2007
|
var _a;
|
|
1923
2008
|
return (_a = calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.ScalarExpression;
|
|
@@ -1967,7 +2052,7 @@ class Adaptable {
|
|
|
1967
2052
|
return rowNode;
|
|
1968
2053
|
}
|
|
1969
2054
|
destroy(config) {
|
|
1970
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2055
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1971
2056
|
if (this.gridOptions && this.gridOptions.api) {
|
|
1972
2057
|
this.gridOptions.api.__adaptable = null;
|
|
1973
2058
|
this.gridOptions.api.setColumnDefs = GridApi_setColumnDefs;
|
|
@@ -1986,7 +2071,7 @@ class Adaptable {
|
|
|
1986
2071
|
this.emitter = null;
|
|
1987
2072
|
this._adaptableReady = false;
|
|
1988
2073
|
Adaptable.dismissInstance(this);
|
|
1989
|
-
const abContainerElement = this.
|
|
2074
|
+
const abContainerElement = this.getAdaptableContainerElement();
|
|
1990
2075
|
if (config && !config.unmount) {
|
|
1991
2076
|
return;
|
|
1992
2077
|
}
|
|
@@ -1999,6 +2084,11 @@ class Adaptable {
|
|
|
1999
2084
|
(_d = this.ReportService) === null || _d === void 0 ? void 0 : _d.destroy();
|
|
2000
2085
|
(_e = this.ModuleService) === null || _e === void 0 ? void 0 : _e.destroy();
|
|
2001
2086
|
(_f = this.ValidationService) === null || _f === void 0 ? void 0 : _f.destroy();
|
|
2087
|
+
(_g = this.QueryLanguageService) === null || _g === void 0 ? void 0 : _g.destroy();
|
|
2088
|
+
(_h = this.AlertService) === null || _h === void 0 ? void 0 : _h.destroy();
|
|
2089
|
+
(_j = this.TeamSharingService) === null || _j === void 0 ? void 0 : _j.destroy();
|
|
2090
|
+
(_k = this.MetamodelService) === null || _k === void 0 ? void 0 : _k.destroy();
|
|
2091
|
+
(_l = this.LicenseService) === null || _l === void 0 ? void 0 : _l.destroy();
|
|
2002
2092
|
}
|
|
2003
2093
|
// really really need to do this properly but as a temp fix lets create a default style for when no data
|
|
2004
2094
|
getDefaultIPPStyle() {
|
|
@@ -2043,7 +2133,7 @@ class Adaptable {
|
|
|
2043
2133
|
getCurrentIPPStyle() {
|
|
2044
2134
|
return this.agGridHelper.getCurrentIPPStyle();
|
|
2045
2135
|
}
|
|
2046
|
-
|
|
2136
|
+
getAdaptableContainerElement() {
|
|
2047
2137
|
if (!this.abContainerElement) {
|
|
2048
2138
|
let containerOptionsContainer = this.adaptableOptions.containerOptions.adaptableContainer;
|
|
2049
2139
|
this.abContainerElement =
|
|
@@ -2079,7 +2169,7 @@ class Adaptable {
|
|
|
2079
2169
|
initInternalGridLogic() {
|
|
2080
2170
|
LoggingHelper_1.LogAdaptableInfo(`Initializing InternalGridLogic...`);
|
|
2081
2171
|
if (this.abContainerElement == null) {
|
|
2082
|
-
this.abContainerElement = this.
|
|
2172
|
+
this.abContainerElement = this.getAdaptableContainerElement();
|
|
2083
2173
|
}
|
|
2084
2174
|
if (this.abContainerElement == null) {
|
|
2085
2175
|
if (typeof this.adaptableOptions.containerOptions.adaptableContainer === 'string') {
|
|
@@ -2310,11 +2400,21 @@ class Adaptable {
|
|
|
2310
2400
|
RowNodeProto.dispatchLocalEvent = function (event) {
|
|
2311
2401
|
const node = event.node;
|
|
2312
2402
|
const result = RowNode_dispatchLocalEvent.apply(this, arguments);
|
|
2403
|
+
const extractGridApiFromRowNode = (rowNode) => {
|
|
2404
|
+
var _a, _b, _c, _d;
|
|
2405
|
+
// starting with AG Grid 26.1.0 the gridApi is wrapped in a Beans property
|
|
2406
|
+
// while older versions than 26.1.0 had a direct property
|
|
2407
|
+
const rowNodeApi = (_c = (_b = (_a = rowNode) === null || _a === void 0 ? void 0 : _a.beans) === null || _b === void 0 ? void 0 : _b.gridApi) !== null && _c !== void 0 ? _c : (_d = rowNode) === null || _d === void 0 ? void 0 : _d.gridApi;
|
|
2408
|
+
if (!rowNodeApi) {
|
|
2409
|
+
LoggingHelper_1.LogAdaptableWarning(`No GridAPI found in passed RowNode, this should never happen!`, rowNode);
|
|
2410
|
+
}
|
|
2411
|
+
return rowNodeApi;
|
|
2412
|
+
};
|
|
2313
2413
|
// we don't know from which instance of aggrid this is coming,
|
|
2314
2414
|
// as this fn is shared by all instances
|
|
2315
2415
|
if (node) {
|
|
2316
2416
|
Adaptable.forEachAdaptable((adaptable) => {
|
|
2317
|
-
if (node
|
|
2417
|
+
if (extractGridApiFromRowNode(node) !== adaptable.gridOptions.api) {
|
|
2318
2418
|
// the event is coming from another aggrid instance
|
|
2319
2419
|
// so IGNORE IT
|
|
2320
2420
|
return;
|
|
@@ -2556,6 +2656,8 @@ class Adaptable {
|
|
|
2556
2656
|
const cellClass = (params) => {
|
|
2557
2657
|
const isQuickSearchActive = hasQuickSearchStyleClassName && this.isQuickSearchActive(abColumn, params);
|
|
2558
2658
|
const primaryKeyValue = this.getPrimaryKeyValueFromRowNode(params.node);
|
|
2659
|
+
const editableClassName = this.getEditableCellClass(abColumn, params);
|
|
2660
|
+
const readonlyClassName = this.getReadonlyCellClass(abColumn, params);
|
|
2559
2661
|
let returnValue = [
|
|
2560
2662
|
this.getExcelClassNameForCell(colId, primaryKeyValue),
|
|
2561
2663
|
typeof userCellClass === 'function' ? userCellClass(params) : userCellClass,
|
|
@@ -2564,6 +2666,8 @@ class Adaptable {
|
|
|
2564
2666
|
? this.getConditionalStyleCellClass(conditionalStyles, abColumn, params)
|
|
2565
2667
|
: null,
|
|
2566
2668
|
isQuickSearchActive ? quickSearchStyleClassName : null,
|
|
2669
|
+
editableClassName,
|
|
2670
|
+
readonlyClassName,
|
|
2567
2671
|
]
|
|
2568
2672
|
.filter((x) => !!x)
|
|
2569
2673
|
.join(' ');
|
|
@@ -2576,7 +2680,8 @@ class Adaptable {
|
|
|
2576
2680
|
return `--excel-cell-${colId}-${primaryKeyValue}`;
|
|
2577
2681
|
}
|
|
2578
2682
|
setupColumnCellEditor({ colId, col }) {
|
|
2579
|
-
const
|
|
2683
|
+
const adaptableColumn = this.api.columnApi.getColumnFromId(colId);
|
|
2684
|
+
const editLookUpItem = this.api.userInterfaceApi.getEditLookUpItemForColumn(adaptableColumn);
|
|
2580
2685
|
this.setColDefProperty(col, 'cellEditor', () => {
|
|
2581
2686
|
if (editLookUpItem) {
|
|
2582
2687
|
return this.isModulePresent('rich-select')
|
|
@@ -2584,10 +2689,12 @@ class Adaptable {
|
|
|
2584
2689
|
: 'agSelectCellEditor';
|
|
2585
2690
|
}
|
|
2586
2691
|
});
|
|
2587
|
-
this.setColDefProperty(col, 'cellEditorParams', () => {
|
|
2692
|
+
this.setColDefProperty(col, 'cellEditorParams', (params) => {
|
|
2588
2693
|
if (editLookUpItem) {
|
|
2589
|
-
return {
|
|
2590
|
-
|
|
2694
|
+
return (params) => {
|
|
2695
|
+
return {
|
|
2696
|
+
values: this.api.userInterfaceApi.getEditLookUpValuesForEditLookUpItem(editLookUpItem, colId, params === null || params === void 0 ? void 0 : params.data),
|
|
2697
|
+
};
|
|
2591
2698
|
};
|
|
2592
2699
|
}
|
|
2593
2700
|
});
|
|
@@ -3220,7 +3327,7 @@ class Adaptable {
|
|
|
3220
3327
|
}
|
|
3221
3328
|
return state;
|
|
3222
3329
|
});
|
|
3223
|
-
this.gridOptions.columnApi.
|
|
3330
|
+
this.gridOptions.columnApi.applyColumnState({ state: newColumnState, applyOrder: true });
|
|
3224
3331
|
this.gridOptions.api.onSortChanged();
|
|
3225
3332
|
}
|
|
3226
3333
|
clearColumnSort() {
|
|
@@ -3235,6 +3342,26 @@ class Adaptable {
|
|
|
3235
3342
|
}
|
|
3236
3343
|
this.gridOptions.api.setRowData(dataSource);
|
|
3237
3344
|
}
|
|
3345
|
+
getGridData() {
|
|
3346
|
+
var _a;
|
|
3347
|
+
const data = [];
|
|
3348
|
+
(_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.api.forEachNode((rowNode) => {
|
|
3349
|
+
if (!this.isGroupRowNode(rowNode)) {
|
|
3350
|
+
data.push(rowNode.data);
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3353
|
+
return data;
|
|
3354
|
+
}
|
|
3355
|
+
getFilteredData() {
|
|
3356
|
+
var _a;
|
|
3357
|
+
const data = [];
|
|
3358
|
+
(_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.api.forEachNodeAfterFilter((rowNode) => {
|
|
3359
|
+
if (!this.isGroupRowNode(rowNode)) {
|
|
3360
|
+
data.push(rowNode.data);
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
return data;
|
|
3364
|
+
}
|
|
3238
3365
|
loadDataSource(dataSource) {
|
|
3239
3366
|
if (this.hasAutogeneratedPrimaryKey()) {
|
|
3240
3367
|
this.addSyntheticPrimaryKey(dataSource);
|
|
@@ -3258,11 +3385,15 @@ class Adaptable {
|
|
|
3258
3385
|
this.addSyntheticPrimaryKey(dataRows);
|
|
3259
3386
|
}
|
|
3260
3387
|
dataUpdateConfig = dataUpdateConfig || {};
|
|
3388
|
+
const newData = { add: dataRows };
|
|
3389
|
+
if (dataUpdateConfig.addIndex !== undefined) {
|
|
3390
|
+
newData.addIndex = dataUpdateConfig.addIndex;
|
|
3391
|
+
}
|
|
3261
3392
|
if (dataUpdateConfig.runAsync) {
|
|
3262
|
-
this.gridOptions.api.applyTransactionAsync(
|
|
3393
|
+
this.gridOptions.api.applyTransactionAsync(newData, dataUpdateConfig.callback);
|
|
3263
3394
|
}
|
|
3264
3395
|
else {
|
|
3265
|
-
this.gridOptions.api.applyTransaction(
|
|
3396
|
+
this.gridOptions.api.applyTransaction(newData);
|
|
3266
3397
|
}
|
|
3267
3398
|
}
|
|
3268
3399
|
deleteRows(dataRows, dataUpdateConfig) {
|
|
@@ -44,7 +44,7 @@ function Dashboard(props) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
const activeTabTitle = (_c = (_b = (_a = children === null || children === void 0 ? void 0 : children[activeTabIndex]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : 'Select Toolbar';
|
|
47
|
-
return (React.createElement(DropdownButton_1.default, { ml: 1, items: React.Children.map(children, (child, index) => ({
|
|
47
|
+
return (React.createElement(DropdownButton_1.default, { ml: 1, columns: ['label'], items: React.Children.map(children, (child, index) => ({
|
|
48
48
|
value: String(index),
|
|
49
49
|
label: child.props.title,
|
|
50
50
|
onClick: () => setActiveTabIndex(index),
|
|
@@ -17,7 +17,7 @@ const defaultListItemStyle = {
|
|
|
17
17
|
padding: 'var(--ab-cmp-dropdownbutton-list-item__padding)',
|
|
18
18
|
};
|
|
19
19
|
const DropdownButton = React.forwardRef((props, ref) => {
|
|
20
|
-
let { columns, overlayProps, listOffset = 10, collapseOnItemClick = true, focusOnClear = true, idProperty = 'id', isItemDisabled, items, children, listMinWidth = 100, listStyle, listItemStyle, listItemClassName, constrainTo, showClearButton = false, onClear, clearButtonProps } = props, domProps = tslib_1.__rest(props, ["columns", "overlayProps", "listOffset", "collapseOnItemClick", "focusOnClear", "idProperty", "isItemDisabled", "items", "children", "listMinWidth", "listStyle", "listItemStyle", "listItemClassName", "constrainTo", "showClearButton", "onClear", "clearButtonProps"]);
|
|
20
|
+
let { columns, overlayProps, listOffset = 10, collapseOnItemClick = true, focusOnClear = true, idProperty = 'id', isItemDisabled, items, children, listMinWidth = 100, listStyle, listItemStyle, listItemClassName, constrainTo, showClearButton = false, onClear, clearButtonProps, onExpand, onCollapse } = props, domProps = tslib_1.__rest(props, ["columns", "overlayProps", "listOffset", "collapseOnItemClick", "focusOnClear", "idProperty", "isItemDisabled", "items", "children", "listMinWidth", "listStyle", "listItemStyle", "listItemClassName", "constrainTo", "showClearButton", "onClear", "clearButtonProps", "onExpand", "onCollapse"]);
|
|
21
21
|
isItemDisabled = isItemDisabled || ((item) => item.disabled);
|
|
22
22
|
if (!columns) {
|
|
23
23
|
columns = ['icon', 'label'];
|
|
@@ -23,6 +23,7 @@ const ButtonInfo_1 = require("../../View/Components/Buttons/ButtonInfo");
|
|
|
23
23
|
const CodeBlock_1 = require("../CodeBlock");
|
|
24
24
|
const NamedQueryContext_1 = require("./NamedQueryContext");
|
|
25
25
|
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
26
|
+
const DateHelper_1 = require("../../Utilities/Helpers/DateHelper");
|
|
26
27
|
function ExpressionEditor(props) {
|
|
27
28
|
var _a;
|
|
28
29
|
const { type, module } = props;
|
|
@@ -60,7 +61,7 @@ function ExpressionEditor(props) {
|
|
|
60
61
|
cursor: 'grab',
|
|
61
62
|
marginRight: 'var(--ab-space-1)',
|
|
62
63
|
}, data: `[${column.ColumnId}]`, "data-name": "column", icon: "drag" },
|
|
63
|
-
React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start" }, showColumnIds ? `[${column.ColumnId}]` : column.FriendlyName)) }, column.DataType === 'Number' ? (React.createElement(Input_1.default, { type: "number", "data-name": "column-input", value: data[column.ColumnId], onChange: (e) => setData(Object.assign(Object.assign({}, data), { [column.ColumnId]: Number(e.target.value) })), width: "100%", disabled: column.ReadOnly })) : column.DataType === 'String' ? (React.createElement(Input_1.default, { type: "text", "data-name": "column-input", value: data[column.ColumnId], onChange: (e) => setData(Object.assign(Object.assign({}, data), { [column.ColumnId]: e.target.value })), width: "100%", disabled: column.ReadOnly })) : column.DataType === 'Date' ? (React.createElement(AdaptableInput_1.default, { type: "date", "data-name": "column-input", value: data[column.ColumnId]
|
|
64
|
+
React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start" }, showColumnIds ? `[${column.ColumnId}]` : column.FriendlyName)) }, column.DataType === 'Number' ? (React.createElement(Input_1.default, { type: "number", "data-name": "column-input", value: data[column.ColumnId], onChange: (e) => setData(Object.assign(Object.assign({}, data), { [column.ColumnId]: Number(e.target.value) })), width: "100%", disabled: column.ReadOnly })) : column.DataType === 'String' ? (React.createElement(Input_1.default, { type: "text", "data-name": "column-input", value: data[column.ColumnId], onChange: (e) => setData(Object.assign(Object.assign({}, data), { [column.ColumnId]: e.target.value })), width: "100%", disabled: column.ReadOnly })) : column.DataType === 'Date' ? (React.createElement(AdaptableInput_1.default, { type: "date", "data-name": "column-input", value: data[column.ColumnId] && DateHelper_1.isValueValidDate(data[column.ColumnId])
|
|
64
65
|
? new Date(data[column.ColumnId]).toISOString().substr(0, 10)
|
|
65
66
|
: '', onChange: (e) => {
|
|
66
67
|
setData(Object.assign(Object.assign({}, data), { [column.ColumnId]: new Date(e.target.value) }));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Loader = exports.LoaderSpinner = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
exports.LoaderSpinner = (props) => {
|
|
7
|
+
return React.createElement("div", { style: props.style, className: "ab-Loader__Spinner" });
|
|
8
|
+
};
|
|
9
|
+
exports.Loader = (props) => {
|
|
10
|
+
return (React.createElement("div", { style: props.style, className: "ab-Loader" },
|
|
11
|
+
React.createElement(exports.LoaderSpinner, null),
|
|
12
|
+
React.createElement("span", { className: "ab-Loader__text" }, props.children)));
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoaderSpinner = exports.Loader = void 0;
|
|
4
|
+
var Loader_1 = require("./Loader");
|
|
5
|
+
Object.defineProperty(exports, "Loader", { enumerable: true, get: function () { return Loader_1.Loader; } });
|
|
6
|
+
var Loader_2 = require("./Loader");
|
|
7
|
+
Object.defineProperty(exports, "LoaderSpinner", { enumerable: true, get: function () { return Loader_2.LoaderSpinner; } });
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressIndicator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const Loader_1 = require("../Loader");
|
|
9
|
+
const AdaptableContext_1 = require("../../View/AdaptableContext");
|
|
10
|
+
exports.ProgressIndicator = () => {
|
|
11
|
+
const { active, label } = react_redux_1.useSelector((state) => state.System.ProgressIndicator);
|
|
12
|
+
const [visible, setVisible] = react_1.useState(false);
|
|
13
|
+
const [progressIndicatorCoordinates, setProgressIndicatorCoordinates] = react_1.useState({
|
|
14
|
+
top: 0,
|
|
15
|
+
left: 0,
|
|
16
|
+
height: 0,
|
|
17
|
+
width: 0,
|
|
18
|
+
});
|
|
19
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
20
|
+
const adaptableContainerRef = react_1.useRef(adaptable.getAdaptableContainerElement());
|
|
21
|
+
const gridContainerRef = react_1.useRef(adaptable.getGridContainerElement());
|
|
22
|
+
const disableAdaptableGrid = (elemRef, disabled) => {
|
|
23
|
+
const DISABLING_CSS_CLASS = 'ab-wait-for-progress-indicator';
|
|
24
|
+
if (!elemRef.current) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (disabled) {
|
|
28
|
+
elemRef.current.classList.add(DISABLING_CSS_CLASS);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
elemRef.current.classList.remove(DISABLING_CSS_CLASS);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const updateGridContainerCoordinates = () => {
|
|
35
|
+
if (!gridContainerRef.current) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const { top, left, height, width } = gridContainerRef.current.getBoundingClientRect();
|
|
39
|
+
setProgressIndicatorCoordinates({ top, left, height, width });
|
|
40
|
+
};
|
|
41
|
+
react_1.useEffect(() => {
|
|
42
|
+
disableAdaptableGrid(adaptableContainerRef, active);
|
|
43
|
+
disableAdaptableGrid(gridContainerRef, active);
|
|
44
|
+
updateGridContainerCoordinates();
|
|
45
|
+
// without RAF the progress indicator would be rendered instantly, without the 'transition-delay' defined via CSS
|
|
46
|
+
requestAnimationFrame(() => {
|
|
47
|
+
setVisible(active);
|
|
48
|
+
});
|
|
49
|
+
}, [active]);
|
|
50
|
+
return (React.createElement(React.Fragment, null, active && (React.createElement("div", { className: `ab-progress-indicator-wrapper ${visible ? 'ab-progress-indicator-wrapper--visible' : ''}`, style: progressIndicatorCoordinates },
|
|
51
|
+
React.createElement("div", { className: "ab-progress-indicator-body" },
|
|
52
|
+
React.createElement(Loader_1.LoaderSpinner, null),
|
|
53
|
+
React.createElement("span", { style: { marginLeft: 'var(--ab-space-2)' } }, label))))));
|
|
54
|
+
};
|