@adaptabletools/adaptable 11.1.1-canary.1 → 11.1.2
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/README.md +6 -4
- package/agGrid.d.ts +2 -2
- package/base.css +6 -6
- package/bundle.cjs.js +97 -97
- package/index.css +7 -6
- package/package.json +2 -2
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
- package/src/AdaptableOptions/LayoutOptions.d.ts +11 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +9 -13
- package/src/Api/Implementation/EventApiImpl.js +2 -1
- package/src/Api/Implementation/GridApiImpl.js +9 -10
- package/src/Api/Implementation/InternalApiImpl.js +1 -1
- package/src/Api/Implementation/LayoutApiImpl.js +7 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.js +3 -1
- package/src/Api/QueryLanguageApi.d.ts +6 -6
- package/src/Redux/Store/AdaptableStore.js +1 -1
- package/src/Strategy/CalculatedColumnModule.js +5 -0
- package/src/Strategy/FreeTextColumnModule.js +1 -1
- package/src/Strategy/Interface/IModule.d.ts +2 -1
- package/src/Strategy/LayoutModule.d.ts +23 -0
- package/src/Strategy/LayoutModule.js +70 -0
- package/src/Strategy/Utilities/getFlashingCellStyleViewItems.d.ts +1 -0
- package/src/Strategy/Utilities/getFlashingCellStyleViewItems.js +2 -1
- package/src/Utilities/Constants/DocumentationLinkConstants.js +1 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +3 -0
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -1
- package/src/Utilities/Emitter.d.ts +1 -1
- package/src/Utilities/Emitter.js +3 -6
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -1
- package/src/Utilities/Helpers/StyleHelper.d.ts +1 -0
- package/src/Utilities/Helpers/StyleHelper.js +13 -1
- package/src/View/AdaptableViewFactory.js +2 -4
- package/src/View/ColorPicker.d.ts +4 -2
- package/src/View/ColorPicker.js +16 -4
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +24 -19
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +3 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +23 -15
- package/src/View/Components/Popups/WindowPopups/WindowPopups.d.ts +2 -0
- package/src/View/Components/Popups/WindowPopups/WindowPopups.js +9 -5
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +1 -0
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +4 -1
- package/src/View/Components/RangesComponent.js +4 -6
- package/src/View/Components/StyleComponent.js +6 -9
- package/src/View/Components/ValueSelector/index.d.ts +1 -0
- package/src/View/Components/ValueSelector/index.js +1 -1
- package/src/View/Dashboard/CustomToolbarWrapper.js +9 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +2 -3
- package/src/View/GridInfo/AdaptableObjectsSummary.d.ts +2 -0
- package/src/View/GridInfo/AdaptableObjectsSummary.js +26 -0
- package/src/View/GridInfo/GridInfoPopup.js +11 -3
- package/src/View/Layout/LayoutEditorStandalonePopup.js +3 -4
- package/src/View/Layout/LayoutRadioSelector.d.ts +5 -0
- package/src/View/Layout/LayoutRadioSelector.js +18 -0
- package/src/View/Query/ExpandedQueryPopup.d.ts +2 -18
- package/src/View/Query/ExpandedQueryPopup.js +42 -57
- package/src/View/Query/QueryViewPanel.js +8 -5
- package/src/agGrid/ActionColumnRenderer.d.ts +1 -6
- package/src/agGrid/ActionColumnRenderer.js +50 -59
- package/src/agGrid/Adaptable.d.ts +3 -1
- package/src/agGrid/Adaptable.js +63 -27
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -0
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +16 -2
- package/src/components/ExpressionEditor/index.js +0 -1
- package/src/components/OverlayTrigger/index.js +1 -0
- package/src/components/Radio/index.d.ts +1 -1
- package/src/components/Radio/index.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +17 -10
- package/src/types.d.ts +5 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/LICENSE.md +0 -264
|
@@ -9,62 +9,47 @@ const ExpressionEditor_1 = require("../../components/ExpressionEditor");
|
|
|
9
9
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
|
|
10
10
|
const QueryRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/QueryRedux"));
|
|
11
11
|
const StringExtensions_1 = require("../../Utilities/Extensions/StringExtensions");
|
|
12
|
-
const PanelWithButton_1 = require("../Components/Panels/PanelWithButton");
|
|
13
12
|
const NamedQueryContext_1 = require("../../components/ExpressionEditor/NamedQueryContext");
|
|
14
13
|
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
React.createElement(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
React.createElement(rebass_1.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function mapStateToProps() {
|
|
60
|
-
return {
|
|
61
|
-
// GridState: state.Grid,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function mapDispatchToProps(dispatch) {
|
|
65
|
-
return {
|
|
66
|
-
onRunQuery: (expression) => dispatch(QueryRedux.QueryRun(expression)),
|
|
67
|
-
onAddNamedQuery: (namedQuery) => dispatch(QueryRedux.NamedQueryAdd(namedQuery)),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
exports.ExpandedQueryPopup = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(ExpandedQueryPopupComponent);
|
|
14
|
+
exports.ExpandedQueryPopup = (props) => {
|
|
15
|
+
const dispatch = react_redux_1.useDispatch();
|
|
16
|
+
const [namedQuery, setNamedQuery] = React.useState(null);
|
|
17
|
+
const [expression, setExpression] = React.useState(props.popupProps.value);
|
|
18
|
+
const isExpressionValid = props.api.internalApi
|
|
19
|
+
.getQueryLanguageService()
|
|
20
|
+
.validateBoolean(expression, ModuleConstants_1.QueryModuleId).isValid;
|
|
21
|
+
const initialData = React.useMemo(() => props.api.internalApi.getQueryPreviewData(), []);
|
|
22
|
+
const namedQueryValidationError = namedQuery
|
|
23
|
+
? props.api.queryApi.isValidNamedQueryName(namedQuery).message
|
|
24
|
+
: '';
|
|
25
|
+
const hasNamedQueryError = StringExtensions_1.IsNotNullOrEmpty(namedQueryValidationError);
|
|
26
|
+
const onRunQuery = (expression) => dispatch(QueryRedux.QueryRun(expression));
|
|
27
|
+
const onAddNamedQuery = (namedQuery) => dispatch(QueryRedux.NamedQueryAdd(namedQuery));
|
|
28
|
+
return (React.createElement(NamedQueryContext_1.NamedQueryContext.Provider, { value: {
|
|
29
|
+
namedQuery: namedQuery,
|
|
30
|
+
setNamedQuery: (newQuery) => {
|
|
31
|
+
setNamedQuery(newQuery);
|
|
32
|
+
},
|
|
33
|
+
} },
|
|
34
|
+
React.createElement(rebass_1.Flex, { height: "100%", flexDirection: "column" },
|
|
35
|
+
React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'boolean', module: ModuleConstants_1.QueryModuleId, value: expression, onChange: (expression) => setExpression(expression), initialData: initialData, columns: props.api.columnApi.getQueryableColumns(), namedQueries: props.api.queryApi.getAllNamedQuery(), api: props.api }),
|
|
36
|
+
React.createElement(rebass_1.Flex, { flexDirection: "row", padding: 1, backgroundColor: "primary", alignItems: "center" },
|
|
37
|
+
React.createElement(SimpleButton_1.default, { margin: 1, variant: "text", "data-name": "action-close", onClick: () => {
|
|
38
|
+
props.onDismiss();
|
|
39
|
+
} }, "CLOSE"),
|
|
40
|
+
React.createElement(rebass_1.Text, { fontSize: 2, mr: 3, style: {
|
|
41
|
+
flex: 1,
|
|
42
|
+
color: 'var(--ab-color-error)',
|
|
43
|
+
textAlign: 'end',
|
|
44
|
+
} }, namedQueryValidationError),
|
|
45
|
+
React.createElement(SimpleButton_1.default, { variant: "raised", tone: "accent", "data-name": "action-run", margin: 1, onClick: () => {
|
|
46
|
+
if (namedQuery) {
|
|
47
|
+
onAddNamedQuery({
|
|
48
|
+
Name: namedQuery.Name,
|
|
49
|
+
BooleanExpression: expression,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
onRunQuery(expression);
|
|
53
|
+
props.onDismiss();
|
|
54
|
+
}, disabled: !isExpressionValid || StringExtensions_1.IsNullOrEmpty(expression) || hasNamedQueryError }, "Run Query")))));
|
|
55
|
+
};
|
|
@@ -22,6 +22,7 @@ const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Exte
|
|
|
22
22
|
const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
|
|
23
23
|
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
24
24
|
const react_redux_1 = require("react-redux");
|
|
25
|
+
const windowFactory_1 = require("../Components/Popups/WindowPopups/windowFactory");
|
|
25
26
|
class QueryViewPanelComponent extends React.Component {
|
|
26
27
|
constructor(props) {
|
|
27
28
|
super(props);
|
|
@@ -165,11 +166,13 @@ function mapDispatchToProps(dispatch) {
|
|
|
165
166
|
source: 'Toolbar',
|
|
166
167
|
value,
|
|
167
168
|
})),
|
|
168
|
-
onExpand: (value) => dispatch(PopupRedux.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
onExpand: (value) => dispatch(PopupRedux.PopupShowWindow({
|
|
170
|
+
Id: windowFactory_1.WINDOW_QUERY_EDITOR,
|
|
171
|
+
Title: 'Current Query',
|
|
172
|
+
Icon: 'query',
|
|
173
|
+
PopupProps: {
|
|
174
|
+
value: value,
|
|
175
|
+
},
|
|
173
176
|
})),
|
|
174
177
|
};
|
|
175
178
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { ICellRendererComp, ICellRendererParams
|
|
2
|
-
export declare class CustomTooltip implements ITooltipComp {
|
|
3
|
-
private eGui;
|
|
4
|
-
init(params: ITooltipParams): void;
|
|
5
|
-
getGui(): any;
|
|
6
|
-
}
|
|
1
|
+
import { ICellRendererComp, ICellRendererParams } from '@ag-grid-community/all-modules';
|
|
7
2
|
export declare class ActionColumnRenderer implements ICellRendererComp {
|
|
8
3
|
private eGui;
|
|
9
4
|
private eventListener;
|
|
@@ -1,85 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActionColumnRenderer =
|
|
3
|
+
exports.ActionColumnRenderer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const SimpleButton_1 = tslib_1.__importDefault(require("../components/SimpleButton"));
|
|
6
6
|
const react_dom_1 = require("react-dom");
|
|
7
7
|
const React = tslib_1.__importStar(require("react"));
|
|
8
|
-
|
|
9
|
-
init(params) {
|
|
10
|
-
this.eGui = document.createElement('div');
|
|
11
|
-
this.eGui.classList.add('custom-tooltip');
|
|
12
|
-
let { field, lastValidation, validationFailedMsg } = params.value;
|
|
13
|
-
this.eGui.innerHTML = `
|
|
14
|
-
<div class="validation-msg">
|
|
15
|
-
FIELD-${field.toUpperCase()} - invalid value:
|
|
16
|
-
"<span class="invalid-value"> ${lastValidation} </span>",
|
|
17
|
-
${validationFailedMsg}
|
|
18
|
-
</div>
|
|
19
|
-
`;
|
|
20
|
-
}
|
|
21
|
-
getGui() {
|
|
22
|
-
return this.eGui;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.CustomTooltip = CustomTooltip;
|
|
8
|
+
const uuid_1 = require("../components/utils/uuid");
|
|
26
9
|
class ActionColumnRenderer {
|
|
27
10
|
// gets called once before the renderer is used
|
|
28
11
|
init(params) {
|
|
29
12
|
var _a;
|
|
30
13
|
const adaptable = params.api.__adaptable;
|
|
31
|
-
|
|
14
|
+
const actionCol = (_a = adaptable.api.userInterfaceApi
|
|
32
15
|
.getAllActionColumn()) === null || _a === void 0 ? void 0 : _a.find((ac) => ac.columnId == params.colDef.colId);
|
|
33
|
-
if (actionCol) {
|
|
16
|
+
if (actionCol && actionCol.actionColumnButton) {
|
|
17
|
+
let actionButtons = Array.isArray(actionCol.actionColumnButton)
|
|
18
|
+
? actionCol.actionColumnButton
|
|
19
|
+
: [actionCol.actionColumnButton];
|
|
20
|
+
if (!actionButtons.length) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// actionButtons don't have IDs, so we need to generate them to be used later as a react component key
|
|
24
|
+
actionButtons = actionButtons.map((actionButton) => (Object.assign(Object.assign({}, actionButton), { Uuid: uuid_1.createUuid() })));
|
|
34
25
|
// create the cell
|
|
35
26
|
this.eGui = document.createElement('div');
|
|
36
27
|
this.eGui.className = 'ab-ActionColumn';
|
|
37
|
-
let pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
|
|
38
|
-
let button = actionCol.actionColumnButton;
|
|
39
|
-
let context = {
|
|
40
|
-
actionColumn: actionCol,
|
|
41
|
-
primaryKeyValue: pkValue,
|
|
42
|
-
rowNode: params.node,
|
|
43
|
-
adaptableApi: adaptable.api,
|
|
44
|
-
};
|
|
45
28
|
// if its a group node then only show if set to do so
|
|
46
29
|
if (adaptable.api.gridApi.isGroupRowNode(params.node) && !actionCol.includeGroupedRows) {
|
|
47
30
|
this.eGui.innerHTML = '';
|
|
48
31
|
return;
|
|
49
32
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
33
|
+
const pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
|
|
34
|
+
const buttonContext = {
|
|
35
|
+
actionColumn: actionCol,
|
|
36
|
+
primaryKeyValue: pkValue,
|
|
37
|
+
rowNode: params.node,
|
|
38
|
+
adaptableApi: adaptable.api,
|
|
39
|
+
};
|
|
40
|
+
const renderActionButtons = (buttons, adaptableApi, context) => {
|
|
41
|
+
return (React.createElement(React.Fragment, null, buttons.map((button) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
if (button.hidden && button.hidden(button, context)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const defaultIconProps = {
|
|
47
|
+
style: {
|
|
48
|
+
height: 15,
|
|
49
|
+
width: 15,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const iconProps = button.icon && Object.assign({}, defaultIconProps, button.icon);
|
|
53
|
+
const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
|
|
54
|
+
const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
|
|
55
|
+
const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
|
|
56
|
+
const handleClick = () => {
|
|
57
|
+
button.onClick(button, context);
|
|
58
|
+
// Timeout to let any updates to be done before re-rendering the component
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
// when called again it triggers a re-render
|
|
61
|
+
// https:reactjs.org/docs/react-dom.html#render
|
|
62
|
+
doRender();
|
|
63
|
+
}, 16);
|
|
64
|
+
};
|
|
65
|
+
const disabled = button.disabled && button.disabled(button, context);
|
|
66
|
+
return (React.createElement(SimpleButton_1.default, { key: button.Uuid, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, 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' },
|
|
67
|
+
button.icon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
68
|
+
buttonLabel));
|
|
69
|
+
})));
|
|
79
70
|
};
|
|
80
71
|
const eGui = this.eGui;
|
|
81
72
|
function doRender() {
|
|
82
|
-
react_dom_1.render(
|
|
73
|
+
react_dom_1.render(renderActionButtons(actionButtons, adaptable.api, buttonContext), eGui);
|
|
83
74
|
}
|
|
84
75
|
this.render = doRender;
|
|
85
76
|
doRender();
|
|
@@ -74,6 +74,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
74
74
|
private _id;
|
|
75
75
|
private currentColumnDefs?;
|
|
76
76
|
private rowListeners;
|
|
77
|
+
private isCheckedColumnDataType;
|
|
77
78
|
_on: (eventName: string, callback: EmitterCallback) => (() => void);
|
|
78
79
|
_onIncludeFired: (eventName: string, callback: EmitterCallback) => (() => void);
|
|
79
80
|
_emit: (eventName: string, data?: any) => Promise<any>;
|
|
@@ -149,7 +150,8 @@ export declare class Adaptable implements IAdaptable {
|
|
|
149
150
|
private updateLayoutFromGrid;
|
|
150
151
|
setSelectedCells(): SelectedCellInfo | undefined;
|
|
151
152
|
setSelectedRows(): SelectedRowInfo | undefined;
|
|
152
|
-
|
|
153
|
+
setDataValue(value: any, column: AdaptableColumn, primaryKeyValue: any, rowNode?: RowNode): void;
|
|
154
|
+
setCellValue(cellDataChangedInfo: CellDataChangedInfo): void;
|
|
153
155
|
cancelEdit(): void;
|
|
154
156
|
isCellEditable(rowNode: RowNode, column: Column): boolean;
|
|
155
157
|
getDistinctValuesForColumn(column: AdaptableColumn, visibleRowsOnly: boolean, skipRowNode?: RowNode, permittedValues?: any[]): GridCell[];
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -100,6 +100,7 @@ class Adaptable {
|
|
|
100
100
|
constructor() {
|
|
101
101
|
this.colDefPropertyCache = new Map();
|
|
102
102
|
this.gridOptionsPropertyCache = new Map();
|
|
103
|
+
this.isCheckedColumnDataType = false;
|
|
103
104
|
// only for our private / internal events used within Adaptable
|
|
104
105
|
// public events are emitted through the EventApi
|
|
105
106
|
this._on = (eventName, callback) => {
|
|
@@ -201,7 +202,6 @@ class Adaptable {
|
|
|
201
202
|
this.getGroupAndColumnDefs = () => {
|
|
202
203
|
const colDefs = [].concat(this.currentColumnDefs || this.gridOptions.columnDefs);
|
|
203
204
|
return colDefs;
|
|
204
|
-
// return this.gridOptions.columnApi.getAllColumns().map((c) => c.getColDef());
|
|
205
205
|
};
|
|
206
206
|
this.getColumnDefsWithCorrectVisibility = () => {
|
|
207
207
|
const visibleColIds = this.api.layoutApi.getCurrentVisibleColumnIdsMap();
|
|
@@ -817,7 +817,8 @@ class Adaptable {
|
|
|
817
817
|
if (reverseGradient) {
|
|
818
818
|
alpha = 1 - alpha;
|
|
819
819
|
}
|
|
820
|
-
|
|
820
|
+
const preparedColor = StyleHelper_1.getVariableColor(cellBackColor);
|
|
821
|
+
style.backgroundColor = tinycolor(preparedColor).setAlpha(alpha).toRgbString();
|
|
821
822
|
}
|
|
822
823
|
if (columnStyle.PercentBarStyle && columnStyle.PercentBarStyle.CellText) {
|
|
823
824
|
style.paddingTop = 0;
|
|
@@ -1483,27 +1484,23 @@ class Adaptable {
|
|
|
1483
1484
|
this.agGridHelper.fireSelectionChangedEvent();
|
|
1484
1485
|
return selectedRowInfo;
|
|
1485
1486
|
}
|
|
1486
|
-
|
|
1487
|
+
setDataValue(value, column, primaryKeyValue, rowNode) {
|
|
1487
1488
|
// note: because we use RowNode.setDataValue() this will cause Validation to fire
|
|
1488
1489
|
// see https://www.ag-grid.com/javascript-data-grid/change-detection/#triggering-value-change-detection
|
|
1489
1490
|
let newValue;
|
|
1490
|
-
let dataType =
|
|
1491
|
-
newValue =
|
|
1492
|
-
dataType == Enums_1.DataType.Number
|
|
1493
|
-
? Number(cellDataChangedInfo.newValue)
|
|
1494
|
-
: cellDataChangedInfo.newValue;
|
|
1491
|
+
let dataType = column.dataType;
|
|
1492
|
+
newValue = dataType == Enums_1.DataType.Number ? Number(value) : value;
|
|
1495
1493
|
if (dataType == undefined) {
|
|
1496
1494
|
return; // no point continuing as probably a wrong column
|
|
1497
1495
|
}
|
|
1498
|
-
if (
|
|
1499
|
-
|
|
1496
|
+
if (rowNode) {
|
|
1497
|
+
rowNode.setDataValue(column.columnId, newValue);
|
|
1500
1498
|
}
|
|
1501
1499
|
else {
|
|
1502
1500
|
if (this.useRowNodeLookUp) {
|
|
1503
|
-
const rowNode = this.gridOptions.api.getRowNode(
|
|
1501
|
+
const rowNode = this.gridOptions.api.getRowNode(primaryKeyValue);
|
|
1504
1502
|
if (rowNode != null) {
|
|
1505
|
-
rowNode.setDataValue(
|
|
1506
|
-
cellDataChangedInfo.rowNode = rowNode;
|
|
1503
|
+
rowNode.setDataValue(column.columnId, newValue);
|
|
1507
1504
|
}
|
|
1508
1505
|
}
|
|
1509
1506
|
else {
|
|
@@ -1511,9 +1508,8 @@ class Adaptable {
|
|
|
1511
1508
|
// prefer not to use this method but if we do then at least we can prevent further lookups once we find
|
|
1512
1509
|
this.gridOptions.api.getModel().forEachNode((rowNode) => {
|
|
1513
1510
|
if (!isUpdated) {
|
|
1514
|
-
if (
|
|
1515
|
-
rowNode.setDataValue(
|
|
1516
|
-
cellDataChangedInfo.rowNode = rowNode;
|
|
1511
|
+
if (primaryKeyValue == this.getPrimaryKeyValueFromRowNode(rowNode)) {
|
|
1512
|
+
rowNode.setDataValue(column.columnId, newValue);
|
|
1517
1513
|
isUpdated = true;
|
|
1518
1514
|
}
|
|
1519
1515
|
}
|
|
@@ -1521,6 +1517,9 @@ class Adaptable {
|
|
|
1521
1517
|
}
|
|
1522
1518
|
}
|
|
1523
1519
|
}
|
|
1520
|
+
setCellValue(cellDataChangedInfo) {
|
|
1521
|
+
this.setDataValue(cellDataChangedInfo.newValue, cellDataChangedInfo.column, cellDataChangedInfo.primaryKeyValue, cellDataChangedInfo.rowNode);
|
|
1522
|
+
}
|
|
1524
1523
|
cancelEdit() {
|
|
1525
1524
|
this.gridOptions.api.stopEditing(true);
|
|
1526
1525
|
}
|
|
@@ -2063,20 +2062,54 @@ class Adaptable {
|
|
|
2063
2062
|
});
|
|
2064
2063
|
}
|
|
2065
2064
|
updateColDefsForSpecialColumns() {
|
|
2065
|
+
const allColDefs = this.getGroupAndColumnDefs();
|
|
2066
2066
|
const specialColDefs = this.getColDefsForSpecialColumns();
|
|
2067
|
-
const
|
|
2067
|
+
const isSpecialColDef = (colDef) => {
|
|
2068
2068
|
const { type } = colDef;
|
|
2069
2069
|
if (type === GeneralConstants_1.AB_SPECIAL_COLUMN || (Array.isArray(type) && type.includes(GeneralConstants_1.AB_SPECIAL_COLUMN))) {
|
|
2070
|
-
return
|
|
2070
|
+
return true;
|
|
2071
2071
|
}
|
|
2072
|
-
return
|
|
2072
|
+
return false;
|
|
2073
2073
|
};
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
const
|
|
2079
|
-
|
|
2074
|
+
const isColGroupDef = (columnDefinition) => {
|
|
2075
|
+
// @ts-ignore
|
|
2076
|
+
return columnDefinition['children'] != null;
|
|
2077
|
+
};
|
|
2078
|
+
const processedSpecialColDefIds = [];
|
|
2079
|
+
const mapColDefs = (colDefs) => {
|
|
2080
|
+
return colDefs.map((colDef) => {
|
|
2081
|
+
if (isColGroupDef(colDef)) {
|
|
2082
|
+
// if it's a group column, recursively map its children
|
|
2083
|
+
colDef.children = mapColDefs(colDef.children);
|
|
2084
|
+
return colDef;
|
|
2085
|
+
}
|
|
2086
|
+
else {
|
|
2087
|
+
if (!isSpecialColDef(colDef)) {
|
|
2088
|
+
// if it's not a special column, return it as is
|
|
2089
|
+
return colDef;
|
|
2090
|
+
}
|
|
2091
|
+
const newlyCreatedSpecialColDef = specialColDefs.find((specialColDef) => specialColDef.colId === colDef.colId);
|
|
2092
|
+
if (newlyCreatedSpecialColDef) {
|
|
2093
|
+
// if it's a special column and we have a special col def for it, return the special col def
|
|
2094
|
+
processedSpecialColDefIds.push(colDef.colId);
|
|
2095
|
+
return newlyCreatedSpecialColDef;
|
|
2096
|
+
}
|
|
2097
|
+
else {
|
|
2098
|
+
// otherwise, return the original col def
|
|
2099
|
+
return colDef;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
});
|
|
2103
|
+
};
|
|
2104
|
+
const resultColDefs = mapColDefs(allColDefs);
|
|
2105
|
+
// check if there are any special colDefs that were not processed
|
|
2106
|
+
// in that case, add them to the end of the colDefs
|
|
2107
|
+
specialColDefs.forEach((specialColDef) => {
|
|
2108
|
+
if (!processedSpecialColDefIds.includes(specialColDef.colId)) {
|
|
2109
|
+
resultColDefs.push(specialColDef);
|
|
2110
|
+
}
|
|
2111
|
+
});
|
|
2112
|
+
this.safeSetColDefs(resultColDefs);
|
|
2080
2113
|
this.setLayout();
|
|
2081
2114
|
}
|
|
2082
2115
|
cleanupFloatingFilters_WORKAROUND() {
|
|
@@ -3675,7 +3708,7 @@ class Adaptable {
|
|
|
3675
3708
|
updateColumnDataTypeIfRowDataIsEmpty() {
|
|
3676
3709
|
var _a, _b;
|
|
3677
3710
|
// gridOptions?.rowData is not updated when setting data via the api
|
|
3678
|
-
if (!((_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
3711
|
+
if (!this.isCheckedColumnDataType && !((_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
3679
3712
|
// the columns dataType is based on the rawData, when type is not set on the column
|
|
3680
3713
|
// when data is loaded async, the dataType initially is dataType=unknown
|
|
3681
3714
|
// to fix this, we need to update the columnDefs when we data is loaded
|
|
@@ -3683,6 +3716,8 @@ class Adaptable {
|
|
|
3683
3716
|
// this influences the floating filter
|
|
3684
3717
|
// need to trigger header redraw, if not, the columnDef update is not picked-up
|
|
3685
3718
|
this.redrawHeader();
|
|
3719
|
+
// ensures the check is performed only once
|
|
3720
|
+
this.isCheckedColumnDataType = true;
|
|
3686
3721
|
}
|
|
3687
3722
|
}
|
|
3688
3723
|
runAdaptableComparerFunction(columnId, columnValues) {
|
|
@@ -4159,7 +4194,8 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
|
|
|
4159
4194
|
}
|
|
4160
4195
|
convertCSSToExcelStyle(style) {
|
|
4161
4196
|
const getHexColor = (color) => {
|
|
4162
|
-
const
|
|
4197
|
+
const preparedColor = StyleHelper_1.getVariableColor(color);
|
|
4198
|
+
const t = tinycolor(preparedColor);
|
|
4163
4199
|
const a = t.getAlpha();
|
|
4164
4200
|
return tinycolor.mix(tinycolor('white'), t, a * 100).toHexString();
|
|
4165
4201
|
};
|
|
@@ -40,7 +40,7 @@ class AdaptableNumberEditor {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
init(params) {
|
|
43
|
-
this.value = this.
|
|
43
|
+
this.value = this.getStartValue(params);
|
|
44
44
|
this.params = params;
|
|
45
45
|
this.columnId = params.column.getColId();
|
|
46
46
|
const { valueParser } = params.column.getColDef();
|
|
@@ -72,7 +72,7 @@ class AdaptableNumberEditor {
|
|
|
72
72
|
afterGuiAttached() {
|
|
73
73
|
var _a, _b;
|
|
74
74
|
const adaptable = this.params.api.__adaptable;
|
|
75
|
-
const defaultValue = this.
|
|
75
|
+
const defaultValue = this.value;
|
|
76
76
|
const editorElement = (React.createElement(InternalAdaptableNumberEditor_1.InternalAdaptableNumberEditor, { defaultValue: defaultValue, showClearButton: (_a = this.params.showClearButton) !== null && _a !== void 0 ? _a : true, emptyValue: (_b = this.params.emptyValue) !== null && _b !== void 0 ? _b : '', onValueChange: this.onValueChange, ref: (editor) => {
|
|
77
77
|
this.editor = editor;
|
|
78
78
|
editor === null || editor === void 0 ? void 0 : editor.focus();
|
|
@@ -92,8 +92,22 @@ class AdaptableNumberEditor {
|
|
|
92
92
|
destroy() {
|
|
93
93
|
react_dom_1.unmountComponentAtNode(this.el);
|
|
94
94
|
}
|
|
95
|
+
getStartValue(params) {
|
|
96
|
+
if (this.shouldClearExistingValue(params)) {
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
if (params.charPress && this.isValidChar(params.charPress)) {
|
|
100
|
+
return params.charPress;
|
|
101
|
+
}
|
|
102
|
+
return params.value;
|
|
103
|
+
}
|
|
95
104
|
shouldClearExistingValue(params) {
|
|
96
105
|
return params.eventKey === all_modules_1.KeyCode.BACKSPACE || params.eventKey === all_modules_1.KeyCode.DELETE;
|
|
97
106
|
}
|
|
107
|
+
isValidChar(char) {
|
|
108
|
+
// allow only digits
|
|
109
|
+
return ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(char);
|
|
110
|
+
// we do NOT allow key shortcuts for starting non-digits (minus sign, decimal separators) as the input[number] handling is very buggy and we would open a can of worms
|
|
111
|
+
}
|
|
98
112
|
}
|
|
99
113
|
exports.AdaptableNumberEditor = AdaptableNumberEditor;
|
|
@@ -135,7 +135,6 @@ function ExpressionEditor(props) {
|
|
|
135
135
|
React.createElement(rebass_1.Box, { "data-name": "expression-column-picker", pb: 2, paddingLeft: 2, style: {
|
|
136
136
|
overflow: 'auto',
|
|
137
137
|
minWidth: 220,
|
|
138
|
-
maxWidth: '30%',
|
|
139
138
|
height: '100%',
|
|
140
139
|
paddingRight: 'var(--ab-space-2)',
|
|
141
140
|
} },
|
|
@@ -17,7 +17,7 @@ export declare const useRadioContext: <T extends unknown>() => {
|
|
|
17
17
|
onChange: (value: T) => void;
|
|
18
18
|
name: string;
|
|
19
19
|
};
|
|
20
|
-
declare const Radio: ({ children, checked, onChange, value, name, gapDistance, childrenPosition, as, id, tabIndex, ...props }: RadioProps) => JSX.Element;
|
|
20
|
+
declare const Radio: ({ children, checked, onChange, value, name, gapDistance, childrenPosition, as, id, tabIndex, disabled, ...props }: RadioProps) => JSX.Element;
|
|
21
21
|
export declare const RadioGroup: <T extends unknown>(props: FlexProps & {
|
|
22
22
|
orientation: 'horizontal' | 'vertical';
|
|
23
23
|
value?: T;
|
|
@@ -15,7 +15,7 @@ exports.useRadioContext = () => {
|
|
|
15
15
|
return React.useContext(RadioContext);
|
|
16
16
|
};
|
|
17
17
|
const Radio = (_a) => {
|
|
18
|
-
var { children, checked, onChange, value, name, gapDistance = 10, childrenPosition = 'end', as = 'label', id, tabIndex } = _a, props = tslib_1.__rest(_a, ["children", "checked", "onChange", "value", "name", "gapDistance", "childrenPosition", "as", "id", "tabIndex"]);
|
|
18
|
+
var { children, checked, onChange, value, name, gapDistance = 10, childrenPosition = 'end', as = 'label', id, tabIndex, disabled } = _a, props = tslib_1.__rest(_a, ["children", "checked", "onChange", "value", "name", "gapDistance", "childrenPosition", "as", "id", "tabIndex", "disabled"]);
|
|
19
19
|
const context = exports.useRadioContext();
|
|
20
20
|
const { value: contextValue, onChange: contextOnChange, name: contextName } = context;
|
|
21
21
|
const [stateChecked, setStateChecked] = react_1.useState(false);
|
|
@@ -44,7 +44,7 @@ const Radio = (_a) => {
|
|
|
44
44
|
return (React.createElement(rebass_1.Box, Object.assign({ className: "ab-Radio", my: 2 }, props, { style: Object.assign({ display: 'inline-flex', flexFlow: 'row', alignItems: 'center', cursor: 'pointer', position: 'relative' }, props.style), as: as }),
|
|
45
45
|
before,
|
|
46
46
|
beforeGap,
|
|
47
|
-
React.createElement("input", { className: "ab-Radio-input", id: id, checked: computedChecked, type: "radio", name: name !== null && name !== void 0 ? name : contextName, value: value, tabIndex: tabIndex, style: {
|
|
47
|
+
React.createElement("input", { disabled: disabled, className: "ab-Radio-input", id: id, checked: computedChecked, type: "radio", name: name !== null && name !== void 0 ? name : contextName, value: value, tabIndex: tabIndex, style: {
|
|
48
48
|
verticalAlign: 'middle',
|
|
49
49
|
borderRadius: '50%',
|
|
50
50
|
cursor: 'pointer',
|