@adaptabletools/adaptable 11.0.2 → 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 +6 -3
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/Strategy/FormatColumnModule.js +3 -3
- package/src/agGrid/CheckboxRenderer.d.ts +2 -0
- package/src/agGrid/CheckboxRenderer.js +37 -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
|
@@ -19,7 +19,7 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
19
19
|
* Use Case: Data (cell/row) has changed
|
|
20
20
|
* Action: Any CheckboxFormatColumns need to be updated, as their disabled state may have changed
|
|
21
21
|
*/
|
|
22
|
-
this.api.internalApi.getDataService().on('DataChanged', () => {
|
|
22
|
+
this.api.internalApi.getDataService().on('DataChanged', (dataChangedInfo) => {
|
|
23
23
|
const activeCheckboxColumnIds = this.api.columnApi
|
|
24
24
|
.getColumns()
|
|
25
25
|
.filter((aColumn) => {
|
|
@@ -27,8 +27,8 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
27
27
|
return checkboxFormatColumn && !checkboxFormatColumn.IsSuspended;
|
|
28
28
|
})
|
|
29
29
|
.map((aColumn) => aColumn.columnId);
|
|
30
|
-
if
|
|
31
|
-
|
|
30
|
+
// no need to refresh the CheckboxColumns if the change was triggered by one of them
|
|
31
|
+
if (!activeCheckboxColumnIds.includes(dataChangedInfo.column.columnId)) {
|
|
32
32
|
this.api.internalApi
|
|
33
33
|
.getAdaptableInstance()
|
|
34
34
|
.refreshCells(null, activeCheckboxColumnIds, true, true);
|
|
@@ -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,12 +21,23 @@ 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
|
};
|
|
@@ -36,8 +47,10 @@ exports.getCheckboxRendererForColumn = (columnId, isColumnReadOnly, api) => {
|
|
|
36
47
|
return false;
|
|
37
48
|
};
|
|
38
49
|
CheckboxRenderer.prototype.destroy = function () {
|
|
39
|
-
var _a, _b;
|
|
50
|
+
var _a, _b, _c, _d;
|
|
40
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);
|
|
41
54
|
};
|
|
42
55
|
return CheckboxRenderer;
|
|
43
56
|
};
|
|
@@ -47,10 +60,30 @@ class CheckboxEditor {
|
|
|
47
60
|
// never show the editor, we edit it via the checkbox input element
|
|
48
61
|
return true;
|
|
49
62
|
}
|
|
50
|
-
|
|
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
|
+
}
|
|
51
82
|
getGui() {
|
|
52
|
-
return
|
|
83
|
+
return this.eGui;
|
|
84
|
+
}
|
|
85
|
+
getValue() {
|
|
86
|
+
return this.value;
|
|
53
87
|
}
|
|
54
|
-
getValue() { }
|
|
55
88
|
}
|
|
56
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
|