@adaptabletools/adaptable 13.0.0-canary.16 → 13.0.0-canary.17
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/bundle.cjs.js +140 -140
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/Api/StyledColumnApi.d.ts +27 -13
- package/src/PredefinedConfig/StyledColumnState.d.ts +10 -4
- package/src/Strategy/ConditionalStyleModule.d.ts +0 -2
- package/src/Strategy/ConditionalStyleModule.js +1 -27
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.js +1 -11
- package/src/agGrid/ActionColumnRenderer.d.ts +2 -0
- package/src/agGrid/ActionColumnRenderer.js +94 -62
- package/src/agGrid/Adaptable.js +2 -2
- package/src/agGrid/PercentBarRenderer.js +13 -0
- package/src/metamodel/adaptable.metamodel.d.ts +7 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "13.0.0-canary.
|
|
3
|
+
"version": "13.0.0-canary.17",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1663843348593;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -2,19 +2,9 @@ import { RowNode } from '@ag-grid-community/core/dist/cjs/es5/entities/rowNode';
|
|
|
2
2
|
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
3
3
|
import { StyledColumnState, StyledColumn, CellColorRange, ColumnComparison } from '../PredefinedConfig/StyledColumnState';
|
|
4
4
|
/**
|
|
5
|
-
* Provides run-time access to
|
|
5
|
+
* Provides run-time access to Styled Column Module and associated state
|
|
6
6
|
*/
|
|
7
7
|
export interface StyledColumnApi {
|
|
8
|
-
/**
|
|
9
|
-
* Delete styled column
|
|
10
|
-
* @param styledColumn
|
|
11
|
-
*/
|
|
12
|
-
deleteStyledColumn(styledColumn: StyledColumn): void;
|
|
13
|
-
/**
|
|
14
|
-
* Create a styled column
|
|
15
|
-
* @param styledColumn
|
|
16
|
-
*/
|
|
17
|
-
addStyledColumn(styledColumn: StyledColumn): void;
|
|
18
8
|
/**
|
|
19
9
|
* Retrieves Styled Column section from Adaptable State
|
|
20
10
|
*/
|
|
@@ -48,6 +38,16 @@ export interface StyledColumnApi {
|
|
|
48
38
|
* @returns Styled Columns
|
|
49
39
|
*/
|
|
50
40
|
getAllSuspendedStyledColumn(): StyledColumn[];
|
|
41
|
+
/**
|
|
42
|
+
* Delete a Styled column
|
|
43
|
+
* @param styledColumn
|
|
44
|
+
*/
|
|
45
|
+
deleteStyledColumn(styledColumn: StyledColumn): void;
|
|
46
|
+
/**
|
|
47
|
+
* Create a Styled column
|
|
48
|
+
* @param styledColumn
|
|
49
|
+
*/
|
|
50
|
+
addStyledColumn(styledColumn: StyledColumn): void;
|
|
51
51
|
/**
|
|
52
52
|
* Gets the Minimum Value to display for a Styled Column
|
|
53
53
|
* @param styledColumn Styled Column to check
|
|
@@ -62,13 +62,23 @@ export interface StyledColumnApi {
|
|
|
62
62
|
* @param cellValue current Cell Value
|
|
63
63
|
*/
|
|
64
64
|
getNumericStyleMaxValue(styledColumn: Omit<StyledColumn, 'ColumnId'>, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the smallest number in a Range
|
|
67
|
+
* @param range Range to check
|
|
68
|
+
* @param column current Column
|
|
69
|
+
*/
|
|
65
70
|
getCellColorRangeMinValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the largest number in a Range
|
|
73
|
+
* @param range Range to check
|
|
74
|
+
* @param column current Column
|
|
75
|
+
*/
|
|
66
76
|
getCellColorRangeMaxValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
|
|
67
77
|
/**
|
|
68
78
|
* Retrieves the ColumnComparison property, if there, from a Styled Column
|
|
69
|
-
* @param
|
|
79
|
+
* @param styledColumn Styled Column to Add
|
|
70
80
|
*/
|
|
71
|
-
getColumnComparisonForStyledColumn(
|
|
81
|
+
getColumnComparisonForStyledColumn(styledColumn: StyledColumn): ColumnComparison | undefined;
|
|
72
82
|
/**
|
|
73
83
|
* Returns any ColumnIds referenced in a Column Comparison
|
|
74
84
|
* @param columnComparision Column Comparison to check
|
|
@@ -88,5 +98,9 @@ export interface StyledColumnApi {
|
|
|
88
98
|
* Publishes the CheckboxColumnClickedEvent - when the checkbox in an Checkbox Column is clicked
|
|
89
99
|
*/
|
|
90
100
|
fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
|
|
101
|
+
/**
|
|
102
|
+
* Returns a Styled Column for a given column
|
|
103
|
+
* @param column Column to check
|
|
104
|
+
*/
|
|
91
105
|
getActiveStyledColumnForColumn(column: AdaptableColumn): StyledColumn | undefined;
|
|
92
106
|
}
|
|
@@ -13,14 +13,20 @@ export interface StyledColumnState extends ConfigState {
|
|
|
13
13
|
* Object used in Special Column Style function
|
|
14
14
|
*/
|
|
15
15
|
export interface StyledColumn extends SuspendableObject {
|
|
16
|
+
/**
|
|
17
|
+
* Column being styled
|
|
18
|
+
*/
|
|
16
19
|
ColumnId: string;
|
|
20
|
+
/**
|
|
21
|
+
* Styles a numeric column with a Gradient
|
|
22
|
+
*/
|
|
17
23
|
GradientStyle?: GradientStyle;
|
|
18
24
|
/**
|
|
19
|
-
*
|
|
25
|
+
* Styles a numeric column so each cell displays a 'bar'
|
|
20
26
|
*/
|
|
21
27
|
PercentBarStyle?: PercentBarStyle;
|
|
22
28
|
/**
|
|
23
|
-
*
|
|
29
|
+
* Renders a Checkbox in a boolean column
|
|
24
30
|
*/
|
|
25
31
|
CheckBoxStyle?: boolean;
|
|
26
32
|
}
|
|
@@ -33,7 +39,7 @@ export interface PercentBarStyle extends NumericStyledColumn {
|
|
|
33
39
|
*/
|
|
34
40
|
CellRanges?: CellColorRange[];
|
|
35
41
|
/**
|
|
36
|
-
* Compares
|
|
42
|
+
* Compares Cell values to another Column
|
|
37
43
|
*/
|
|
38
44
|
ColumnComparison?: ColumnComparison;
|
|
39
45
|
/**
|
|
@@ -45,7 +51,7 @@ export interface PercentBarStyle extends NumericStyledColumn {
|
|
|
45
51
|
*/
|
|
46
52
|
ToolTipText?: CellTextOptions;
|
|
47
53
|
/**
|
|
48
|
-
*
|
|
54
|
+
* Background colour for 'Percent Bar'; leave unset if none required
|
|
49
55
|
* @defaultValue Gray
|
|
50
56
|
*/
|
|
51
57
|
BackColor?: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
2
2
|
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
3
|
-
import { AdaptableMenuItem } from '../PredefinedConfig/Common/Menu';
|
|
4
3
|
import { ConditionalStyle } from '../PredefinedConfig/ConditionalStyleState';
|
|
5
4
|
import { TeamSharingImportInfo } from '../PredefinedConfig/TeamSharingState';
|
|
6
5
|
import { AdaptableModuleBase } from './AdaptableModuleBase';
|
|
@@ -15,7 +14,6 @@ export declare class ConditionalStyleModule extends AdaptableModuleBase implemen
|
|
|
15
14
|
getExplicitlyReferencedColumnIds(conditionalStyle: ConditionalStyle): string[];
|
|
16
15
|
getReferencedNamedQueryNames(conditionalStyle: ConditionalStyle): string[];
|
|
17
16
|
updateOldConfig(): void;
|
|
18
|
-
addColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem[] | undefined;
|
|
19
17
|
getTeamSharingAction(): TeamSharingImportInfo<ConditionalStyle>;
|
|
20
18
|
isConditionalStyleActiveForColumn(conditionalStyleForColumn: ConditionalStyle, column: AdaptableColumn, params: any): boolean;
|
|
21
19
|
isConditionalStyleActiveForRow(conditionalStyleForRow: ConditionalStyle, params: any): boolean;
|
|
@@ -9,7 +9,6 @@ const LoggingHelper_1 = require("../Utilities/Helpers/LoggingHelper");
|
|
|
9
9
|
const AdaptableModuleBase_1 = require("./AdaptableModuleBase");
|
|
10
10
|
const ModuleConstants_1 = require("../Utilities/Constants/ModuleConstants");
|
|
11
11
|
const getScopeViewItems_1 = require("./Utilities/getScopeViewItems");
|
|
12
|
-
const ConditionalStyleWizard_1 = require("../View/ConditionalStyle/Wizard/ConditionalStyleWizard");
|
|
13
12
|
const getRuleViewItems_1 = require("./Utilities/getRuleViewItems");
|
|
14
13
|
const getStyleViewItems_1 = require("./Utilities/getStyleViewItems");
|
|
15
14
|
const getObjectTagsViewItems_1 = require("./Utilities/getObjectTagsViewItems");
|
|
@@ -79,25 +78,6 @@ class ConditionalStyleModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
79
78
|
});
|
|
80
79
|
this.api.conditionalStyleApi.editConditionalStyles(oldConditionalStyles);
|
|
81
80
|
}
|
|
82
|
-
addColumnMenuItems(column) {
|
|
83
|
-
if (column && this.isModuleEditable() && !column.isSparkline) {
|
|
84
|
-
let conditionalStyles = this.api.conditionalStyleApi.getConditionalStylesForColumn(column);
|
|
85
|
-
let firstConditionalStyle = ArrayExtensions_1.default.IsNotNullOrEmpty(conditionalStyles)
|
|
86
|
-
? conditionalStyles.find((cs) => this.api.scopeApi.isColumnInScopeColumns(column, cs.Scope))
|
|
87
|
-
: undefined;
|
|
88
|
-
let conditionalStyleExists = firstConditionalStyle != undefined;
|
|
89
|
-
let label = conditionalStyleExists ? 'Edit ' : 'Create ';
|
|
90
|
-
let popupParam = {
|
|
91
|
-
column: column,
|
|
92
|
-
action: conditionalStyleExists ? 'Edit' : 'New',
|
|
93
|
-
source: 'ColumnMenu',
|
|
94
|
-
value: firstConditionalStyle,
|
|
95
|
-
};
|
|
96
|
-
return [
|
|
97
|
-
this.createColumnMenuItemShowPopup(label + this.moduleInfo.FriendlyName, this.moduleInfo.Popup, this.moduleInfo.Glyph, popupParam),
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
81
|
getTeamSharingAction() {
|
|
102
82
|
return {
|
|
103
83
|
ModuleEntities: this.api.conditionalStyleApi.getAllConditionalStyle(),
|
|
@@ -211,13 +191,7 @@ class ConditionalStyleModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
211
191
|
getViewProperties() {
|
|
212
192
|
return {
|
|
213
193
|
HeaderComponent: ConditionalStylePopupHeader_1.ConditionalStylePopupHeader,
|
|
214
|
-
|
|
215
|
-
getSuspendAction: (conditionalStyle) => ConditionalStyleRedux.ConditionalStyleSuspend(conditionalStyle),
|
|
216
|
-
getUnSuspendAction: (conditionalStyle) => ConditionalStyleRedux.ConditionalStyleUnSuspend(conditionalStyle),
|
|
217
|
-
emptyView: "Click 'New' to create a new Conditional Style Rule. When this is met, row or cells in the Conditional Style's scope will be styled appropriately.",
|
|
218
|
-
getEditWizard() {
|
|
219
|
-
return ConditionalStyleWizard_1.ConditionalStyleWizard;
|
|
220
|
-
},
|
|
194
|
+
emptyView: '',
|
|
221
195
|
};
|
|
222
196
|
}
|
|
223
197
|
canBeAssociatedWithLayouts() {
|
|
@@ -16,7 +16,6 @@ const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
|
|
|
16
16
|
const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
|
|
17
17
|
const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
|
|
18
18
|
const react_redux_1 = require("react-redux");
|
|
19
|
-
const ConditionalStyleRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/ConditionalStyleRedux"));
|
|
20
19
|
const ConditionalStyleSettingsWizardSettings_1 = require("./ConditionalStyleSettingsWizardSettings");
|
|
21
20
|
const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
|
|
22
21
|
const ConditionalStyleWizard = (props) => {
|
|
@@ -43,16 +42,7 @@ const ConditionalStyleWizard = (props) => {
|
|
|
43
42
|
return conditionalStyle;
|
|
44
43
|
});
|
|
45
44
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
46
|
-
|
|
47
|
-
if (data) {
|
|
48
|
-
dispatch(ConditionalStyleRedux.ConditionalStyleEdit(conditionalStyle));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
dispatch(ConditionalStyleRedux.ConditionalStyleAdd(conditionalStyle));
|
|
52
|
-
}
|
|
53
|
-
props.onCloseWizard();
|
|
54
|
-
};
|
|
55
|
-
return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: conditionalStyle, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
|
|
45
|
+
return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: conditionalStyle, onHide: props.onCloseWizard, sections: [
|
|
56
46
|
{
|
|
57
47
|
title: 'Style',
|
|
58
48
|
details: 'Specify the Style to be applied conditionally',
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ICellRendererComp, ICellRendererParams } from '@ag-grid-community/core';
|
|
2
3
|
import { ActionColumn } from '../AdaptableOptions/ActionOptions';
|
|
3
4
|
interface ActionColumnCellRendererParams extends ICellRendererParams {
|
|
4
5
|
actionColumn?: ActionColumn;
|
|
5
6
|
}
|
|
7
|
+
export declare const ReactActionColumnRenderer: (props: ActionColumnCellRendererParams) => JSX.Element;
|
|
6
8
|
export declare class ActionColumnRenderer implements ICellRendererComp {
|
|
7
9
|
private eGui;
|
|
8
10
|
private eventListener;
|
|
@@ -1,76 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActionColumnRenderer = void 0;
|
|
3
|
+
exports.ActionColumnRenderer = exports.ReactActionColumnRenderer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const SimpleButton_1 = tslib_1.__importDefault(require("../components/SimpleButton"));
|
|
6
6
|
const React = tslib_1.__importStar(require("react"));
|
|
7
7
|
const uuid_1 = require("../components/utils/uuid");
|
|
8
|
+
const useRerender_1 = require("../components/utils/useRerender");
|
|
9
|
+
function getActionButtonsAndActionColumn(adaptable, actionColumn, colId) {
|
|
10
|
+
var _a;
|
|
11
|
+
const actionCol = actionColumn
|
|
12
|
+
? actionColumn
|
|
13
|
+
: (_a = adaptable.api.actionApi.getAllActionColumn()) === null || _a === void 0 ? void 0 : _a.find((ac) => ac.columnId == colId);
|
|
14
|
+
if (actionCol && actionCol.actionColumnButton) {
|
|
15
|
+
let actionButtons = Array.isArray(actionCol.actionColumnButton)
|
|
16
|
+
? actionCol.actionColumnButton
|
|
17
|
+
: [actionCol.actionColumnButton];
|
|
18
|
+
if (!actionButtons.length) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// actionButtons don't have IDs, so we need to generate them to be used later as a react component key
|
|
22
|
+
actionButtons = actionButtons.map((actionButton) => (Object.assign(Object.assign({}, actionButton), { Uuid: (0, uuid_1.createUuid)() })));
|
|
23
|
+
return { actionButtons, actionColumn: actionCol };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
actionButtons: [],
|
|
27
|
+
actionColumn: actionCol,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const renderActionButtons = (buttons, adaptableApi, context, rerender) => {
|
|
31
|
+
return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
if (button.hidden && button.hidden(button, context)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const buttonIcon = adaptableApi.internalApi.getIconForButton(button, context, {
|
|
37
|
+
height: 15,
|
|
38
|
+
width: 15,
|
|
39
|
+
});
|
|
40
|
+
const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
|
|
41
|
+
const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
|
|
42
|
+
const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
|
|
43
|
+
const handleClick = () => {
|
|
44
|
+
var _a;
|
|
45
|
+
(_a = button.onClick) === null || _a === void 0 ? void 0 : _a.call(button, button, context);
|
|
46
|
+
// Timeout to let any updates to be done before re-rendering the component
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
// when called again it triggers a re-render
|
|
49
|
+
// https:reactjs.org/docs/react-dom.html#render
|
|
50
|
+
rerender();
|
|
51
|
+
}, 16);
|
|
52
|
+
};
|
|
53
|
+
const disabled = button.disabled && button.disabled(button, context);
|
|
54
|
+
return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
|
|
55
|
+
})));
|
|
56
|
+
};
|
|
57
|
+
const ReactActionColumnRenderer = (props) => {
|
|
58
|
+
const rerender = (0, useRerender_1.useRerender)();
|
|
59
|
+
const adaptable = props.api.__adaptable;
|
|
60
|
+
const { actionButtons, actionColumn } = getActionButtonsAndActionColumn(adaptable, props.actionColumn, props.colDef.colId);
|
|
61
|
+
if (!actionColumn || !actionButtons.length) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (adaptable.api.gridApi.isGroupRowNode(props.node) && !actionColumn.includeGroupedRows) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const pkValue = adaptable.getPrimaryKeyValueFromRowNode(props.node);
|
|
68
|
+
const buttonContext = {
|
|
69
|
+
actionColumn,
|
|
70
|
+
primaryKeyValue: pkValue,
|
|
71
|
+
rowNode: props.node,
|
|
72
|
+
adaptableApi: adaptable.api,
|
|
73
|
+
};
|
|
74
|
+
return (React.createElement("div", { className: "ab-ActionColumn" }, renderActionButtons(actionButtons, adaptable.api, buttonContext, rerender)));
|
|
75
|
+
};
|
|
76
|
+
exports.ReactActionColumnRenderer = ReactActionColumnRenderer;
|
|
8
77
|
class ActionColumnRenderer {
|
|
9
78
|
// gets called once before the renderer is used
|
|
10
79
|
init(params) {
|
|
11
|
-
var _a;
|
|
12
80
|
const adaptable = params.api.__adaptable;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// actionButtons don't have IDs, so we need to generate them to be used later as a react component key
|
|
25
|
-
actionButtons = actionButtons.map((actionButton) => (Object.assign(Object.assign({}, actionButton), { Uuid: (0, uuid_1.createUuid)() })));
|
|
26
|
-
// create the cell
|
|
27
|
-
this.eGui = document.createElement('div');
|
|
28
|
-
this.eGui.className = 'ab-ActionColumn';
|
|
29
|
-
// if its a group node then only show if set to do so
|
|
30
|
-
if (adaptable.api.gridApi.isGroupRowNode(params.node) && !actionCol.includeGroupedRows) {
|
|
31
|
-
this.eGui.innerHTML = '';
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
|
|
35
|
-
const buttonContext = {
|
|
36
|
-
actionColumn: actionCol,
|
|
37
|
-
primaryKeyValue: pkValue,
|
|
38
|
-
rowNode: params.node,
|
|
39
|
-
adaptableApi: adaptable.api,
|
|
40
|
-
};
|
|
41
|
-
const renderActionButtons = (buttons, adaptableApi, context) => {
|
|
42
|
-
return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
if (button.hidden && button.hidden(button, context)) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const buttonIcon = adaptableApi.internalApi.getIconForButton(button, context, {
|
|
48
|
-
height: 15,
|
|
49
|
-
width: 15,
|
|
50
|
-
});
|
|
51
|
-
const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
|
|
52
|
-
const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
|
|
53
|
-
const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
|
|
54
|
-
const handleClick = () => {
|
|
55
|
-
button.onClick(button, context);
|
|
56
|
-
// Timeout to let any updates to be done before re-rendering the component
|
|
57
|
-
setTimeout(() => {
|
|
58
|
-
// when called again it triggers a re-render
|
|
59
|
-
// https:reactjs.org/docs/react-dom.html#render
|
|
60
|
-
doRender();
|
|
61
|
-
}, 16);
|
|
62
|
-
};
|
|
63
|
-
const disabled = button.disabled && button.disabled(button, context);
|
|
64
|
-
return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
|
|
65
|
-
})));
|
|
66
|
-
};
|
|
67
|
-
const eGui = this.eGui;
|
|
68
|
-
const doRender = () => {
|
|
69
|
-
this.unmountReactRoot = adaptable.renderReactRoot(renderActionButtons(actionButtons, adaptable.api, buttonContext), eGui);
|
|
70
|
-
};
|
|
71
|
-
this.render = doRender;
|
|
72
|
-
doRender();
|
|
81
|
+
const { actionButtons, actionColumn } = getActionButtonsAndActionColumn(adaptable, params.actionColumn, params.colDef.colId);
|
|
82
|
+
if (!actionColumn || !actionButtons.length) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// create the cell
|
|
86
|
+
this.eGui = document.createElement('div');
|
|
87
|
+
this.eGui.className = 'ab-ActionColumn';
|
|
88
|
+
// if its a group node then only show if set to do so
|
|
89
|
+
if (adaptable.api.gridApi.isGroupRowNode(params.node) && !actionColumn.includeGroupedRows) {
|
|
90
|
+
this.eGui.innerHTML = '';
|
|
91
|
+
return;
|
|
73
92
|
}
|
|
93
|
+
const pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
|
|
94
|
+
const buttonContext = {
|
|
95
|
+
actionColumn,
|
|
96
|
+
primaryKeyValue: pkValue,
|
|
97
|
+
rowNode: params.node,
|
|
98
|
+
adaptableApi: adaptable.api,
|
|
99
|
+
};
|
|
100
|
+
const eGui = this.eGui;
|
|
101
|
+
const doRender = () => {
|
|
102
|
+
this.unmountReactRoot = adaptable.renderReactRoot(renderActionButtons(actionButtons, adaptable.api, buttonContext, doRender), eGui);
|
|
103
|
+
};
|
|
104
|
+
this.render = doRender;
|
|
105
|
+
doRender();
|
|
74
106
|
}
|
|
75
107
|
// defined on init
|
|
76
108
|
// used to re-render in refresh
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -2335,7 +2335,7 @@ class Adaptable {
|
|
|
2335
2335
|
pinned: this.adaptableOptions.actionOptions.actionRowButtonsPosition === 'pinnedRight'
|
|
2336
2336
|
? 'right'
|
|
2337
2337
|
: 'left',
|
|
2338
|
-
cellRenderer: ActionColumnRenderer_1.ActionColumnRenderer,
|
|
2338
|
+
cellRenderer: this.variant === 'react' ? ActionColumnRenderer_1.ReactActionColumnRenderer : ActionColumnRenderer_1.ActionColumnRenderer,
|
|
2339
2339
|
cellRendererParams: {
|
|
2340
2340
|
actionColumn: rowEditActionColumn,
|
|
2341
2341
|
},
|
|
@@ -2364,7 +2364,7 @@ class Adaptable {
|
|
|
2364
2364
|
filter: false,
|
|
2365
2365
|
sortable: false,
|
|
2366
2366
|
enableRowGroup: false,
|
|
2367
|
-
cellRenderer: ActionColumnRenderer_1.ActionColumnRenderer,
|
|
2367
|
+
cellRenderer: this.variant === 'react' ? ActionColumnRenderer_1.ReactActionColumnRenderer : ActionColumnRenderer_1.ActionColumnRenderer,
|
|
2368
2368
|
type: [GeneralConstants_1.AB_SPECIAL_COLUMN, 'abColDefObject'],
|
|
2369
2369
|
};
|
|
2370
2370
|
(0, LoggingHelper_1.LogAdaptableInfo)('Setting up Action Column: ' + actionColumn.columnId);
|
|
@@ -4,6 +4,7 @@ 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 = require("../Utilities/Helpers/FormatHelper");
|
|
7
8
|
const getPercentBarRendererForColumn = (columnStyle, abColumn, api) => {
|
|
8
9
|
if (!columnStyle.PercentBarStyle) {
|
|
9
10
|
return;
|
|
@@ -56,6 +57,18 @@ const getPercentBarRendererForColumn = (columnStyle, abColumn, api) => {
|
|
|
56
57
|
textEl.className = 'ab-PercentBar__text';
|
|
57
58
|
textEl.style.lineHeight = '1.2';
|
|
58
59
|
if (percentBarStyle.CellText.includes('CellValue')) {
|
|
60
|
+
let preparedValue = value;
|
|
61
|
+
const formatColumn = api.formatColumnApi.getFormatColumnWithDisplayFormatForColumn(abColumn);
|
|
62
|
+
if (formatColumn &&
|
|
63
|
+
!formatColumn.IsSuspended &&
|
|
64
|
+
formatColumn.DisplayFormat &&
|
|
65
|
+
api.scopeApi.isColumnInNumericScope(abColumn, formatColumn.Scope)) {
|
|
66
|
+
const options = formatColumn.DisplayFormat.Options;
|
|
67
|
+
value = api.formatColumnApi.getNumberFormattedValue(params.value, params.node, abColumn, options);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
value = (0, FormatHelper_1.NumberFormatter)(value, { FractionDigits: 2 });
|
|
71
|
+
}
|
|
59
72
|
textEl.innerText = value;
|
|
60
73
|
}
|
|
61
74
|
if (percentBarStyle.CellText.includes('PercentageValue')) {
|
|
@@ -4728,6 +4728,13 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
4728
4728
|
uiLabel: string;
|
|
4729
4729
|
isOptional: boolean;
|
|
4730
4730
|
reference?: undefined;
|
|
4731
|
+
} | {
|
|
4732
|
+
name: string;
|
|
4733
|
+
kind: string;
|
|
4734
|
+
description: string;
|
|
4735
|
+
uiLabel: string;
|
|
4736
|
+
isOptional?: undefined;
|
|
4737
|
+
reference?: undefined;
|
|
4731
4738
|
} | {
|
|
4732
4739
|
name: string;
|
|
4733
4740
|
kind: string;
|