@adaptabletools/adaptable 11.0.8 → 11.1.1-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base.css +19 -11
- package/bundle.cjs.js +125 -125
- package/index.css +23 -11
- package/package.json +2 -2
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -0
- package/src/AdaptableOptions/LayoutOptions.d.ts +5 -1
- package/src/Api/AlertApi.d.ts +2 -1
- package/src/Api/BulkUpdateApi.d.ts +5 -0
- package/src/Api/ConfigApi.d.ts +1 -1
- package/src/Api/EventApi.d.ts +1 -1
- package/src/Api/Events/GridDataChanged.d.ts +5 -1
- package/src/Api/GridApi.d.ts +23 -2
- package/src/Api/Implementation/AlertApiImpl.d.ts +4 -1
- package/src/Api/Implementation/AlertApiImpl.js +79 -52
- package/src/Api/Implementation/BulkUpdateApiImpl.d.ts +1 -0
- package/src/Api/Implementation/BulkUpdateApiImpl.js +4 -0
- package/src/Api/Implementation/ConfigApiImpl.d.ts +1 -1
- package/src/Api/Implementation/ConfigApiImpl.js +7 -2
- package/src/Api/Implementation/EventApiImpl.js +1 -1
- package/src/Api/Implementation/GridApiImpl.d.ts +9 -1
- package/src/Api/Implementation/GridApiImpl.js +24 -3
- package/src/Api/Implementation/InternalApiImpl.d.ts +9 -2
- package/src/Api/Implementation/InternalApiImpl.js +37 -1
- package/src/Api/Implementation/LayoutApiImpl.d.ts +6 -1
- package/src/Api/Implementation/LayoutApiImpl.js +45 -4
- package/src/Api/Implementation/ScheduleApiImpl.js +1 -0
- package/src/Api/Implementation/SettingsPanelApiImpl.js +7 -1
- package/src/Api/InternalApi.d.ts +9 -2
- package/src/Api/LayoutApi.d.ts +33 -3
- package/src/PredefinedConfig/AlertState.d.ts +7 -3
- package/src/PredefinedConfig/Common/AdaptableAlert.d.ts +35 -6
- package/src/PredefinedConfig/Common/AdaptableAlert.js +7 -0
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +20 -0
- package/src/PredefinedConfig/Common/CellHighlightInfo.d.ts +1 -1
- package/src/PredefinedConfig/Common/DataChangedInfo.d.ts +1 -1
- package/src/PredefinedConfig/Common/Entitlement.d.ts +2 -2
- package/src/PredefinedConfig/Common/Menu.d.ts +3 -0
- package/src/PredefinedConfig/Common/RowsHighlightInfo.d.ts +15 -0
- package/src/PredefinedConfig/Common/RowsHighlightInfo.js +2 -0
- package/src/PredefinedConfig/ConfigState.d.ts +4 -1
- package/src/PredefinedConfig/LayoutState.d.ts +1 -1
- package/src/PredefinedConfig/PopupState.d.ts +2 -1
- package/src/Redux/ActionsReducers/FlashingCellRedux.js +4 -8
- package/src/Redux/ActionsReducers/PopupRedux.d.ts +18 -0
- package/src/Redux/ActionsReducers/PopupRedux.js +36 -1
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +11 -0
- package/src/Redux/ActionsReducers/SystemRedux.js +32 -1
- package/src/Redux/Store/AdaptableReduxMerger.d.ts +1 -0
- package/src/Redux/Store/AdaptableReduxMerger.js +40 -4
- package/src/Redux/Store/AdaptableStore.js +69 -27
- package/src/Strategy/AlertModule.d.ts +5 -3
- package/src/Strategy/AlertModule.js +60 -16
- package/src/Strategy/BulkUpdateModule.js +5 -0
- package/src/Strategy/ExportModule.js +1 -0
- package/src/Strategy/SmartEditModule.js +6 -0
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -0
- package/src/Utilities/Defaults/DefaultSettingsPanel.d.ts +1 -1
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +6 -2
- package/src/Utilities/Emitter.d.ts +1 -1
- package/src/Utilities/Emitter.js +6 -3
- package/src/Utilities/Interface/MessagePopups.d.ts +13 -0
- package/src/Utilities/ObjectFactory.d.ts +8 -6
- package/src/Utilities/ObjectFactory.js +26 -12
- package/src/Utilities/Services/LicenseService.js +1 -1
- package/src/Utilities/Services/ModuleService.js +1 -1
- package/src/Utilities/Services/ValidationService.js +1 -0
- package/src/View/AdaptableView.js +2 -0
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +16 -9
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +13 -3
- package/src/View/Alert/Wizard/AlertDisplayWizardSection.js +2 -0
- package/src/View/Alert/Wizard/AlertWizard.js +83 -1
- package/src/View/CellSummary/CellSummaryViewPanel.js +1 -1
- package/src/View/Components/FilterForm/FilterForm.js +2 -2
- package/src/View/Components/Panels/PanelFooter.d.ts +10 -0
- package/src/View/Components/Panels/PanelFooter.js +14 -0
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +12 -7
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +1 -1
- package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +3 -1
- package/src/View/Components/Popups/{AdaptablePopup/Utilities.d.ts → Utilities.d.ts} +4 -0
- package/src/View/Components/Popups/{AdaptablePopup/Utilities.js → Utilities.js} +5 -2
- package/src/View/Components/Popups/WindowPopups/WindowPopups.d.ts +6 -0
- package/src/View/Components/Popups/WindowPopups/WindowPopups.js +32 -0
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +4 -0
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +8 -0
- package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +3 -0
- package/src/View/Layout/LayoutEditorStandalonePopup.js +76 -0
- package/src/View/Layout/LayoutPopup.js +3 -24
- package/src/View/Layout/LayoutViewPanel.d.ts +1 -4
- package/src/View/Layout/LayoutViewPanel.js +5 -18
- package/src/View/Layout/Wizard/LayoutEditor/ColumnLabels.d.ts +9 -0
- package/src/View/Layout/Wizard/LayoutEditor/ColumnLabels.js +55 -0
- package/src/View/Layout/Wizard/LayoutEditor/index.js +3 -68
- package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +1 -0
- package/src/View/Layout/Wizard/LayoutEditorWizard.js +35 -7
- package/src/View/SystemStatus/SystemStatusEntityRow.js +1 -2
- package/src/agGrid/Adaptable.d.ts +4 -2
- package/src/agGrid/Adaptable.js +65 -69
- package/src/agGrid/agGridHelper.d.ts +1 -1
- package/src/agGrid/agGridHelper.js +23 -8
- package/src/agGrid/editors/AdaptableDateEditor/index.js +1 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +1 -1
- package/src/components/Dialog/index.js +1 -1
- package/src/components/Modal/index.js +1 -1
- package/src/components/WindowModal/WindowModal.d.ts +10 -8
- package/src/components/WindowModal/WindowModal.js +4 -2
- package/src/components/WindowModal/useStacking.d.ts +9 -0
- package/src/components/WindowModal/useStacking.js +45 -0
- package/src/env.js +3 -3
- package/src/metamodel/adaptable.metamodel.d.ts +51 -11
- package/src/metamodel/adaptable.metamodel.js +146 -21
- package/src/types.d.ts +3 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -21,61 +21,12 @@ const PivotList_1 = require("./PivotList");
|
|
|
21
21
|
const ButtonInfo_1 = require("../../../Components/Buttons/ButtonInfo");
|
|
22
22
|
const Input_1 = tslib_1.__importDefault(require("../../../../components/Input"));
|
|
23
23
|
const StringExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/StringExtensions"));
|
|
24
|
+
const ColumnLabels_1 = require("./ColumnLabels");
|
|
24
25
|
const verticalPanelStyle = {
|
|
25
26
|
minHeight: 150,
|
|
26
|
-
flex: '1 0 auto',
|
|
27
27
|
overflow: 'auto',
|
|
28
28
|
};
|
|
29
29
|
const ListPanel = (props) => (React.createElement(Panel_1.default, Object.assign({ variant: "modern", bodyProps: { padding: 0 }, style: Object.assign(Object.assign({}, verticalPanelStyle), props.style) }, props)));
|
|
30
|
-
const ColumnLabels = (props) => {
|
|
31
|
-
const { children, showBoth, showTitle, flexDirection = 'row', labels: labelsProp } = props, columnProperties = tslib_1.__rest(props, ["children", "showBoth", "showTitle", "flexDirection", "labels"]);
|
|
32
|
-
const labelNames = [
|
|
33
|
-
'Aggregatable',
|
|
34
|
-
'Filterable',
|
|
35
|
-
'Groupable',
|
|
36
|
-
'Moveable',
|
|
37
|
-
'Pivotable',
|
|
38
|
-
'Sortable',
|
|
39
|
-
];
|
|
40
|
-
const labels = labelNames.map((name) => columnProperties[name.toLocaleLowerCase()] ? name.charAt(0) : '');
|
|
41
|
-
const flexProps = {
|
|
42
|
-
[flexDirection === 'row' ? 'alignItems' : 'justifyContent']: 'center',
|
|
43
|
-
};
|
|
44
|
-
return (React.createElement(rebass_1.Flex, Object.assign({ flexDirection: flexDirection }, flexProps, { width: "100%" }),
|
|
45
|
-
showTitle ? React.createElement(rebass_1.Text, { mr: 2 }, "Behaviours:") : null,
|
|
46
|
-
labels.map((l, index) => {
|
|
47
|
-
const enabled = !!l;
|
|
48
|
-
const labelName = labelNames[index];
|
|
49
|
-
const letter = labelName.charAt(0);
|
|
50
|
-
const renderBox = (enabled, key) => {
|
|
51
|
-
return (React.createElement(rebass_1.Flex, { className: "ab-LayoutEditor__LegendLetter", width: '20px', height: '20px', alignItems: "center", justifyContent: "center", fontSize: 2, ml: 2, backgroundColor: "defaultbackground", title: enabled ? labelName : `Not ${labelName}`, style: {
|
|
52
|
-
overflow: 'hidden',
|
|
53
|
-
cursor: 'auto',
|
|
54
|
-
position: 'relative',
|
|
55
|
-
fontWeight: 600,
|
|
56
|
-
lineHeight: 0,
|
|
57
|
-
border: `1px solid var(--ab-color-${enabled ? 'accent' : 'inputborder'})`,
|
|
58
|
-
borderRadius: 'var(--ab__border-radius)',
|
|
59
|
-
opacity: enabled ? 1 : 0.5,
|
|
60
|
-
}, key: `${letter}${key ? key : ''}` },
|
|
61
|
-
!enabled ? (React.createElement("div", { style: {
|
|
62
|
-
background: 'currentColor',
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
bottom: '-100%',
|
|
65
|
-
right: 0,
|
|
66
|
-
width: 2,
|
|
67
|
-
height: '200%',
|
|
68
|
-
transform: 'skewX(45deg)',
|
|
69
|
-
} })) : null,
|
|
70
|
-
letter));
|
|
71
|
-
};
|
|
72
|
-
return (React.createElement(rebass_1.Flex, { key: letter, mt: flexDirection === 'row' ? 0 : 2, flexDirection: "row", alignItems: "center" },
|
|
73
|
-
renderBox(enabled),
|
|
74
|
-
showBoth ? renderBox(!enabled, 'label') : null,
|
|
75
|
-
labelsProp ? (React.createElement(rebass_1.Flex, { key: "labelProps", flex: 1, ml: 2, className: "ab-LayoutEditor__LegendLetterDescription" }, labelsProp[labelName])) : null));
|
|
76
|
-
}),
|
|
77
|
-
children));
|
|
78
|
-
};
|
|
79
30
|
function areEqual(_prevProps, _nextProps) {
|
|
80
31
|
/*
|
|
81
32
|
* For now we don't need updates from the parent - the initial layout we receive on mount is enough
|
|
@@ -297,7 +248,7 @@ exports.LayoutEditor = React.memo((props) => {
|
|
|
297
248
|
whiteSpace: 'nowrap',
|
|
298
249
|
}, onChange: setColumnVisibility.bind(null, c) }, "Visible")),
|
|
299
250
|
React.createElement(rebass_1.Flex, { padding: 2, flexDirection: "column" },
|
|
300
|
-
React.createElement(ColumnLabels, { showTitle: true, sortable: c.sortable, filterable: c.filterable, moveable: c.moveable, pivotable: c.pivotable, groupable: c.groupable, aggregatable: c.aggregatable }, ' '),
|
|
251
|
+
React.createElement(ColumnLabels_1.ColumnLabels, { showTitle: true, sortable: c.sortable, filterable: c.filterable, moveable: c.moveable, pivotable: c.pivotable, groupable: c.groupable, aggregatable: c.aggregatable }, ' '),
|
|
301
252
|
React.createElement(rebass_1.Flex, { flexDirection: "row", mt: 2 },
|
|
302
253
|
React.createElement(rebass_1.Flex, { flex: 3, alignItems: "baseline" },
|
|
303
254
|
React.createElement(rebass_1.Text, { fontSize: 3, mr: 2 }, "Header:"),
|
|
@@ -415,21 +366,5 @@ exports.LayoutEditor = React.memo((props) => {
|
|
|
415
366
|
React.createElement(icons_1.Icon, { name: "clear" }))));
|
|
416
367
|
}, getItemStyle: (columnId, snapshot, draggableStyle) => {
|
|
417
368
|
return getItemStyle_1.getItemStyle(allColumnsMap[columnId], layout, state.dragSource, snapshot, draggableStyle);
|
|
418
|
-
} }))
|
|
419
|
-
React.createElement(ListPanel, { header: "Legend: Column Behaviour", className: "ab-LayoutEditor__LegendPanel", style: {
|
|
420
|
-
gridRow: '1 /1',
|
|
421
|
-
gridColumn: '3/3',
|
|
422
|
-
}, bodyProps: {
|
|
423
|
-
padding: 2,
|
|
424
|
-
backgroundColor: 'defaultbackground',
|
|
425
|
-
color: 'text-on-defaultbackground',
|
|
426
|
-
} },
|
|
427
|
-
React.createElement(ColumnLabels, { flexDirection: "column", showBoth: true, labels: {
|
|
428
|
-
Sortable: 'Able to be sorted',
|
|
429
|
-
Filterable: 'Can be filtered',
|
|
430
|
-
Aggregatable: 'Shows aggregations (in grouped rows)',
|
|
431
|
-
Groupable: 'Can form a row group',
|
|
432
|
-
Moveable: 'Is draggable and movable',
|
|
433
|
-
Pivotable: 'Eligible for pivoting',
|
|
434
|
-
}, sortable: true, filterable: true, moveable: true, pivotable: true, groupable: true, aggregatable: true })))));
|
|
369
|
+
} })))));
|
|
435
370
|
}, areEqual);
|
|
@@ -3,6 +3,7 @@ import { AdaptableWizardStep, AdaptableWizardStepProps } from '../../Wizard/Inte
|
|
|
3
3
|
import { Layout } from '../../../PredefinedConfig/LayoutState';
|
|
4
4
|
export interface LayoutEditorWizardProps extends AdaptableWizardStepProps<Layout> {
|
|
5
5
|
Layouts: Layout[];
|
|
6
|
+
onLayoutChange?: (layout: Layout) => void;
|
|
6
7
|
}
|
|
7
8
|
export interface LayoutEditorWizardState {
|
|
8
9
|
layoutName: string;
|
|
@@ -8,6 +8,10 @@ const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayou
|
|
|
8
8
|
const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
|
|
9
9
|
const LayoutEditor_1 = require("./LayoutEditor");
|
|
10
10
|
const ErrorBox_1 = tslib_1.__importDefault(require("../../../components/ErrorBox"));
|
|
11
|
+
const AdaptablePopover_1 = require("../../AdaptablePopover");
|
|
12
|
+
const rebass_1 = require("rebass");
|
|
13
|
+
const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
|
|
14
|
+
const ColumnLabels_1 = require("./LayoutEditor/ColumnLabels");
|
|
11
15
|
class LayoutEditorWizard extends React.Component {
|
|
12
16
|
constructor(props) {
|
|
13
17
|
super(props);
|
|
@@ -35,11 +39,13 @@ class LayoutEditorWizard extends React.Component {
|
|
|
35
39
|
return ErrorMessage;
|
|
36
40
|
};
|
|
37
41
|
this.updateLayout = (layout) => {
|
|
42
|
+
var _a, _b;
|
|
38
43
|
const updatedLayout = Object.assign(Object.assign({}, this.state.layout), layout);
|
|
39
44
|
Object.assign(this.props.data, updatedLayout);
|
|
40
45
|
this.setState({
|
|
41
46
|
layout: updatedLayout,
|
|
42
47
|
});
|
|
48
|
+
(_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.onLayoutChange) === null || _b === void 0 ? void 0 : _b.call(_a, updatedLayout);
|
|
43
49
|
};
|
|
44
50
|
this.onLayoutChange = (layout) => {
|
|
45
51
|
layout = Object.assign(Object.assign({}, layout), { Name: this.state.layoutName });
|
|
@@ -64,14 +70,36 @@ class LayoutEditorWizard extends React.Component {
|
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
72
|
render() {
|
|
67
|
-
return (React.createElement("div", { "data-name": 'layout-editor', style: {
|
|
73
|
+
return (React.createElement("div", { "data-name": 'layout-editor', style: { height: '100%' } },
|
|
68
74
|
React.createElement(WizardPanel_1.default, { bodyProps: { padding: 0 } },
|
|
69
|
-
React.createElement(
|
|
70
|
-
React.createElement(
|
|
71
|
-
React.createElement(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
React.createElement(rebass_1.Flex, null,
|
|
76
|
+
React.createElement(rebass_1.Box, { width: 350 },
|
|
77
|
+
React.createElement(FormLayout_1.default, { columns: ['label', 'children'], m: 2 },
|
|
78
|
+
React.createElement(FormLayout_1.FormRow, { label: "Layout Name" },
|
|
79
|
+
React.createElement(Input_1.default, { value: this.state.layoutName, "data-name": "layout-editor-name-input", width: "100%", autoFocus: true, placeholder: "Type a name", onChange: this.onLayoutNameChange }),
|
|
80
|
+
' '),
|
|
81
|
+
this.state.errorMessage ? (React.createElement(FormLayout_1.FormRow, { label: "" },
|
|
82
|
+
React.createElement(ErrorBox_1.default, null, this.state.errorMessage))) : null)),
|
|
83
|
+
React.createElement(rebass_1.Flex, { flex: 1, pr: 2, alignItems: "center", justifyContent: "end" },
|
|
84
|
+
React.createElement(rebass_1.Text, { mr: 2 }, "Legend"),
|
|
85
|
+
React.createElement(AdaptablePopover_1.AdaptablePopover, { popoverMinWidth: 200, bodyText: [
|
|
86
|
+
React.createElement(Panel_1.default, { variant: "modern", header: "Legend: Column Behaviour", className: "ab-LayoutEditor__LegendPanel", style: {
|
|
87
|
+
gridRow: '1 /1',
|
|
88
|
+
gridColumn: '3/3',
|
|
89
|
+
}, bodyProps: {
|
|
90
|
+
padding: 2,
|
|
91
|
+
backgroundColor: 'defaultbackground',
|
|
92
|
+
color: 'text-on-defaultbackground',
|
|
93
|
+
} },
|
|
94
|
+
React.createElement(ColumnLabels_1.ColumnLabels, { flexDirection: "column", showBoth: true, labels: {
|
|
95
|
+
Sortable: 'Able to be sorted',
|
|
96
|
+
Filterable: 'Can be filtered',
|
|
97
|
+
Aggregatable: 'Shows aggregations (in grouped rows)',
|
|
98
|
+
Groupable: 'Can form a row group',
|
|
99
|
+
Moveable: 'Is draggable and movable',
|
|
100
|
+
Pivotable: 'Eligible for pivoting',
|
|
101
|
+
}, sortable: true, filterable: true, moveable: true, pivotable: true, groupable: true, aggregatable: true })),
|
|
102
|
+
] }))),
|
|
75
103
|
React.createElement(LayoutEditor_1.LayoutEditor, { api: this.props.api, layout: this.state.layout, onLayoutChange: this.onLayoutChange }))));
|
|
76
104
|
}
|
|
77
105
|
canNext() {
|
|
@@ -4,7 +4,6 @@ exports.SystemStatusEntityRow = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const AdaptableObjectRow_1 = require("../Components/AdaptableObjectRow");
|
|
7
|
-
const EntityRowItem_1 = require("../Components/EntityRowItem");
|
|
8
7
|
const rebass_1 = require("rebass");
|
|
9
8
|
const UIHelper_1 = tslib_1.__importDefault(require("../UIHelper"));
|
|
10
9
|
const Helper_1 = require("../../Utilities/Helpers/Helper");
|
|
@@ -25,7 +24,7 @@ class SystemStatusEntityRow extends React.Component {
|
|
|
25
24
|
" ",
|
|
26
25
|
systemStatus.statusFurtherInformation ? '...' : ''),
|
|
27
26
|
systemStatus.statusFurtherInformation ? (React.createElement(rebass_1.Box, { margin: 2, style: { whiteSpace: 'normal' } }, systemStatus.statusFurtherInformation)) : null)) : null;
|
|
28
|
-
colItems[1].Content =
|
|
27
|
+
colItems[1].Content = systemStatus.timestamp.toLocaleString();
|
|
29
28
|
return React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: colItems });
|
|
30
29
|
}
|
|
31
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColDef, ColGroupDef, Column, ExcelStyle, GridOptions,
|
|
1
|
+
import { ColDef, ColGroupDef, Column, ExcelStyle, GridOptions, Module, RowNode, ValueGetterParams, ValueSetterParams } from '@ag-grid-community/all-modules';
|
|
2
2
|
import { AdaptableNoCodeWizardOptions, IAdaptableNoCodeWizard } from '../AdaptableInterfaces/AdaptableNoCodeWizard';
|
|
3
3
|
import { IAdaptable } from '../AdaptableInterfaces/IAdaptable';
|
|
4
4
|
import { AdaptableOptions } from '../AdaptableOptions/AdaptableOptions';
|
|
@@ -178,6 +178,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
178
178
|
forAllRowNodesDo(func: (rowNode: RowNode) => void): void;
|
|
179
179
|
forAllVisibleRowNodesDo(func: (rowNode: RowNode, rowIndex: number) => void): void;
|
|
180
180
|
getVisibleRowNodes(): RowNode[];
|
|
181
|
+
getRowsInViewport(): RowNode[];
|
|
181
182
|
selectNodes(rowNodes: RowNode[], clearSelection: boolean): void;
|
|
182
183
|
deSelectNodes(rowNodes: RowNode[], clearSelection: boolean): void;
|
|
183
184
|
selectNode(rowNode: RowNode, clearSelection: boolean): void;
|
|
@@ -187,6 +188,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
187
188
|
redrawBody(): void;
|
|
188
189
|
redrawHeader(): void;
|
|
189
190
|
redrawRow(rowNode: RowNode): void;
|
|
191
|
+
redrawRows(rowNodes: RowNode[]): void;
|
|
190
192
|
refreshCells(rowNodes: RowNode[], columns: (string | Column)[], forceUpdate: boolean, suppressFlash?: boolean): void;
|
|
191
193
|
jumpToRow(rowNode: RowNode): void;
|
|
192
194
|
jumpToColumn(columnId: string): void;
|
|
@@ -241,6 +243,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
241
243
|
getAdaptableContainerElement(): HTMLElement | null;
|
|
242
244
|
getAgGridContainerElement(): HTMLElement | null;
|
|
243
245
|
private initInternalGridLogic;
|
|
246
|
+
private updateColumnFilterActiveState;
|
|
244
247
|
buildStandaloneColumnHeader(adaptableColumn: AdaptableColumn): AdaptableMenuItem[];
|
|
245
248
|
prepareGrid(): void;
|
|
246
249
|
setupColumns(): void;
|
|
@@ -360,5 +363,4 @@ export declare class AdaptableNoCodeWizard implements IAdaptableNoCodeWizard {
|
|
|
360
363
|
constructor(adaptableOptions: AdaptableOptions, extraOptions?: AdaptableNoCodeWizardOptions);
|
|
361
364
|
render(container?: HTMLElement | null): void;
|
|
362
365
|
}
|
|
363
|
-
export declare const bindAdaptableAgGrid: (gridReadyEvent: GridReadyEvent, gridOptions: GridOptions) => void;
|
|
364
366
|
export {};
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AdaptableNoCodeWizard = exports.Adaptable = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const all_modules_1 = require("@ag-grid-community/all-modules");
|
|
6
6
|
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
@@ -316,13 +316,6 @@ class Adaptable {
|
|
|
316
316
|
this.runtimeConfig = runtimeConfig || {};
|
|
317
317
|
this.agGridModules = this.runtimeConfig.modules || [];
|
|
318
318
|
this.gridOptions = this.adaptableOptions.gridOptions;
|
|
319
|
-
if (this.hasAutogeneratedPrimaryKey() && !this.gridOptions.getRowNodeId) {
|
|
320
|
-
this.gridOptions.getRowNodeId = (rowData) => {
|
|
321
|
-
var _a;
|
|
322
|
-
rowData[GeneralConstants_1.AUTOGENERATED_PK_COLUMN] = (_a = rowData[GeneralConstants_1.AUTOGENERATED_PK_COLUMN]) !== null && _a !== void 0 ? _a : Uuid_1.createUuid();
|
|
323
|
-
return rowData[GeneralConstants_1.AUTOGENERATED_PK_COLUMN];
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
319
|
if (this.gridOptions.allowContextMenuWithControlKey === undefined) {
|
|
327
320
|
this.gridOptions.allowContextMenuWithControlKey = true;
|
|
328
321
|
}
|
|
@@ -517,7 +510,7 @@ class Adaptable {
|
|
|
517
510
|
LoggingHelper_1.LogAdaptableInfo(`Initializing AgGrid...`);
|
|
518
511
|
// set up whether we use the getRowNode method or loop when finding a rowNode (former is preferable)
|
|
519
512
|
// can only do that here as the gridOptions not yet set up
|
|
520
|
-
this.useRowNodeLookUp = this.agGridHelper.TrySetUpNodeIds();
|
|
513
|
+
this.useRowNodeLookUp = this.agGridHelper.TrySetUpNodeIds(this.hasAutogeneratedPrimaryKey());
|
|
521
514
|
if (Array.isArray(this.gridOptions.columnDefs)) {
|
|
522
515
|
this.gridOptions.columnDefs.forEach(assignColId);
|
|
523
516
|
}
|
|
@@ -850,32 +843,10 @@ class Adaptable {
|
|
|
850
843
|
return style;
|
|
851
844
|
}
|
|
852
845
|
getActiveAlertWithHighlightCell(col, params) {
|
|
853
|
-
|
|
854
|
-
.getAdaptableAlerts()
|
|
855
|
-
.filter((alert) => {
|
|
856
|
-
var _a;
|
|
857
|
-
return ((_a = alert.alertDefinition.AlertProperties) === null || _a === void 0 ? void 0 : _a.HighlightCell) &&
|
|
858
|
-
alert.dataChangedInfo &&
|
|
859
|
-
alert.dataChangedInfo.column &&
|
|
860
|
-
alert.dataChangedInfo.column.columnId === col.columnId &&
|
|
861
|
-
alert.dataChangedInfo.rowNode === params.node;
|
|
862
|
-
});
|
|
863
|
-
if (!activeAlerts.length) {
|
|
864
|
-
return null;
|
|
865
|
-
}
|
|
866
|
-
return activeAlerts === null || activeAlerts === void 0 ? void 0 : activeAlerts[0];
|
|
846
|
+
return this.api.internalApi.getAdaptableAlertWithHighlightCell(col.columnId, params.node);
|
|
867
847
|
}
|
|
868
848
|
getActiveAlertWithHighlightRow(params) {
|
|
869
|
-
|
|
870
|
-
return (_a = this.api.internalApi
|
|
871
|
-
.getAdaptableAlerts()
|
|
872
|
-
.filter((alert) => {
|
|
873
|
-
var _a;
|
|
874
|
-
return ((_a = alert.alertDefinition.AlertProperties) === null || _a === void 0 ? void 0 : _a.HighlightRow) &&
|
|
875
|
-
alert.dataChangedInfo &&
|
|
876
|
-
alert.dataChangedInfo.column &&
|
|
877
|
-
alert.dataChangedInfo.rowNode === params.node;
|
|
878
|
-
})) === null || _a === void 0 ? void 0 : _a[0];
|
|
849
|
+
return this.api.internalApi.getAdaptableAlertWithHighlightRow(params.node);
|
|
879
850
|
}
|
|
880
851
|
getAlertCellStyle(col, params) {
|
|
881
852
|
const alert = this.getActiveAlertWithHighlightCell(col, params);
|
|
@@ -1062,12 +1033,15 @@ class Adaptable {
|
|
|
1062
1033
|
}
|
|
1063
1034
|
getPrimaryKeyValueFromRowNode(rowNode) {
|
|
1064
1035
|
var _a;
|
|
1036
|
+
if (!rowNode) {
|
|
1037
|
+
return null;
|
|
1038
|
+
}
|
|
1065
1039
|
let gridApi = this.getGridOptionsApi();
|
|
1066
1040
|
let result;
|
|
1067
1041
|
if (gridApi && !this.hasAutogeneratedPrimaryKey()) {
|
|
1068
1042
|
result = gridApi.getValue(this.adaptableOptions.primaryKey, rowNode);
|
|
1069
1043
|
}
|
|
1070
|
-
if ((result === null || result == undefined) && rowNode
|
|
1044
|
+
if ((result === null || result == undefined) && rowNode.data) {
|
|
1071
1045
|
result = (_a = rowNode.data[this.adaptableOptions.primaryKey]) !== null && _a !== void 0 ? _a : null;
|
|
1072
1046
|
}
|
|
1073
1047
|
return result;
|
|
@@ -1282,10 +1256,13 @@ class Adaptable {
|
|
|
1282
1256
|
shouldUpdateHeaders = this.setupColumnHeader(colSetupInfo) || shouldUpdateHeaders;
|
|
1283
1257
|
});
|
|
1284
1258
|
isChanged = isChanged || shouldUpdateHeaders;
|
|
1285
|
-
if (
|
|
1286
|
-
|
|
1259
|
+
if (this.api.layoutApi.areExpandedRowGroupsSavedInLayouts() &&
|
|
1260
|
+
ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(layout.ExpandedRowGroupValues)) {
|
|
1287
1261
|
this.expandRowGroupsForValues(layout.ExpandedRowGroupValues);
|
|
1288
1262
|
}
|
|
1263
|
+
if (this.adaptableOptions.layoutOptions.displayRowGroups === 'expanded') {
|
|
1264
|
+
this.expandAllRowGroups();
|
|
1265
|
+
}
|
|
1289
1266
|
if (isChanged) {
|
|
1290
1267
|
// it's important we set pivot mode
|
|
1291
1268
|
// before we set column state
|
|
@@ -1404,7 +1381,7 @@ class Adaptable {
|
|
|
1404
1381
|
}
|
|
1405
1382
|
layout.EnablePivot = this.gridOptions.columnApi.isPivotMode();
|
|
1406
1383
|
layout.PivotColumns = pivotColumns;
|
|
1407
|
-
if (this.
|
|
1384
|
+
if (this.api.layoutApi.areExpandedRowGroupsSavedInLayouts()) {
|
|
1408
1385
|
layout.ExpandedRowGroupValues = this.getExpandRowGroupsKeys();
|
|
1409
1386
|
}
|
|
1410
1387
|
// this.api.layoutApi.fireLayoutUpdatedEvent(layout, 'UpdatedLayout');
|
|
@@ -1895,6 +1872,9 @@ class Adaptable {
|
|
|
1895
1872
|
});
|
|
1896
1873
|
return rowNodes;
|
|
1897
1874
|
}
|
|
1875
|
+
getRowsInViewport() {
|
|
1876
|
+
return this.gridOptions.api.getRenderedNodes();
|
|
1877
|
+
}
|
|
1898
1878
|
selectNodes(rowNodes, clearSelection) {
|
|
1899
1879
|
if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(rowNodes)) {
|
|
1900
1880
|
rowNodes.forEach((node) => this.selectNode(node, clearSelection));
|
|
@@ -1945,19 +1925,17 @@ class Adaptable {
|
|
|
1945
1925
|
this.gridOptions.api.refreshHeader();
|
|
1946
1926
|
}
|
|
1947
1927
|
redrawRow(rowNode) {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
// return;
|
|
1952
|
-
// }
|
|
1928
|
+
this.redrawRows([rowNode]);
|
|
1929
|
+
}
|
|
1930
|
+
redrawRows(rowNodes) {
|
|
1953
1931
|
const redrawRowsParams = {
|
|
1954
|
-
rowNodes
|
|
1932
|
+
rowNodes,
|
|
1955
1933
|
};
|
|
1956
1934
|
try {
|
|
1957
1935
|
this.gridOptions.api.redrawRows(redrawRowsParams);
|
|
1958
1936
|
}
|
|
1959
1937
|
catch (ex) {
|
|
1960
|
-
LoggingHelper_1.ConsoleLogError('ag-grid redrawRows was unable to find some row nodes. Tried to redraw row
|
|
1938
|
+
LoggingHelper_1.ConsoleLogError('ag-grid redrawRows was unable to find some row nodes. Tried to redraw row nodes: ', rowNodes, ex);
|
|
1961
1939
|
}
|
|
1962
1940
|
}
|
|
1963
1941
|
refreshCells(rowNodes, columns, forceUpdate, suppressFlash = false) {
|
|
@@ -2589,26 +2567,22 @@ class Adaptable {
|
|
|
2589
2567
|
this.gridOptions.isExternalFilterPresent = () => {
|
|
2590
2568
|
const columnFilters = this.api.filterApi.getAllColumnFilter();
|
|
2591
2569
|
const isFilterActive = ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(columnFilters);
|
|
2592
|
-
if (isFilterActive) {
|
|
2593
|
-
// used in particular at init time to show the filter icon correctly
|
|
2594
|
-
for (const colFilter of columnFilters) {
|
|
2595
|
-
const agGridCol = this.gridOptions.columnApi.getColumn(colFilter.ColumnId);
|
|
2596
|
-
if (agGridCol && !agGridCol.isFilterActive()) {
|
|
2597
|
-
agGridCol.setFilterActive(true);
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
else {
|
|
2602
|
-
(this.gridOptions.columnApi.getAllColumns() || []).forEach((col) => {
|
|
2603
|
-
if (col.isFilterActive()) {
|
|
2604
|
-
col.setFilterActive(false);
|
|
2605
|
-
}
|
|
2606
|
-
});
|
|
2607
|
-
}
|
|
2608
2570
|
const isQueryActive = StringExtensions_1.StringExtensions.IsNotNullOrEmpty(this.api.queryApi.getCurrentQuery());
|
|
2609
|
-
|
|
2571
|
+
/**
|
|
2572
|
+
* Changing the column filterState sync breaks the rendering of the custom filter component.
|
|
2573
|
+
* I think that changing the column definition while ag-grid determines if a column is filtered
|
|
2574
|
+
* breaks the logic of the custom component.
|
|
2575
|
+
*
|
|
2576
|
+
* Result:
|
|
2577
|
+
* - custom filters in sate
|
|
2578
|
+
* - refresh page, the ag-grid filter is rendered instead of adaptable custom-filter-component.
|
|
2579
|
+
*/
|
|
2580
|
+
requestAnimationFrame(() => {
|
|
2581
|
+
this.updateColumnFilterActiveState();
|
|
2582
|
+
});
|
|
2610
2583
|
return (isFilterActive ||
|
|
2611
2584
|
isQueryActive ||
|
|
2585
|
+
// it means that originaldoesExternalFilterPass will be called so we reinit that collection
|
|
2612
2586
|
(originalisExternalFilterPresent ? originalisExternalFilterPresent() : false));
|
|
2613
2587
|
};
|
|
2614
2588
|
const originaldoesExternalFilterPass = this.gridOptions.doesExternalFilterPass;
|
|
@@ -2660,6 +2634,26 @@ class Adaptable {
|
|
|
2660
2634
|
};
|
|
2661
2635
|
this.prepareGrid();
|
|
2662
2636
|
}
|
|
2637
|
+
updateColumnFilterActiveState() {
|
|
2638
|
+
const columnFilters = this.api.filterApi.getAllColumnFilter();
|
|
2639
|
+
const isFilterActive = ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(columnFilters);
|
|
2640
|
+
if (isFilterActive) {
|
|
2641
|
+
// used in particular at init time to show the filter icon correctly
|
|
2642
|
+
for (const colFilter of columnFilters) {
|
|
2643
|
+
const agGridCol = this.gridOptions.columnApi.getColumn(colFilter.ColumnId);
|
|
2644
|
+
if (agGridCol && !agGridCol.isFilterActive()) {
|
|
2645
|
+
agGridCol.setFilterActive(true);
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
else {
|
|
2650
|
+
(this.gridOptions.columnApi.getAllColumns() || []).forEach((col) => {
|
|
2651
|
+
if (col.isFilterActive()) {
|
|
2652
|
+
col.setFilterActive(false);
|
|
2653
|
+
}
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2663
2657
|
buildStandaloneColumnHeader(adaptableColumn) {
|
|
2664
2658
|
return this.agGridMenuHelper.buildStandaloneColumnHeader(adaptableColumn);
|
|
2665
2659
|
}
|
|
@@ -2869,6 +2863,7 @@ class Adaptable {
|
|
|
2869
2863
|
setupColumnCellEditor({ colId, col }) {
|
|
2870
2864
|
const adaptableColumn = this.api.columnApi.getColumnFromId(colId);
|
|
2871
2865
|
const editLookUpItem = this.api.userInterfaceApi.getEditLookUpItemForColumn(adaptableColumn);
|
|
2866
|
+
const hasRichSelectCellEditor = this.isModulePresent('rich-select');
|
|
2872
2867
|
this.setColDefProperty(col, 'cellEditor', () => {
|
|
2873
2868
|
var _a;
|
|
2874
2869
|
const formatColumn = this.api.formatColumnApi.getFormatColumnForColumn(adaptableColumn);
|
|
@@ -2876,9 +2871,14 @@ class Adaptable {
|
|
|
2876
2871
|
return CheckboxRenderer_1.CheckboxEditor;
|
|
2877
2872
|
}
|
|
2878
2873
|
if (editLookUpItem) {
|
|
2879
|
-
return
|
|
2880
|
-
|
|
2881
|
-
|
|
2874
|
+
return hasRichSelectCellEditor ? 'agRichSelectCellEditor' : 'agSelectCellEditor';
|
|
2875
|
+
}
|
|
2876
|
+
});
|
|
2877
|
+
this.setColDefProperty(col, 'cellEditorPopup', () => {
|
|
2878
|
+
// as specified in https://www.ag-grid.com/react-data-grid/provided-cell-editors/#rich-select-cell-editor
|
|
2879
|
+
// agRichSelectCellEditor should always set cellEditorPopup=true. Otherwise the editor will be clipped to the cell contents
|
|
2880
|
+
if (editLookUpItem && hasRichSelectCellEditor) {
|
|
2881
|
+
return true;
|
|
2882
2882
|
}
|
|
2883
2883
|
});
|
|
2884
2884
|
this.setColDefProperty(col, 'cellEditorParams', (params) => {
|
|
@@ -3429,7 +3429,7 @@ class Adaptable {
|
|
|
3429
3429
|
}
|
|
3430
3430
|
getExpandRowGroupsKeys() {
|
|
3431
3431
|
let returnValues = [];
|
|
3432
|
-
if (this.
|
|
3432
|
+
if (this.api.layoutApi.areExpandedRowGroupsSavedInLayouts()) {
|
|
3433
3433
|
this.gridOptions.api.forEachNode((node) => {
|
|
3434
3434
|
if (node.group && node.expanded) {
|
|
3435
3435
|
let current = node;
|
|
@@ -4307,7 +4307,3 @@ class AdaptableNoCodeWizard {
|
|
|
4307
4307
|
}
|
|
4308
4308
|
}
|
|
4309
4309
|
exports.AdaptableNoCodeWizard = AdaptableNoCodeWizard;
|
|
4310
|
-
exports.bindAdaptableAgGrid = (gridReadyEvent, gridOptions) => {
|
|
4311
|
-
gridOptions.api = gridReadyEvent.api;
|
|
4312
|
-
gridOptions.columnApi = gridReadyEvent.columnApi;
|
|
4313
|
-
};
|
|
@@ -20,7 +20,7 @@ export declare class agGridHelper {
|
|
|
20
20
|
getAgGridLightThemeName(): string;
|
|
21
21
|
getAgGridDarkThemeName(): string;
|
|
22
22
|
setUpModules(): Map<AdaptableModule, IModule>;
|
|
23
|
-
TrySetUpNodeIds(): boolean;
|
|
23
|
+
TrySetUpNodeIds(hasAutogeneratedPrimaryKey: boolean): boolean;
|
|
24
24
|
createCheckboxRendererComp(columnId: string, isColumnReadOnly: boolean): ICellRendererFunc | undefined;
|
|
25
25
|
createPercentBarRendererComp(formatColumn: FormatColumn): ICellRendererFunc;
|
|
26
26
|
getCleanValue(value: string): string | undefined;
|
|
@@ -39,6 +39,7 @@ const FlashingCellModule_1 = require("../Strategy/FlashingCellModule");
|
|
|
39
39
|
const SettingsPanelModule_1 = require("../Strategy/SettingsPanelModule");
|
|
40
40
|
const ChartingModule_1 = require("../Strategy/ChartingModule");
|
|
41
41
|
const PercentBarRenderer_1 = require("./PercentBarRenderer");
|
|
42
|
+
const Helper_1 = require("../Utilities/Helpers/Helper");
|
|
42
43
|
const tinycolor = require('tinycolor2');
|
|
43
44
|
/**
|
|
44
45
|
* Adaptable AG Grid implementation is getting really big and unwieldy
|
|
@@ -99,21 +100,35 @@ class agGridHelper {
|
|
|
99
100
|
modules.set(ModuleConstants.ChartingModuleId, new ChartingModule_1.ChartingModule(api));
|
|
100
101
|
return modules;
|
|
101
102
|
}
|
|
102
|
-
TrySetUpNodeIds() {
|
|
103
|
+
TrySetUpNodeIds(hasAutogeneratedPrimaryKey) {
|
|
103
104
|
if (StringExtensions_1.StringExtensions.IsNullOrEmpty(this.adaptable.adaptableOptions.primaryKey)) {
|
|
104
105
|
// if no valid pk then always false
|
|
105
106
|
return false;
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
if (Helper_1.Helper.objectExists(this.gridOptions.getRowNodeId) ||
|
|
109
|
+
Helper_1.Helper.objectExists(this.gridOptions.getRowId)) {
|
|
110
|
+
// if the user provided a getRowNodeId/getRowId then we don't need to do anything
|
|
111
|
+
// Note: starting with 27.1.0 'getRowNodeId' method is deprecated and will be removed in future versions
|
|
109
112
|
return true;
|
|
110
113
|
}
|
|
111
|
-
// also we can check if they have done it
|
|
112
114
|
const primaryKey = this.adaptable.adaptableOptions.primaryKey;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
if (hasAutogeneratedPrimaryKey) {
|
|
116
|
+
this.gridOptions.getRowId = (params) => {
|
|
117
|
+
// if the PK value is autogenerated, we need to make sure that the rowData has a valid PK value
|
|
118
|
+
// this should be taken care of in the Adaptable.[loadDataSource/setDataSource/updateRows]() methods, but the users will always make silly decisions
|
|
119
|
+
// so just to be safe we'll check here and add a PK value is missing
|
|
120
|
+
// thus adding a side-effect in a getter, but what can we do against it?! :)
|
|
121
|
+
if (Helper_1.Helper.objectNotExists(params.data[primaryKey])) {
|
|
122
|
+
params.data[primaryKey] = Uuid_1.createUuid();
|
|
123
|
+
}
|
|
124
|
+
return params.data[primaryKey];
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.gridOptions.getRowId = (params) => {
|
|
129
|
+
return params.data[primaryKey];
|
|
130
|
+
};
|
|
131
|
+
}
|
|
117
132
|
return true;
|
|
118
133
|
}
|
|
119
134
|
createCheckboxRendererComp(columnId, isColumnReadOnly) {
|
|
@@ -117,7 +117,7 @@ class AdaptableDateEditor {
|
|
|
117
117
|
react_dom_1.unmountComponentAtNode(this.el);
|
|
118
118
|
}
|
|
119
119
|
shouldClearExistingValue(params) {
|
|
120
|
-
return params.
|
|
120
|
+
return params.eventKey === all_modules_1.KeyCode.BACKSPACE || params.eventKey === all_modules_1.KeyCode.DELETE;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
exports.AdaptableDateEditor = AdaptableDateEditor;
|
|
@@ -93,7 +93,7 @@ class AdaptableNumberEditor {
|
|
|
93
93
|
react_dom_1.unmountComponentAtNode(this.el);
|
|
94
94
|
}
|
|
95
95
|
shouldClearExistingValue(params) {
|
|
96
|
-
return params.
|
|
96
|
+
return params.eventKey === all_modules_1.KeyCode.BACKSPACE || params.eventKey === all_modules_1.KeyCode.DELETE;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
exports.AdaptableNumberEditor = AdaptableNumberEditor;
|
|
@@ -105,7 +105,7 @@ exports.Dialog = React.forwardRef((props, ref) => {
|
|
|
105
105
|
e.nativeEvent.preventDialogDismiss = true;
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
const box = (React.createElement(rebass_1.Box, Object.assign({
|
|
108
|
+
const box = (React.createElement(rebass_1.Box, Object.assign({}, boxProps, { onClick: (e) => {
|
|
109
109
|
setPreventDismissFlag(e);
|
|
110
110
|
if (boxProps && boxProps.onClick) {
|
|
111
111
|
boxProps.onClick(e);
|
|
@@ -32,7 +32,7 @@ exports.Modal = (props) => {
|
|
|
32
32
|
const counter = react_1.useMemo(() => globalCounter++, [isOpen]);
|
|
33
33
|
const openTimestamp = counter;
|
|
34
34
|
const backdropZIndexOffset = props.backdropZIndexOffset || 1;
|
|
35
|
-
const zIndex = (props.baseZIndex ||
|
|
35
|
+
const zIndex = (props.baseZIndex || 2000) + counter;
|
|
36
36
|
return react_dom_1.createPortal(isOpen ? (React.createElement(React.Fragment, null,
|
|
37
37
|
React.createElement(Backdrop_1.default, { timestamp: openTimestamp, uuid: uuid, zIndex: zIndex - backdropZIndexOffset, onBringToFront: onBringToFront }),
|
|
38
38
|
React.createElement(react_remove_scroll_1.RemoveScroll, null,
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
export declare type WindowModalSize = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export declare type WindowModalPosition = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
2
10
|
export interface WindowModalProps {
|
|
3
11
|
handleSelector: string;
|
|
4
|
-
size:
|
|
5
|
-
|
|
6
|
-
height: number;
|
|
7
|
-
};
|
|
8
|
-
position?: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
};
|
|
12
|
+
size: WindowModalSize;
|
|
13
|
+
position?: WindowModalPosition;
|
|
12
14
|
onChange: (settings: {
|
|
13
15
|
size: {
|
|
14
16
|
width: number;
|
|
@@ -7,6 +7,7 @@ const re_resizable_1 = require("re-resizable");
|
|
|
7
7
|
const useDraggable_1 = tslib_1.__importDefault(require("../utils/useDraggable"));
|
|
8
8
|
const UIHelper_1 = require("../../View/UIHelper");
|
|
9
9
|
const react_dom_1 = require("react-dom");
|
|
10
|
+
const useStacking_1 = require("./useStacking");
|
|
10
11
|
let portalElement;
|
|
11
12
|
const ensurePortalElement = () => {
|
|
12
13
|
if (!UIHelper_1.isBrowserDocumentAvailable()) {
|
|
@@ -43,6 +44,7 @@ exports.WindowModal = (props) => {
|
|
|
43
44
|
ensurePortalElement();
|
|
44
45
|
const positionDeltaRef = React.useRef(null);
|
|
45
46
|
const positionRef = React.useRef(props.position);
|
|
47
|
+
const stacking = useStacking_1.useStacking();
|
|
46
48
|
/**
|
|
47
49
|
* This is needed because the function called in onDrop is saved when
|
|
48
50
|
* it gets attached to the DOM element event handler.
|
|
@@ -50,7 +52,7 @@ exports.WindowModal = (props) => {
|
|
|
50
52
|
*/
|
|
51
53
|
positionRef.current = props.position;
|
|
52
54
|
const style = {
|
|
53
|
-
zIndex:
|
|
55
|
+
zIndex: stacking.zIndex,
|
|
54
56
|
position: 'absolute',
|
|
55
57
|
left: props.position.x,
|
|
56
58
|
top: props.position.y,
|
|
@@ -97,7 +99,7 @@ exports.WindowModal = (props) => {
|
|
|
97
99
|
}, []);
|
|
98
100
|
return react_dom_1.createPortal(React.createElement("div", { style: style,
|
|
99
101
|
//@ts-ignore
|
|
100
|
-
ref: targetRef },
|
|
102
|
+
ref: targetRef, onMouseDown: stacking.bringInFront },
|
|
101
103
|
React.createElement(re_resizable_1.Resizable, { onResizeStop: handleResizeStop, onResize: handleResize, bounds: "window", defaultSize: {
|
|
102
104
|
width: props.size.width,
|
|
103
105
|
height: props.size.height,
|