@adaptabletools/adaptable 11.0.1 → 11.0.3
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 +29 -26
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -1
- package/src/Strategy/FormatColumnModule.js +19 -0
- package/src/Utilities/Services/DataService.d.ts +1 -1
- package/src/Utilities/Services/DataService.js +4 -3
- package/src/agGrid/Adaptable.d.ts +1 -1
- package/src/agGrid/Adaptable.js +4 -2
- package/src/agGrid/CheckboxRenderer.d.ts +2 -0
- package/src/agGrid/CheckboxRenderer.js +43 -4
- 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": "11.0.
|
|
3
|
+
"version": "11.0.3",
|
|
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: 1646417924493;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -109,7 +109,7 @@ export interface IAdaptable {
|
|
|
109
109
|
redrawBody(): void;
|
|
110
110
|
redrawHeader(): void;
|
|
111
111
|
redrawRow(rowNode: RowNode): void;
|
|
112
|
-
refreshCells(rowNodes: RowNode[], columns: (string | any)[], forceUpdate: boolean): void;
|
|
112
|
+
refreshCells(rowNodes: RowNode[], columns: (string | any)[], forceUpdate: boolean, suppressFlash?: boolean): void;
|
|
113
113
|
setSelectedCells(): SelectedCellInfo | undefined;
|
|
114
114
|
setSelectedRows(): SelectedRowInfo | undefined;
|
|
115
115
|
jumpToRow(rowNode: RowNode): void;
|
|
@@ -15,6 +15,25 @@ const getFormatColumnStyleViewItems_1 = require("./Utilities/getFormatColumnStyl
|
|
|
15
15
|
class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
16
16
|
constructor(api) {
|
|
17
17
|
super(ModuleConstants.FormatColumnModuleId, 'Format Column', 'format-column', 'FormatColumnPopup', 'Create a column style, display format or cell alignment', api);
|
|
18
|
+
/**
|
|
19
|
+
* Use Case: Data (cell/row) has changed
|
|
20
|
+
* Action: Any CheckboxFormatColumns need to be updated, as their disabled state may have changed
|
|
21
|
+
*/
|
|
22
|
+
this.api.internalApi.getDataService().on('DataChanged', (dataChangedInfo) => {
|
|
23
|
+
const activeCheckboxColumnIds = this.api.columnApi
|
|
24
|
+
.getColumns()
|
|
25
|
+
.filter((aColumn) => {
|
|
26
|
+
const checkboxFormatColumn = this.api.formatColumnApi.getCheckBoxStyleFormatColumn(aColumn);
|
|
27
|
+
return checkboxFormatColumn && !checkboxFormatColumn.IsSuspended;
|
|
28
|
+
})
|
|
29
|
+
.map((aColumn) => aColumn.columnId);
|
|
30
|
+
// no need to refresh the CheckboxColumns if the change was triggered by one of them
|
|
31
|
+
if (!activeCheckboxColumnIds.includes(dataChangedInfo.column.columnId)) {
|
|
32
|
+
this.api.internalApi
|
|
33
|
+
.getAdaptableInstance()
|
|
34
|
+
.refreshCells(null, activeCheckboxColumnIds, true, true);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
18
37
|
}
|
|
19
38
|
getModuleAdaptableObjects() {
|
|
20
39
|
return this.api.formatColumnApi.getAllFormatColumn();
|
|
@@ -16,8 +16,8 @@ export declare class DataService implements IDataService {
|
|
|
16
16
|
CreateDataChangedEvent(dataChangedInfo: DataChangedInfo): void;
|
|
17
17
|
logUndoChange(change: DataChangedInfo): void;
|
|
18
18
|
extractUndoChange(change: DataChangedInfo): DataChangedInfo | undefined;
|
|
19
|
+
destroy(): void;
|
|
19
20
|
private getUndoChangeKey;
|
|
20
21
|
private logDataChange;
|
|
21
22
|
private extractDataChangeLogEntry;
|
|
22
|
-
destroy(): void;
|
|
23
23
|
}
|
|
@@ -57,6 +57,10 @@ class DataService {
|
|
|
57
57
|
}
|
|
58
58
|
return result;
|
|
59
59
|
}
|
|
60
|
+
destroy() {
|
|
61
|
+
this.emitter.clearListeners();
|
|
62
|
+
this.emitter = null;
|
|
63
|
+
}
|
|
60
64
|
getUndoChangeKey(primaryKeyValue, columnId, previousValue, newValue) {
|
|
61
65
|
return JSON.stringify({
|
|
62
66
|
primaryKeyValue,
|
|
@@ -77,8 +81,5 @@ class DataService {
|
|
|
77
81
|
return Object.assign(Object.assign({}, dataChangedInfo), { rowNode,
|
|
78
82
|
rowData });
|
|
79
83
|
}
|
|
80
|
-
destroy() {
|
|
81
|
-
// TO DO
|
|
82
|
-
}
|
|
83
84
|
}
|
|
84
85
|
exports.DataService = DataService;
|
|
@@ -187,7 +187,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
187
187
|
redrawBody(): void;
|
|
188
188
|
redrawHeader(): void;
|
|
189
189
|
redrawRow(rowNode: RowNode): void;
|
|
190
|
-
refreshCells(rowNodes: RowNode[], columns: (string | Column)[], forceUpdate: boolean): void;
|
|
190
|
+
refreshCells(rowNodes: RowNode[], columns: (string | Column)[], forceUpdate: boolean, suppressFlash?: boolean): void;
|
|
191
191
|
jumpToRow(rowNode: RowNode): void;
|
|
192
192
|
jumpToColumn(columnId: string): void;
|
|
193
193
|
jumpToCell(columnId: string, rowNode: RowNode): void;
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -1507,7 +1507,8 @@ class Adaptable {
|
|
|
1507
1507
|
return selectedRowInfo;
|
|
1508
1508
|
}
|
|
1509
1509
|
setValue(dataChangedInfo) {
|
|
1510
|
-
// note: because we use
|
|
1510
|
+
// note: because we use RowNode.setDataValue() this will cause Validation to fire
|
|
1511
|
+
// see https://www.ag-grid.com/javascript-data-grid/change-detection/#triggering-value-change-detection
|
|
1511
1512
|
let newValue;
|
|
1512
1513
|
let dataType = dataChangedInfo.column.dataType;
|
|
1513
1514
|
newValue =
|
|
@@ -1959,7 +1960,7 @@ class Adaptable {
|
|
|
1959
1960
|
LoggingHelper_1.ConsoleLogError('ag-grid redrawRows was unable to find some row nodes. Tried to redraw row node: ', rowNode, ex);
|
|
1960
1961
|
}
|
|
1961
1962
|
}
|
|
1962
|
-
refreshCells(rowNodes, columns, forceUpdate) {
|
|
1963
|
+
refreshCells(rowNodes, columns, forceUpdate, suppressFlash = false) {
|
|
1963
1964
|
const api = this.gridOptions.api;
|
|
1964
1965
|
// in order to get a fresh reference to rowNodes
|
|
1965
1966
|
// rowNodes = this.getRowNodesForPrimaryKeys(
|
|
@@ -1969,6 +1970,7 @@ class Adaptable {
|
|
|
1969
1970
|
rowNodes,
|
|
1970
1971
|
columns: columns,
|
|
1971
1972
|
force: forceUpdate,
|
|
1973
|
+
suppressFlash,
|
|
1972
1974
|
};
|
|
1973
1975
|
api.refreshCells(refreshCellParams);
|
|
1974
1976
|
}
|
|
@@ -3,6 +3,8 @@ import { AdaptableApi } from '../Api/AdaptableApi';
|
|
|
3
3
|
import { ICellEditorComp, ICellEditorParams } from '@ag-grid-community/core/dist/cjs/es5/interfaces/iCellEditor';
|
|
4
4
|
export declare const getCheckboxRendererForColumn: (columnId: string, isColumnReadOnly: boolean, api: AdaptableApi) => ICellRendererFunc;
|
|
5
5
|
export declare class CheckboxEditor implements ICellEditorComp {
|
|
6
|
+
private eGui;
|
|
7
|
+
private value;
|
|
6
8
|
isCancelBeforeStart(): boolean;
|
|
7
9
|
init(params: ICellEditorParams): void;
|
|
8
10
|
getGui(): HTMLElement;
|
|
@@ -21,17 +21,36 @@ exports.getCheckboxRendererForColumn = (columnId, isColumnReadOnly, api) => {
|
|
|
21
21
|
align-items: center;
|
|
22
22
|
justify-content: center;`;
|
|
23
23
|
this.eGui.appendChild(inputElement);
|
|
24
|
+
if (!inputElement.disabled) {
|
|
25
|
+
this.suppressEditEvent = this.suppressEditEvent.bind(this);
|
|
26
|
+
this.eGui.addEventListener('click', this.suppressEditEvent);
|
|
27
|
+
this.eGui.addEventListener('dblclick', this.suppressEditEvent);
|
|
28
|
+
}
|
|
24
29
|
};
|
|
25
30
|
CheckboxRenderer.prototype.checkedHandler = function (e) {
|
|
26
31
|
let checked = e.target.checked;
|
|
27
32
|
this.params.node.setDataValue(columnId, checked);
|
|
28
33
|
api.formatColumnApi.fireCheckboxColumnClickedEvent(columnId, this.params.node.data, api.gridApi.getPrimaryKeyValueForRowNode(this.params.node), checked);
|
|
29
34
|
};
|
|
35
|
+
CheckboxRenderer.prototype.suppressEditEvent = function (event) {
|
|
36
|
+
if (event.target === this.eGui) {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
event.stopPropagation();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
30
41
|
CheckboxRenderer.prototype.getGui = function () {
|
|
31
42
|
return this.eGui;
|
|
32
43
|
};
|
|
33
44
|
CheckboxRenderer.prototype.refresh = function () {
|
|
34
|
-
|
|
45
|
+
// by returning FALSE, AG Grid will remove the component from the DOM
|
|
46
|
+
// and (re)create a new component in its place with the new value & disabled state
|
|
47
|
+
return false;
|
|
48
|
+
};
|
|
49
|
+
CheckboxRenderer.prototype.destroy = function () {
|
|
50
|
+
var _a, _b, _c, _d;
|
|
51
|
+
(_b = (_a = this.eGui) === null || _a === void 0 ? void 0 : _a.firstChild) === null || _b === void 0 ? void 0 : _b.removeEventListener('click', this.checkedHandler);
|
|
52
|
+
(_c = this.eGui) === null || _c === void 0 ? void 0 : _c.removeEventListener('click', this.suppressEditEvent);
|
|
53
|
+
(_d = this.eGui) === null || _d === void 0 ? void 0 : _d.removeEventListener('dblclick', this.suppressEditEvent);
|
|
35
54
|
};
|
|
36
55
|
return CheckboxRenderer;
|
|
37
56
|
};
|
|
@@ -41,10 +60,30 @@ class CheckboxEditor {
|
|
|
41
60
|
// never show the editor, we edit it via the checkbox input element
|
|
42
61
|
return true;
|
|
43
62
|
}
|
|
44
|
-
|
|
63
|
+
// the initialisation below is not required in 99% of cases, as the editor is never shown
|
|
64
|
+
// however, using ReactUI makes some race conditions possible, in which cases the editor will be displayed for a few milliseconds
|
|
65
|
+
// we provide this logic for those few cases (to avoid a flicker effect)
|
|
66
|
+
init(params) {
|
|
67
|
+
const adaptable = params.api.__adaptable;
|
|
68
|
+
const inputElement = document.createElement('input');
|
|
69
|
+
inputElement.type = 'checkbox';
|
|
70
|
+
inputElement.checked = params.value;
|
|
71
|
+
inputElement.disabled = adaptable.api.internalApi
|
|
72
|
+
.getAdaptableInstance()
|
|
73
|
+
.isCellEditable(params.node, params.column);
|
|
74
|
+
this.eGui = document.createElement('div');
|
|
75
|
+
this.eGui.style.cssText = `display: flex;
|
|
76
|
+
height: 100%;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;`;
|
|
79
|
+
this.eGui.appendChild(inputElement);
|
|
80
|
+
this.value = params.value;
|
|
81
|
+
}
|
|
45
82
|
getGui() {
|
|
46
|
-
return
|
|
83
|
+
return this.eGui;
|
|
84
|
+
}
|
|
85
|
+
getValue() {
|
|
86
|
+
return this.value;
|
|
47
87
|
}
|
|
48
|
-
getValue() { }
|
|
49
88
|
}
|
|
50
89
|
exports.CheckboxEditor = CheckboxEditor;
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "11.0.
|
|
1
|
+
declare const _default: "11.0.3";
|
|
2
2
|
export default _default;
|
package/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = '11.0.
|
|
3
|
+
exports.default = '11.0.3'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
|