@adaptabletools/adaptable 13.0.0-canary.9 → 13.0.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 +1454 -840
- package/base.css.map +1 -0
- package/bundle.cjs.js +238 -220
- package/index.css +1505 -850
- package/index.css.map +1 -0
- package/package.json +6 -6
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -0
- package/src/AdaptableOptions/AdaptableQLOptions.d.ts +30 -6
- package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
- package/src/AdaptableOptions/GeneralOptions.d.ts +0 -5
- package/src/AdaptableOptions/LayoutOptions.d.ts +2 -1
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -2
- package/src/Api/AdaptableApi.d.ts +2 -5
- package/src/Api/ColumnApi.d.ts +8 -2
- package/src/Api/ConfigApi.d.ts +0 -5
- package/src/Api/ExportApi.d.ts +6 -6
- package/src/Api/FormatColumnApi.d.ts +46 -73
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -2
- package/src/Api/Implementation/AdaptableApiImpl.js +2 -3
- package/src/Api/Implementation/AlertApiImpl.js +9 -4
- package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -1
- package/src/Api/Implementation/ColumnApiImpl.js +15 -11
- package/src/Api/Implementation/ConfigApiImpl.d.ts +0 -2
- package/src/Api/Implementation/ConfigApiImpl.js +0 -11
- package/src/Api/Implementation/ExportApiImpl.d.ts +4 -4
- package/src/Api/Implementation/ExportApiImpl.js +14 -14
- package/src/Api/Implementation/FlashingCellApiImpl.js +4 -1
- package/src/Api/Implementation/FormatColumnApiImpl.d.ts +24 -22
- package/src/Api/Implementation/FormatColumnApiImpl.js +57 -224
- package/src/Api/Implementation/InternalApiImpl.d.ts +1 -1
- package/src/Api/Implementation/InternalApiImpl.js +4 -3
- package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +2 -1
- package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -15
- package/src/Api/Implementation/ScopeApiImpl.d.ts +1 -1
- package/src/Api/Implementation/StyledColumnApiImpl.d.ts +25 -0
- package/src/Api/Implementation/StyledColumnApiImpl.js +193 -0
- package/src/Api/InternalApi.d.ts +1 -1
- package/src/Api/QueryLanguageApi.d.ts +3 -2
- package/src/Api/ScopeApi.d.ts +1 -1
- package/src/Api/StyledColumnApi.d.ts +106 -0
- package/src/Api/{ConditionalStyleApi.js → StyledColumnApi.js} +0 -0
- package/src/PredefinedConfig/AdaptableState.d.ts +2 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/Types.d.ts +3 -3
- package/src/PredefinedConfig/Common/Types.js +1 -0
- package/src/PredefinedConfig/FormatColumnState.d.ts +6 -90
- package/src/PredefinedConfig/PredefinedConfig.d.ts +5 -0
- package/src/PredefinedConfig/StyledColumnState.d.ts +119 -0
- package/src/{Strategy/Interface/IConditionalStyleModule.js → PredefinedConfig/StyledColumnState.js} +0 -0
- package/src/Redux/ActionsReducers/PluginsRedux.d.ts +4 -4
- package/src/Redux/ActionsReducers/PluginsRedux.js +5 -5
- package/src/Redux/ActionsReducers/StyledColumnRedux.d.ts +49 -0
- package/src/Redux/ActionsReducers/StyledColumnRedux.js +92 -0
- package/src/Redux/DeadRedux.d.ts +6 -0
- package/src/Redux/DeadRedux.js +19 -1
- package/src/Redux/Store/AdaptableStore.js +9 -8
- package/src/Strategy/ConditionalStyleModule.d.ts +2 -27
- package/src/Strategy/ConditionalStyleModule.js +0 -219
- package/src/Strategy/FormatColumnModule.d.ts +0 -2
- package/src/Strategy/FormatColumnModule.js +30 -221
- package/src/Strategy/LayoutModule.js +0 -4
- package/src/Strategy/StyledColumnModule.d.ts +24 -0
- package/src/Strategy/StyledColumnModule.js +165 -0
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +1 -16
- package/src/Strategy/Utilities/getScopeViewItems.js +1 -1
- package/src/Utilities/Constants/ModuleConstants.d.ts +3 -0
- package/src/Utilities/Constants/ModuleConstants.js +4 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -3
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -1
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -4
- package/src/Utilities/ObjectFactory.d.ts +5 -2
- package/src/Utilities/ObjectFactory.js +14 -6
- package/src/Utilities/Services/ModuleService.js +2 -2
- package/src/Utilities/Services/QueryLanguageService.js +1 -1
- package/src/Utilities/Services/ReportService.js +6 -6
- package/src/View/AdaptablePopover/index.js +1 -1
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +15 -14
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +24 -1
- package/src/View/Alert/Wizard/AlertDisplayWizardSection.js +6 -5
- package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +3 -3
- package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +3 -3
- package/src/View/Alert/Wizard/isValidAlertRules.js +1 -1
- package/src/View/BulkUpdate/BulkUpdatePopup.js +1 -1
- package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
- package/src/View/Components/AdaptableObjectRow/index.js +1 -6
- package/src/View/Components/Buttons/ButtonInfo.d.ts +1 -3
- package/src/View/Components/Buttons/ButtonInfo.js +3 -5
- package/src/View/Components/EntityRulesEditor/index.js +8 -17
- package/src/View/Components/FilterForm/FilterForm.js +11 -16
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
- package/src/View/Components/FilterForm/QuickFilterForm.js +7 -13
- package/src/View/Components/NewScopeComponent.js +3 -3
- package/src/View/Components/Panels/PanelWithButton.js +1 -5
- package/src/View/Components/Panels/PanelWithImage.js +1 -5
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -2
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.d.ts +1 -0
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +3 -16
- package/src/View/Components/Popups/AdaptablePopup/PopupPanel.js +1 -1
- package/src/View/Components/Popups/AdaptablePopupTeamSharing.js +5 -5
- package/src/View/Components/RangesComponent.d.ts +8 -1
- package/src/View/Components/RangesComponent.js +60 -24
- package/src/View/Components/ScopeComponent.js +6 -6
- package/src/View/Components/Selectors/ColumnSelector.d.ts +1 -0
- package/src/View/Components/Selectors/ColumnSelector.js +2 -1
- package/src/View/Components/Selectors/ColumnValueSelector.js +2 -2
- package/src/View/Components/StyleComponent.js +14 -19
- package/src/View/Components/ToolPanel/AdaptableToolPanel.d.ts +1 -11
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +21 -9
- package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
- package/src/View/Components/ToolPanel/ToolPanelPopup.d.ts +1 -1
- package/src/View/Dashboard/DashboardPopup.js +1 -1
- package/src/View/DataSet/DataSetSelector.js +1 -1
- package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
- package/src/View/Export/ExportViewPanel.d.ts +1 -1
- package/src/View/Export/ExportViewPanel.js +4 -4
- package/src/View/Export/ReportExportDropdown.js +1 -1
- package/src/View/Export/Wizard/ReportNameWizardSection.js +10 -11
- package/src/View/Filter/FilterSummary.d.ts +1 -1
- package/src/View/Filter/FilterViewPanel.d.ts +1 -1
- package/src/View/FlashingCell/FlashingCellStyle.js +3 -3
- package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +3 -3
- package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +6 -6
- package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +4 -4
- package/src/View/FormatColumn/FormatColumnSummary.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +27 -27
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +4 -5
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +2 -6
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -3
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +6 -300
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -10
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +7 -7
- package/src/View/GridInfo/ColumnInfoComponent.js +26 -18
- package/src/View/GridInfo/GridInfoPopup.js +10 -9
- package/src/View/Layout/LayoutRadioSelector.js +1 -1
- package/src/View/Layout/LayoutViewPanel.d.ts +1 -1
- package/src/View/Layout/Wizard/Components/ColumnLabels.js +1 -1
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +7 -6
- package/src/View/Layout/Wizard/sections/SettingsSection.js +2 -2
- package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +1 -1
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +3 -3
- package/src/View/Query/QueryViewPanel.d.ts +1 -1
- package/src/View/Query/Wizard/NamedQuerySettingsWizardSection.js +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.js +2 -2
- package/src/View/QuickSearch/QuickSearchViewPanel.d.ts +1 -1
- package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +5 -5
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsGlue42.js +1 -1
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsIPushPull.js +5 -5
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsOpenFin.js +1 -1
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +5 -5
- package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +2 -2
- package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +3 -3
- package/src/View/SmartEdit/SmartEditPopup.js +3 -3
- package/src/View/SpecialColumnSettingsWizardStep.js +10 -10
- package/src/View/StateManagement/StateManagementPopup.js +4 -4
- package/src/View/StatusBar/StatusBarPopup.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.d.ts +7 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +77 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +65 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.js +234 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.d.ts +7 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +59 -0
- package/src/View/SystemStatus/SystemStatusEntityRow.js +4 -6
- package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
- package/src/View/TeamSharing/SharedEntityObjectView.js +1 -1
- package/src/View/TeamSharing/TeamSharingApplyButton.js +1 -1
- package/src/View/Theme/ThemePopup.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +1 -2
- package/src/agGrid/ActionColumnRenderer.d.ts +2 -0
- package/src/agGrid/ActionColumnRenderer.js +94 -62
- package/src/agGrid/Adaptable.d.ts +10 -11
- package/src/agGrid/Adaptable.js +164 -222
- package/src/agGrid/CheckboxRenderer.js +1 -1
- package/src/agGrid/FilterWrapper.js +60 -16
- package/src/agGrid/FloatingFilterWrapper.d.ts +2 -2
- package/src/agGrid/FloatingFilterWrapper.js +71 -32
- package/src/agGrid/PercentBarRenderer.d.ts +6 -2
- package/src/agGrid/PercentBarRenderer.js +19 -17
- package/src/agGrid/agGridHelper.d.ts +6 -2
- package/src/agGrid/agGridHelper.js +17 -17
- package/src/agGrid/createAgStatusPanelComponent.d.ts +1 -1
- package/src/agGrid/createAgStatusPanelComponent.js +17 -0
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -1
- package/src/agGrid/editors/AdaptableDateEditor/index.js +84 -17
- package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -3
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +78 -27
- package/src/agGrid/weightedAverage.js +19 -11
- package/src/components/CheckBox/index.js +7 -2
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/DragAndDropContext/TabList.js +1 -1
- package/src/components/DragAndDropContext/UnusedPanel.js +3 -2
- package/src/components/ExpressionEditor/BaseEditorInput.js +13 -32
- package/src/components/ExpressionEditor/index.js +9 -17
- package/src/components/FormLayout/index.js +1 -1
- package/src/components/StylePreview.js +2 -1
- package/src/components/icons/brush.d.ts +3 -0
- package/src/components/icons/brush.js +7 -0
- package/src/components/icons/index.js +2 -0
- package/src/metamodel/adaptable.metamodel.d.ts +113 -57
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/renderReactRoot.d.ts +2 -0
- package/src/renderReactRoot.js +11 -9
- package/src/types.d.ts +5 -5
- package/themes/dark.css +8 -4
- package/themes/dark.css.map +1 -0
- package/themes/light.css +4 -1
- package/themes/light.css.map +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/AdaptableComponents.d.ts +0 -1
- package/src/AdaptableComponents.js +0 -5
- package/src/Api/ConditionalStyleApi.d.ts +0 -86
- package/src/Api/Implementation/ConditionalStyleApiImpl.d.ts +0 -29
- package/src/Api/Implementation/ConditionalStyleApiImpl.js +0 -98
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +0 -49
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +0 -95
- package/src/Strategy/Interface/IConditionalStyleModule.d.ts +0 -6
- package/src/Strategy/Utilities/getStyleViewItems.d.ts +0 -2
- package/src/Strategy/Utilities/getStyleViewItems.js +0 -16
- package/src/View/ConditionalStyle/ConditionalStylePopupHeader.d.ts +0 -2
- package/src/View/ConditionalStyle/ConditionalStylePopupHeader.js +0 -18
- package/src/View/ConditionalStyle/ConditionalStyleSummary.d.ts +0 -25
- package/src/View/ConditionalStyle/ConditionalStyleSummary.js +0 -108
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.d.ts +0 -9
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +0 -42
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleScopeWizardSection.d.ts +0 -8
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleScopeWizardSection.js +0 -43
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.d.ts +0 -8
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.js +0 -29
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleStyleWizardSection.d.ts +0 -8
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleStyleWizardSection.js +0 -23
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.d.ts +0 -6
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.js +0 -114
- package/src/View/ConditionalStyle/Wizard/DEFAULT_PREDICATE_ID_FOR_CONDITIONAL_STYLE.d.ts +0 -1
- package/src/View/ConditionalStyle/Wizard/DEFAULT_PREDICATE_ID_FOR_CONDITIONAL_STYLE.js +0 -4
|
@@ -30,7 +30,7 @@ const getCheckboxRendererForColumn = (columnId, isColumnReadOnly, api) => {
|
|
|
30
30
|
CheckboxRenderer.prototype.checkedHandler = function (e) {
|
|
31
31
|
let checked = e.target.checked;
|
|
32
32
|
this.params.node.setDataValue(columnId, checked);
|
|
33
|
-
api.
|
|
33
|
+
api.styledColumnApi.fireCheckboxColumnClickedEvent(columnId, this.params.node.data, api.gridApi.getPrimaryKeyValueForRowNode(this.params.node), checked);
|
|
34
34
|
};
|
|
35
35
|
CheckboxRenderer.prototype.suppressEditEvent = function (event) {
|
|
36
36
|
if (event.target === this.eGui) {
|
|
@@ -1,26 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FilterWrapperFactory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_1 = require("react");
|
|
4
7
|
const FilterForm_1 = require("../View/Components/FilterForm/FilterForm");
|
|
5
8
|
let FilterWrapperFactory = (adaptable) => {
|
|
9
|
+
function isFilterActive(colId) {
|
|
10
|
+
// we need this here
|
|
11
|
+
if (adaptable.isDestroyed) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
//make the small filter icon to appear when there is a filter
|
|
15
|
+
return adaptable.api.filterApi.getColumnFilters().findIndex((x) => x.ColumnId == colId) > -1;
|
|
16
|
+
}
|
|
17
|
+
function getFilterContext(colId, hidePopup) {
|
|
18
|
+
let column = adaptable.api.columnApi.getColumnFromId(colId);
|
|
19
|
+
let filterContext = {
|
|
20
|
+
Column: column,
|
|
21
|
+
Adaptable: adaptable,
|
|
22
|
+
ShowCloseButton: hidePopup,
|
|
23
|
+
};
|
|
24
|
+
return filterContext;
|
|
25
|
+
}
|
|
26
|
+
function getContainerId(colId) {
|
|
27
|
+
return 'filter_' + colId + '_' + adaptable.adaptableOptions.adaptableId;
|
|
28
|
+
}
|
|
29
|
+
if (adaptable.variant === 'react') {
|
|
30
|
+
return (0, react_1.forwardRef)(function ReactFilterWrapper(props, ref) {
|
|
31
|
+
const [filterContext, setFilterContext] = (0, react_1.useState)(null);
|
|
32
|
+
const colId = props.column.getId();
|
|
33
|
+
const column = adaptable.api.columnApi.getColumnFromId(colId);
|
|
34
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
35
|
+
return {
|
|
36
|
+
isFilterActive: () => isFilterActive(colId),
|
|
37
|
+
afterGuiAttached: (params) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const hidePopup = (_a = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _a !== void 0 ? _a : null;
|
|
40
|
+
const filterContext = getFilterContext(colId, !!hidePopup);
|
|
41
|
+
adaptable.hideFilterFormPopup = hidePopup;
|
|
42
|
+
setFilterContext(filterContext);
|
|
43
|
+
},
|
|
44
|
+
getModel: () => { },
|
|
45
|
+
setModel: () => { },
|
|
46
|
+
//we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
|
|
47
|
+
doesFilterPass: () => true,
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
if (!column || !filterContext) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return React.createElement("div", { id: getContainerId(colId) }, (0, FilterForm_1.FilterFormReact)(filterContext));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
6
56
|
return class FilterWrapper {
|
|
7
57
|
init(params) {
|
|
8
58
|
this.params = params;
|
|
9
59
|
this.column = params.column;
|
|
10
60
|
this.filterContainer = document.createElement('div');
|
|
11
|
-
this.filterContainer.id =
|
|
12
|
-
'filter_' + this.params.column.getColId() + '_' + adaptable.adaptableOptions.adaptableId;
|
|
13
|
-
}
|
|
14
|
-
isFilterActive() {
|
|
15
|
-
//make the small filter icon to appear when there is a filter
|
|
16
|
-
return (adaptable.api.filterApi
|
|
17
|
-
.getColumnFilters()
|
|
18
|
-
.findIndex((x) => x.ColumnId == this.params.column.getColId()) > -1);
|
|
61
|
+
this.filterContainer.id = getContainerId(this.params.column.getColId());
|
|
19
62
|
}
|
|
20
63
|
doesFilterPass(params) {
|
|
21
64
|
//we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
|
|
22
65
|
return true;
|
|
23
66
|
}
|
|
67
|
+
isFilterActive() {
|
|
68
|
+
return isFilterActive(this.params.column.getColId());
|
|
69
|
+
}
|
|
24
70
|
getModel() {
|
|
25
71
|
//
|
|
26
72
|
}
|
|
@@ -31,22 +77,20 @@ let FilterWrapperFactory = (adaptable) => {
|
|
|
31
77
|
return this.filterContainer;
|
|
32
78
|
}
|
|
33
79
|
afterGuiAttached(params) {
|
|
34
|
-
var _a;
|
|
80
|
+
var _a, _b;
|
|
35
81
|
//we always unmount first so the autofocus from the form works... in other grids we unmount when hidden
|
|
36
82
|
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
37
83
|
let column = adaptable.api.columnApi.getColumnFromId(this.column.getColId());
|
|
38
84
|
if (column) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ShowCloseButton: params != null && params.hidePopup != null,
|
|
43
|
-
};
|
|
44
|
-
adaptable.hideFilterFormPopup = params ? params.hidePopup : null;
|
|
85
|
+
const hidePopup = (_b = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _b !== void 0 ? _b : null;
|
|
86
|
+
const filterContext = getFilterContext(this.column.getColId(), !!hidePopup);
|
|
87
|
+
adaptable.hideFilterFormPopup = hidePopup;
|
|
45
88
|
this.unmountReactRoot = adaptable.renderReactRoot((0, FilterForm_1.FilterFormReact)(filterContext), this.filterContainer);
|
|
46
89
|
}
|
|
47
90
|
}
|
|
48
91
|
destroy() {
|
|
49
|
-
|
|
92
|
+
var _a;
|
|
93
|
+
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
50
94
|
this.filterContainer = null;
|
|
51
95
|
}
|
|
52
96
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const FloatingFilterWrapperFactory: (adaptable:
|
|
1
|
+
import { IAdaptable } from '../AdaptableInterfaces/IAdaptable';
|
|
2
|
+
export declare const FloatingFilterWrapperFactory: (adaptable: IAdaptable) => any;
|
|
@@ -1,43 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FloatingFilterWrapperFactory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_1 = require("react");
|
|
4
7
|
const QuickFilterForm_1 = require("../View/Components/FilterForm/QuickFilterForm");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const filterContainerStyle = {
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
minWidth: '0',
|
|
11
|
+
height: '100%',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'stretch',
|
|
14
|
+
position: 'relative',
|
|
15
|
+
};
|
|
16
|
+
const FloatingFilterWrapperFactory = (adaptable) => {
|
|
17
|
+
function getContainerId(colId) {
|
|
18
|
+
return `floatingFilter_${colId}_${adaptable.adaptableOptions.adaptableId}`;
|
|
13
19
|
}
|
|
14
|
-
|
|
15
|
-
const colId = params.column.getColId();
|
|
16
|
-
this.filterContainer = document.createElement('div');
|
|
17
|
-
this.filterContainer.id = `floatingFilter_${colId}_${adaptable.adaptableOptions.adaptableId}`;
|
|
18
|
-
this.filterContainer.style.overflow = 'hidden';
|
|
19
|
-
this.filterContainer.style.minWidth = '0';
|
|
20
|
-
this.filterContainer.style.height = '100%';
|
|
21
|
-
this.filterContainer.style.display = 'flex';
|
|
22
|
-
this.filterContainer.style.alignItems = 'stretch';
|
|
23
|
-
this.filterContainer.style.position = 'relative';
|
|
20
|
+
function getFilterContext(colId) {
|
|
24
21
|
const column = adaptable.api.columnApi.getColumnFromId(colId);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.unmountReactRoot = adaptable.renderReactRoot((0, QuickFilterForm_1.QuickFilterFormReact)(filterContext), this.filterContainer);
|
|
32
|
-
}
|
|
22
|
+
const filterContext = {
|
|
23
|
+
Column: column,
|
|
24
|
+
Adaptable: adaptable,
|
|
25
|
+
ShowCloseButton: false,
|
|
26
|
+
};
|
|
27
|
+
return filterContext;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
function patchParentElement(filterContainer) {
|
|
30
|
+
if (filterContainer) {
|
|
31
|
+
// todo: consider theme
|
|
32
|
+
filterContainer.parentElement.style.overflow = 'visible';
|
|
33
|
+
filterContainer.parentElement.parentElement.style.padding = 'var(--ab-space-1)';
|
|
34
|
+
}
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
if (adaptable.variant === 'react') {
|
|
37
|
+
return (0, react_1.forwardRef)(function ReactFloatingFilterWrapper(props, ref) {
|
|
38
|
+
const colId = props.column.getId();
|
|
39
|
+
const column = adaptable.api.columnApi.getColumnFromId(colId);
|
|
40
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
41
|
+
return {
|
|
42
|
+
onParentModelChanged() { },
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
if (!column) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return (React.createElement("div", { ref: patchParentElement, id: getContainerId(colId), style: filterContainerStyle }, (0, QuickFilterForm_1.QuickFilterFormReact)(getFilterContext(colId))));
|
|
49
|
+
});
|
|
41
50
|
}
|
|
51
|
+
return class FloatingFilterWrapper {
|
|
52
|
+
onParentModelChanged(parentModel, filterChangedEvent) {
|
|
53
|
+
// todo?
|
|
54
|
+
}
|
|
55
|
+
afterGuiAttached() {
|
|
56
|
+
patchParentElement(this.filterContainer);
|
|
57
|
+
}
|
|
58
|
+
init(params) {
|
|
59
|
+
const colId = params.column.getColId();
|
|
60
|
+
this.filterContainer = document.createElement('div');
|
|
61
|
+
this.filterContainer.id = getContainerId(colId);
|
|
62
|
+
Object.keys(filterContainerStyle).forEach((key) => {
|
|
63
|
+
//@ts-ignore
|
|
64
|
+
this.filterContainer.style[key] = filterContainerStyle[key];
|
|
65
|
+
});
|
|
66
|
+
const column = adaptable.api.columnApi.getColumnFromId(colId);
|
|
67
|
+
if (column) {
|
|
68
|
+
const filterContext = getFilterContext(colId);
|
|
69
|
+
this.unmountReactRoot = adaptable.renderReactRoot((0, QuickFilterForm_1.QuickFilterFormReact)(filterContext), this.filterContainer);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
getGui() {
|
|
73
|
+
return this.filterContainer;
|
|
74
|
+
}
|
|
75
|
+
destroy() {
|
|
76
|
+
var _a;
|
|
77
|
+
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
78
|
+
this.filterContainer = null;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
42
81
|
};
|
|
43
82
|
exports.FloatingFilterWrapperFactory = FloatingFilterWrapperFactory;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GradientStyle, PercentBarStyle } from '../PredefinedConfig/StyledColumnState';
|
|
2
2
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
3
|
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
4
|
-
export declare const getPercentBarRendererForColumn: (
|
|
4
|
+
export declare const getPercentBarRendererForColumn: (columnStyle: {
|
|
5
|
+
GradientStyle?: GradientStyle;
|
|
6
|
+
PercentBarStyle?: PercentBarStyle;
|
|
7
|
+
CheckBoxStyle?: boolean;
|
|
8
|
+
}, abColumn: AdaptableColumn, api: AdaptableApi) => any;
|
|
@@ -4,19 +4,15 @@ exports.getPercentBarRendererForColumn = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
|
|
6
6
|
const clamp_1 = tslib_1.__importDefault(require("lodash/clamp"));
|
|
7
|
-
const FormatHelper_1 =
|
|
8
|
-
const getPercentBarRendererForColumn = (
|
|
9
|
-
|
|
10
|
-
if (!((_a = formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle) === null || _a === void 0 ? void 0 : _a.PercentBarStyle)) {
|
|
7
|
+
const FormatHelper_1 = require("../Utilities/Helpers/FormatHelper");
|
|
8
|
+
const getPercentBarRendererForColumn = (columnStyle, abColumn, api) => {
|
|
9
|
+
if (!columnStyle.PercentBarStyle) {
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
13
12
|
return class PercentBarRenderer {
|
|
14
13
|
init(params) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
const min = api.formatColumnApi.getNumericStyleMinValue(formatColumn.ColumnStyle, abColumn, params.node, params.value);
|
|
19
|
-
const max = api.formatColumnApi.getNumericStyleMaxValue(formatColumn.ColumnStyle, abColumn, params.node, params.value);
|
|
14
|
+
const min = api.styledColumnApi.getNumericStyleMinValue(columnStyle, abColumn, params.node, params.value);
|
|
15
|
+
const max = api.styledColumnApi.getNumericStyleMaxValue(columnStyle, abColumn, params.node, params.value);
|
|
20
16
|
let value = params.value;
|
|
21
17
|
if (Helper_1.default.objectNotExists(value)) {
|
|
22
18
|
value = 0;
|
|
@@ -24,12 +20,16 @@ const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
|
|
|
24
20
|
const clampedValue = (0, clamp_1.default)(value, min, max);
|
|
25
21
|
const percentageValue = ((clampedValue - min) / (max - min)) * 100;
|
|
26
22
|
let cellBackColor;
|
|
27
|
-
const percentBarStyle =
|
|
23
|
+
const percentBarStyle = columnStyle.PercentBarStyle;
|
|
28
24
|
if (percentBarStyle.ColumnComparison) {
|
|
29
25
|
cellBackColor = percentBarStyle.ColumnComparison.Color;
|
|
30
26
|
}
|
|
31
27
|
else {
|
|
32
|
-
const matchingRange = percentBarStyle.CellRanges.find((r) =>
|
|
28
|
+
const matchingRange = percentBarStyle.CellRanges.find((r) => {
|
|
29
|
+
const rMin = r.Min === 'Col-Min' ? min : r.Min;
|
|
30
|
+
const rMax = r.Max === 'Col-Max' ? max : r.Max;
|
|
31
|
+
return rMin <= clampedValue && rMax >= clampedValue;
|
|
32
|
+
});
|
|
33
33
|
if (matchingRange) {
|
|
34
34
|
cellBackColor = matchingRange.Color;
|
|
35
35
|
}
|
|
@@ -57,12 +57,14 @@ const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
|
|
|
57
57
|
textEl.className = 'ab-PercentBar__text';
|
|
58
58
|
textEl.style.lineHeight = '1.2';
|
|
59
59
|
if (percentBarStyle.CellText.includes('CellValue')) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
const activeFormatColumnsWithDisplayFormat = api.formatColumnApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
|
|
61
|
+
const [formatColumn] = api.formatColumnApi.getFormatColumnsRelevantForColumn(activeFormatColumnsWithDisplayFormat, abColumn, { node: params.node, value });
|
|
62
|
+
if (formatColumn && api.scopeApi.isColumnInNumericScope(abColumn, formatColumn.Scope)) {
|
|
63
|
+
const options = formatColumn.DisplayFormat.Options;
|
|
64
|
+
value = api.formatColumnApi.getNumberFormattedValue(params.value, params.node, abColumn, options);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
value = (0, FormatHelper_1.NumberFormatter)(value, { FractionDigits: 2 });
|
|
66
68
|
}
|
|
67
69
|
textEl.innerText = value;
|
|
68
70
|
}
|
|
@@ -5,7 +5,7 @@ import { AdaptableNodeComparerFunction } from '../PredefinedConfig/Common/Adapta
|
|
|
5
5
|
import { AdaptableColumnType, AdaptableModule } from '../PredefinedConfig/Common/Types';
|
|
6
6
|
import { IModule } from '../Strategy/Interface/IModule';
|
|
7
7
|
import { IPPStyle } from '../Utilities/Interface/IPPStyle';
|
|
8
|
-
import {
|
|
8
|
+
import { GradientStyle, PercentBarStyle } from '../PredefinedConfig/StyledColumnState';
|
|
9
9
|
/**
|
|
10
10
|
* Adaptable AG Grid implementation is getting really big and unwieldy
|
|
11
11
|
* So lets put some of the more obvious 'Helper' functions here
|
|
@@ -22,7 +22,11 @@ export declare class agGridHelper {
|
|
|
22
22
|
setUpModules(): Map<AdaptableModule, IModule>;
|
|
23
23
|
TrySetUpNodeIds(hasAutogeneratedPrimaryKey: boolean): boolean;
|
|
24
24
|
createCheckboxRendererComp(columnId: string, isColumnReadOnly: boolean): ICellRendererFunc | undefined;
|
|
25
|
-
createPercentBarRendererComp(
|
|
25
|
+
createPercentBarRendererComp(columnStyle: {
|
|
26
|
+
GradientStyle?: GradientStyle;
|
|
27
|
+
PercentBarStyle?: PercentBarStyle;
|
|
28
|
+
CheckBoxStyle?: boolean;
|
|
29
|
+
}, abColumn: AdaptableColumn): ICellRendererFunc;
|
|
26
30
|
getCleanValue(value: string): string | undefined;
|
|
27
31
|
getRenderedValue(colDef: ColDef, valueToRender: any): any;
|
|
28
32
|
createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
|
|
@@ -7,7 +7,6 @@ const AlertModule_1 = require("../Strategy/AlertModule");
|
|
|
7
7
|
const BulkUpdateModule_1 = require("../Strategy/BulkUpdateModule");
|
|
8
8
|
const CalculatedColumnModule_1 = require("../Strategy/CalculatedColumnModule");
|
|
9
9
|
const CellSummaryModule_1 = require("../Strategy/CellSummaryModule");
|
|
10
|
-
const ConditionalStyleModule_1 = require("../Strategy/ConditionalStyleModule");
|
|
11
10
|
const CustomSortModule_1 = require("../Strategy/CustomSortModule");
|
|
12
11
|
const DashboardModule_1 = require("../Strategy/DashboardModule");
|
|
13
12
|
const DataSetModule_1 = require("../Strategy/DataSetModule");
|
|
@@ -43,6 +42,7 @@ const StatusBarModule_1 = require("../Strategy/StatusBarModule");
|
|
|
43
42
|
const GeneralConstants = tslib_1.__importStar(require("../Utilities/Constants/GeneralConstants"));
|
|
44
43
|
const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
|
|
45
44
|
const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
|
|
45
|
+
const StyledColumnModule_1 = require("../Strategy/StyledColumnModule");
|
|
46
46
|
const tinycolor = require('tinycolor2');
|
|
47
47
|
/**
|
|
48
48
|
* Adaptable AG Grid implementation is getting really big and unwieldy
|
|
@@ -80,7 +80,7 @@ class agGridHelper {
|
|
|
80
80
|
modules.set(ModuleConstants.BulkUpdateModuleId, new BulkUpdateModule_1.BulkUpdateModule(api));
|
|
81
81
|
modules.set(ModuleConstants.CalculatedColumnModuleId, new CalculatedColumnModule_1.CalculatedColumnModule(api));
|
|
82
82
|
modules.set(ModuleConstants.CellSummaryModuleId, new CellSummaryModule_1.CellSummaryModule(api));
|
|
83
|
-
modules.set(ModuleConstants.ConditionalStyleModuleId, new
|
|
83
|
+
// modules.set(ModuleConstants.ConditionalStyleModuleId, new ConditionalStyleModule(api));
|
|
84
84
|
modules.set(ModuleConstants.CustomSortModuleId, new CustomSortModule_1.CustomSortModule(api));
|
|
85
85
|
modules.set(ModuleConstants.DataChangeHistoryModuleId, new DataChangeHistoryModule_1.DataChangeHistoryModule(api));
|
|
86
86
|
modules.set(ModuleConstants.DataSetModuleId, new DataSetModule_1.DataSetModule(api));
|
|
@@ -104,6 +104,7 @@ class agGridHelper {
|
|
|
104
104
|
modules.set(ModuleConstants.SettingsPanelModuleId, new SettingsPanelModule_1.SettingsPanelModule(api));
|
|
105
105
|
modules.set(ModuleConstants.StatusBarModuleId, new StatusBarModule_1.StatusBarModule(api));
|
|
106
106
|
modules.set(ModuleConstants.ChartingModuleId, new ChartingModule_1.ChartingModule(api));
|
|
107
|
+
modules.set(ModuleConstants.StyledColumnModuleId, new StyledColumnModule_1.StyledColumnModule(api));
|
|
107
108
|
return modules;
|
|
108
109
|
}
|
|
109
110
|
TrySetUpNodeIds(hasAutogeneratedPrimaryKey) {
|
|
@@ -150,8 +151,8 @@ class agGridHelper {
|
|
|
150
151
|
createCheckboxRendererComp(columnId, isColumnReadOnly) {
|
|
151
152
|
return (0, CheckboxRenderer_1.getCheckboxRendererForColumn)(columnId, isColumnReadOnly, this.adaptable.api);
|
|
152
153
|
}
|
|
153
|
-
createPercentBarRendererComp(
|
|
154
|
-
return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(
|
|
154
|
+
createPercentBarRendererComp(columnStyle, abColumn) {
|
|
155
|
+
return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(columnStyle, abColumn, this.adaptable.api);
|
|
155
156
|
}
|
|
156
157
|
getCleanValue(value) {
|
|
157
158
|
if (value == null || value == 'null' || value == undefined || value == 'undefined') {
|
|
@@ -174,7 +175,7 @@ class agGridHelper {
|
|
|
174
175
|
const customFriendlyName = typeof columnFriendlyName === 'function'
|
|
175
176
|
? columnFriendlyName({ colId: colId, agColumn: agGridColumn })
|
|
176
177
|
: null;
|
|
177
|
-
const
|
|
178
|
+
const friendlyName = customFriendlyName !== null && customFriendlyName !== void 0 ? customFriendlyName : (isActionRowButtonColumn
|
|
178
179
|
? GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME
|
|
179
180
|
: this.gridOptions.columnApi.getDisplayNameForColumn(agGridColumn, 'header'));
|
|
180
181
|
if (!this.initialAgGridColDefs[colId]) {
|
|
@@ -183,13 +184,14 @@ class agGridHelper {
|
|
|
183
184
|
const ColumnId = colId;
|
|
184
185
|
const pkColumn = this.adaptable.adaptableOptions.primaryKey;
|
|
185
186
|
let ColumnGroup = colsToGroups === null || colsToGroups === void 0 ? void 0 : colsToGroups[ColumnId];
|
|
187
|
+
const dataType = this.getColumnDataType(agGridColumn, false);
|
|
186
188
|
const abColumn = {
|
|
187
189
|
Uuid: (0, Uuid_1.createUuid)(),
|
|
188
190
|
columnId: ColumnId,
|
|
189
191
|
field: colDef.field,
|
|
190
|
-
friendlyName:
|
|
192
|
+
friendlyName: friendlyName,
|
|
191
193
|
isPrimaryKey: ColumnId === pkColumn,
|
|
192
|
-
dataType:
|
|
194
|
+
dataType: dataType,
|
|
193
195
|
visible: agGridColumn.isVisible(),
|
|
194
196
|
readOnly: this.isColumnReadonly(colDef),
|
|
195
197
|
columnGroup: ColumnGroup,
|
|
@@ -202,7 +204,7 @@ class agGridHelper {
|
|
|
202
204
|
aggregationFunction: null,
|
|
203
205
|
moveable: this.isColumnMoveable(colDef),
|
|
204
206
|
hideable: this.isColumnHideable(colDef),
|
|
205
|
-
queryable: this.isColumnQueryable(colDef, ColumnId),
|
|
207
|
+
queryable: this.isColumnQueryable(colDef, ColumnId, friendlyName, dataType),
|
|
206
208
|
isGrouped: this.isColumnGrouped(colDef),
|
|
207
209
|
isFixed: this.isColumnFixed(colDef),
|
|
208
210
|
pinned: this.getColumnPinnedPosition(colDef),
|
|
@@ -316,21 +318,19 @@ class agGridHelper {
|
|
|
316
318
|
}
|
|
317
319
|
return true;
|
|
318
320
|
}
|
|
319
|
-
isColumnQueryable(colDef, columnId) {
|
|
321
|
+
isColumnQueryable(colDef, columnId, friendlyName, datatype) {
|
|
320
322
|
if (!colDef) {
|
|
321
323
|
return false;
|
|
322
324
|
}
|
|
323
325
|
if (colDef.colId === GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS) {
|
|
324
326
|
return false;
|
|
325
327
|
}
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
return queryableColumns.find((qc) => qc == columnId) != null;
|
|
328
|
+
const abColumnBase = {
|
|
329
|
+
columnId: columnId,
|
|
330
|
+
friendlyName: friendlyName,
|
|
331
|
+
dataType: datatype,
|
|
332
|
+
};
|
|
333
|
+
return this.adaptable.api.queryLanguageApi.isColumnQueryable(abColumnBase);
|
|
334
334
|
}
|
|
335
335
|
isColumnHideable(colDef) {
|
|
336
336
|
if (!colDef) {
|
|
@@ -9,7 +9,7 @@ export interface StatusPanelProps {
|
|
|
9
9
|
Key: string;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
export declare const createAgStatusPanelComponent: (component: React.FunctionComponent<StatusPanelProps>, adaptable: IAdaptable, context: StatusPanelProps['context']) => {
|
|
12
|
+
export declare const createAgStatusPanelComponent: (component: React.FunctionComponent<StatusPanelProps>, adaptable: IAdaptable, context: StatusPanelProps['context']) => ((props: IStatusPanelParams) => JSX.Element) | {
|
|
13
13
|
new (): {
|
|
14
14
|
params: IStatusPanelParams;
|
|
15
15
|
eGui: HTMLElement;
|
|
@@ -5,6 +5,23 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext");
|
|
7
7
|
const createAgStatusPanelComponent = (component, adaptable, context) => {
|
|
8
|
+
if (adaptable.variant === 'react') {
|
|
9
|
+
return (props) => {
|
|
10
|
+
const children = (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(component, {
|
|
11
|
+
params: props,
|
|
12
|
+
adaptableApi: adaptable.api,
|
|
13
|
+
context,
|
|
14
|
+
}), adaptable);
|
|
15
|
+
return (React.createElement("div", { className: "ab-StatusBar", ref: (node) => {
|
|
16
|
+
if (node) {
|
|
17
|
+
// in React rendering, ag-grid renders an additional extra div
|
|
18
|
+
// around the status panel container, with className of 'ag-react-container'
|
|
19
|
+
// which needs to be stretched in order to fill the status panel
|
|
20
|
+
node.parentElement.style.display = 'flex';
|
|
21
|
+
}
|
|
22
|
+
} }, children));
|
|
23
|
+
};
|
|
24
|
+
}
|
|
8
25
|
return class StatusBarRenderer {
|
|
9
26
|
init(params) {
|
|
10
27
|
this.params = params;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { ICellEditorParams, ICellEditorComp } from '@ag-grid-community/core';
|
|
2
3
|
import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
|
|
4
|
+
export declare const ReactAdaptableDateEditor: React.ForwardRefExoticComponent<ICellEditorParams<any, any> & {
|
|
5
|
+
showClearButton?: boolean;
|
|
6
|
+
} & React.RefAttributes<unknown>>;
|
|
3
7
|
/**
|
|
4
8
|
* Used by default for all `abColDefDate` columns.
|
|
5
9
|
*
|
|
@@ -38,5 +42,4 @@ export declare class AdaptableDateEditor implements ICellEditorComp {
|
|
|
38
42
|
getAdaptableInstance(params: ICellEditorParams): IAdaptable;
|
|
39
43
|
afterGuiAttached(): void;
|
|
40
44
|
destroy(): void;
|
|
41
|
-
private shouldClearExistingValue;
|
|
42
45
|
}
|
|
@@ -1,12 +1,88 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdaptableDateEditor = void 0;
|
|
3
|
+
exports.AdaptableDateEditor = exports.ReactAdaptableDateEditor = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
|
|
7
7
|
const InternalAdaptableDateEditor_1 = require("./InternalAdaptableDateEditor");
|
|
8
8
|
const core_1 = require("@ag-grid-community/core");
|
|
9
9
|
const FormatHelper_1 = require("../../../Utilities/Helpers/FormatHelper");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
function shouldClearExistingValue(params) {
|
|
12
|
+
return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
|
|
13
|
+
}
|
|
14
|
+
function getStartValue(params) {
|
|
15
|
+
return shouldClearExistingValue(params) ? '' : params.value;
|
|
16
|
+
}
|
|
17
|
+
const style = {
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
top: '0px',
|
|
20
|
+
left: '0px',
|
|
21
|
+
right: '0px',
|
|
22
|
+
bottom: '0px',
|
|
23
|
+
};
|
|
24
|
+
const defaultDateValueParser = ({ newValue, oldValue, defaultParser }) => {
|
|
25
|
+
if ((typeof oldValue === 'string' || oldValue == null) && defaultParser) {
|
|
26
|
+
return defaultParser(newValue);
|
|
27
|
+
}
|
|
28
|
+
return newValue;
|
|
29
|
+
};
|
|
30
|
+
exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const [initialValue] = (0, react_1.useState)(() => getStartValue(props));
|
|
33
|
+
const valueRef = (0, react_1.useRef)(initialValue);
|
|
34
|
+
const colValueParser = props.column.getColDef().valueParser;
|
|
35
|
+
const valueParser = typeof colValueParser === 'function' ? colValueParser : defaultDateValueParser;
|
|
36
|
+
const adaptable = props.api.__adaptable;
|
|
37
|
+
const editorRef = (0, react_1.useRef)(null);
|
|
38
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
39
|
+
return {
|
|
40
|
+
focusIn() {
|
|
41
|
+
var _a;
|
|
42
|
+
(_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
43
|
+
},
|
|
44
|
+
// the final value to send to the grid, on completion of editing
|
|
45
|
+
getValue() {
|
|
46
|
+
return valueRef.current;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: initialValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
|
|
51
|
+
const invalid = isNaN(+value);
|
|
52
|
+
if (valueParser) {
|
|
53
|
+
const params = Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value, defaultParser: (value) => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
const Pattern = (_b = (_a = adaptable.adaptableOptions.userInterfaceOptions) === null || _a === void 0 ? void 0 : _a.dateInputOptions) === null || _b === void 0 ? void 0 : _b.dateFormat;
|
|
56
|
+
if (!Pattern) {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
return (0, FormatHelper_1.DateFormatter)(value, {
|
|
60
|
+
Pattern,
|
|
61
|
+
});
|
|
62
|
+
} });
|
|
63
|
+
valueRef.current = valueParser(params);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
valueRef.current = invalid ? null : value;
|
|
67
|
+
}
|
|
68
|
+
if (!invalid) {
|
|
69
|
+
requestAnimationFrame(() => {
|
|
70
|
+
props.stopEditing();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}, showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true, onStopEdit: (keyboardEventKey) => {
|
|
74
|
+
if (keyboardEventKey === 'Escape') {
|
|
75
|
+
props.api.stopEditing(true);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
props.stopEditing();
|
|
79
|
+
}
|
|
80
|
+
}, ref: (editor) => {
|
|
81
|
+
editorRef.current = editor;
|
|
82
|
+
editor === null || editor === void 0 ? void 0 : editor.focus();
|
|
83
|
+
} }));
|
|
84
|
+
return React.createElement("div", { style: style }, (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable));
|
|
85
|
+
});
|
|
10
86
|
/**
|
|
11
87
|
* Used by default for all `abColDefDate` columns.
|
|
12
88
|
*
|
|
@@ -32,26 +108,20 @@ const FormatHelper_1 = require("../../../Utilities/Helpers/FormatHelper");
|
|
|
32
108
|
*/
|
|
33
109
|
class AdaptableDateEditor {
|
|
34
110
|
constructor() {
|
|
35
|
-
this.valueParser =
|
|
36
|
-
if ((typeof oldValue === 'string' || oldValue == null) && defaultParser) {
|
|
37
|
-
return defaultParser(newValue);
|
|
38
|
-
}
|
|
39
|
-
return newValue;
|
|
40
|
-
};
|
|
111
|
+
this.valueParser = defaultDateValueParser;
|
|
41
112
|
}
|
|
42
113
|
init(params) {
|
|
43
|
-
this.value =
|
|
114
|
+
this.value = getStartValue(params);
|
|
44
115
|
const { valueParser } = params.column.getColDef();
|
|
45
116
|
this.params = params;
|
|
46
117
|
if (typeof valueParser === 'function') {
|
|
47
118
|
this.valueParser = valueParser;
|
|
48
119
|
}
|
|
49
120
|
this.el = document.createElement('div');
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.el.style.bottom = '0px';
|
|
121
|
+
Object.keys(style).forEach((key) => {
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
this.el.style[key] = style[key];
|
|
124
|
+
});
|
|
55
125
|
}
|
|
56
126
|
/* Component Editor Lifecycle methods */
|
|
57
127
|
// gets called once when grid ready to insert the element
|
|
@@ -75,7 +145,7 @@ class AdaptableDateEditor {
|
|
|
75
145
|
afterGuiAttached() {
|
|
76
146
|
var _a;
|
|
77
147
|
const adaptable = this.getAdaptableInstance(this.params);
|
|
78
|
-
const defaultValue =
|
|
148
|
+
const defaultValue = shouldClearExistingValue(this.params) ? '' : this.params.value;
|
|
79
149
|
const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: defaultValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
|
|
80
150
|
const invalid = isNaN(+value);
|
|
81
151
|
if (this.valueParser) {
|
|
@@ -116,8 +186,5 @@ class AdaptableDateEditor {
|
|
|
116
186
|
var _a;
|
|
117
187
|
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
118
188
|
}
|
|
119
|
-
shouldClearExistingValue(params) {
|
|
120
|
-
return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
|
|
121
|
-
}
|
|
122
189
|
}
|
|
123
190
|
exports.AdaptableDateEditor = AdaptableDateEditor;
|
|
@@ -22,7 +22,7 @@ const inputStyle = {
|
|
|
22
22
|
width: '100%',
|
|
23
23
|
border: 'none',
|
|
24
24
|
};
|
|
25
|
-
exports.InternalAdaptableNumberEditor = React.forwardRef((props, ref)
|
|
25
|
+
exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdaptableNumberEditorFn(props, ref) {
|
|
26
26
|
var _a;
|
|
27
27
|
const inputRef = React.useRef(null);
|
|
28
28
|
const focus = () => {
|