@adaptabletools/adaptable 24.0.0-canary.7 → 24.0.0-canary.9
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/agGrid.d.ts +2 -3
- package/agGrid.js +2 -3
- package/aql.d.ts +29 -1
- package/aql.js +49 -1
- package/devtools.d.ts +55 -1
- package/index.css +7 -19
- package/index.d.ts +2 -3
- package/index.js +2 -3
- package/package.json +1 -1
- package/src/AdaptableOptions/ActionColumnOptions.d.ts +24 -0
- package/src/AdaptableOptions/AdaptableOptions.d.ts +97 -69
- package/src/AdaptableOptions/AdaptablePlugin.d.ts +113 -1
- package/src/AdaptableOptions/AlertOptions.d.ts +0 -2
- package/src/AdaptableOptions/ChartingOptions.d.ts +11 -5
- package/src/AdaptableOptions/ColumnMenuOptions.d.ts +30 -0
- package/src/AdaptableOptions/ColumnOptions.d.ts +0 -2
- package/src/AdaptableOptions/CommentOptions.d.ts +12 -4
- package/src/AdaptableOptions/ContextMenuOptions.d.ts +31 -1
- package/src/AdaptableOptions/DashboardOptions.d.ts +0 -3
- package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +3 -2
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +6 -0
- package/src/AdaptableOptions/EditOptions.d.ts +18 -2
- package/src/AdaptableOptions/ExportOptions.d.ts +23 -0
- package/src/AdaptableOptions/ExpressionOptions.d.ts +0 -3
- package/src/AdaptableOptions/Fdc3Options.d.ts +77 -3
- package/src/AdaptableOptions/FilterOptions.d.ts +13 -8
- package/src/AdaptableOptions/LayoutOptions.d.ts +16 -3
- package/src/AdaptableOptions/NotificationsOptions.d.ts +0 -1
- package/src/AdaptableOptions/QuickSearchOptions.d.ts +0 -2
- package/src/AdaptableOptions/RowFormOptions.d.ts +9 -0
- package/src/AdaptableOptions/SettingsPanelOptions.d.ts +10 -1
- package/src/AdaptableOptions/ToolPanelOptions.d.ts +0 -1
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +87 -2
- package/src/AdaptableState/AdaptableState.d.ts +98 -4
- package/src/AdaptableState/AlertState.d.ts +20 -21
- package/src/AdaptableState/ApplicationState.d.ts +5 -3
- package/src/AdaptableState/BaseState.d.ts +9 -2
- package/src/AdaptableState/CalculatedColumnState.d.ts +10 -8
- package/src/AdaptableState/ChartingState.d.ts +10 -5
- package/src/AdaptableState/CommentState.d.ts +10 -4
- package/src/AdaptableState/Common/AdaptableAlert.d.ts +6 -2
- package/src/AdaptableState/Common/AdaptableButton.d.ts +3 -1
- package/src/AdaptableState/Common/AdaptableColumn.d.ts +38 -1
- package/src/AdaptableState/Common/AdaptableFilterState.d.ts +3 -1
- package/src/AdaptableState/Common/AdaptableFlashingCell.d.ts +3 -1
- package/src/AdaptableState/Common/AdaptableForm.d.ts +9 -0
- package/src/AdaptableState/Common/AdaptableFormat.d.ts +27 -1
- package/src/AdaptableState/Common/AdaptableIcon.d.ts +4 -2
- package/src/AdaptableState/Common/AdaptableObject.d.ts +9 -1
- package/src/AdaptableState/Common/AdaptableQuery.d.ts +9 -0
- package/src/AdaptableState/Common/AdaptableStyle.d.ts +6 -8
- package/src/AdaptableState/Common/AggregationColumns.d.ts +15 -6
- package/src/AdaptableState/Common/ButtonStyle.d.ts +3 -1
- package/src/AdaptableState/Common/CellDataChangedInfo.d.ts +6 -2
- package/src/AdaptableState/Common/CellHighlightInfo.d.ts +4 -2
- package/src/AdaptableState/Common/CellSummary.d.ts +33 -0
- package/src/AdaptableState/Common/ColumnFilter.d.ts +3 -1
- package/src/AdaptableState/Common/ColumnHighlightInfo.d.ts +4 -2
- package/src/AdaptableState/Common/ColumnScope.d.ts +32 -1
- package/src/AdaptableState/Common/ColumnSetupInfo.d.ts +17 -0
- package/src/AdaptableState/Common/ColumnSort.d.ts +3 -1
- package/src/AdaptableState/Common/CompactCalculatedColumnEditorInfo.d.ts +3 -0
- package/src/AdaptableState/Common/DataChangedScope.d.ts +3 -1
- package/src/AdaptableState/Common/DataUpdateConfig.d.ts +3 -1
- package/src/AdaptableState/Common/Entitlement.d.ts +4 -2
- package/src/AdaptableState/Common/Enums.d.ts +21 -0
- package/src/AdaptableState/Common/ExtendedLayout.d.ts +3 -1
- package/src/AdaptableState/Common/Fdc3Context.d.ts +9 -0
- package/src/AdaptableState/Common/Fdc3Intent.d.ts +6 -0
- package/src/AdaptableState/Common/GridFilter.d.ts +3 -1
- package/src/AdaptableState/Common/MenuItem.d.ts +9 -0
- package/src/AdaptableState/Common/RowHighlightInfo.d.ts +4 -2
- package/src/AdaptableState/Common/RowScope.d.ts +3 -1
- package/src/AdaptableState/Common/RowSummary.d.ts +14 -4
- package/src/AdaptableState/Common/RowsHighlightInfo.d.ts +5 -3
- package/src/AdaptableState/Common/Schedule.d.ts +10 -2
- package/src/AdaptableState/Common/SpecialColumnSettings.d.ts +3 -1
- package/src/AdaptableState/Common/SystemStatusMessageInfo.d.ts +4 -2
- package/src/AdaptableState/Common/TransposeConfig.d.ts +1 -1
- package/src/AdaptableState/Common/Types.d.ts +9 -0
- package/src/AdaptableState/CustomSortState.d.ts +8 -5
- package/src/AdaptableState/DashboardState.d.ts +14 -10
- package/src/AdaptableState/ExportState.d.ts +12 -4
- package/src/AdaptableState/FlashingCellState.d.ts +8 -5
- package/src/AdaptableState/FormatColumnState.d.ts +28 -8
- package/src/AdaptableState/FreeTextColumnState.d.ts +14 -8
- package/src/AdaptableState/IPushPullState.d.ts +39 -3
- package/src/AdaptableState/InitialState.d.ts +9 -9
- package/src/AdaptableState/InternalState.d.ts +183 -3
- package/src/AdaptableState/LayoutState.d.ts +64 -21
- package/src/AdaptableState/NamedQueryState.d.ts +16 -4
- package/src/AdaptableState/NoteState.d.ts +7 -3
- package/src/AdaptableState/OpenFinState.d.ts +12 -2
- package/src/AdaptableState/PlusMinusState.d.ts +8 -4
- package/src/AdaptableState/PopupState.d.ts +29 -1
- package/src/AdaptableState/QuickSearchState.d.ts +5 -3
- package/src/AdaptableState/Selection/GridCell.d.ts +5 -3
- package/src/AdaptableState/Selection/GridCellRange.d.ts +8 -7
- package/src/AdaptableState/Selection/SelectedCellInfo.d.ts +1 -1
- package/src/AdaptableState/ShortcutState.d.ts +7 -3
- package/src/AdaptableState/StatusBarState.d.ts +7 -6
- package/src/AdaptableState/StyledColumnState.d.ts +46 -14
- package/src/AdaptableState/TeamSharingState.d.ts +46 -2
- package/src/AdaptableState/ThemeState.d.ts +24 -2
- package/src/AdaptableState/ToolPanelState.d.ts +10 -5
- package/src/AdaptableState/UserInterfaceState.d.ts +2 -2
- package/src/AdaptableState/Uuid.d.ts +6 -0
- package/src/Api/ActionColumnApi.d.ts +3 -1
- package/src/Api/AdaptableApi.d.ts +54 -50
- package/src/Api/AlertApi.d.ts +20 -12
- package/src/Api/ApplicationApi.d.ts +6 -2
- package/src/Api/BulkUpdateApi.d.ts +2 -1
- package/src/Api/CalculatedColumnApi.d.ts +4 -1
- package/src/Api/CalendarApi.d.ts +10 -0
- package/src/Api/CellSummaryApi.d.ts +9 -3
- package/src/Api/ChartingApi.d.ts +22 -7
- package/src/Api/ColumnApi.d.ts +71 -4
- package/src/Api/ColumnFilterApi.d.ts +13 -3
- package/src/Api/ColumnMenuApi.d.ts +13 -2
- package/src/Api/ColumnScopeApi.d.ts +27 -1
- package/src/Api/CommentApi.d.ts +10 -7
- package/src/Api/ContextMenuApi.d.ts +11 -1
- package/src/Api/CustomSortApi.d.ts +6 -2
- package/src/Api/DashboardApi.d.ts +30 -9
- package/src/Api/DataChangeHistoryApi.d.ts +9 -3
- package/src/Api/DataImportApi.d.ts +1 -1
- package/src/Api/EntitlementApi.d.ts +6 -1
- package/src/Api/EventApi.d.ts +67 -19
- package/src/Api/Events/AdaptableReady.d.ts +6 -2
- package/src/Api/Events/AdaptableStateChanged.d.ts +9 -5
- package/src/Api/Events/AdaptableStateReloaded.d.ts +7 -3
- package/src/Api/Events/AlertFired.d.ts +8 -2
- package/src/Api/Events/BeforeAdaptableStateChange.d.ts +6 -2
- package/src/Api/Events/CalculatedColumnChanged.d.ts +7 -3
- package/src/Api/Events/CellChanged.d.ts +6 -2
- package/src/Api/Events/CellSelectionChanged.d.ts +6 -2
- package/src/Api/Events/ChartChanged.d.ts +16 -8
- package/src/Api/Events/CommentChanged.d.ts +8 -2
- package/src/Api/Events/CustomToolbarConfigured.d.ts +6 -2
- package/src/Api/Events/DashboardChanged.d.ts +27 -6
- package/src/Api/Events/DataImported.d.ts +8 -4
- package/src/Api/Events/DataSetSelected.d.ts +6 -2
- package/src/Api/Events/Fdc3MessageInfo.d.ts +14 -4
- package/src/Api/Events/FlashingCellDisplayed.d.ts +6 -2
- package/src/Api/Events/GridFilterApplied.d.ts +11 -3
- package/src/Api/Events/GridSorted.d.ts +6 -2
- package/src/Api/Events/LayoutChanged.d.ts +36 -5
- package/src/Api/Events/LiveDataChanged.d.ts +21 -5
- package/src/Api/Events/NoteChanged.d.ts +5 -1
- package/src/Api/Events/ReportScheduleRan.d.ts +7 -3
- package/src/Api/Events/RowChanged.d.ts +6 -2
- package/src/Api/Events/RowFormSubmitted.d.ts +28 -12
- package/src/Api/Events/RowSelectionChanged.d.ts +6 -2
- package/src/Api/Events/SystemStatusMessageDisplayed.d.ts +6 -2
- package/src/Api/Events/TeamSharingEntityChanged.d.ts +6 -2
- package/src/Api/Events/ThemeSelected.d.ts +6 -2
- package/src/Api/ExportApi.d.ts +59 -32
- package/src/Api/ExpressionApi.d.ts +24 -1
- package/src/Api/Fdc3Api.d.ts +16 -3
- package/src/Api/FlashingCellApi.d.ts +6 -1
- package/src/Api/FormatColumnApi.d.ts +18 -11
- package/src/Api/FreeTextColumnApi.d.ts +4 -2
- package/src/Api/GridApi.d.ts +92 -19
- package/src/Api/IPushPullApi.d.ts +19 -2
- package/src/Api/Internal/EventInternalApi.d.ts +2 -1
- package/src/Api/Internal/EventInternalApi.js +7 -0
- package/src/Api/InteropioPluginApi.d.ts +2 -1
- package/src/Api/LayoutApi.d.ts +29 -15
- package/src/Api/NamedQueryApi.d.ts +10 -6
- package/src/Api/NoteApi.d.ts +15 -11
- package/src/Api/OpenFinApi.d.ts +8 -2
- package/src/Api/OptionsApi.d.ts +43 -1
- package/src/Api/PluginsApi.d.ts +6 -1
- package/src/Api/PlusMinusApi.d.ts +2 -1
- package/src/Api/QuickSearchApi.d.ts +6 -1
- package/src/Api/RowFormApi.d.ts +8 -7
- package/src/Api/ShortcutApi.d.ts +3 -1
- package/src/Api/SmartEditApi.d.ts +4 -1
- package/src/Api/StateApi.d.ts +30 -2
- package/src/Api/StatusBarApi.d.ts +2 -0
- package/src/Api/StyledColumnApi.d.ts +23 -12
- package/src/Api/SystemStatusApi.d.ts +18 -6
- package/src/Api/TeamSharingApi.d.ts +8 -1
- package/src/Api/ThemeApi.d.ts +17 -8
- package/src/Api/ToolPanelApi.d.ts +12 -7
- package/src/Api/UserInterfaceApi.d.ts +10 -1
- package/src/Redux/Store/AdaptableStore.js +1 -1
- package/src/View/Filter/ColumnFilter/ColumnFilterNew.js +14 -9
- package/src/agGrid/Adaptable.d.ts +0 -12
- package/src/agGrid/Adaptable.js +0 -52
- package/src/agGrid/AdaptableFrameworkComponent.d.ts +12 -0
- package/src/agGrid/AdaptableLogger.d.ts +74 -1
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +3 -0
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +3 -0
- package/src/agGrid/index.d.ts +1 -6
- package/src/agGrid/index.js +1 -3
- package/src/aql/ExpressionEvaluation.d.ts +27 -0
- package/src/aql/types.d.ts +22 -0
- package/src/components/ColorField/index.d.ts +2 -3
- package/src/components/ColorField/index.js +22 -2
- package/src/components/aql/QueryBuilder/GroupEditor.js +1 -1
- package/src/components/aql/QueryBuilder/QueryBuilder.d.ts +5 -0
- package/src/components/aql/QueryBuilder/QueryBuilder.js +1 -1
- package/src/components/aql/QueryBuilder/context.d.ts +7 -0
- package/src/components/aql/QueryBuilder/context.js +3 -1
- package/src/env.js +2 -2
- package/src/migration/legacyAdaptableQuery.d.ts +29 -4
- package/src/setupDevTools.js +223 -0
- package/src/types.d.ts +1 -3
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/vendor/components/ColorField/index.d.ts +12 -2
- package/vendor/components/ColorField/index.d.ts.map +1 -1
- package/vendor/components/ColorField/index.js +3 -4
- package/vendor/components/ColorField/index.js.map +1 -1
- package/vendor/components/ColorPicker/index.d.ts +50 -11
- package/vendor/components/ColorPicker/index.d.ts.map +1 -1
- package/vendor/components/ColorPicker/index.js +172 -54
- package/vendor/components/ColorPicker/index.js.map +1 -1
- package/vendor/components/ColorPicker/themeColors.d.ts +42 -1
- package/vendor/components/ColorPicker/themeColors.d.ts.map +1 -1
- package/vendor/components/ColorPicker/themeColors.js +131 -1
- package/vendor/components/ColorPicker/themeColors.js.map +1 -1
- package/vendor/components/index.css +6 -0
- package/vendor/components/index.d.ts +2 -2
- package/vendor/components/index.d.ts.map +1 -1
- package/vendor/components/index.js +1 -1
- package/vendor/components/index.js.map +1 -1
- package/src/AdaptableInterfaces/AdaptableNoCodeWizard.d.ts +0 -99
- package/src/AdaptableInterfaces/AdaptableNoCodeWizard.js +0 -1
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableConfig.d.ts +0 -15
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableConfig.js +0 -1
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.d.ts +0 -19
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +0 -337
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.d.ts +0 -5
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.js +0 -4
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.d.ts +0 -30
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +0 -162
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.d.ts +0 -18
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.js +0 -12
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.d.ts +0 -8
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +0 -131
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.d.ts +0 -8
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.js +0 -30
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.d.ts +0 -6
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.js +0 -80
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.d.ts +0 -6
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.js +0 -100
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.d.ts +0 -11
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.js +0 -8
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/index.d.ts +0 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/index.js +0 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/useSelection.d.ts +0 -21
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/useSelection.js +0 -63
- package/src/View/AdaptableWizardView/Utilities/Utils.d.ts +0 -1
- package/src/View/AdaptableWizardView/Utilities/Utils.js +0 -21
- package/src/View/AdaptableWizardView/Utilities/helper.d.ts +0 -19
- package/src/View/AdaptableWizardView/Utilities/helper.js +0 -81
- package/src/View/AdaptableWizardView/Wizard.d.ts +0 -57
- package/src/View/AdaptableWizardView/Wizard.js +0 -98
- package/src/View/AdaptableWizardView/index.d.ts +0 -4
- package/src/View/AdaptableWizardView/index.js +0 -4
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import HelpBlock from '../../../components/HelpBlock';
|
|
4
|
-
import { ALL_MODULES } from '../../../AdaptableState/Common/Types';
|
|
5
|
-
import Radio from '../../../components/Radio';
|
|
6
|
-
import FormLayout, { FormRow } from '../../../components/FormLayout';
|
|
7
|
-
import { ACCESS_LEVEL_FULL, ACCESS_LEVEL_HIDDEN, ACCESS_LEVEL_READ_ONLY, } from '../../../Utilities/Constants/GeneralConstants';
|
|
8
|
-
import { ADAPTABLE_MODULE_MAP } from '../../../Utilities/Constants/ModuleConstants';
|
|
9
|
-
import { DataSource, InfiniteTableGrid, } from '../../../components/InfiniteTable';
|
|
10
|
-
import { Box, Flex } from '../../../components/Flex';
|
|
11
|
-
const ALL_ENTITLEMENTS_MODULES = ALL_MODULES;
|
|
12
|
-
const tableDOMProps = {
|
|
13
|
-
style: {
|
|
14
|
-
height: '100%',
|
|
15
|
-
minWidth: '10rem',
|
|
16
|
-
minHeight: 600,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const columnTypes = {
|
|
20
|
-
default: {
|
|
21
|
-
defaultFlex: 1,
|
|
22
|
-
align: 'center',
|
|
23
|
-
defaultSortable: false,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
const headerOptions = {
|
|
27
|
-
alwaysReserveSpaceForSortIcon: false,
|
|
28
|
-
};
|
|
29
|
-
const EntitlementsListForm = (props) => {
|
|
30
|
-
let abOptions = props.adaptableOptions;
|
|
31
|
-
const entitlements = abOptions?.entitlementOptions?.moduleEntitlements ?? [];
|
|
32
|
-
if (typeof entitlements === 'function') {
|
|
33
|
-
return (_jsx(HelpBlock, { className: "twa:mt-2", children: "Entitlements cannot be customized, they are handled by a custom function." }));
|
|
34
|
-
}
|
|
35
|
-
const entitlementsMap = React.useMemo(() => {
|
|
36
|
-
return entitlements.reduce((acc, entitlement) => {
|
|
37
|
-
acc[entitlement.adaptableModule] = entitlement.accessLevel;
|
|
38
|
-
return acc;
|
|
39
|
-
}, {});
|
|
40
|
-
}, [abOptions?.entitlementOptions]);
|
|
41
|
-
const handleOnChange = React.useCallback((module, accessLevel) => {
|
|
42
|
-
let newEntitlements = entitlements;
|
|
43
|
-
if (entitlementsMap[module]) {
|
|
44
|
-
newEntitlements = newEntitlements.map((entitlement) => {
|
|
45
|
-
if (entitlement.adaptableModule === module) {
|
|
46
|
-
entitlement.accessLevel = accessLevel;
|
|
47
|
-
}
|
|
48
|
-
return entitlement;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
newEntitlements = [
|
|
53
|
-
...newEntitlements,
|
|
54
|
-
{ adaptableModule: module, accessLevel: accessLevel },
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
props.onChangedAptableOptions({
|
|
58
|
-
...abOptions,
|
|
59
|
-
entitlementOptions: {
|
|
60
|
-
...abOptions.entitlementOptions,
|
|
61
|
-
moduleEntitlements: newEntitlements,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
}, [abOptions?.entitlementOptions]);
|
|
65
|
-
if (typeof entitlements === 'function') {
|
|
66
|
-
return (_jsx(HelpBlock, { className: "twa:mb-2", children: "Entitlements cannot be customized, they are handled by a custom function." }));
|
|
67
|
-
}
|
|
68
|
-
const columnsMap = {
|
|
69
|
-
name: {
|
|
70
|
-
header: 'Module Name',
|
|
71
|
-
align: 'start',
|
|
72
|
-
renderValue: (params) => {
|
|
73
|
-
return _jsx(_Fragment, { children: params.data.name });
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
full: {
|
|
77
|
-
header: 'Full',
|
|
78
|
-
render: (params) => {
|
|
79
|
-
const module = params.data.name;
|
|
80
|
-
const accessLevel = entitlementsMap[module];
|
|
81
|
-
return (_jsx(Radio, { onClick: () => handleOnChange(module, ACCESS_LEVEL_FULL), checked: accessLevel === ACCESS_LEVEL_FULL }));
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
readonly: {
|
|
85
|
-
header: 'Read Only',
|
|
86
|
-
render: (params) => {
|
|
87
|
-
const module = params.data.name;
|
|
88
|
-
const accessLevel = entitlementsMap[module];
|
|
89
|
-
return (_jsx(Radio, { onClick: () => handleOnChange(module, ACCESS_LEVEL_READ_ONLY), checked: accessLevel === ACCESS_LEVEL_READ_ONLY }));
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
hidden: {
|
|
93
|
-
header: 'Hidden',
|
|
94
|
-
render: (params) => {
|
|
95
|
-
const module = params.data.name;
|
|
96
|
-
const accessLevel = entitlementsMap[module];
|
|
97
|
-
return (_jsx(Radio, { onClick: () => handleOnChange(module, ACCESS_LEVEL_HIDDEN), checked: accessLevel === ACCESS_LEVEL_HIDDEN }));
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
const data = ALL_ENTITLEMENTS_MODULES.map((module) => ({ name: ADAPTABLE_MODULE_MAP[module] }));
|
|
102
|
-
let theme = 'light';
|
|
103
|
-
if (typeof props.adaptableOptions.initialState === 'object' &&
|
|
104
|
-
props.adaptableOptions.initialState.Theme?.CurrentTheme) {
|
|
105
|
-
theme = props.adaptableOptions.initialState.Theme.CurrentTheme;
|
|
106
|
-
}
|
|
107
|
-
return (_jsx(Box, { className: `${theme} twa:flex-1 twa:h-full`, children: _jsx(DataSource, { data: data, primaryKey: "name", children: _jsx(InfiniteTableGrid, { columnTypes: columnTypes, headerOptions: headerOptions, domProps: tableDOMProps, columns: columnsMap }) }) }));
|
|
108
|
-
};
|
|
109
|
-
const DefaultEntitlementForm = (props) => {
|
|
110
|
-
const abOptions = props.adaptableOptions;
|
|
111
|
-
const entitlementOptions = props.adaptableOptions?.entitlementOptions;
|
|
112
|
-
const defaultEntitlement = entitlementOptions?.defaultAccessLevel;
|
|
113
|
-
if (typeof defaultEntitlement === 'function') {
|
|
114
|
-
return (_jsx(HelpBlock, { className: "twa:mb-2", children: "Default Entitlement is controlled by a custom function" }));
|
|
115
|
-
}
|
|
116
|
-
const handleDefaultEntitlementChange = React.useCallback((accessLevel) => {
|
|
117
|
-
props.onChangedAptableOptions({
|
|
118
|
-
...abOptions,
|
|
119
|
-
entitlementOptions: {
|
|
120
|
-
...abOptions.entitlementOptions,
|
|
121
|
-
defaultAccessLevel: accessLevel,
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
}, [abOptions?.entitlementOptions?.defaultAccessLevel]);
|
|
125
|
-
return (_jsx(FormLayout, { className: "twa:mb-2", children: _jsxs(FormRow, { label: "Default Entitlement:", children: [_jsx(Radio, { onClick: () => handleDefaultEntitlementChange(ACCESS_LEVEL_FULL), checked: defaultEntitlement === ACCESS_LEVEL_FULL, className: "twa:mr-3", children: "Visible" }), _jsx(Radio, { onClick: () => handleDefaultEntitlementChange(ACCESS_LEVEL_READ_ONLY), checked: defaultEntitlement === ACCESS_LEVEL_READ_ONLY, className: "twa:mr-3", children: "Read Only" }), _jsx(Radio, { onClick: () => handleDefaultEntitlementChange(ACCESS_LEVEL_HIDDEN), checked: defaultEntitlement === ACCESS_LEVEL_HIDDEN, children: "Hidden" })] }) }));
|
|
126
|
-
};
|
|
127
|
-
const EntitlementsForm = (props) => {
|
|
128
|
-
let abOptions = props.adaptableOptions;
|
|
129
|
-
return (_jsxs(Flex, { flexDirection: "column", className: "twa:p-2 twa:h-full", children: [_jsx(DefaultEntitlementForm, { ...props }), _jsx(EntitlementsListForm, { ...props })] }));
|
|
130
|
-
};
|
|
131
|
-
export default EntitlementsForm;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { GridOptions } from 'ag-grid-enterprise';
|
|
3
|
-
interface GridOptionsFormOptions {
|
|
4
|
-
gridOptions: GridOptions;
|
|
5
|
-
onChangedGridOptions: (gridOptions: GridOptions) => void;
|
|
6
|
-
}
|
|
7
|
-
declare const GridOptionsForm: (props: GridOptionsFormOptions) => React.JSX.Element;
|
|
8
|
-
export default GridOptionsForm;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import FormLayout, { FormRow } from '../../../components/FormLayout';
|
|
3
|
-
import { CheckBox } from '../../../components/CheckBox';
|
|
4
|
-
import HelpBlock from '../../../components/HelpBlock';
|
|
5
|
-
import { Box } from '../../../components/Flex';
|
|
6
|
-
const GridOptionsForm = (props) => {
|
|
7
|
-
let { gridOptions } = props;
|
|
8
|
-
return (_jsxs(Box, { className: "twa:p-2", children: [_jsx(HelpBlock, { children: "Grid Options" }), _jsxs(FormLayout, { className: "twa:m-2", columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }], children: [_jsx(FormRow, { label: "Enable Cell Selection", children: _jsx(CheckBox, { checked: !!gridOptions.cellSelection, onChange: (enableCellSelection) => {
|
|
9
|
-
gridOptions = { ...gridOptions, cellSelection: enableCellSelection };
|
|
10
|
-
props.onChangedGridOptions(gridOptions);
|
|
11
|
-
} }) }), _jsx(FormRow, { label: "Show Filter Bar", children: _jsx(CheckBox, { checked: gridOptions.defaultColDef?.floatingFilter, onChange: (floatingFilter) => {
|
|
12
|
-
gridOptions = {
|
|
13
|
-
...gridOptions,
|
|
14
|
-
defaultColDef: {
|
|
15
|
-
floatingFilter,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
props.onChangedGridOptions(gridOptions);
|
|
19
|
-
} }) }), _jsx(FormRow, { label: "Suppress Column Virtualisation", children: _jsx(CheckBox, { checked: gridOptions.suppressColumnVirtualisation, onChange: (suppressColumnVirtualisation) => {
|
|
20
|
-
gridOptions = {
|
|
21
|
-
...gridOptions,
|
|
22
|
-
suppressColumnVirtualisation: suppressColumnVirtualisation,
|
|
23
|
-
};
|
|
24
|
-
props.onChangedGridOptions(gridOptions);
|
|
25
|
-
} }) }), _jsx(FormRow, { label: "Show Column Menu Button", children: _jsx(CheckBox, { checked: gridOptions.suppressMenuHide, onChange: (suppressMenuHide) => {
|
|
26
|
-
gridOptions = { ...gridOptions, suppressMenuHide: suppressMenuHide };
|
|
27
|
-
props.onChangedGridOptions(gridOptions);
|
|
28
|
-
} }) })] })] }));
|
|
29
|
-
};
|
|
30
|
-
export default GridOptionsForm;
|
package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CheckBox } from '../../../../components/CheckBox';
|
|
3
|
-
import { NewDropdownButton } from '../../../../components/DropdownButton';
|
|
4
|
-
import FormLayout, { FormRow } from '../../../../components/FormLayout';
|
|
5
|
-
import HelpBlock from '../../../../components/HelpBlock';
|
|
6
|
-
import StringExtensions from '../../../../Utilities/Extensions/StringExtensions';
|
|
7
|
-
import { Box, Flex } from '../../../../components/Flex';
|
|
8
|
-
const ALL_SIDEBAR_OPTIONS = ['columns', 'filters', 'adaptable'];
|
|
9
|
-
const prepareSidebarDef = (sideBar) => {
|
|
10
|
-
sideBar = sideBar;
|
|
11
|
-
if (typeof sideBar === 'boolean') {
|
|
12
|
-
sideBar = {
|
|
13
|
-
toolPanels: ALL_SIDEBAR_OPTIONS,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
if (typeof sideBar === 'string') {
|
|
17
|
-
sideBar = {
|
|
18
|
-
toolPanels: [sideBar],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(sideBar)) {
|
|
22
|
-
sideBar = {
|
|
23
|
-
toolPanels: sideBar,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return sideBar ?? { toolPanels: [] };
|
|
27
|
-
};
|
|
28
|
-
const isSidebarChecked = (sideBar, panelName) => {
|
|
29
|
-
return (sideBar?.toolPanels ?? []).some((panel) => {
|
|
30
|
-
const panelId = typeof panel === 'string' ? panel : panel.id;
|
|
31
|
-
return panelId === panelName;
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
export const UIOptionsSidebarForm = (props) => {
|
|
35
|
-
const { gridOptions, onChange } = props;
|
|
36
|
-
const sideBar = prepareSidebarDef(gridOptions.sideBar);
|
|
37
|
-
const renderSidebarCheckbox = (sidebarName) => {
|
|
38
|
-
return (_jsx(CheckBox, { className: "twa:mr-3", checked: isSidebarChecked(sideBar, sidebarName), onChange: (check) => handleToolpanelsChange(sidebarName, check), children: StringExtensions.Humanize(sidebarName) }, sidebarName));
|
|
39
|
-
};
|
|
40
|
-
const handleToolpanelsChange = (panelName, check) => {
|
|
41
|
-
let newPanels = sideBar?.toolPanels ?? [];
|
|
42
|
-
if (check) {
|
|
43
|
-
newPanels = [...newPanels, panelName];
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
newPanels = newPanels.filter((panel) => {
|
|
47
|
-
const panelId = typeof panel === 'string' ? panel : panel.id;
|
|
48
|
-
return panelId !== panelName;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
let hiddenByDefault = sideBar.hiddenByDefault ?? false;
|
|
52
|
-
if (newPanels.length === 0) {
|
|
53
|
-
hiddenByDefault = true;
|
|
54
|
-
}
|
|
55
|
-
const newGridOptions = {
|
|
56
|
-
...gridOptions,
|
|
57
|
-
sideBar: {
|
|
58
|
-
...sideBar,
|
|
59
|
-
toolPanels: newPanels,
|
|
60
|
-
hiddenByDefault,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
props.onChange(newGridOptions);
|
|
64
|
-
};
|
|
65
|
-
let sidebarPosition = sideBar?.position ?? 'right';
|
|
66
|
-
const handleSidebarPositionChange = (position) => {
|
|
67
|
-
const newGridOptions = {
|
|
68
|
-
...gridOptions,
|
|
69
|
-
sideBar: {
|
|
70
|
-
...sideBar,
|
|
71
|
-
position,
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
props.onChange(newGridOptions);
|
|
75
|
-
};
|
|
76
|
-
return (_jsxs(Box, { children: [_jsx(HelpBlock, { children: "Tool Panels" }), _jsxs(Box, { className: "twa:m-2", children: [_jsx(Flex, { className: "twa:mb-2", children: ALL_SIDEBAR_OPTIONS.map(renderSidebarCheckbox) }), _jsx(FormLayout, { columns: [{ name: 'label' }, { name: 'children' }], children: _jsx(FormRow, { label: "Position", children: _jsx(NewDropdownButton, { items: [
|
|
77
|
-
{ label: 'Left', onClick: () => handleSidebarPositionChange('left') },
|
|
78
|
-
{ label: 'Right', onClick: () => handleSidebarPositionChange('right') },
|
|
79
|
-
], children: sidebarPosition === 'left' ? 'Left' : 'Right' }) }) })] })] }));
|
|
80
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ModuleManager } from '../../../../components/DragAndDropContext/ModuleManager';
|
|
4
|
-
import HelpBlock from '../../../../components/HelpBlock';
|
|
5
|
-
import FormLayout, { FormRow } from '../../../../components/FormLayout';
|
|
6
|
-
import Input from '../../../../components/Input';
|
|
7
|
-
import { ButtonNew } from '../../../Components/Buttons/ButtonNew';
|
|
8
|
-
import { NewDropdownButton } from '../../../../components/DropdownButton';
|
|
9
|
-
import { NocodeWizardFormBox } from '../Components/FormBox';
|
|
10
|
-
import { Box } from '../../../../components/Flex';
|
|
11
|
-
export const UIOptionsStatusbarForm = (props) => {
|
|
12
|
-
const allPanels = props.gridOptions?.statusBar?.statusPanels ?? [];
|
|
13
|
-
const panelIdtoPanel = (panelsIds, align) => panelsIds.map((panelId) => {
|
|
14
|
-
const previousItem = allPanels.find((panel) => panel.key === panelId || panel.statusPanel === panelId);
|
|
15
|
-
if (previousItem) {
|
|
16
|
-
return {
|
|
17
|
-
...previousItem,
|
|
18
|
-
align,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const newPanel = {
|
|
23
|
-
statusPanel: panelId,
|
|
24
|
-
align,
|
|
25
|
-
};
|
|
26
|
-
return newPanel;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const leftPanels = allPanels.filter((panel) => !panel?.align || panel.align === 'left');
|
|
30
|
-
const centerPanels = allPanels.filter((panel) => panel.align === 'center');
|
|
31
|
-
const rightPanels = allPanels.filter((panel) => panel.align === 'right');
|
|
32
|
-
const handleTabChange = (tabs) => {
|
|
33
|
-
const leftPanels = panelIdtoPanel(tabs[0].Items, 'left');
|
|
34
|
-
const centerPanels = panelIdtoPanel(tabs[1].Items, 'center');
|
|
35
|
-
const rightPanels = panelIdtoPanel(tabs[2].Items, 'right');
|
|
36
|
-
const newStatusbarPanels = [...leftPanels, ...centerPanels, ...rightPanels];
|
|
37
|
-
props.onChange({
|
|
38
|
-
...props.gridOptions,
|
|
39
|
-
statusBar: {
|
|
40
|
-
...props.gridOptions.statusBar,
|
|
41
|
-
statusPanels: newStatusbarPanels,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const disabled = false;
|
|
46
|
-
const panelToTabItemId = (panel) => panel.key ?? panel.statusPanel;
|
|
47
|
-
const tabs = [
|
|
48
|
-
{
|
|
49
|
-
Name: 'Left',
|
|
50
|
-
Items: leftPanels.map(panelToTabItemId),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
Name: 'Center',
|
|
54
|
-
Items: centerPanels.map(panelToTabItemId),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
Name: 'Right',
|
|
58
|
-
Items: rightPanels.map(panelToTabItemId),
|
|
59
|
-
},
|
|
60
|
-
];
|
|
61
|
-
const allOptions = [
|
|
62
|
-
{ Id: 'agTotalRowCountComponent', Title: 'Row Count' },
|
|
63
|
-
{ Id: 'agTotalAndFilteredRowCountComponent', Title: 'Totals and Filtered Row Count' },
|
|
64
|
-
{ Id: 'agFilteredRowCountComponent', Title: 'Filtered Row Count' },
|
|
65
|
-
{ Id: 'agSelectedRowCountComponent', Title: 'Selected Row Count' },
|
|
66
|
-
{ Id: 'agAggregationComponent', Title: 'Aggregation' },
|
|
67
|
-
];
|
|
68
|
-
const availableItems = allOptions;
|
|
69
|
-
const [adaptablePanelTitle, setAdaptablePanelTitle] = React.useState('');
|
|
70
|
-
const [adaptablePanelAlign, setAdaptablePanelAlign] = React.useState('left');
|
|
71
|
-
const isAdaptablePanelTitleAvailable = !allPanels.some((panel) => panel.key === adaptablePanelTitle);
|
|
72
|
-
const alignOptions = [
|
|
73
|
-
{ onClick: () => setAdaptablePanelAlign('left'), value: 'left', label: 'Left' },
|
|
74
|
-
{ onClick: () => setAdaptablePanelAlign('center'), value: 'center', label: 'Center' },
|
|
75
|
-
{ onClick: () => setAdaptablePanelAlign('right'), value: 'right', label: 'Right' },
|
|
76
|
-
];
|
|
77
|
-
const handleNewAdaptablePanel = () => {
|
|
78
|
-
const newAdaptablePanel = {
|
|
79
|
-
statusPanel: 'AdaptableStatusPanel',
|
|
80
|
-
align: adaptablePanelAlign,
|
|
81
|
-
key: adaptablePanelTitle,
|
|
82
|
-
};
|
|
83
|
-
const newStatusbarPanels = [...allPanels, newAdaptablePanel];
|
|
84
|
-
setAdaptablePanelTitle('');
|
|
85
|
-
setAdaptablePanelAlign('left');
|
|
86
|
-
props.onChange({
|
|
87
|
-
...props.gridOptions,
|
|
88
|
-
statusBar: {
|
|
89
|
-
...props.gridOptions.statusBar,
|
|
90
|
-
statusPanels: newStatusbarPanels,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
return (_jsxs(Box, { children: [_jsx(HelpBlock, { children: "Status Bar" }), _jsxs(Box, { className: "twa:p-2", children: [_jsxs(NocodeWizardFormBox, { children: [_jsx(Box, { as: "b", children: "Create Adaptable Statusbar Panel" }), _jsxs(FormLayout, { className: "twa:mt-2", children: [_jsx(FormRow, { label: "Panel Name", children: _jsx(Input, { value: adaptablePanelTitle, placeholder: 'Adaptable Panel Name', onChange: (event) => setAdaptablePanelTitle(event.target.value) }) }), _jsx(FormRow, { label: "Align", children: _jsx(NewDropdownButton, { items: alignOptions, children: alignOptions.find((option) => option.value === adaptablePanelAlign)?.label }) }), _jsxs(FormRow, { label: "", children: [_jsx(ButtonNew, { disabled: !isAdaptablePanelTitleAvailable, onClick: handleNewAdaptablePanel, children: "Add" }), !isAdaptablePanelTitleAvailable && (_jsx(Box, { className: "twa:mt-2 twa:text-destructive", children: "Adaptable panel name must be unique." }))] })] })] }), _jsx(ModuleManager, { permittedActions: {
|
|
95
|
-
createTab: false,
|
|
96
|
-
dragAndDropTab: false,
|
|
97
|
-
deleteTab: false,
|
|
98
|
-
editTabName: false,
|
|
99
|
-
}, onTabsChange: handleTabChange, disabled: disabled, tabs: tabs, availableItems: availableItems, tabsTitle: 'Status Bar Panels', unusedPanelTitle: "Ag Grid Status Bar Panels", dragItemText: "Drag into a Status Bar Panel below" })] })] }));
|
|
100
|
-
};
|
package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GridOptions } from 'ag-grid-enterprise';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { AdaptableOptions } from '../../../../types';
|
|
4
|
-
interface UIElementsOptionsProps {
|
|
5
|
-
adaptableOptions: AdaptableOptions;
|
|
6
|
-
gridOptions: GridOptions;
|
|
7
|
-
onChangedAdaptableOptions: (adaptableOptions: AdaptableOptions) => void;
|
|
8
|
-
onChangedGridOptions: (gridOptions: GridOptions) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const UIElementsForm: React.FunctionComponent<UIElementsOptionsProps>;
|
|
11
|
-
export {};
|
package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Tabs } from '../../../../components/Tabs';
|
|
3
|
-
import { UIOptionsSidebarForm } from './UIOptionsSidebarForm';
|
|
4
|
-
import { UIOptionsStatusbarForm } from './UIOptionsStatusbarForm';
|
|
5
|
-
import { Box } from '../../../../components/Flex';
|
|
6
|
-
export const UIElementsForm = (props) => {
|
|
7
|
-
return (_jsx(Box, { className: "twa:p-2", children: _jsxs(Tabs, { children: [_jsx(Tabs.Tab, { children: "Tool Panel" }), _jsx(Tabs.Tab, { children: "Status Bar" }), _jsx(Tabs.Content, { children: _jsx(UIOptionsSidebarForm, { gridOptions: props.gridOptions, onChange: props.onChangedGridOptions }) }), _jsx(Tabs.Content, { children: _jsx(UIOptionsStatusbarForm, { gridOptions: props.gridOptions, onChange: props.onChangedGridOptions }) }), ' '] }) }));
|
|
8
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare const useSelection: (columns: {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}[], defaultValue: boolean | {
|
|
4
|
-
[key: string]: boolean;
|
|
5
|
-
}, fieldName: string | null, changeListeners?: {
|
|
6
|
-
onChange?: (column: any, flag: boolean) => void;
|
|
7
|
-
onBatchChange?: (flag: boolean) => void;
|
|
8
|
-
}) => {
|
|
9
|
-
selected: {
|
|
10
|
-
[key: string]: boolean;
|
|
11
|
-
};
|
|
12
|
-
isSelected: (field: string) => boolean;
|
|
13
|
-
isAllSelected: () => boolean;
|
|
14
|
-
isNoneSelected: () => boolean;
|
|
15
|
-
selectColumn: (field: string) => void;
|
|
16
|
-
deselectColumn: (field: string) => void;
|
|
17
|
-
toggleColumn: (field: string) => void;
|
|
18
|
-
deselectAll: () => void;
|
|
19
|
-
selectAll: () => void;
|
|
20
|
-
};
|
|
21
|
-
export default useSelection;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
const useSelection = (columns, defaultValue, fieldName, changeListeners) => {
|
|
3
|
-
changeListeners = changeListeners || {};
|
|
4
|
-
const onChange = changeListeners.onChange || ((column, flag) => { });
|
|
5
|
-
const onBatchChange = changeListeners.onBatchChange || ((flag) => { });
|
|
6
|
-
const [selected, setSelected] = useState(typeof defaultValue === 'object'
|
|
7
|
-
? defaultValue
|
|
8
|
-
: columns.reduce((acc, col) => {
|
|
9
|
-
const flag = fieldName ? col[fieldName] : defaultValue;
|
|
10
|
-
if (flag) {
|
|
11
|
-
acc[col.field] = flag;
|
|
12
|
-
}
|
|
13
|
-
return acc;
|
|
14
|
-
}, {}));
|
|
15
|
-
const getColumn = (field) => columns.filter((c) => c.field === field)[0];
|
|
16
|
-
const result = {
|
|
17
|
-
selected,
|
|
18
|
-
isSelected: (field) => !!selected[field],
|
|
19
|
-
isAllSelected: () => Object.keys(selected).length === columns.length,
|
|
20
|
-
isNoneSelected: () => Object.keys(selected).length === 0,
|
|
21
|
-
selectColumn: (field) => {
|
|
22
|
-
if (!selected[field]) {
|
|
23
|
-
setSelected({
|
|
24
|
-
...selected,
|
|
25
|
-
[field]: true,
|
|
26
|
-
});
|
|
27
|
-
onChange(getColumn(field), true);
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
deselectColumn: (field) => {
|
|
31
|
-
if (selected[field]) {
|
|
32
|
-
const newSelected = { ...selected };
|
|
33
|
-
delete newSelected[field];
|
|
34
|
-
setSelected(newSelected);
|
|
35
|
-
onChange(getColumn(field), false);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
toggleColumn: (field) => {
|
|
39
|
-
if (result.isSelected(field)) {
|
|
40
|
-
result.deselectColumn(field);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
result.selectColumn(field);
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
deselectAll: () => {
|
|
47
|
-
setSelected({});
|
|
48
|
-
columns.forEach((col) => {
|
|
49
|
-
onChange(col, false);
|
|
50
|
-
});
|
|
51
|
-
onBatchChange(false);
|
|
52
|
-
},
|
|
53
|
-
selectAll: () => {
|
|
54
|
-
setSelected(columns.reduce((acc, col) => {
|
|
55
|
-
acc[col.field] = true;
|
|
56
|
-
return acc;
|
|
57
|
-
}, {}));
|
|
58
|
-
onBatchChange(true);
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
return result;
|
|
62
|
-
};
|
|
63
|
-
export default useSelection;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const validDataSource: (dataSourceInfo: any) => boolean;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const validDataSource = (dataSourceInfo) => {
|
|
2
|
-
if (!dataSourceInfo || !Array.isArray(dataSourceInfo.columns)) {
|
|
3
|
-
throw `We can't find any columns in your configuration`;
|
|
4
|
-
}
|
|
5
|
-
if (!dataSourceInfo.columns.length) {
|
|
6
|
-
throw 'You should have at least one column';
|
|
7
|
-
}
|
|
8
|
-
const allStringColumns = dataSourceInfo.columns.reduce((acc, col) => {
|
|
9
|
-
if (!col || typeof col !== 'string') {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
return acc;
|
|
13
|
-
}, true);
|
|
14
|
-
if (!allStringColumns) {
|
|
15
|
-
throw `Some of your columns are not strings`;
|
|
16
|
-
}
|
|
17
|
-
if (!Array.isArray(dataSourceInfo.data)) {
|
|
18
|
-
throw `We can't find the data array in your configuration`;
|
|
19
|
-
}
|
|
20
|
-
return true;
|
|
21
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { GridOptions } from 'ag-grid-enterprise';
|
|
2
|
-
export interface WizardDataSourceInfo {
|
|
3
|
-
columns: string[];
|
|
4
|
-
data: any[];
|
|
5
|
-
primaryKey?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* There are two ways in which the datasource can be dropped in the wizard:
|
|
9
|
-
*
|
|
10
|
-
* 1. array of objects - eg: [{"lastName":"John","firstName":"Bobson"},{"lastName":"Mike","firstName":"Richardson"},...]
|
|
11
|
-
* 2. array of arrays - eg: [["lastName","firstName"],["John","Bobson"],["Mike","Richardson"],...]
|
|
12
|
-
*
|
|
13
|
-
* Although the second one is more compact, the first one is what we need for the datasource of the grid,
|
|
14
|
-
* so if we receive v2, we transform it to 1
|
|
15
|
-
* @param json
|
|
16
|
-
*/
|
|
17
|
-
export declare const prepareDataSource: (json: any, _file?: File) => WizardDataSourceInfo;
|
|
18
|
-
export declare const getColTypeFromValue: (value: any) => string;
|
|
19
|
-
export declare const prepareGridOptions: (dataSourceInfo: WizardDataSourceInfo, defaultGridOptions: Partial<GridOptions>) => GridOptions;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export const prepareDataSource = (json, _file) => {
|
|
2
|
-
if (!Array.isArray(json) || !json.length) {
|
|
3
|
-
return {
|
|
4
|
-
primaryKey: undefined,
|
|
5
|
-
columns: [],
|
|
6
|
-
data: [],
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
let columns = [];
|
|
10
|
-
let data = [];
|
|
11
|
-
let primaryKey;
|
|
12
|
-
if (Array.isArray(json[0])) {
|
|
13
|
-
columns = json[0];
|
|
14
|
-
for (let i = 1, len = json.length; i < len; i++) {
|
|
15
|
-
const it = json[i];
|
|
16
|
-
const obj = {};
|
|
17
|
-
for (let j = 0; j < columns.length; j++) {
|
|
18
|
-
obj[columns[j]] = it[j];
|
|
19
|
-
}
|
|
20
|
-
data.push(obj);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
columns = Object.keys(json[0]);
|
|
25
|
-
data = json;
|
|
26
|
-
}
|
|
27
|
-
primaryKey = columns[0];
|
|
28
|
-
return {
|
|
29
|
-
primaryKey,
|
|
30
|
-
columns,
|
|
31
|
-
data,
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
const typeToColType = {
|
|
35
|
-
string: 'text',
|
|
36
|
-
number: 'number',
|
|
37
|
-
boolean: 'boolean',
|
|
38
|
-
date: 'date',
|
|
39
|
-
};
|
|
40
|
-
export const getColTypeFromValue = (value) => {
|
|
41
|
-
const dataType = typeof value;
|
|
42
|
-
let columnDataType = typeToColType[dataType] || typeToColType.string;
|
|
43
|
-
if (value instanceof Date) {
|
|
44
|
-
columnDataType = typeToColType.date;
|
|
45
|
-
}
|
|
46
|
-
if (Array.isArray(value) && value.length && typeof value[0] === 'number') {
|
|
47
|
-
columnDataType = 'numberArray';
|
|
48
|
-
}
|
|
49
|
-
return columnDataType;
|
|
50
|
-
};
|
|
51
|
-
export const prepareGridOptions = (dataSourceInfo, defaultGridOptions) => {
|
|
52
|
-
const firstItem = dataSourceInfo.data[0];
|
|
53
|
-
const columnDefs = dataSourceInfo.columns.map((columnName) => {
|
|
54
|
-
const firstItemValue = firstItem[columnName];
|
|
55
|
-
const columnType = getColTypeFromValue(firstItemValue);
|
|
56
|
-
return {
|
|
57
|
-
headerName: columnName,
|
|
58
|
-
field: columnName,
|
|
59
|
-
type: columnType,
|
|
60
|
-
filter: true,
|
|
61
|
-
sortable: true,
|
|
62
|
-
enableRowGroup: true,
|
|
63
|
-
resizable: true,
|
|
64
|
-
editable: true,
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
const gridOptions = {
|
|
68
|
-
...defaultGridOptions,
|
|
69
|
-
defaultColDef: {
|
|
70
|
-
floatingFilter: true,
|
|
71
|
-
},
|
|
72
|
-
rowData: dataSourceInfo.data,
|
|
73
|
-
columnDefs,
|
|
74
|
-
cellSelection: true,
|
|
75
|
-
rowSelection: {
|
|
76
|
-
mode: 'multiRow',
|
|
77
|
-
},
|
|
78
|
-
rowHeight: 30,
|
|
79
|
-
};
|
|
80
|
-
return gridOptions;
|
|
81
|
-
};
|