@adaptabletools/adaptable 12.0.8 → 12.1.0-canary.1
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 +231 -120
- package/bundle.cjs.js +143 -114
- package/index.css +268 -130
- package/package.json +3 -3
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/SettingsPanelOptions.d.ts +1 -2
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/EventApi.d.ts +13 -1
- package/src/Api/Events/AdaptableStateReloaded.d.ts +23 -0
- package/src/Api/Events/AdaptableStateReloaded.js +2 -0
- package/src/Api/FilterApi.d.ts +15 -1
- package/src/Api/Implementation/CalculatedColumnApiImpl.js +2 -3
- package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -0
- package/src/Api/Implementation/ColumnApiImpl.js +10 -0
- package/src/Api/Implementation/ConfigApiImpl.js +11 -0
- package/src/Api/Implementation/FilterApiImpl.d.ts +6 -1
- package/src/Api/Implementation/FilterApiImpl.js +58 -0
- package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -1
- package/src/Api/Implementation/LayoutApiImpl.js +8 -16
- package/src/Api/Implementation/ScheduleApiImpl.js +4 -1
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +7 -2
- package/src/PredefinedConfig/LayoutState.d.ts +2 -0
- package/src/PredefinedConfig/ScheduleState.d.ts +4 -0
- package/src/Redux/Store/AdaptableStore.js +12 -6
- package/src/Strategy/AdaptableModuleBase.d.ts +2 -0
- package/src/Strategy/AdaptableModuleBase.js +6 -0
- package/src/Strategy/AlertModule.js +2 -2
- package/src/Strategy/CalculatedColumnModule.d.ts +2 -0
- package/src/Strategy/CalculatedColumnModule.js +4 -0
- package/src/Strategy/CustomSortModule.js +2 -2
- package/src/Strategy/ExportModule.js +2 -2
- package/src/Strategy/FlashingCellModule.js +3 -3
- package/src/Strategy/FormatColumnModule.js +2 -2
- package/src/Strategy/LayoutModule.js +10 -17
- package/src/Strategy/ShortcutModule.js +1 -1
- package/src/Strategy/TeamSharingModule.js +4 -2
- package/src/Strategy/Utilities/{getAlertBehaviourViewItems.d.ts → Alert/getAlertBehaviourViewItems.d.ts} +0 -0
- package/src/Strategy/Utilities/{getAlertBehaviourViewItems.js → Alert/getAlertBehaviourViewItems.js} +2 -2
- package/src/Strategy/Utilities/{getAlertPreviewViewItems.d.ts → Alert/getAlertPreviewViewItems.d.ts} +2 -2
- package/src/Strategy/Utilities/{getAlertPreviewViewItems.js → Alert/getAlertPreviewViewItems.js} +2 -2
- package/src/Strategy/Utilities/{getCustomSortColumnViewItems.d.ts → CustomSort/getCustomSortColumnViewItems.d.ts} +1 -1
- package/src/Strategy/Utilities/{getCustomSortColumnViewItems.js → CustomSort/getCustomSortColumnViewItems.js} +0 -0
- package/src/Strategy/Utilities/{getCustomSortSortOrderViewItems.d.ts → CustomSort/getCustomSortSortOrderViewItems.d.ts} +1 -1
- package/src/Strategy/Utilities/{getCustomSortSortOrderViewItems.js → CustomSort/getCustomSortSortOrderViewItems.js} +0 -0
- package/src/Strategy/Utilities/Export/getExportColumnsViewItems.d.ts +3 -0
- package/src/Strategy/Utilities/{getExportColumnsViewItems.js → Export/getExportColumnsViewItems.js} +0 -0
- package/src/Strategy/Utilities/{getExportRowsViewItems.d.ts → Export/getExportRowsViewItems.d.ts} +0 -0
- package/src/Strategy/Utilities/{getExportRowsViewItems.js → Export/getExportRowsViewItems.js} +0 -0
- package/src/Strategy/Utilities/{getFlashingCellDurationViewItems.d.ts → FlashingCell/getFlashingCellDurationViewItems.d.ts} +1 -1
- package/src/Strategy/Utilities/{getFlashingCellDurationViewItems.js → FlashingCell/getFlashingCellDurationViewItems.js} +0 -0
- package/src/Strategy/Utilities/{getFlashingCellStyleViewItems.d.ts → FlashingCell/getFlashingCellStyleViewItems.d.ts} +1 -1
- package/src/Strategy/Utilities/{getFlashingCellStyleViewItems.js → FlashingCell/getFlashingCellStyleViewItems.js} +1 -1
- package/src/Strategy/Utilities/{getFlashingTargetViewItems.d.ts → FlashingCell/getFlashingTargetViewItems.d.ts} +1 -1
- package/src/Strategy/Utilities/{getFlashingTargetViewItems.js → FlashingCell/getFlashingTargetViewItems.js} +0 -0
- package/src/Strategy/Utilities/{getFormatColumnSettingsViewItems.d.ts → FormatColumn/getFormatColumnSettingsViewItems.d.ts} +1 -1
- package/src/Strategy/Utilities/{getFormatColumnSettingsViewItems.js → FormatColumn/getFormatColumnSettingsViewItems.js} +0 -0
- package/src/Strategy/Utilities/{getFormatColumnStyleViewItems.d.ts → FormatColumn/getFormatColumnStyleViewItems.d.ts} +0 -0
- package/src/Strategy/Utilities/{getFormatColumnStyleViewItems.js → FormatColumn/getFormatColumnStyleViewItems.js} +1 -1
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.d.ts +5 -0
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +24 -0
- package/src/Strategy/Utilities/Layout/getLayoutSortViewItems.d.ts +5 -0
- package/src/Strategy/Utilities/Layout/getLayoutSortViewItems.js +14 -0
- package/src/Strategy/Utilities/{getShortcutSettingsViewItems.d.ts → Shortcut/getShortcutSettingsViewItems.d.ts} +1 -1
- package/src/Strategy/Utilities/{getShortcutSettingsViewItems.js → Shortcut/getShortcutSettingsViewItems.js} +0 -0
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +4 -2
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +144 -0
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -6
- package/src/Utilities/ObjectFactory.d.ts +1 -1
- package/src/Utilities/ObjectFactory.js +12 -11
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +57 -13
- package/src/View/AdaptableView.js +2 -2
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.d.ts +27 -1
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +46 -36
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +5 -4
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +4 -2
- package/src/View/Components/Popups/AdaptableToaster.js +15 -33
- package/src/View/Components/ValueSelector/index.d.ts +10 -1
- package/src/View/Components/ValueSelector/index.js +16 -8
- package/src/View/FormatColumn/FormatColumnSummary.js +2 -1
- package/src/View/Layout/Wizard/LayoutEditor/index.js +1 -1
- package/src/View/Layout/Wizard/LayoutWizard.d.ts +4 -7
- package/src/View/Layout/Wizard/LayoutWizard.js +127 -13
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +102 -0
- package/src/View/Layout/Wizard/sections/ColumnsSection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +226 -0
- package/src/View/Layout/Wizard/sections/FilterSection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/FilterSection.js +35 -0
- package/src/View/Layout/Wizard/sections/PivotColumnsSection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +39 -0
- package/src/View/Layout/Wizard/sections/RowGroupingSection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/RowGroupingSection.js +46 -0
- package/src/View/Layout/Wizard/sections/SettingsSection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/SettingsSection.js +51 -0
- package/src/View/Layout/Wizard/sections/SortSection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/SortSection.js +69 -0
- package/src/View/Layout/Wizard/sections/Utilities.d.ts +2 -0
- package/src/View/Layout/Wizard/sections/Utilities.js +5 -0
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +7 -2
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +2 -2
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsSummary.js +4 -0
- package/src/View/StatusBar/StatusBarPanel.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -0
- package/src/View/Wizard/OnePageAdaptableWizard.js +3 -3
- package/src/View/Wizard/OnePageWizards.d.ts +1 -0
- package/src/View/Wizard/OnePageWizards.js +1 -1
- package/src/agGrid/Adaptable.d.ts +3 -0
- package/src/agGrid/Adaptable.js +47 -10
- package/src/agGrid/agGridHelper.js +11 -1
- package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -0
- package/src/components/ExpressionEditor/index.js +1 -1
- package/src/components/Tabs/index.js +4 -2
- package/src/components/icons/arrow-down-long.d.ts +3 -0
- package/src/components/icons/arrow-down-long.js +7 -0
- package/src/components/icons/arrow-up-long.d.ts +3 -0
- package/src/components/icons/arrow-up-long.js +7 -0
- package/src/components/icons/index.js +4 -0
- package/src/metamodel/adaptable.metamodel.d.ts +9 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/Strategy/Utilities/getExportColumnsViewItems.d.ts +0 -3
- package/src/View/Layout/LayoutEntityRow.d.ts +0 -13
- package/src/View/Layout/LayoutEntityRow.js +0 -23
- package/src/View/Layout/LayoutPopup.d.ts +0 -32
- package/src/View/Layout/LayoutPopup.js +0 -153
|
@@ -3,18 +3,132 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LayoutWizard = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const LayoutRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/LayoutRedux"));
|
|
8
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
9
|
+
const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
|
|
10
|
+
const Helper_1 = require("../../../Utilities/Helpers/Helper");
|
|
11
|
+
const SettingsSection_1 = require("./sections/SettingsSection");
|
|
12
|
+
const rebass_1 = require("rebass");
|
|
13
|
+
const AdaptableContext_1 = require("../../AdaptableContext");
|
|
14
|
+
const react_redux_1 = require("react-redux");
|
|
15
|
+
const ColumnsSection_1 = require("./sections/ColumnsSection");
|
|
16
|
+
const PivotColumnsSection_1 = require("./sections/PivotColumnsSection");
|
|
17
|
+
const RowGroupingSection_1 = require("./sections/RowGroupingSection");
|
|
18
|
+
const AggregationsSection_1 = require("./sections/AggregationsSection");
|
|
19
|
+
const SortSection_1 = require("./sections/SortSection");
|
|
20
|
+
const FilterSection_1 = require("./sections/FilterSection");
|
|
21
|
+
const LayoutWizard = (props) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const dispatch = react_redux_1.useDispatch();
|
|
24
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
25
|
+
const allLayouts = adaptable.api.layoutApi.getAllLayout();
|
|
26
|
+
const initialLayout = (_a = props.data) !== null && _a !== void 0 ? _a : (_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.value;
|
|
27
|
+
const [layout, setLayout] = react_1.useState(() => {
|
|
28
|
+
var _a;
|
|
29
|
+
if (initialLayout) {
|
|
30
|
+
const preparedLayout = Helper_1.cloneObject(initialLayout);
|
|
31
|
+
if (((_a = props === null || props === void 0 ? void 0 : props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'Clone') {
|
|
32
|
+
preparedLayout.Name = '';
|
|
33
|
+
}
|
|
34
|
+
return preparedLayout;
|
|
35
|
+
}
|
|
36
|
+
return ObjectFactory_1.default.CreateEmptyLayout({ Name: '' });
|
|
37
|
+
});
|
|
38
|
+
const handleFinish = () => {
|
|
39
|
+
var _a;
|
|
40
|
+
let action = (_a = props === null || props === void 0 ? void 0 : props.popupParams) === null || _a === void 0 ? void 0 : _a.action;
|
|
41
|
+
if (!action) {
|
|
42
|
+
action = initialLayout ? 'Edit' : 'New';
|
|
43
|
+
}
|
|
44
|
+
switch (action) {
|
|
45
|
+
case 'Edit':
|
|
46
|
+
const currentLayout = adaptable.api.layoutApi.getCurrentLayout();
|
|
47
|
+
dispatch(LayoutRedux.LayoutSave(layout));
|
|
48
|
+
if (currentLayout.Uuid === layout.Uuid) {
|
|
49
|
+
dispatch(LayoutRedux.LayoutSelect(layout.Name));
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
case 'Clone':
|
|
53
|
+
const clonedLayout = Object.assign({}, layout);
|
|
54
|
+
delete clonedLayout.Uuid;
|
|
55
|
+
dispatch(LayoutRedux.LayoutAdd(clonedLayout));
|
|
56
|
+
dispatch(LayoutRedux.LayoutSelect(clonedLayout.Name));
|
|
57
|
+
break;
|
|
58
|
+
case 'New':
|
|
59
|
+
dispatch(LayoutRedux.LayoutAdd(layout));
|
|
60
|
+
dispatch(LayoutRedux.LayoutSelect(layout.Name));
|
|
61
|
+
}
|
|
62
|
+
props.onFinishWizard(layout);
|
|
63
|
+
};
|
|
64
|
+
return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { titleContainerStyle: { width: 180 }, defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: layout, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
|
|
65
|
+
{
|
|
66
|
+
title: 'Settings',
|
|
67
|
+
details: 'Configure Layout',
|
|
68
|
+
isValid: () => {
|
|
69
|
+
if (!layout.Name) {
|
|
70
|
+
return 'Layout name cannot be blank';
|
|
71
|
+
}
|
|
72
|
+
if (allLayouts.some((layoutItem) => layoutItem.Name === layout.Name && layoutItem.Uuid !== layout.Uuid)) {
|
|
73
|
+
return 'A Layout already exists with that name';
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
16
76
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
77
|
+
renderSummary: () => React.createElement(SettingsSection_1.SettingsSectionSummary, null),
|
|
78
|
+
render: () => (React.createElement(rebass_1.Box, { padding: 2 },
|
|
79
|
+
React.createElement(SettingsSection_1.SettingsSection, { onChange: (newLayout) => setLayout(newLayout) }))),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: 'Columns',
|
|
83
|
+
details: 'Select Columns',
|
|
84
|
+
isVisible: () => !(layout === null || layout === void 0 ? void 0 : layout.EnablePivot),
|
|
85
|
+
renderSummary: () => React.createElement(ColumnsSection_1.ColumnsSectionSummary, null),
|
|
86
|
+
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
87
|
+
React.createElement(ColumnsSection_1.ColumnsSection, { onChange: setLayout }))),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: 'Pivot Columns',
|
|
91
|
+
details: 'Select Pivot Columns',
|
|
92
|
+
isVisible: () => layout === null || layout === void 0 ? void 0 : layout.EnablePivot,
|
|
93
|
+
renderSummary: () => React.createElement(PivotColumnsSection_1.PivotColumnsSectionSummary, null),
|
|
94
|
+
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
95
|
+
React.createElement(PivotColumnsSection_1.PivotColumnsSection, { onChange: (newLayout) => setLayout(newLayout) }))),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
title: 'Row Groups',
|
|
99
|
+
details: 'Configure Row Grouping',
|
|
100
|
+
renderSummary: () => React.createElement(RowGroupingSection_1.RowGroupingSectionSummary, null),
|
|
101
|
+
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
102
|
+
React.createElement(RowGroupingSection_1.RowGroupingSection, { onChange: setLayout }))),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: 'Aggregations',
|
|
106
|
+
details: 'Select Column Aggregations',
|
|
107
|
+
renderSummary: () => React.createElement(AggregationsSection_1.AggregationsSectionSummary, null),
|
|
108
|
+
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
109
|
+
React.createElement(AggregationsSection_1.AggregationsSection, { onChange: setLayout }))),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
title: 'Sort',
|
|
113
|
+
renderSummary: () => React.createElement(SortSection_1.SortSectionSummary, null),
|
|
114
|
+
details: 'Configure Column Sorts',
|
|
115
|
+
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
116
|
+
React.createElement(SortSection_1.SortSection, { onChange: (newLayout) => setLayout(newLayout) }))),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: 'Filters',
|
|
120
|
+
details: 'Column Filters',
|
|
121
|
+
renderSummary: () => React.createElement(FilterSection_1.FilterSectionSummary, null),
|
|
122
|
+
render: () => (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' } },
|
|
123
|
+
React.createElement(FilterSection_1.FilterSection, { onChange: (newLayout) => setLayout(newLayout) }))),
|
|
124
|
+
},
|
|
125
|
+
'-',
|
|
126
|
+
{
|
|
127
|
+
details: 'Review your Layout',
|
|
128
|
+
render: () => (React.createElement(rebass_1.Box, { padding: 2 },
|
|
129
|
+
React.createElement(OnePageAdaptableWizard_1.OnePageWizardSummary, null))),
|
|
130
|
+
title: 'Summary',
|
|
131
|
+
},
|
|
132
|
+
] }));
|
|
133
|
+
};
|
|
20
134
|
exports.LayoutWizard = LayoutWizard;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Layout } from '../../../../../types';
|
|
3
|
+
export declare const AggregationsSectionSummary: React.FunctionComponent;
|
|
4
|
+
interface AggregationsSectionProps {
|
|
5
|
+
onChange: (data: Layout) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const AggregationsSection: React.FunctionComponent<AggregationsSectionProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregationsSection = exports.AggregationsSectionSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const CheckBox_1 = require("../../../../components/CheckBox");
|
|
8
|
+
const DropdownButton_1 = tslib_1.__importDefault(require("../../../../components/DropdownButton"));
|
|
9
|
+
const FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
|
|
10
|
+
const Tabs_1 = require("../../../../components/Tabs");
|
|
11
|
+
const Tag_1 = require("../../../../components/Tag");
|
|
12
|
+
const sortWithOrder_1 = require("../../../../Utilities/sortWithOrder");
|
|
13
|
+
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
14
|
+
const ValueSelector_1 = require("../../../Components/ValueSelector");
|
|
15
|
+
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
16
|
+
const Utilities_1 = require("./Utilities");
|
|
17
|
+
const AggregationsSectionSummary = () => {
|
|
18
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
19
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
20
|
+
const aggregations = layout.AggregationColumns;
|
|
21
|
+
const entires = Object.entries(aggregations !== null && aggregations !== void 0 ? aggregations : {});
|
|
22
|
+
let content = null;
|
|
23
|
+
if (entires.length) {
|
|
24
|
+
content = (React.createElement(FormLayout_1.default, null, entires.map(([columnId, aggregation]) => (React.createElement(FormLayout_1.FormRow, { key: columnId, label: adaptable.api.columnApi.getFriendlyNameFromColumnId(columnId) },
|
|
25
|
+
React.createElement(Tag_1.Tag, null, aggregation))))));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
content = React.createElement(Tag_1.Tag, null, "No Aggregations");
|
|
29
|
+
}
|
|
30
|
+
return React.createElement(rebass_1.Box, null, content);
|
|
31
|
+
};
|
|
32
|
+
exports.AggregationsSectionSummary = AggregationsSectionSummary;
|
|
33
|
+
const ColumnRow = (props) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const aggValue = (_b = (_a = props.layout) === null || _a === void 0 ? void 0 : _a.AggregationColumns) === null || _b === void 0 ? void 0 : _b[props.column.columnId];
|
|
36
|
+
const aggOptions = props.column.availableAggregationFunctions.map((fnName) => {
|
|
37
|
+
return {
|
|
38
|
+
label: fnName,
|
|
39
|
+
onClick: () => {
|
|
40
|
+
const aggCols = Object.assign({}, props.layout.AggregationColumns);
|
|
41
|
+
if (!aggCols) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
aggCols[props.column.columnId] = fnName;
|
|
45
|
+
props.onChangeAggFunction(aggCols);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
return (React.createElement(rebass_1.Box, null,
|
|
50
|
+
props.column.friendlyName,
|
|
51
|
+
aggValue && (React.createElement(DropdownButton_1.default, { columns: ['label'], items: aggOptions, ml: 2 }, props.aggregationColumnsMap[props.column.columnId]))));
|
|
52
|
+
};
|
|
53
|
+
const AggregationsSection = (props) => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
56
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
57
|
+
const allAggregableColumns = adaptable.api.columnApi.getAggregetableColumns();
|
|
58
|
+
const allColumns = adaptable.api.columnApi.getColumns();
|
|
59
|
+
const sortedAggregableColumns = React.useMemo(() => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
return sortWithOrder_1.sortWithOrderArray(allAggregableColumns.map((col) => col.columnId), (_b = Object.keys((_a = layout.AggregationColumns) !== null && _a !== void 0 ? _a : {})) !== null && _b !== void 0 ? _b : [], { sortUnorderedItems: true }).map((colId) => adaptable.api.columnApi.getColumnFromId(colId));
|
|
62
|
+
}, [layout, allAggregableColumns]);
|
|
63
|
+
const handleColumnsSelectionChange = React.useCallback((columnIds) => {
|
|
64
|
+
props.onChange(Object.assign(Object.assign({}, layout), { AggregationColumns: columnIds.reduce((acc, colId) => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
acc[colId] =
|
|
67
|
+
(_b = (_a = layout.AggregationColumns) === null || _a === void 0 ? void 0 : _a[colId]) !== null && _b !== void 0 ? _b : adaptable.api.columnApi.getDefaultAggFunc(colId);
|
|
68
|
+
return acc;
|
|
69
|
+
}, {}) }));
|
|
70
|
+
}, [layout]);
|
|
71
|
+
const handleAggregationChange = React.useCallback((aggFunctions) => {
|
|
72
|
+
props.onChange(Object.assign(Object.assign({}, layout), { AggregationColumns: aggFunctions }));
|
|
73
|
+
}, [layout]);
|
|
74
|
+
const aggregationColumnsMap = React.useMemo(() => {
|
|
75
|
+
const allColumnsMap = allColumns.reduce((acc, col) => {
|
|
76
|
+
acc[col.columnId] = col;
|
|
77
|
+
return acc;
|
|
78
|
+
}, {});
|
|
79
|
+
return Object.keys(layout.AggregationColumns || {}).reduce((acc, colId) => {
|
|
80
|
+
var _a;
|
|
81
|
+
let fn = (_a = layout.AggregationColumns) === null || _a === void 0 ? void 0 : _a[colId];
|
|
82
|
+
if (typeof fn === 'boolean') {
|
|
83
|
+
fn = allColumnsMap[colId].aggregationFunction;
|
|
84
|
+
}
|
|
85
|
+
acc[colId] = fn;
|
|
86
|
+
return acc;
|
|
87
|
+
}, {});
|
|
88
|
+
}, [layout]);
|
|
89
|
+
const handleSuppressAggFuncInHeader = (checked) => {
|
|
90
|
+
props.onChange(Object.assign(Object.assign({}, layout), { SuppressAggFuncInHeader: checked }));
|
|
91
|
+
};
|
|
92
|
+
return (React.createElement(Tabs_1.Tabs, { style: { height: '100%' } },
|
|
93
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Columns Aggregations"),
|
|
94
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
95
|
+
React.createElement(rebass_1.Flex, null,
|
|
96
|
+
React.createElement(FormLayout_1.default, null,
|
|
97
|
+
React.createElement(CheckBox_1.CheckBox, { checked: layout.SuppressAggFuncInHeader, onChange: handleSuppressAggFuncInHeader }, "Suppress Aggregation Function in Header"))),
|
|
98
|
+
React.createElement(ValueSelector_1.ValueSelector, { showFilterInput: true, showSelectedOnlyPosition: "top", filter: Utilities_1.columnFilter, toIdentifier: (option) => `${option.columnId}`, toLabel: (option) => { var _a; return (_a = option.friendlyName) !== null && _a !== void 0 ? _a : option.columnId; }, toListLabel: (column) => (React.createElement(ColumnRow, { onChangeAggFunction: handleAggregationChange, layout: layout, column: column, aggregationColumnsMap: aggregationColumnsMap })), options: sortedAggregableColumns, value: (_b = Object.keys((_a = layout.AggregationColumns) !== null && _a !== void 0 ? _a : {})) !== null && _b !== void 0 ? _b : [], allowReorder: () => false, xSelectedLabel: () => {
|
|
99
|
+
return `Active aggregations:`;
|
|
100
|
+
}, onChange: handleColumnsSelectionChange }))));
|
|
101
|
+
};
|
|
102
|
+
exports.AggregationsSection = AggregationsSection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Layout } from '../../../../../types';
|
|
3
|
+
export declare const ColumnsSectionSummary: React.FunctionComponent;
|
|
4
|
+
interface ColumnsSectionProps {
|
|
5
|
+
onChange: (data: Layout) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ColumnsSection: React.FunctionComponent<ColumnsSectionProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnsSection = exports.ColumnsSectionSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const InfiniteTable_1 = require("../../../../components/InfiniteTable");
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
const rebass_1 = require("rebass");
|
|
8
|
+
const DropdownButton_1 = tslib_1.__importDefault(require("../../../../components/DropdownButton"));
|
|
9
|
+
const FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
|
|
10
|
+
const Input_1 = tslib_1.__importDefault(require("../../../../components/Input"));
|
|
11
|
+
const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
|
|
12
|
+
const Tabs_1 = require("../../../../components/Tabs");
|
|
13
|
+
const Tag_1 = require("../../../../components/Tag");
|
|
14
|
+
const AdaptableColumn_1 = require("../../../../PredefinedConfig/Common/AdaptableColumn");
|
|
15
|
+
const sortWithOrder_1 = require("../../../../Utilities/sortWithOrder");
|
|
16
|
+
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
17
|
+
const ValueSelector_1 = require("../../../Components/ValueSelector");
|
|
18
|
+
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
19
|
+
const ColumnLabels_1 = require("../LayoutEditor/ColumnLabels");
|
|
20
|
+
const Utilities_1 = require("./Utilities");
|
|
21
|
+
const lodash_1 = require("lodash");
|
|
22
|
+
const icons_1 = require("../../../../components/icons");
|
|
23
|
+
const CheckBox_1 = require("../../../../components/CheckBox");
|
|
24
|
+
const PropertyOrderText = (props) => (React.createElement(rebass_1.Text, { fontWeight: 600, fontSize: 2 }, props.children));
|
|
25
|
+
const ColumnsSectionSummary = () => {
|
|
26
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
27
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
28
|
+
const rowHeight = 40;
|
|
29
|
+
const headerHeight = 40;
|
|
30
|
+
const tableHeight = headerHeight + lodash_1.clamp(rowHeight * layout.Columns.length, 100, 360);
|
|
31
|
+
const data = React.useMemo(() => {
|
|
32
|
+
return layout.Columns.map((columnId) => {
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
34
|
+
const friendlyName = adaptable.api.columnApi.getFriendlyNameFromColumnId(columnId);
|
|
35
|
+
const header = (_b = (_a = layout.ColumnHeadersMap) === null || _a === void 0 ? void 0 : _a[columnId]) !== null && _b !== void 0 ? _b : '';
|
|
36
|
+
const columnWidth = (_c = layout.ColumnWidthMap) === null || _c === void 0 ? void 0 : _c[columnId];
|
|
37
|
+
const columnPinning = (_d = layout.PinnedColumnsMap) === null || _d === void 0 ? void 0 : _d[columnId];
|
|
38
|
+
const agg = (_e = layout.AggregationColumns) === null || _e === void 0 ? void 0 : _e[columnId];
|
|
39
|
+
const sortIndex = ((_f = layout === null || layout === void 0 ? void 0 : layout.ColumnSorts) !== null && _f !== void 0 ? _f : []).findIndex((sort) => sort.ColumnId === columnId);
|
|
40
|
+
const sortOrder = sortIndex != -1
|
|
41
|
+
? {
|
|
42
|
+
index: sortIndex + 1,
|
|
43
|
+
sort: (_h = (_g = layout.ColumnSorts[sortIndex]) === null || _g === void 0 ? void 0 : _g.SortOrder) !== null && _h !== void 0 ? _h : null,
|
|
44
|
+
}
|
|
45
|
+
: {};
|
|
46
|
+
let grouping = (_k = (_j = layout.RowGroupedColumns) === null || _j === void 0 ? void 0 : _j.indexOf) === null || _k === void 0 ? void 0 : _k.call(_j, columnId);
|
|
47
|
+
grouping = grouping != -1 ? grouping + 1 : null;
|
|
48
|
+
const filter = (_l = layout.ColumnFilters) === null || _l === void 0 ? void 0 : _l.find((colFilter) => colFilter.ColumnId === columnId);
|
|
49
|
+
return {
|
|
50
|
+
columnId,
|
|
51
|
+
agg,
|
|
52
|
+
friendlyName,
|
|
53
|
+
header,
|
|
54
|
+
columnWidth,
|
|
55
|
+
columnPinning,
|
|
56
|
+
sortOrder,
|
|
57
|
+
grouping,
|
|
58
|
+
filter,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}, [layout]);
|
|
62
|
+
const columns = React.useMemo(() => {
|
|
63
|
+
return {
|
|
64
|
+
name: { header: 'Name', field: 'friendlyName', minWidth: 100 },
|
|
65
|
+
header: { header: 'Header', field: 'header', minWidth: 120 },
|
|
66
|
+
colId: { header: 'ID', field: 'columnId' },
|
|
67
|
+
agg: { header: 'Agg', field: 'agg', minWidth: 70 },
|
|
68
|
+
width: { header: 'Width', field: 'columnWidth', minWidth: 70 },
|
|
69
|
+
pin: { header: 'Pin', field: 'columnPinning', minWidth: 80 },
|
|
70
|
+
sort: {
|
|
71
|
+
header: 'Sort',
|
|
72
|
+
field: 'sortOrder',
|
|
73
|
+
minWidth: 50,
|
|
74
|
+
align: 'center',
|
|
75
|
+
render: (params) => {
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
77
|
+
if (!((_b = (_a = params.data) === null || _a === void 0 ? void 0 : _a.sortOrder) === null || _b === void 0 ? void 0 : _b.sort)) {
|
|
78
|
+
return React.createElement(React.Fragment, null);
|
|
79
|
+
}
|
|
80
|
+
return (React.createElement(rebass_1.Flex, null,
|
|
81
|
+
React.createElement(icons_1.Icon, { name: ((_d = (_c = params.data) === null || _c === void 0 ? void 0 : _c.sortOrder) === null || _d === void 0 ? void 0 : _d.sort) === 'Asc' ? 'arrow-up-long' : 'arrow-down-long' }),
|
|
82
|
+
' ',
|
|
83
|
+
React.createElement(PropertyOrderText, null, (_g = (_f = (_e = params.data) === null || _e === void 0 ? void 0 : _e.sortOrder) === null || _f === void 0 ? void 0 : _f.index) !== null && _g !== void 0 ? _g : '')));
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
filter: {
|
|
87
|
+
header: 'Filter',
|
|
88
|
+
field: 'filter',
|
|
89
|
+
align: 'center',
|
|
90
|
+
minWidth: 50,
|
|
91
|
+
render: (params) => {
|
|
92
|
+
var _a;
|
|
93
|
+
if (!((_a = params.data) === null || _a === void 0 ? void 0 : _a.filter)) {
|
|
94
|
+
return React.createElement(React.Fragment, null);
|
|
95
|
+
}
|
|
96
|
+
return React.createElement(CheckBox_1.CheckBox, { checked: true });
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
group: {
|
|
100
|
+
header: 'Group',
|
|
101
|
+
minWidth: 50,
|
|
102
|
+
field: 'columnGroupping',
|
|
103
|
+
align: 'center',
|
|
104
|
+
render: (params) => {
|
|
105
|
+
var _a;
|
|
106
|
+
if (!params.data.grouping) {
|
|
107
|
+
return React.createElement(React.Fragment, null);
|
|
108
|
+
}
|
|
109
|
+
return (React.createElement(rebass_1.Flex, null,
|
|
110
|
+
React.createElement(CheckBox_1.CheckBox, { margin: 0, mr: 1, checked: true }),
|
|
111
|
+
React.createElement(PropertyOrderText, null, (_a = params.data) === null || _a === void 0 ? void 0 : _a.grouping)));
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}, []);
|
|
116
|
+
const tableDOMProps = {
|
|
117
|
+
style: {
|
|
118
|
+
height: '100%',
|
|
119
|
+
minWidth: '10rem',
|
|
120
|
+
minHeight: tableHeight,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
return (React.createElement(InfiniteTable_1.DataSource, { data: data, primaryKey: "columnId" },
|
|
124
|
+
React.createElement(InfiniteTable_1.InfiniteTable, { columnTypes: {
|
|
125
|
+
default: {
|
|
126
|
+
defaultFlex: 1,
|
|
127
|
+
},
|
|
128
|
+
}, rowHeight: rowHeight, domProps: tableDOMProps, columns: columns })));
|
|
129
|
+
};
|
|
130
|
+
exports.ColumnsSectionSummary = ColumnsSectionSummary;
|
|
131
|
+
const ColumnRow = (props) => {
|
|
132
|
+
var _a, _b, _c, _d;
|
|
133
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
134
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
135
|
+
// headers
|
|
136
|
+
const initialHeader = adaptable.api.columnApi.getFriendlyNameFromColumnId(props.column.columnId);
|
|
137
|
+
const customHeader = (_b = (_a = props.layout.ColumnHeadersMap) === null || _a === void 0 ? void 0 : _a[props.column.columnId]) !== null && _b !== void 0 ? _b : '';
|
|
138
|
+
// column pinning
|
|
139
|
+
const columnPinning = ((_c = props.layout.PinnedColumnsMap) === null || _c === void 0 ? void 0 : _c[props.column.columnId]) || 'None';
|
|
140
|
+
const pinningOptions = [
|
|
141
|
+
{ value: 'None', label: 'None', onClick: () => props.onPinChange(props.column.columnId, null) },
|
|
142
|
+
{
|
|
143
|
+
value: 'left',
|
|
144
|
+
label: 'Left',
|
|
145
|
+
onClick: () => props.onPinChange(props.column.columnId, 'left'),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
value: 'right',
|
|
149
|
+
label: 'Right',
|
|
150
|
+
onClick: () => props.onPinChange(props.column.columnId, 'right'),
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
// behaviour
|
|
154
|
+
const behaviourHeader = 'Column ' + adaptable.api.internalApi.getCorrectEnglishVariant('Behaviours');
|
|
155
|
+
// width
|
|
156
|
+
const columnWidth = (_d = props.layout.ColumnWidthMap) === null || _d === void 0 ? void 0 : _d[props.column.columnId];
|
|
157
|
+
return (React.createElement(rebass_1.Box, { className: "ab-Layout-Wizard__ColumnRow" },
|
|
158
|
+
React.createElement(rebass_1.Flex, { className: "ab-Layout-Wizard__ColumnRow__Header", mt: 1, mb: 1, onClick: () => setIsExpanded(!isExpanded) },
|
|
159
|
+
React.createElement(rebass_1.Flex, { mr: 2, alignItems: "center" }, initialHeader),
|
|
160
|
+
props.column.columnGroup && props.column.columnGroup.groupCount > 1 ? (React.createElement(rebass_1.Box, { className: "ab-Layout-Wizard__ColumnRow__Title", ml: 2, mr: 2, padding: 1 },
|
|
161
|
+
"Group: ",
|
|
162
|
+
props.column.columnGroup.friendlyName)) : null,
|
|
163
|
+
React.createElement(rebass_1.Flex, { mr: 2 },
|
|
164
|
+
React.createElement(ColumnLabels_1.ColumnLabels, { showTitle: false, sortable: props.column.sortable, filterable: props.column.filterable, pivotable: props.column.pivotable, moveable: props.column.moveable, groupable: props.column.groupable, aggregatable: props.column.aggregatable })),
|
|
165
|
+
React.createElement(rebass_1.Box, { flex: 1 }),
|
|
166
|
+
React.createElement(SimpleButton_1.default, { ml: 10, padding: 0, iconSize: 24, variant: "text", onClick: () => setIsExpanded(!isExpanded), icon: isExpanded ? 'triangle-up' : 'triangle-down' })),
|
|
167
|
+
isExpanded && (React.createElement(rebass_1.Box, { className: "ab-Layout-Wizard__ColumnRow__Expanded-Container", mb: 2, padding: 2, mt: 2 },
|
|
168
|
+
React.createElement(rebass_1.Flex, { mb: 2 },
|
|
169
|
+
React.createElement(FormLayout_1.default, { width: "100%", mr: 3 },
|
|
170
|
+
React.createElement(FormLayout_1.FormRow, { label: "Column ID" },
|
|
171
|
+
React.createElement(Tag_1.Tag, null, props.column.friendlyName)),
|
|
172
|
+
React.createElement(FormLayout_1.FormRow, { label: "Header" },
|
|
173
|
+
React.createElement(Input_1.default, { className: "ab-Layout-Wizard__ColumnRow__Input", placehoder: "Custom name (optional)", onChange: () => {
|
|
174
|
+
props.onColumnNameChange(props.column.columnId, event.target.value);
|
|
175
|
+
}, value: customHeader })),
|
|
176
|
+
React.createElement(FormLayout_1.FormRow, { label: "Width" },
|
|
177
|
+
React.createElement(Input_1.default, { className: "ab-Layout-Wizard__ColumnRow__Input", type: "number", placeholder: "Column width", onChange: (event) => {
|
|
178
|
+
let value = parseFloat(event.target.value);
|
|
179
|
+
value = typeof value === 'number' && !isNaN(value) ? value : void 0;
|
|
180
|
+
props.onColumnWidthChange(props.column.columnId, value);
|
|
181
|
+
}, value: columnWidth })),
|
|
182
|
+
React.createElement(FormLayout_1.FormRow, { label: "Pinning" },
|
|
183
|
+
React.createElement(DropdownButton_1.default, { columns: ['label'], items: pinningOptions }, pinningOptions.find((option) => option.value === columnPinning).label))))))));
|
|
184
|
+
};
|
|
185
|
+
const ColumnsSection = (props) => {
|
|
186
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
187
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
188
|
+
const allColumns = adaptable.api.columnApi.getColumns();
|
|
189
|
+
const sortedColumns = React.useMemo(() => {
|
|
190
|
+
return sortWithOrder_1.sortWithOrderArray(allColumns.map((col) => col.columnId), layout.Columns, { sortUnorderedItems: true }).map((colId) => adaptable.api.columnApi.getColumnFromId(colId));
|
|
191
|
+
}, [layout, allColumns]);
|
|
192
|
+
const handlePinChange = (columnId, pinning) => {
|
|
193
|
+
props.onChange(Object.assign(Object.assign({}, layout), { PinnedColumnsMap: Object.assign(Object.assign({}, layout.PinnedColumnsMap), { [columnId]: pinning }) }));
|
|
194
|
+
};
|
|
195
|
+
const handleColumnNameChange = (columnId, headerName) => {
|
|
196
|
+
props.onChange(Object.assign(Object.assign({}, layout), { ColumnHeadersMap: Object.assign(Object.assign({}, layout.ColumnHeadersMap), { [columnId]: headerName }) }));
|
|
197
|
+
};
|
|
198
|
+
const handleColumnsChange = (columnIds) => {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
const oldColumns = (_a = layout.Columns.map((colId) => adaptable.api.columnApi.getColumnFromId(colId))) !== null && _a !== void 0 ? _a : [];
|
|
201
|
+
const newColumns = (_b = columnIds.map((colId) => adaptable.api.columnApi.getColumnFromId(colId))) !== null && _b !== void 0 ? _b : [];
|
|
202
|
+
if (!AdaptableColumn_1.isValidOrderForColumnGroups({ oldColumns, newColumns })) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
props.onChange(Object.assign(Object.assign({}, layout), { Columns: columnIds }));
|
|
206
|
+
};
|
|
207
|
+
const handleColumnWidthChange = (columnId, width) => {
|
|
208
|
+
props.onChange(Object.assign(Object.assign({}, layout), { ColumnWidthMap: Object.assign(Object.assign({}, layout.ColumnWidthMap), { [columnId]: width }) }));
|
|
209
|
+
};
|
|
210
|
+
return (React.createElement(Tabs_1.Tabs, { style: { height: '100%' } },
|
|
211
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Columns"),
|
|
212
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
213
|
+
React.createElement(rebass_1.Flex, { mt: 2, mb: 3 },
|
|
214
|
+
React.createElement(ColumnLabels_1.ColumnLabels, { flexDirection: "row", showBoth: false, labels: {
|
|
215
|
+
Sortable: 'Sortable',
|
|
216
|
+
Filterable: 'Filterable',
|
|
217
|
+
Aggregatable: 'Shows Aggregations',
|
|
218
|
+
Groupable: 'Groupable',
|
|
219
|
+
Moveable: 'Moveable',
|
|
220
|
+
Pivotable: 'Pivotable',
|
|
221
|
+
}, sortable: true, filterable: true, moveable: true, pivotable: true, groupable: true, aggregatable: true })),
|
|
222
|
+
React.createElement(ValueSelector_1.ValueSelector, { showSelectedOnlyPosition: "top", showFilterInput: true, filter: Utilities_1.columnFilter, toIdentifier: (option) => `${option.columnId}`, toLabel: (option) => { var _a; return (_a = option.friendlyName) !== null && _a !== void 0 ? _a : option.columnId; }, toListLabel: (option) => (React.createElement(ColumnRow, { onColumnNameChange: handleColumnNameChange, onColumnWidthChange: handleColumnWidthChange, onPinChange: handlePinChange, layout: layout, column: option })), options: sortedColumns, value: layout.Columns, allowReorder: true, xSelectedLabel: () => {
|
|
223
|
+
return `Selected Columns:`;
|
|
224
|
+
}, onChange: handleColumnsChange }))));
|
|
225
|
+
};
|
|
226
|
+
exports.ColumnsSection = ColumnsSection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Layout } from '../../../../../types';
|
|
3
|
+
export declare const FilterSectionSummary: React.FunctionComponent;
|
|
4
|
+
interface FilterSectionProps {
|
|
5
|
+
onChange: (data: Layout) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const FilterSection: React.FunctionComponent<FilterSectionProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterSection = exports.FilterSectionSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const ModuleConstants = tslib_1.__importStar(require("../../../../Utilities/Constants/ModuleConstants"));
|
|
8
|
+
const Tabs_1 = require("../../../../components/Tabs");
|
|
9
|
+
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
10
|
+
const AdaptableObjectList_1 = require("../../../Components/AdaptableObjectList/AdaptableObjectList");
|
|
11
|
+
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
12
|
+
const getLayoutFilterViewItems_1 = require("../../../../Strategy/Utilities/Layout/getLayoutFilterViewItems");
|
|
13
|
+
const Tag_1 = require("../../../../components/Tag");
|
|
14
|
+
const FilterSectionSummary = () => {
|
|
15
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
16
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
17
|
+
const fitlerViewItems = getLayoutFilterViewItems_1.getLayoutFilterViewItems(layout, adaptable.api);
|
|
18
|
+
return (React.createElement(rebass_1.Box, null, fitlerViewItems.values.length ? (fitlerViewItems.values.map((value) => (React.createElement(Tag_1.Tag, { key: value, mb: 1, mr: 1 }, value)))) : (React.createElement(Tag_1.Tag, null, "No Filters"))));
|
|
19
|
+
};
|
|
20
|
+
exports.FilterSectionSummary = FilterSectionSummary;
|
|
21
|
+
const FilterSection = (props) => {
|
|
22
|
+
var _a;
|
|
23
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
24
|
+
const filterModule = adaptable.ModuleService.getModuleById(ModuleConstants.FilterModuleId);
|
|
25
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
26
|
+
const layoutFilters = (_a = layout.ColumnFilters) !== null && _a !== void 0 ? _a : [];
|
|
27
|
+
const handleDelete = React.useCallback((columnFilter) => {
|
|
28
|
+
props.onChange(Object.assign(Object.assign({}, layout), { ColumnFilters: layoutFilters.filter((layoutFilter) => layoutFilter.ColumnId !== columnFilter.ColumnId) }));
|
|
29
|
+
}, [layout]);
|
|
30
|
+
return (React.createElement(Tabs_1.Tabs, { style: { height: '100%' } },
|
|
31
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Column Filters"),
|
|
32
|
+
React.createElement(Tabs_1.Tabs.Content, null, (layoutFilters === null || layoutFilters === void 0 ? void 0 : layoutFilters.length) ? (React.createElement(rebass_1.Box, { p: 0, as: "ul" }, layoutFilters.map((columnFilter) => (React.createElement(AdaptableObjectList_1.AdaptableObjectListItemView, { abObject: columnFilter, entityType: "Filter", showActions: true, showEditButton: false, items: filterModule.toView(columnFilter).items, onDelete: () => handleDelete(columnFilter) }))))) : (React.createElement(rebass_1.Box, null,
|
|
33
|
+
React.createElement(Tag_1.Tag, null, "No Column Filters are applied. Filters are set using the grid."))))));
|
|
34
|
+
};
|
|
35
|
+
exports.FilterSection = FilterSection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Layout } from '../../../../types';
|
|
3
|
+
export declare const PivotColumnsSectionSummary: React.FunctionComponent;
|
|
4
|
+
interface PivotColumnsSectionProps {
|
|
5
|
+
onChange: (data: Layout) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const PivotColumnsSection: React.FunctionComponent<PivotColumnsSectionProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PivotColumnsSection = exports.PivotColumnsSectionSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const Tabs_1 = require("../../../../components/Tabs");
|
|
8
|
+
const Tag_1 = require("../../../../components/Tag");
|
|
9
|
+
const sortWithOrder_1 = require("../../../../Utilities/sortWithOrder");
|
|
10
|
+
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
11
|
+
const ValueSelector_1 = require("../../../Components/ValueSelector");
|
|
12
|
+
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
13
|
+
const Utilities_1 = require("./Utilities");
|
|
14
|
+
const PivotColumnsSectionSummary = () => {
|
|
15
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
16
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
17
|
+
return (React.createElement(rebass_1.Box, { p: 2, style: { borderRadius: 'var(--ab__border-radius)' }, backgroundColor: "var(--ab-color-defaultbackground)" }, layout.PivotColumns.length ? (layout.PivotColumns.map((columnId) => (React.createElement(Tag_1.Tag, { mr: 1, key: columnId }, adaptable.api.columnApi.getFriendlyNameFromColumnId(columnId))))) : (React.createElement(Tag_1.Tag, null, "No Column Pivoting"))));
|
|
18
|
+
};
|
|
19
|
+
exports.PivotColumnsSectionSummary = PivotColumnsSectionSummary;
|
|
20
|
+
const PivotColumnsSection = (props) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
23
|
+
const { data: layout } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
24
|
+
const allPivotColumns = adaptable.api.columnApi.getPivotableColumns();
|
|
25
|
+
const sortedPivotColumns = React.useMemo(() => {
|
|
26
|
+
var _a;
|
|
27
|
+
return sortWithOrder_1.sortWithOrderArray(allPivotColumns.map((col) => col.columnId), (_a = layout.PivotColumns) !== null && _a !== void 0 ? _a : [], { sortUnorderedItems: true }).map((colId) => adaptable.api.columnApi.getColumnFromId(colId));
|
|
28
|
+
}, [layout, allPivotColumns]);
|
|
29
|
+
const handleColumnsChange = (columnIds) => {
|
|
30
|
+
props.onChange(Object.assign(Object.assign({}, layout), { PivotColumns: columnIds }));
|
|
31
|
+
};
|
|
32
|
+
return (React.createElement(Tabs_1.Tabs, { style: { height: '100%' } },
|
|
33
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Pivot Columns"),
|
|
34
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
35
|
+
React.createElement(ValueSelector_1.ValueSelector, { showFilterInput: true, showSelectedOnlyPosition: "top", filter: Utilities_1.columnFilter, toIdentifier: (option) => `${option.columnId}`, toLabel: (option) => { var _a; return (_a = option.friendlyName) !== null && _a !== void 0 ? _a : option.columnId; }, options: sortedPivotColumns, value: (_a = layout.PivotColumns) !== null && _a !== void 0 ? _a : [], allowReorder: true, xSelectedLabel: () => {
|
|
36
|
+
return `Selected Columns:`;
|
|
37
|
+
}, onChange: handleColumnsChange }))));
|
|
38
|
+
};
|
|
39
|
+
exports.PivotColumnsSection = PivotColumnsSection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Layout } from '../../../../../types';
|
|
3
|
+
export declare const RowGroupingSectionSummary: React.FunctionComponent;
|
|
4
|
+
interface RowGroupingSectionProps {
|
|
5
|
+
onChange: (data: Layout) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const RowGroupingSection: React.FunctionComponent<RowGroupingSectionProps>;
|
|
8
|
+
export {};
|