@adaptabletools/adaptable 12.1.7 → 12.1.8-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 +11 -49
- package/bundle.cjs.js +105 -105
- package/index.css +13 -60
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/FilterOptions.d.ts +12 -0
- package/src/AdaptableOptions/FinancePluginOptions.d.ts +22 -1
- package/src/AdaptableOptions/StateOptions.d.ts +25 -12
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/ExportApi.d.ts +5 -0
- package/src/Api/FilterApi.d.ts +23 -0
- package/src/Api/GridApi.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +5 -0
- package/src/Api/Implementation/ExportApiImpl.d.ts +3 -1
- package/src/Api/Implementation/ExportApiImpl.js +19 -3
- package/src/Api/Implementation/FilterApiImpl.d.ts +5 -0
- package/src/Api/Implementation/FilterApiImpl.js +25 -2
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/InternalApiImpl.d.ts +0 -1
- package/src/Api/Implementation/InternalApiImpl.js +0 -3
- package/src/Api/Implementation/PredicateApiImpl.js +4 -0
- package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -1
- package/src/Api/InternalApi.d.ts +0 -1
- package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +16 -4
- package/src/PredefinedConfig/Common/AdaptableQuery.js +1 -1
- package/src/PredefinedConfig/Common/AggregationColumns.d.ts +6 -0
- package/src/PredefinedConfig/Common/AggregationColumns.js +4 -0
- package/src/PredefinedConfig/Common/ColumnFilter.d.ts +2 -2
- package/src/PredefinedConfig/Common/Enums.d.ts +0 -15
- package/src/PredefinedConfig/Common/Enums.js +1 -18
- package/src/PredefinedConfig/ExportState.d.ts +12 -4
- package/src/PredefinedConfig/LayoutState.d.ts +2 -1
- package/src/PredefinedConfig/PopupState.d.ts +1 -2
- package/src/Redux/ActionsReducers/AlertRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/AlertRedux.js +1 -1
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +1 -1
- package/src/Redux/ActionsReducers/CustomSortRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/CustomSortRedux.js +1 -1
- package/src/Redux/ActionsReducers/FlashingCellRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/FlashingCellRedux.js +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +1 -1
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +28 -0
- package/src/Redux/ActionsReducers/LayoutRedux.js +80 -2
- package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/PlusMinusRedux.js +1 -1
- package/src/Redux/ActionsReducers/PopupRedux.d.ts +0 -2
- package/src/Redux/ActionsReducers/PopupRedux.js +1 -28
- package/src/Redux/ActionsReducers/ScheduleRedux.d.ts +5 -5
- package/src/Redux/ActionsReducers/ScheduleRedux.js +5 -5
- package/src/Redux/ActionsReducers/ShortcutRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/ShortcutRedux.js +1 -1
- package/src/Redux/Store/AdaptableStore.js +15 -6
- package/src/Strategy/AlertModule.d.ts +1 -0
- package/src/Strategy/AlertModule.js +20 -0
- package/src/Strategy/CalculatedColumnModule.js +2 -2
- package/src/Strategy/ExportModule.d.ts +0 -1
- package/src/Strategy/ExportModule.js +0 -16
- package/src/Strategy/FilterModule.js +6 -0
- package/src/Strategy/Interface/IModule.d.ts +4 -0
- package/src/Strategy/LayoutModule.js +20 -20
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +16 -1
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +15 -11
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -0
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +12 -2
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +30 -66
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +22 -6
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +423 -220
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +7 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +23 -7
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +0 -1
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -54
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +17 -5
- package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
- package/src/Utilities/ObjectFactory.d.ts +4 -2
- package/src/Utilities/ObjectFactory.js +16 -3
- package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +25 -0
- package/src/Utilities/Services/AggregatedScalarLiveValue.js +103 -0
- package/src/Utilities/Services/AlertService.d.ts +0 -1
- package/src/Utilities/Services/AlertService.js +5 -17
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +4 -4
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +29 -154
- package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +2 -2
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +6 -3
- package/src/Utilities/Services/QueryLanguageService.d.ts +6 -3
- package/src/Utilities/Services/QueryLanguageService.js +23 -6
- package/src/Utilities/Services/ReportService.js +47 -46
- package/src/View/AdaptableView.js +1 -2
- package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags.d.ts +2 -0
- package/src/View/CalculatedColumn/Utilities/{getCalculatedColumnSettingTags.js → getCalculatedColumnSettingsTags.js} +3 -3
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.d.ts +10 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +80 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +20 -11
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -52
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +17 -6
- package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +42 -6
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
- package/src/View/Components/EntityRulesEditor/index.js +26 -5
- package/src/View/Components/FilterForm/FilterForm.js +8 -4
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -0
- package/src/View/Components/FilterForm/QuickFilterForm.js +10 -6
- package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.d.ts +9 -0
- package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.js +28 -0
- package/src/View/Components/PermittedValuesSelector/index.d.ts +1 -0
- package/src/View/Components/PermittedValuesSelector/index.js +5 -0
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +2 -2
- package/src/View/Components/Popups/AdaptableToaster.js +2 -7
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -4
- package/src/View/Export/ExportViewPanel.d.ts +1 -2
- package/src/View/Export/ExportViewPanel.js +2 -6
- package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +1 -2
- package/src/View/Export/Wizard/ReportColumnTypeWizard.js +11 -12
- package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +1 -2
- package/src/View/Export/Wizard/ReportRowTypeWizard.js +12 -13
- package/src/View/Export/Wizard/ReportSettingsWizard.js +1 -2
- package/src/View/Filter/FilterViewPanel.js +20 -4
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
- package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.d.ts +0 -0
- package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.js +0 -0
- package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +69 -8
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
- package/src/View/Query/QueryViewPanel.js +1 -1
- package/src/agGrid/Adaptable.d.ts +10 -3
- package/src/agGrid/Adaptable.js +211 -142
- package/src/agGrid/agGridHelper.d.ts +1 -0
- package/src/agGrid/agGridHelper.js +5 -3
- package/src/agGrid/agGridMenuHelper.d.ts +1 -0
- package/src/agGrid/agGridMenuHelper.js +4 -2
- package/src/agGrid/weightedAverage.d.ts +6 -0
- package/src/agGrid/weightedAverage.js +66 -0
- package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -0
- package/src/components/ExpressionEditor/BaseEditorInput.js +2 -3
- package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
- package/src/components/ExpressionEditor/EditorInput.js +24 -4
- package/src/components/ExpressionEditor/{EditorInputReactive.d.ts → EditorInputWithWhereClause.d.ts} +3 -3
- package/src/components/ExpressionEditor/{EditorInputReactive.js → EditorInputWithWhereClause.js} +6 -5
- package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.d.ts +2 -0
- package/src/components/ExpressionEditor/{editorButtonsReactive.js → editorButtonsAggregatedBoolean.js} +22 -37
- package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +50 -0
- package/src/components/ExpressionEditor/editorButtonsObservable.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsObservable.js +40 -0
- package/src/components/ExpressionEditor/index.d.ts +1 -1
- package/src/components/ExpressionEditor/index.js +26 -5
- package/src/metamodel/adaptable.metamodel.d.ts +55 -1
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +3 -3
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags.d.ts +0 -2
- package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +0 -3
- package/src/View/Layout/LayoutEditorStandalonePopup.js +0 -78
- package/src/View/Layout/Wizard/LayoutEditor/ColumnList.d.ts +0 -27
- package/src/View/Layout/Wizard/LayoutEditor/ColumnList.js +0 -86
- package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.d.ts +0 -16
- package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.js +0 -89
- package/src/View/Layout/Wizard/LayoutEditor/PivotList.d.ts +0 -15
- package/src/View/Layout/Wizard/LayoutEditor/PivotList.js +0 -70
- package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.d.ts +0 -15
- package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.js +0 -70
- package/src/View/Layout/Wizard/LayoutEditor/droppableIds.d.ts +0 -7
- package/src/View/Layout/Wizard/LayoutEditor/droppableIds.js +0 -11
- package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.d.ts +0 -6
- package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.js +0 -26
- package/src/View/Layout/Wizard/LayoutEditor/index.d.ts +0 -9
- package/src/View/Layout/Wizard/LayoutEditor/index.js +0 -367
- package/src/View/Layout/Wizard/LayoutEditor/reducer.d.ts +0 -28
- package/src/View/Layout/Wizard/LayoutEditor/reducer.js +0 -46
- package/src/View/Layout/Wizard/LayoutEditor/utils.d.ts +0 -10
- package/src/View/Layout/Wizard/LayoutEditor/utils.js +0 -14
- package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +0 -30
- package/src/View/Layout/Wizard/LayoutEditorWizard.js +0 -132
- package/src/components/ExpressionEditor/editorButtonsReactive.d.ts +0 -2
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LayoutEditor = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const react_beautiful_dnd_1 = require("react-beautiful-dnd");
|
|
7
|
-
const rebass_1 = require("rebass");
|
|
8
|
-
const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
|
|
9
|
-
const ColumnList_1 = require("./ColumnList");
|
|
10
|
-
const CheckBox_1 = require("../../../../components/CheckBox");
|
|
11
|
-
const icons_1 = require("../../../../components/icons");
|
|
12
|
-
const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
|
|
13
|
-
const ColumnSortList_1 = require("./ColumnSortList");
|
|
14
|
-
const RowGroupsList_1 = require("./RowGroupsList");
|
|
15
|
-
const droppableIds_1 = require("./droppableIds");
|
|
16
|
-
const react_1 = require("react");
|
|
17
|
-
const getItemStyle_1 = require("./getItemStyle");
|
|
18
|
-
const reducer_1 = require("./reducer");
|
|
19
|
-
const DropdownButton_1 = tslib_1.__importDefault(require("../../../../components/DropdownButton"));
|
|
20
|
-
const PivotList_1 = require("./PivotList");
|
|
21
|
-
const ButtonInfo_1 = require("../../../Components/Buttons/ButtonInfo");
|
|
22
|
-
const Input_1 = tslib_1.__importDefault(require("../../../../components/Input"));
|
|
23
|
-
const StringExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/StringExtensions"));
|
|
24
|
-
const ColumnLabels_1 = require("./ColumnLabels");
|
|
25
|
-
const verticalPanelStyle = {
|
|
26
|
-
minHeight: 150,
|
|
27
|
-
overflow: 'auto',
|
|
28
|
-
};
|
|
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
|
-
function areEqual(_prevProps, _nextProps) {
|
|
31
|
-
/*
|
|
32
|
-
* For now we don't need updates from the parent - the initial layout we receive on mount is enough
|
|
33
|
-
* so for performance reasons, skip updating this component on subsequent renders
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
exports.LayoutEditor = React.memo((props) => {
|
|
39
|
-
const { api } = props;
|
|
40
|
-
const allColumns = React.useMemo(() => api.columnApi.getColumns(), []);
|
|
41
|
-
const initialState = React.useMemo(() => reducer_1.getInitialState(props.layout), []);
|
|
42
|
-
const [state, dispatch] = React.useReducer(reducer_1.reducer, initialState);
|
|
43
|
-
const { layout } = state;
|
|
44
|
-
const allColumnsMap = React.useMemo(() => {
|
|
45
|
-
return allColumns.reduce((acc, col) => {
|
|
46
|
-
acc[col.columnId] = col;
|
|
47
|
-
return acc;
|
|
48
|
-
}, {});
|
|
49
|
-
}, [allColumns]);
|
|
50
|
-
const tmpMap = {};
|
|
51
|
-
const [columnList, setColumnList] = React.useState(layout.Columns.map((colId) => {
|
|
52
|
-
const col = allColumnsMap[colId];
|
|
53
|
-
tmpMap[colId] = col;
|
|
54
|
-
return col;
|
|
55
|
-
})
|
|
56
|
-
.concat(allColumns.filter((col) => {
|
|
57
|
-
return !tmpMap[col.columnId];
|
|
58
|
-
}))
|
|
59
|
-
.filter((c) => c));
|
|
60
|
-
const setLayout = (layout) => {
|
|
61
|
-
dispatch({
|
|
62
|
-
type: reducer_1.LayoutEditorActions.SET_LAYOUT,
|
|
63
|
-
payload: layout,
|
|
64
|
-
});
|
|
65
|
-
if (props.onLayoutChange) {
|
|
66
|
-
props.onLayoutChange(layout);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
React.useEffect(() => {
|
|
70
|
-
if (props.layout !== state.layout) {
|
|
71
|
-
setLayout(props.layout);
|
|
72
|
-
}
|
|
73
|
-
}, [props.layout]);
|
|
74
|
-
const visibleColumnsMap = React.useMemo(() => {
|
|
75
|
-
return allColumns.reduce((acc, col) => {
|
|
76
|
-
acc[col.columnId] = layout.Columns.indexOf(col.columnId) != -1 ? col : null;
|
|
77
|
-
return acc;
|
|
78
|
-
}, {});
|
|
79
|
-
}, [layout, allColumns]);
|
|
80
|
-
const aggregationColumnsMap = React.useMemo(() => {
|
|
81
|
-
return Object.keys(layout.AggregationColumns || {}).reduce((acc, colId) => {
|
|
82
|
-
let fn = layout.AggregationColumns[colId];
|
|
83
|
-
if (typeof fn === 'boolean') {
|
|
84
|
-
fn = allColumnsMap[colId].aggregationFunction;
|
|
85
|
-
}
|
|
86
|
-
acc[colId] = fn;
|
|
87
|
-
return acc;
|
|
88
|
-
}, {});
|
|
89
|
-
}, [allColumnsMap, layout]);
|
|
90
|
-
const headerColumnsMap = React.useMemo(() => {
|
|
91
|
-
var _a;
|
|
92
|
-
return Object.keys((_a = layout.ColumnHeadersMap) !== null && _a !== void 0 ? _a : {}).reduce((acc, colId) => {
|
|
93
|
-
let customHeader = layout.ColumnHeadersMap[colId];
|
|
94
|
-
if (typeof customHeader === 'string') {
|
|
95
|
-
acc[colId] = customHeader;
|
|
96
|
-
}
|
|
97
|
-
return acc;
|
|
98
|
-
}, {});
|
|
99
|
-
}, [allColumnsMap, layout]);
|
|
100
|
-
const setColumnVisibility = (c, visible) => {
|
|
101
|
-
const newLayout = visible
|
|
102
|
-
? Object.assign(Object.assign({}, layout), { Columns: columnList
|
|
103
|
-
.filter((col) => visibleColumnsMap[col.columnId] || col.columnId === c.columnId)
|
|
104
|
-
.map((c) => c.columnId) }) : Object.assign(Object.assign({}, layout), { Columns: layout.Columns.filter((colId) => colId !== c.columnId) });
|
|
105
|
-
const previousGroupCols = getAgGridGroupAutoColumn(layout);
|
|
106
|
-
const currentGroupCols = getAgGridGroupAutoColumn(newLayout);
|
|
107
|
-
if (previousGroupCols.length !== currentGroupCols.length) {
|
|
108
|
-
const missingGroupCols = previousGroupCols.filter((col) => !currentGroupCols.includes(col));
|
|
109
|
-
// the AG Grid group auto-columns got lost (because it's not part of the persistent column definition)
|
|
110
|
-
// Adaptable can handle this because it will be auto-generated at the next grid init (OK), but it will mess up the teamsharing revisions (NOK)
|
|
111
|
-
// therefore we insert them back
|
|
112
|
-
newLayout.Columns = [...missingGroupCols, ...newLayout.Columns];
|
|
113
|
-
}
|
|
114
|
-
setLayout(newLayout);
|
|
115
|
-
};
|
|
116
|
-
const getAgGridGroupAutoColumn = react_1.useCallback((layout) => layout.Columns.filter((columnId) => api.columnApi.isAutoRowGroupColumn(columnId)), []);
|
|
117
|
-
const onDragEndRef = react_1.useRef({
|
|
118
|
-
columnList: () => { },
|
|
119
|
-
columnSortList: () => { },
|
|
120
|
-
rowGroupsList: () => { },
|
|
121
|
-
pivotList: () => { },
|
|
122
|
-
});
|
|
123
|
-
const onDragEnd = react_1.useCallback((result) => {
|
|
124
|
-
const { source, destination } = result;
|
|
125
|
-
if (!source || !destination) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (source.droppableId === droppableIds_1.LayoutEditorDroppableIds.ColumnList) {
|
|
129
|
-
source.column = columnList[source.index];
|
|
130
|
-
source.columnId = source.column.columnId;
|
|
131
|
-
}
|
|
132
|
-
if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.ColumnList) {
|
|
133
|
-
onDragEndRef.current.columnList(result);
|
|
134
|
-
}
|
|
135
|
-
if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.ColumnSortList) {
|
|
136
|
-
onDragEndRef.current.columnSortList(result);
|
|
137
|
-
}
|
|
138
|
-
if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.RowGroupsList) {
|
|
139
|
-
onDragEndRef.current.rowGroupsList(result);
|
|
140
|
-
}
|
|
141
|
-
if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.PivotList) {
|
|
142
|
-
onDragEndRef.current.pivotList(result);
|
|
143
|
-
}
|
|
144
|
-
}, [columnList]);
|
|
145
|
-
const onDragStart = react_1.useCallback((snapshot) => {
|
|
146
|
-
const { source, draggableId } = snapshot;
|
|
147
|
-
const dragSource = source.droppableId;
|
|
148
|
-
const column = dragSource === droppableIds_1.LayoutEditorDroppableIds.ColumnList ? allColumnsMap[draggableId] : null;
|
|
149
|
-
const invalidSourceForColumns = source.droppableId !== droppableIds_1.LayoutEditorDroppableIds.ColumnList;
|
|
150
|
-
const dropDisabledOnColumns = !column || !column.moveable || invalidSourceForColumns;
|
|
151
|
-
dispatch({
|
|
152
|
-
type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_COLUMNS,
|
|
153
|
-
payload: dropDisabledOnColumns,
|
|
154
|
-
});
|
|
155
|
-
dispatch({
|
|
156
|
-
type: reducer_1.LayoutEditorActions.SET_DRAG_SOURCE,
|
|
157
|
-
payload: dragSource,
|
|
158
|
-
});
|
|
159
|
-
const columnAlreadySorted = column &&
|
|
160
|
-
layout.ColumnSorts &&
|
|
161
|
-
!!layout.ColumnSorts.filter((c) => c.ColumnId === column.columnId)[0];
|
|
162
|
-
const invalidSourceForSort = dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnList &&
|
|
163
|
-
dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnSortList;
|
|
164
|
-
const disableDropOnSort = invalidSourceForSort || columnAlreadySorted || (column && !column.sortable);
|
|
165
|
-
dispatch({
|
|
166
|
-
type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_SORT,
|
|
167
|
-
payload: !!disableDropOnSort,
|
|
168
|
-
});
|
|
169
|
-
const columnAlreadyRowGrouped = column && layout.RowGroupedColumns
|
|
170
|
-
? !!layout.RowGroupedColumns.filter((colId) => colId === column.columnId)[0]
|
|
171
|
-
: false;
|
|
172
|
-
const invalidSourceForRowGroups = dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnList &&
|
|
173
|
-
dragSource !== droppableIds_1.LayoutEditorDroppableIds.RowGroupsList;
|
|
174
|
-
const disableDropOnRowGroups = invalidSourceForRowGroups || columnAlreadyRowGrouped || (column && !column.groupable);
|
|
175
|
-
dispatch({
|
|
176
|
-
type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_ROW_GROUPS,
|
|
177
|
-
payload: !!disableDropOnRowGroups,
|
|
178
|
-
});
|
|
179
|
-
const columnAlreadyPivoted = column && layout.PivotColumns
|
|
180
|
-
? !!layout.PivotColumns.filter((colId) => colId === column.columnId)[0]
|
|
181
|
-
: false;
|
|
182
|
-
const invalidSourceForPivot = dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnList &&
|
|
183
|
-
dragSource !== droppableIds_1.LayoutEditorDroppableIds.PivotList;
|
|
184
|
-
const disableDropOnPivot = invalidSourceForPivot || columnAlreadyPivoted || (column && !column.pivotable);
|
|
185
|
-
dispatch({
|
|
186
|
-
type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_PIVOT,
|
|
187
|
-
payload: !!disableDropOnPivot,
|
|
188
|
-
});
|
|
189
|
-
}, [state, layout]);
|
|
190
|
-
const onColumnOrderChange = react_1.useCallback((columns) => {
|
|
191
|
-
setLayout(Object.assign(Object.assign({}, layout), { Columns: columns.filter((c) => visibleColumnsMap[c.columnId]).map((c) => c.columnId) }));
|
|
192
|
-
setColumnList(columns);
|
|
193
|
-
}, [visibleColumnsMap, layout]);
|
|
194
|
-
const onColumnSortsChange = react_1.useCallback((ColumnSorts) => {
|
|
195
|
-
setLayout(Object.assign(Object.assign({}, layout), { ColumnSorts }));
|
|
196
|
-
}, [layout]);
|
|
197
|
-
const onRowGroupsChange = react_1.useCallback((RowGroupedColumns) => {
|
|
198
|
-
setLayout(Object.assign(Object.assign({}, layout), { RowGroupedColumns }));
|
|
199
|
-
}, [layout]);
|
|
200
|
-
const onPivotColumnsChange = react_1.useCallback((PivotColumns) => {
|
|
201
|
-
setLayout(Object.assign(Object.assign({}, layout), { PivotColumns }));
|
|
202
|
-
}, [layout]);
|
|
203
|
-
const showGridInfoLink = props.api.internalApi
|
|
204
|
-
.getEntitlementService()
|
|
205
|
-
.isGridInfoSectionVisible('ColumnInfo');
|
|
206
|
-
return (React.createElement(react_beautiful_dnd_1.DragDropContext, { onDragEnd: onDragEnd, onDragStart: onDragStart },
|
|
207
|
-
React.createElement(rebass_1.Box, { className: "ab-LayoutEditor" },
|
|
208
|
-
React.createElement(ListPanel, { header: React.createElement(rebass_1.Flex, { width: "100%", flexDirection: "row", justifyContent: "space-between", alignItems: "center" },
|
|
209
|
-
React.createElement(rebass_1.Text, null, "Columns"),
|
|
210
|
-
React.createElement(CheckBox_1.CheckBox, { mt: 0, mb: 0, checked: !layout.SuppressAggFuncInHeader, onChange: (checked) => {
|
|
211
|
-
setLayout(Object.assign(Object.assign({}, layout), { SuppressAggFuncInHeader: !checked }));
|
|
212
|
-
} }, "Show aggregation function in headers")), style: { flex: 'none' }, className: "ab-LayoutEditor__ColumnListPanel", bodyProps: { style: { display: 'flex', overflow: 'hidden' }, px: 0 } },
|
|
213
|
-
React.createElement(ColumnList_1.ColumnList, { onReady: (onDragEnd) => {
|
|
214
|
-
onDragEndRef.current.columnList = onDragEnd;
|
|
215
|
-
}, getItemStyle: (c, snapshot, draggableStyle) => {
|
|
216
|
-
return getItemStyle_1.getItemStyle(c, layout, state.dragSource, snapshot, draggableStyle);
|
|
217
|
-
}, columns: columnList, isDropDisabled: state.dropDisabledOnColumns, onColumnOrderChange: onColumnOrderChange, renderItem: (c) => {
|
|
218
|
-
const visible = !!visibleColumnsMap[c.columnId];
|
|
219
|
-
const aggregate = !!aggregationColumnsMap[c.columnId];
|
|
220
|
-
// enable aggregation if there are row groups or pivoting is enabled
|
|
221
|
-
// const aggregateEnabled =
|
|
222
|
-
// (layout.RowGroupedColumns && layout.RowGroupedColumns.length) || layout.EnablePivot;
|
|
223
|
-
// JW: Not sure we do - why not just make it always visible as we ignore if if not required.
|
|
224
|
-
const aggregateEnabled = true;
|
|
225
|
-
const customHeader = headerColumnsMap[c.columnId];
|
|
226
|
-
const initialHeader = api.columnApi.getFriendlyNameFromColumnId(c.columnId);
|
|
227
|
-
return (React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "stretch", "data-name": "drag-item", "data-col-id": c.columnId },
|
|
228
|
-
React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", backgroundColor: "secondary", color: "text-on-secondary" },
|
|
229
|
-
React.createElement(rebass_1.Flex, { alignItems: "center" },
|
|
230
|
-
React.createElement(rebass_1.Box, { ml: 2, mr: 2 },
|
|
231
|
-
React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
|
|
232
|
-
initialHeader,
|
|
233
|
-
' ',
|
|
234
|
-
showGridInfoLink && (React.createElement(ButtonInfo_1.ButtonInfo, { marginLeft: 1, style: { color: 'var(--ab-color-text-on-secondary)' }, onClick: () => {
|
|
235
|
-
props.api.internalApi.showPopupScreen('GridInfo', 'GridInfoPopup', {
|
|
236
|
-
column: c,
|
|
237
|
-
source: 'ContextMenu',
|
|
238
|
-
});
|
|
239
|
-
} })),
|
|
240
|
-
c.columnGroup && c.columnGroup.groupCount > 1 ? (React.createElement(rebass_1.Box, { ml: 2, padding: 1, style: {
|
|
241
|
-
borderRadius: 'var(--ab__border-radius)',
|
|
242
|
-
background: 'var(--ab-color-defaultbackground)',
|
|
243
|
-
color: 'var(--ab-color-text-on-defaultbackground)',
|
|
244
|
-
} },
|
|
245
|
-
"Group: ",
|
|
246
|
-
c.columnGroup.friendlyName)) : null),
|
|
247
|
-
React.createElement(CheckBox_1.CheckBox, { title: "Visible", readOnly: !c.hideable && visible, checked: visible, mx: 2, style: {
|
|
248
|
-
whiteSpace: 'nowrap',
|
|
249
|
-
}, onChange: setColumnVisibility.bind(null, c) }, "Visible")),
|
|
250
|
-
React.createElement(rebass_1.Flex, { padding: 2, flexDirection: "column" },
|
|
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 }, ' '),
|
|
252
|
-
React.createElement(rebass_1.Flex, { flexDirection: "row", mt: 2 },
|
|
253
|
-
React.createElement(rebass_1.Flex, { flex: 3, alignItems: "baseline" },
|
|
254
|
-
React.createElement(rebass_1.Text, { fontSize: 3, mr: 2 }, "Header:"),
|
|
255
|
-
React.createElement(Input_1.default, { width: '100%', value: customHeader || '', placeholder: "Custom Name (optional)", onChange: (event) => {
|
|
256
|
-
const newTextValue = event.target.value;
|
|
257
|
-
const columnHeaders = Object.assign({}, layout.ColumnHeadersMap) || {};
|
|
258
|
-
if (StringExtensions_1.default.IsNullOrEmptyOrWhiteSpace(newTextValue)) {
|
|
259
|
-
delete columnHeaders[c.columnId];
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
columnHeaders[c.columnId] = newTextValue;
|
|
263
|
-
}
|
|
264
|
-
setLayout(Object.assign(Object.assign({}, layout), { ColumnHeadersMap: columnHeaders }));
|
|
265
|
-
} })),
|
|
266
|
-
React.createElement(rebass_1.Flex, { flex: 2 }, c.aggregatable &&
|
|
267
|
-
c.availableAggregationFunctions &&
|
|
268
|
-
c.availableAggregationFunctions.length ? (React.createElement(CheckBox_1.CheckBox, { key: "checkbox", ml: 3, my: 0, disabled: !aggregateEnabled, onChange: (checked) => {
|
|
269
|
-
let aggCols = layout.AggregationColumns || {};
|
|
270
|
-
// const aggCols = new Set(layout.AggregationColumns);
|
|
271
|
-
if (checked) {
|
|
272
|
-
let aggFunc = c.aggregationFunction;
|
|
273
|
-
if (!aggFunc && c.availableAggregationFunctions) {
|
|
274
|
-
aggFunc = c.availableAggregationFunctions[0];
|
|
275
|
-
}
|
|
276
|
-
aggCols[c.columnId] = aggFunc;
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
delete aggCols[c.columnId];
|
|
280
|
-
if (!Object.keys(aggCols).length) {
|
|
281
|
-
aggCols = null;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
setLayout(Object.assign(Object.assign({}, layout), { AggregationColumns: aggCols }));
|
|
285
|
-
}, checked: aggregate },
|
|
286
|
-
"Aggregate",
|
|
287
|
-
React.createElement(DropdownButton_1.default, { style: {
|
|
288
|
-
visibility: aggregate ? 'visible' : 'hidden',
|
|
289
|
-
}, ml: 2, padding: 0, columns: ['label'], variant: "text", items: c.availableAggregationFunctions.map((fnName) => {
|
|
290
|
-
return {
|
|
291
|
-
label: fnName,
|
|
292
|
-
onClick: () => {
|
|
293
|
-
const aggCols = layout.AggregationColumns;
|
|
294
|
-
if (!aggCols) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
aggCols[c.columnId] = fnName;
|
|
298
|
-
setLayout(Object.assign(Object.assign({}, layout), { AggregationColumns: aggCols }));
|
|
299
|
-
},
|
|
300
|
-
};
|
|
301
|
-
}) }, aggregationColumnsMap[c.columnId]))) : null)))));
|
|
302
|
-
} })),
|
|
303
|
-
React.createElement(ListPanel, { header: "Sorting", className: "ab-LayoutEditor__ColumnSortListPanel" },
|
|
304
|
-
React.createElement(ColumnSortList_1.ColumnSortList, { columnSorts: layout.ColumnSorts, onColumnSortsChange: onColumnSortsChange, isDropDisabled: state.dropDisabledOnSort, onReady: (dragEnd) => {
|
|
305
|
-
onDragEndRef.current.columnSortList = dragEnd;
|
|
306
|
-
}, getItemStyle: (columnId, snapshot, draggableStyle) => {
|
|
307
|
-
return getItemStyle_1.getItemStyle(allColumnsMap[columnId], layout, state.dragSource, snapshot, draggableStyle);
|
|
308
|
-
}, renderItem: (c, clear, toggleSort) => {
|
|
309
|
-
const column = allColumnsMap[c.ColumnId];
|
|
310
|
-
if (!column) {
|
|
311
|
-
return null; //TODO fix this
|
|
312
|
-
}
|
|
313
|
-
return (React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", "data-name": "drag-item" },
|
|
314
|
-
React.createElement(rebass_1.Box, { ml: 2, mr: 3 },
|
|
315
|
-
React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
|
|
316
|
-
React.createElement(rebass_1.Flex, { flex: "1", flexDirection: "row", alignItems: "center" },
|
|
317
|
-
column.friendlyName,
|
|
318
|
-
" [",
|
|
319
|
-
c.SortOrder,
|
|
320
|
-
"]"),
|
|
321
|
-
React.createElement(SimpleButton_1.default, { variant: "raised", style: { cursor: 'pointer' }, mr: 3, onClick: (e) => {
|
|
322
|
-
e.stopPropagation();
|
|
323
|
-
toggleSort();
|
|
324
|
-
} },
|
|
325
|
-
React.createElement(icons_1.Icon, { name: c.SortOrder === 'Asc' ? 'sort-asc' : 'sort-desc' })),
|
|
326
|
-
React.createElement(SimpleButton_1.default, { variant: "text", onClick: (e) => {
|
|
327
|
-
e.stopPropagation();
|
|
328
|
-
clear();
|
|
329
|
-
} },
|
|
330
|
-
React.createElement(icons_1.Icon, { name: "clear" }))));
|
|
331
|
-
} })),
|
|
332
|
-
React.createElement(ListPanel, { header: "Row Groups", className: "ab-LayoutEditor__RowGroupsListPanel" },
|
|
333
|
-
React.createElement(RowGroupsList_1.RowGroupsList, { rowGroups: layout.RowGroupedColumns, onRowGroupsChange: onRowGroupsChange, isDropDisabled: state.dropDisabledOnRowGroups, onReady: (dragEnd) => {
|
|
334
|
-
onDragEndRef.current.rowGroupsList = dragEnd;
|
|
335
|
-
}, getItemStyle: (columnId, snapshot, draggableStyle) => {
|
|
336
|
-
return getItemStyle_1.getItemStyle(allColumnsMap[columnId], layout, state.dragSource, snapshot, draggableStyle);
|
|
337
|
-
}, renderItem: (colId, clear) => {
|
|
338
|
-
const column = allColumnsMap[colId];
|
|
339
|
-
return (React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", "data-name": "drag-item" },
|
|
340
|
-
React.createElement(rebass_1.Box, { ml: 2, mr: 3 },
|
|
341
|
-
React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
|
|
342
|
-
React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", flex: 1 }, column.friendlyName),
|
|
343
|
-
React.createElement(SimpleButton_1.default, { variant: "text", onClick: (e) => {
|
|
344
|
-
e.stopPropagation();
|
|
345
|
-
clear();
|
|
346
|
-
} },
|
|
347
|
-
React.createElement(icons_1.Icon, { name: "clear" }))));
|
|
348
|
-
} })),
|
|
349
|
-
React.createElement(ListPanel, { className: "ab-LayoutEditor__PivotListPanel", header: React.createElement(rebass_1.Flex, { width: "100%", flexDirection: "row", justifyContent: "space-between", alignItems: "center" },
|
|
350
|
-
React.createElement(rebass_1.Text, null, "Pivoted Columns")), bodyProps: { padding: 0 } },
|
|
351
|
-
React.createElement(PivotList_1.PivotList, { pivotColumns: layout.PivotColumns, onPivotColumnsChange: onPivotColumnsChange, isDropDisabled: state.dropDisabledOnPivot, onReady: (dragEnd) => {
|
|
352
|
-
onDragEndRef.current.pivotList = dragEnd;
|
|
353
|
-
}, renderItem: (colId, clear) => {
|
|
354
|
-
const column = allColumnsMap[colId];
|
|
355
|
-
return (React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", "data-name": "drag-item" },
|
|
356
|
-
React.createElement(rebass_1.Box, { ml: 2, mr: 3 },
|
|
357
|
-
React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
|
|
358
|
-
React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", flex: 1 }, column.friendlyName),
|
|
359
|
-
React.createElement(SimpleButton_1.default, { variant: "text", onClick: (e) => {
|
|
360
|
-
e.stopPropagation();
|
|
361
|
-
clear();
|
|
362
|
-
} },
|
|
363
|
-
React.createElement(icons_1.Icon, { name: "clear" }))));
|
|
364
|
-
}, getItemStyle: (columnId, snapshot, draggableStyle) => {
|
|
365
|
-
return getItemStyle_1.getItemStyle(allColumnsMap[columnId], layout, state.dragSource, snapshot, draggableStyle);
|
|
366
|
-
} })))));
|
|
367
|
-
}, areEqual);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Layout } from '../../../../PredefinedConfig/LayoutState';
|
|
2
|
-
import { LayoutEditorDroppableIds } from './droppableIds';
|
|
3
|
-
export declare type LayoutEditorState = {
|
|
4
|
-
dropDisabledOnColumns: boolean;
|
|
5
|
-
dropDisabledOnSort: boolean;
|
|
6
|
-
dropDisabledOnRowGroups: boolean;
|
|
7
|
-
dropDisabledOnPivot: boolean;
|
|
8
|
-
dragSource: LayoutEditorDroppableIds;
|
|
9
|
-
layout: Layout;
|
|
10
|
-
};
|
|
11
|
-
export declare const getInitialState: (layout: Layout) => {
|
|
12
|
-
dropDisabledOnColumns: boolean;
|
|
13
|
-
dropDisabledOnSort: boolean;
|
|
14
|
-
dropDisabledOnRowGroups: boolean;
|
|
15
|
-
dropDisabledOnPivot: boolean;
|
|
16
|
-
dragSource: LayoutEditorDroppableIds;
|
|
17
|
-
layout: Layout;
|
|
18
|
-
};
|
|
19
|
-
export declare type LayoutEditorAction = any;
|
|
20
|
-
export declare const reducer: (state: LayoutEditorState, action: LayoutEditorAction) => LayoutEditorState;
|
|
21
|
-
export declare enum LayoutEditorActions {
|
|
22
|
-
SET_LAYOUT = "SET_LAYOUT",
|
|
23
|
-
SET_DRAG_SOURCE = "SET_DRAG_SOURCE",
|
|
24
|
-
SET_DROP_DISABLED_ON_COLUMNS = "SET_DROP_DISABLED_ON_COLUMNS",
|
|
25
|
-
SET_DROP_DISABLED_ON_SORT = "SET_DROP_DISABLED_ON_SORT",
|
|
26
|
-
SET_DROP_DISABLED_ON_ROW_GROUPS = "SET_DROP_DISABLED_ON_ROW_GROUPS",
|
|
27
|
-
SET_DROP_DISABLED_ON_PIVOT = "SET_DROP_DISABLED_ON_PIVOT"
|
|
28
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LayoutEditorActions = exports.reducer = exports.getInitialState = void 0;
|
|
4
|
-
const droppableIds_1 = require("./droppableIds");
|
|
5
|
-
const getInitialState = (layout) => {
|
|
6
|
-
return {
|
|
7
|
-
dropDisabledOnColumns: false,
|
|
8
|
-
dropDisabledOnSort: false,
|
|
9
|
-
dropDisabledOnRowGroups: false,
|
|
10
|
-
dropDisabledOnPivot: false,
|
|
11
|
-
dragSource: droppableIds_1.LayoutEditorDroppableIds.None,
|
|
12
|
-
layout,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
exports.getInitialState = getInitialState;
|
|
16
|
-
const reducer = (state, action) => {
|
|
17
|
-
if (action.type === LayoutEditorActions.SET_DRAG_SOURCE) {
|
|
18
|
-
return Object.assign(Object.assign({}, state), { dragSource: action.payload });
|
|
19
|
-
}
|
|
20
|
-
if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_COLUMNS) {
|
|
21
|
-
return Object.assign(Object.assign({}, state), { dropDisabledOnColumns: action.payload });
|
|
22
|
-
}
|
|
23
|
-
if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_SORT) {
|
|
24
|
-
return Object.assign(Object.assign({}, state), { dropDisabledOnSort: action.payload });
|
|
25
|
-
}
|
|
26
|
-
if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_ROW_GROUPS) {
|
|
27
|
-
return Object.assign(Object.assign({}, state), { dropDisabledOnRowGroups: action.payload });
|
|
28
|
-
}
|
|
29
|
-
if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_PIVOT) {
|
|
30
|
-
return Object.assign(Object.assign({}, state), { dropDisabledOnPivot: action.payload });
|
|
31
|
-
}
|
|
32
|
-
if (action.type === LayoutEditorActions.SET_LAYOUT) {
|
|
33
|
-
return Object.assign(Object.assign({}, state), { layout: action.payload });
|
|
34
|
-
}
|
|
35
|
-
return state;
|
|
36
|
-
};
|
|
37
|
-
exports.reducer = reducer;
|
|
38
|
-
var LayoutEditorActions;
|
|
39
|
-
(function (LayoutEditorActions) {
|
|
40
|
-
LayoutEditorActions["SET_LAYOUT"] = "SET_LAYOUT";
|
|
41
|
-
LayoutEditorActions["SET_DRAG_SOURCE"] = "SET_DRAG_SOURCE";
|
|
42
|
-
LayoutEditorActions["SET_DROP_DISABLED_ON_COLUMNS"] = "SET_DROP_DISABLED_ON_COLUMNS";
|
|
43
|
-
LayoutEditorActions["SET_DROP_DISABLED_ON_SORT"] = "SET_DROP_DISABLED_ON_SORT";
|
|
44
|
-
LayoutEditorActions["SET_DROP_DISABLED_ON_ROW_GROUPS"] = "SET_DROP_DISABLED_ON_ROW_GROUPS";
|
|
45
|
-
LayoutEditorActions["SET_DROP_DISABLED_ON_PIVOT"] = "SET_DROP_DISABLED_ON_PIVOT";
|
|
46
|
-
})(LayoutEditorActions = exports.LayoutEditorActions || (exports.LayoutEditorActions = {}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
export declare type DraggableSnapshot = {
|
|
3
|
-
isDragging: boolean;
|
|
4
|
-
draggingOver?: string;
|
|
5
|
-
};
|
|
6
|
-
export declare type DroppableSnapshot = {
|
|
7
|
-
isDraggingOver: boolean;
|
|
8
|
-
draggingOverWith?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const getListStyle: (droppableSnapshot: DroppableSnapshot) => CSSProperties;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getListStyle = void 0;
|
|
4
|
-
const getListStyle = (droppableSnapshot) => {
|
|
5
|
-
const style = {
|
|
6
|
-
width: '100%',
|
|
7
|
-
height: '100%',
|
|
8
|
-
};
|
|
9
|
-
if (droppableSnapshot.isDraggingOver) {
|
|
10
|
-
style.background = 'var(--ab-color-primary)';
|
|
11
|
-
}
|
|
12
|
-
return style;
|
|
13
|
-
};
|
|
14
|
-
exports.getListStyle = getListStyle;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { AdaptableWizardStep, AdaptableWizardStepProps } from '../../Wizard/Interface/IAdaptableWizard';
|
|
3
|
-
import { Layout } from '../../../PredefinedConfig/LayoutState';
|
|
4
|
-
export interface LayoutEditorWizardProps extends AdaptableWizardStepProps<Layout> {
|
|
5
|
-
Layouts: Layout[];
|
|
6
|
-
onLayoutChange?: (layout: Layout) => void;
|
|
7
|
-
}
|
|
8
|
-
export interface LayoutEditorWizardState {
|
|
9
|
-
layoutName: string;
|
|
10
|
-
layout: Layout;
|
|
11
|
-
errorMessage: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class LayoutEditorWizard extends React.Component<any, any> implements AdaptableWizardStep {
|
|
14
|
-
constructor(props: LayoutEditorWizardProps);
|
|
15
|
-
render(): any;
|
|
16
|
-
onLayoutNameChange: (event: React.FormEvent<any>) => void;
|
|
17
|
-
getErrorMessage: ({ layout, layoutName }: {
|
|
18
|
-
layout: Layout;
|
|
19
|
-
layoutName: string;
|
|
20
|
-
}) => string;
|
|
21
|
-
updateLayout: (layout: Partial<Layout>) => void;
|
|
22
|
-
onLayoutChange: (layout: Layout) => void;
|
|
23
|
-
getLayout: () => any;
|
|
24
|
-
canNext(): boolean;
|
|
25
|
-
canBack(): boolean;
|
|
26
|
-
next(): void;
|
|
27
|
-
back(): void;
|
|
28
|
-
getIndexStepIncrement(): number;
|
|
29
|
-
getIndexStepDecrement(): number;
|
|
30
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LayoutEditorWizard = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const WizardPanel_1 = tslib_1.__importDefault(require("../../../components/WizardPanel"));
|
|
7
|
-
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
8
|
-
const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
|
|
9
|
-
const LayoutEditor_1 = require("./LayoutEditor");
|
|
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");
|
|
15
|
-
const CheckBox_1 = require("../../../components/CheckBox");
|
|
16
|
-
class LayoutEditorWizard extends React.Component {
|
|
17
|
-
constructor(props) {
|
|
18
|
-
super(props);
|
|
19
|
-
this.onLayoutNameChange = (event) => {
|
|
20
|
-
const Name = event.target.value;
|
|
21
|
-
const ErrorMessage = this.getErrorMessage(Object.assign(Object.assign({}, this.state), { layoutName: Name }));
|
|
22
|
-
this.updateLayout({ Name });
|
|
23
|
-
this.setState({
|
|
24
|
-
layoutName: Name,
|
|
25
|
-
errorMessage: ErrorMessage || null,
|
|
26
|
-
}, () => {
|
|
27
|
-
this.props.updateGoBackState();
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
this.getErrorMessage = ({ layout, layoutName }) => {
|
|
31
|
-
const Exists = this.props.Layouts.find((l) => l.Name === layoutName && l.Uuid !== layout.Uuid);
|
|
32
|
-
let ErrorMessage = Exists
|
|
33
|
-
? 'A Layout already exists with that name'
|
|
34
|
-
: !layoutName
|
|
35
|
-
? 'Layout name cannot be blank'
|
|
36
|
-
: null;
|
|
37
|
-
// if (!ErrorMessage && !layout.Columns.length) {
|
|
38
|
-
// ErrorMessage = 'A Layout must have at least one visible column';
|
|
39
|
-
// }
|
|
40
|
-
return ErrorMessage;
|
|
41
|
-
};
|
|
42
|
-
this.updateLayout = (layout) => {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
const updatedLayout = Object.assign(Object.assign({}, this.state.layout), layout);
|
|
45
|
-
Object.assign(this.props.data, updatedLayout);
|
|
46
|
-
this.setState({
|
|
47
|
-
layout: updatedLayout,
|
|
48
|
-
});
|
|
49
|
-
(_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.onLayoutChange) === null || _b === void 0 ? void 0 : _b.call(_a, updatedLayout);
|
|
50
|
-
};
|
|
51
|
-
this.onLayoutChange = (layout) => {
|
|
52
|
-
layout = Object.assign(Object.assign({}, layout), { Name: this.state.layoutName });
|
|
53
|
-
this.updateLayout(layout);
|
|
54
|
-
this.setState({
|
|
55
|
-
layout,
|
|
56
|
-
errorMessage: this.getErrorMessage({
|
|
57
|
-
layout,
|
|
58
|
-
layoutName: this.state.layoutName,
|
|
59
|
-
}),
|
|
60
|
-
}, () => {
|
|
61
|
-
this.props.updateGoBackState();
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
this.getLayout = () => {
|
|
65
|
-
return Object.assign(Object.assign({}, this.state.layout), { Name: this.state.layoutName });
|
|
66
|
-
};
|
|
67
|
-
this.state = {
|
|
68
|
-
layout: props.data,
|
|
69
|
-
layoutName: props.data.Name,
|
|
70
|
-
errorMessage: null,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
render() {
|
|
74
|
-
const behaviourHeader = 'Column ' + this.props.api.internalApi.getCorrectEnglishVariant('Behaviours');
|
|
75
|
-
return (React.createElement("div", { "data-name": 'layout-editor', style: { height: '100%' } },
|
|
76
|
-
React.createElement(WizardPanel_1.default, { bodyProps: { padding: 0 } },
|
|
77
|
-
React.createElement(rebass_1.Flex, null,
|
|
78
|
-
React.createElement(rebass_1.Box, { width: 350 },
|
|
79
|
-
React.createElement(FormLayout_1.default, { columns: ['label', 'children'], m: 2 },
|
|
80
|
-
React.createElement(FormLayout_1.FormRow, { label: "Layout Name" },
|
|
81
|
-
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 }),
|
|
82
|
-
' '),
|
|
83
|
-
this.state.errorMessage ? (React.createElement(FormLayout_1.FormRow, { label: "" },
|
|
84
|
-
React.createElement(ErrorBox_1.default, null, this.state.errorMessage))) : null)),
|
|
85
|
-
React.createElement(rebass_1.Flex, { flex: 1, alignItems: "center", justifyContent: "flex-end" },
|
|
86
|
-
React.createElement(CheckBox_1.CheckBox, { mt: 0, mb: 0, checked: this.state.layout.EnablePivot, onChange: (checked) => {
|
|
87
|
-
this.updateLayout({ EnablePivot: checked });
|
|
88
|
-
} }, "Enable Pivot Layout")),
|
|
89
|
-
React.createElement(rebass_1.Flex, { width: 120, pr: 2, alignItems: "center", justifyContent: "end" },
|
|
90
|
-
React.createElement(rebass_1.Text, { mr: 2 }, "Legend"),
|
|
91
|
-
React.createElement(AdaptablePopover_1.AdaptablePopover, { popoverMinWidth: 200, bodyText: [
|
|
92
|
-
React.createElement(Panel_1.default, { variant: "modern", header: behaviourHeader, className: "ab-LayoutEditor__LegendPanel", style: {
|
|
93
|
-
gridRow: '1 /1',
|
|
94
|
-
gridColumn: '3/3',
|
|
95
|
-
}, bodyProps: {
|
|
96
|
-
padding: 2,
|
|
97
|
-
backgroundColor: 'defaultbackground',
|
|
98
|
-
color: 'text-on-defaultbackground',
|
|
99
|
-
} },
|
|
100
|
-
React.createElement(ColumnLabels_1.ColumnLabels, { flexDirection: "column", showBoth: true, labels: {
|
|
101
|
-
Sortable: 'Able to be sorted',
|
|
102
|
-
Filterable: 'Can be filtered',
|
|
103
|
-
Aggregatable: 'Shows aggregations (in grouped rows)',
|
|
104
|
-
Groupable: 'Can form a row group',
|
|
105
|
-
Moveable: 'Is draggable and movable',
|
|
106
|
-
Pivotable: 'Eligible for pivoting',
|
|
107
|
-
}, sortable: true, filterable: true, moveable: true, pivotable: true, groupable: true, aggregatable: true })),
|
|
108
|
-
] }))),
|
|
109
|
-
React.createElement(LayoutEditor_1.LayoutEditor, { api: this.props.api, layout: this.state.layout, onLayoutChange: this.onLayoutChange }))));
|
|
110
|
-
}
|
|
111
|
-
canNext() {
|
|
112
|
-
return !!this.state.layoutName && !this.state.errorMessage;
|
|
113
|
-
}
|
|
114
|
-
canBack() {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
next() {
|
|
118
|
-
Object.keys(this.props.data).forEach((key) => {
|
|
119
|
-
delete this.props.data[key];
|
|
120
|
-
});
|
|
121
|
-
const layout = this.getLayout();
|
|
122
|
-
Object.assign(this.props.data, layout);
|
|
123
|
-
}
|
|
124
|
-
back() { }
|
|
125
|
-
getIndexStepIncrement() {
|
|
126
|
-
return 1;
|
|
127
|
-
}
|
|
128
|
-
getIndexStepDecrement() {
|
|
129
|
-
return 1;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
exports.LayoutEditorWizard = LayoutEditorWizard;
|