@adaptabletools/adaptable 11.0.2-canary.0 → 11.0.4
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 +75 -72
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/AdaptableNoCodeWizard.d.ts +1 -0
- package/src/AdaptableOptions/FilterOptions.d.ts +4 -1
- package/src/Api/CellSummaryApi.d.ts +4 -0
- package/src/Api/Implementation/CellSummaryApiImpl.d.ts +2 -0
- package/src/Api/Implementation/CellSummaryApiImpl.js +4 -0
- 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/Utilities/Services/LicenseService.js +1 -159
- package/src/Utilities/license/decode.js +1 -67
- package/src/Utilities/license/hashing.js +1 -47
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +1 -0
- package/src/View/License/LicenseWatermark.js +1 -65
- package/src/agGrid/Adaptable.js +1 -19
- package/src/agGrid/CheckboxRenderer.d.ts +2 -0
- package/src/agGrid/CheckboxRenderer.js +37 -4
- package/src/agGrid/PercentBarRenderer.d.ts +3 -0
- package/src/agGrid/PercentBarRenderer.js +83 -0
- package/src/agGrid/agGridHelper.d.ts +1 -1
- package/src/agGrid/agGridHelper.js +3 -74
- package/src/metamodel/adaptable.metamodel.d.ts +5 -9
- package/src/metamodel/adaptable.metamodel.js +15 -2
- package/src/types.d.ts +1 -0
- 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.4",
|
|
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: 1646846997369;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -12,6 +12,7 @@ export interface AdaptableNoCodeWizardOptions {
|
|
|
12
12
|
defaultActionMessage?: React.ReactNode;
|
|
13
13
|
dragOverActionMessage?: React.ReactNode;
|
|
14
14
|
fetchData?: () => Promise<any>;
|
|
15
|
+
showFetchDataWizard?: boolean;
|
|
15
16
|
helpText?: React.ReactNode;
|
|
16
17
|
fileContentsToJSON?: (str: string) => Promise<any> | any;
|
|
17
18
|
readFile?: (file: File) => Promise<any>;
|
|
@@ -66,7 +66,10 @@ export interface FilterOptions {
|
|
|
66
66
|
*/
|
|
67
67
|
quickFilterValuesTrigger?: 'mouseenter' | 'click';
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Sets a height for Quick Filter Bar (if not provided AG Grid's default is used)
|
|
70
|
+
*
|
|
71
|
+
* @defaultValue null
|
|
72
|
+
* @gridInfoItem
|
|
70
73
|
*/
|
|
71
74
|
quickFilterHeight?: number;
|
|
72
75
|
/**
|
|
@@ -7,6 +7,10 @@ export interface CellSummaryApi {
|
|
|
7
7
|
* Retrieves currently selected Cell Summary Operation
|
|
8
8
|
*/
|
|
9
9
|
getCurrentCellSummaryOperation(): CellSummaryOperation | string;
|
|
10
|
+
/**
|
|
11
|
+
* Sets the currently selected Cell Summary Operation
|
|
12
|
+
*/
|
|
13
|
+
setCurrentCellSummaryOperation(operation: CellSummaryOperation | string): void;
|
|
10
14
|
/**
|
|
11
15
|
* Retrieves all Cell Summary Definitions from Cell Summary State
|
|
12
16
|
*/
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ApiBase } from './ApiBase';
|
|
2
2
|
import { CellSummaryApi } from '../CellSummaryApi';
|
|
3
3
|
import { CellSummaryOperation } from '../../PredefinedConfig/Common/CellSummary';
|
|
4
|
+
import { SummaryOperation } from '../../PredefinedConfig/Common/Enums';
|
|
4
5
|
export declare class CellSummaryApiImpl extends ApiBase implements CellSummaryApi {
|
|
5
6
|
getCurrentCellSummaryOperation(): CellSummaryOperation | string;
|
|
6
7
|
getCellSummaryOperationDefinitions(): CellSummaryOperation[];
|
|
7
8
|
showCellSummaryPopup(): void;
|
|
9
|
+
setCurrentCellSummaryOperation(operation: SummaryOperation | string): void;
|
|
8
10
|
}
|
|
@@ -4,6 +4,7 @@ exports.CellSummaryApiImpl = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ApiBase_1 = require("./ApiBase");
|
|
6
6
|
const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
|
|
7
|
+
const SystemRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/SystemRedux"));
|
|
7
8
|
class CellSummaryApiImpl extends ApiBase_1.ApiBase {
|
|
8
9
|
getCurrentCellSummaryOperation() {
|
|
9
10
|
return this.getAdaptableState().System.CellSummaryOperation;
|
|
@@ -14,5 +15,8 @@ class CellSummaryApiImpl extends ApiBase_1.ApiBase {
|
|
|
14
15
|
showCellSummaryPopup() {
|
|
15
16
|
this.showModulePopup(ModuleConstants.CellSummaryModuleId);
|
|
16
17
|
}
|
|
18
|
+
setCurrentCellSummaryOperation(operation) {
|
|
19
|
+
this.dispatchAction(SystemRedux.SystemCellSummaryChangeOperation(operation));
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
exports.CellSummaryApiImpl = CellSummaryApiImpl;
|
|
@@ -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;
|
|
@@ -1,159 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LicenseService = exports.LicenseValidityType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const SystemRedux_1 = require("../../Redux/ActionsReducers/SystemRedux");
|
|
6
|
-
const PopupRedux_1 = require("../../Redux/ActionsReducers/PopupRedux");
|
|
7
|
-
const ObjectFactory_1 = tslib_1.__importDefault(require("../ObjectFactory"));
|
|
8
|
-
const LoggingHelper_1 = require("../Helpers/LoggingHelper");
|
|
9
|
-
const clamp_1 = tslib_1.__importDefault(require("lodash/clamp"));
|
|
10
|
-
const DocumentationLinkConstants_1 = require("../Constants/DocumentationLinkConstants");
|
|
11
|
-
const decode_1 = require("../license/decode");
|
|
12
|
-
const EMAIL = 'sales@adaptabletools.com';
|
|
13
|
-
const COMMERCIAL_LICENSE_SHOW_INFO_DAYS_BEFORE_EXPIRE = 10;
|
|
14
|
-
const DAY_IN_MS = 1000 * 60 * 60 * 24;
|
|
15
|
-
var LicenseValidityType;
|
|
16
|
-
(function (LicenseValidityType) {
|
|
17
|
-
LicenseValidityType["INVALID_LICENSE"] = "INVALID_LICENSE";
|
|
18
|
-
LicenseValidityType["NO_LICENSE"] = "NO_LICENSE";
|
|
19
|
-
LicenseValidityType["NON_PRODUCTION_VALID"] = "NON_PRODUCTION_VALID";
|
|
20
|
-
LicenseValidityType["NON_PRODUCTION_EXPIRED_IN_SCOPE"] = "NON_PRODUCTION_EXPIRED_IN_SCOPE";
|
|
21
|
-
LicenseValidityType["NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE"] = "NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE";
|
|
22
|
-
LicenseValidityType["COMMERCIAL_VALID"] = "COMMERCIAL_VALID";
|
|
23
|
-
LicenseValidityType["COMMERCIAL_EXPIRED_IN_SCOPE"] = "COMMERCIAL_EXPIRED_IN_SCOPE";
|
|
24
|
-
LicenseValidityType["COMMERCIAL_EXPIRED_OUT_OF_SCOPE"] = "COMMERCIAL_EXPIRED_OUT_OF_SCOPE";
|
|
25
|
-
})(LicenseValidityType = exports.LicenseValidityType || (exports.LicenseValidityType = {}));
|
|
26
|
-
const SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
|
|
27
|
-
const SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
|
|
28
|
-
const origin = typeof window !== 'undefined' ? window.location.origin : '';
|
|
29
|
-
const isInsideSandpack = () => {
|
|
30
|
-
const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
|
|
31
|
-
return protocol === 'https' && sandpackUrl === 'sandpack.codesandbox.io';
|
|
32
|
-
};
|
|
33
|
-
const isInsideSandbox = () => {
|
|
34
|
-
const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
35
|
-
return protocol === 'https' && sandboxUrl === '.csb.app';
|
|
36
|
-
};
|
|
37
|
-
class LicenseService {
|
|
38
|
-
constructor(adaptable, licenseKey, packageDetails) {
|
|
39
|
-
this.adaptable = adaptable;
|
|
40
|
-
this.adaptable = adaptable;
|
|
41
|
-
let details = null;
|
|
42
|
-
if (licenseKey) {
|
|
43
|
-
try {
|
|
44
|
-
details = decode_1.decode(licenseKey);
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
details = error;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (!isInsideSandpack() && !isInsideSandbox()) {
|
|
51
|
-
this.handleLicenseValidation(details, this.getValidityType(details, packageDetails));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
getValidityType(details, packageDetails) {
|
|
55
|
-
if (!details) {
|
|
56
|
-
return LicenseValidityType.NO_LICENSE;
|
|
57
|
-
}
|
|
58
|
-
if (details instanceof Error) {
|
|
59
|
-
return LicenseValidityType.INVALID_LICENSE;
|
|
60
|
-
}
|
|
61
|
-
const currentVersionReleaseDate = new Date(packageDetails.publishedAt);
|
|
62
|
-
const licenseEndDate = new Date(details.end);
|
|
63
|
-
const currentDate = new Date();
|
|
64
|
-
const isExpired = licenseEndDate < currentDate;
|
|
65
|
-
const isTrial = details.trial;
|
|
66
|
-
const isScope = licenseEndDate > currentVersionReleaseDate;
|
|
67
|
-
let validityType = null;
|
|
68
|
-
if (isExpired) {
|
|
69
|
-
if (isScope) {
|
|
70
|
-
if (isTrial) {
|
|
71
|
-
validityType = LicenseValidityType.NON_PRODUCTION_EXPIRED_IN_SCOPE;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
validityType = LicenseValidityType.COMMERCIAL_EXPIRED_IN_SCOPE;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
if (isTrial) {
|
|
79
|
-
validityType = LicenseValidityType.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
validityType = LicenseValidityType.COMMERCIAL_EXPIRED_OUT_OF_SCOPE;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
if (isTrial) {
|
|
88
|
-
validityType = LicenseValidityType.NON_PRODUCTION_VALID;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
validityType = LicenseValidityType.COMMERCIAL_VALID;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return validityType;
|
|
95
|
-
}
|
|
96
|
-
handleLicenseValidation(details, validityType) {
|
|
97
|
-
var _a;
|
|
98
|
-
const nowAtMidnight = new Date();
|
|
99
|
-
nowAtMidnight.setHours(0, 0, 0, 0);
|
|
100
|
-
let daysLeft = 0;
|
|
101
|
-
if (!(details instanceof Error) && (details === null || details === void 0 ? void 0 : details.end)) {
|
|
102
|
-
daysLeft = Math.floor((((_a = details === null || details === void 0 ? void 0 : details.end) === null || _a === void 0 ? void 0 : _a.getTime()) - nowAtMidnight.getTime()) / DAY_IN_MS);
|
|
103
|
-
daysLeft = clamp_1.default(daysLeft, 0, Infinity);
|
|
104
|
-
}
|
|
105
|
-
const annotateMessage = (message, link = DocumentationLinkConstants_1.LicenseDocsLink, email = EMAIL, days = daysLeft) => {
|
|
106
|
-
return message.replace('[LINK]', link).replace('[EMAIL]', email).replace('[DAYS]', `${days}`);
|
|
107
|
-
};
|
|
108
|
-
switch (validityType) {
|
|
109
|
-
case 'NO_LICENSE':
|
|
110
|
-
case 'NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE':
|
|
111
|
-
LoggingHelper_1.ConsoleLogByMessageType(annotateMessage('This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK].'), 'Error');
|
|
112
|
-
this.showNotification('No AdapTable License found.');
|
|
113
|
-
this.showWatermark('This instance of AdapTable does not have a license, and some functionality has therefore been removed.');
|
|
114
|
-
this.disableStatePersistence();
|
|
115
|
-
break;
|
|
116
|
-
case 'INVALID_LICENSE':
|
|
117
|
-
LoggingHelper_1.ConsoleLogByMessageType(annotateMessage('This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK].'), 'Error');
|
|
118
|
-
this.showNotification('Corrupted AdapTable License found.');
|
|
119
|
-
this.showWatermark('This instance of AdapTable has a corrupted License, and some functionality has therefore been removed.');
|
|
120
|
-
this.disableStatePersistence();
|
|
121
|
-
break;
|
|
122
|
-
case 'NON_PRODUCTION_VALID':
|
|
123
|
-
LoggingHelper_1.ConsoleLogByMessageType(annotateMessage('This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK].'), 'Info');
|
|
124
|
-
break;
|
|
125
|
-
case 'NON_PRODUCTION_EXPIRED_IN_SCOPE':
|
|
126
|
-
LoggingHelper_1.ConsoleLogByMessageType(annotateMessage('This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK].'), 'Warning');
|
|
127
|
-
this.showWatermark('AdapTable License has expired');
|
|
128
|
-
break;
|
|
129
|
-
case 'COMMERCIAL_VALID':
|
|
130
|
-
if (daysLeft <= COMMERCIAL_LICENSE_SHOW_INFO_DAYS_BEFORE_EXPIRE) {
|
|
131
|
-
LoggingHelper_1.ConsoleLogByMessageType(annotateMessage(`This AdapTable license expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`), 'Info');
|
|
132
|
-
}
|
|
133
|
-
break;
|
|
134
|
-
case 'COMMERCIAL_EXPIRED_IN_SCOPE':
|
|
135
|
-
LoggingHelper_1.ConsoleLogByMessageType(annotateMessage('This AdapTable license has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)'), 'Warning');
|
|
136
|
-
break;
|
|
137
|
-
case 'COMMERCIAL_EXPIRED_OUT_OF_SCOPE':
|
|
138
|
-
LoggingHelper_1.ConsoleLogByMessageType(annotateMessage('This AdapTable license has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.'), 'Error');
|
|
139
|
-
this.showNotification('Adaptable License has expired');
|
|
140
|
-
this.showWatermark('Adaptable License has expired');
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
showNotification(text) {
|
|
145
|
-
this.adaptable.api.internalApi.dispatchReduxAction(PopupRedux_1.PopupShowAlert({
|
|
146
|
-
header: 'License Error',
|
|
147
|
-
message: text,
|
|
148
|
-
alertDefinition: ObjectFactory_1.default.CreateInternalAlertDefinitionForMessages('Error'),
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
showWatermark(text) {
|
|
152
|
-
this.adaptable.api.internalApi.dispatchReduxAction(SystemRedux_1.SystemLicenseShowWatermark(text));
|
|
153
|
-
}
|
|
154
|
-
disableStatePersistence() {
|
|
155
|
-
this.adaptable.api.internalApi.dispatchReduxAction(SystemRedux_1.SystemLicenseDisablePersistence());
|
|
156
|
-
}
|
|
157
|
-
destroy() { }
|
|
158
|
-
}
|
|
159
|
-
exports.LicenseService = LicenseService;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../Redux/ActionsReducers/SystemRedux"),t=require("../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../ObjectFactory")),o=require("../Helpers/LoggingHelper"),i=e.__importDefault(require("lodash/clamp")),n=require("../Constants/DocumentationLinkConstants"),r=require("../license/decode"),c="sales@adaptabletools.com",l=10,d=864e5;var p;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(p=exports.LicenseValidityType||(exports.LicenseValidityType={}));const E=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,I=/(https):\/\/\S+(\.csb\.app)/g,_=/(https):\/\/\S+(\.adaptabletools\.com)/g,O="undefined"!=typeof window?window.location.origin:"",h=()=>{const[e,a,t]=Array.from(E.exec(O)||[]);return"https"===a&&"sandpack.codesandbox.io"===t},u=()=>{const[e,a,t]=Array.from(I.exec(O)||[]);return"https"===a&&".csb.app"===t},L=()=>{const[e,a,t]=Array.from(_.exec(O)||[]);return"https"===a&&".adaptabletools.com"===t};class A{constructor(e,a,t){this.adaptable=e,this.adaptable=e;let s=null;if(a)try{s=r.decode(a)}catch(e){s=e}h()||u()||L()||this.handleLicenseValidation(s,this.getValidityType(s,t))}getValidityType(e,a){if(!e)return p.NO_LICENSE;if(e instanceof Error)return p.INVALID_LICENSE;const t=new Date(a.publishedAt),s=new Date(e.end),o=s<new Date,i=e.trial;let n=null;return n=o?s>t?i?p.NON_PRODUCTION_EXPIRED_IN_SCOPE:p.COMMERCIAL_EXPIRED_IN_SCOPE:i?p.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:p.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:i?p.NON_PRODUCTION_VALID:p.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const s=new Date;s.setHours(0,0,0,0);let r=0;e instanceof Error||!(null==e?void 0:e.end)||(r=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-s.getTime())/864e5),r=i.default(r,0,1/0));const l=(e,a=n.LicenseDocsLink,t=c,s=r)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":o.ConsoleLogByMessageType(l("This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("No AdapTable License found."),this.showWatermark("This instance of AdapTable does not have a license, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"INVALID_LICENSE":o.ConsoleLogByMessageType(l("This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("Corrupted AdapTable License found."),this.showWatermark("This instance of AdapTable has a corrupted License, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"NON_PRODUCTION_VALID":o.ConsoleLogByMessageType(l("This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Info");break;case"NON_PRODUCTION_EXPIRED_IN_SCOPE":o.ConsoleLogByMessageType(l("This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Warning"),this.showWatermark("AdapTable License has expired");break;case"COMMERCIAL_VALID":r<=10&&o.ConsoleLogByMessageType(l("This AdapTable license expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)"),"Info");break;case"COMMERCIAL_EXPIRED_IN_SCOPE":o.ConsoleLogByMessageType(l("This AdapTable license has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)"),"Warning");break;case"COMMERCIAL_EXPIRED_OUT_OF_SCOPE":o.ConsoleLogByMessageType(l("This AdapTable license has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license."),"Error"),this.showNotification("Adaptable License has expired"),this.showWatermark("Adaptable License has expired")}}showNotification(e){this.adaptable.api.internalApi.dispatchReduxAction(t.PopupShowAlert({header:"License Error",message:e,alertDefinition:s.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction(a.SystemLicenseShowWatermark(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction(a.SystemLicenseDisablePersistence())}destroy(){}}exports.LicenseService=A;
|
|
@@ -1,67 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decode = exports.fieldsToLicenseDetails = void 0;
|
|
4
|
-
const hashing_1 = require("./hashing");
|
|
5
|
-
const getGenericError = () => new Error('Invalid License');
|
|
6
|
-
exports.fieldsToLicenseDetails = (fields) => {
|
|
7
|
-
var _a;
|
|
8
|
-
const fieldsMap = fields.reduce((acc, field) => {
|
|
9
|
-
acc.set(field.name, field.value);
|
|
10
|
-
return acc;
|
|
11
|
-
}, new Map());
|
|
12
|
-
const details = {
|
|
13
|
-
count: fieldsMap.get('DeveloperCount') ? Number(fieldsMap.get('DeveloperCount')) : 0,
|
|
14
|
-
start: new Date(fieldsMap.get('StartDate')),
|
|
15
|
-
end: new Date(fieldsMap.get('EndDate')),
|
|
16
|
-
owner: fieldsMap.get('Owner'),
|
|
17
|
-
timestamp: fieldsMap.get('TS') ? Number(fieldsMap.get('TS')) : 0,
|
|
18
|
-
trial: fieldsMap.get('Trial') === 'true' ? true : false,
|
|
19
|
-
ref: (_a = fieldsMap.get('Ref')) !== null && _a !== void 0 ? _a : '',
|
|
20
|
-
};
|
|
21
|
-
if (!details.start ||
|
|
22
|
-
!details.end ||
|
|
23
|
-
!details.owner ||
|
|
24
|
-
typeof details.trial !== 'boolean' ||
|
|
25
|
-
!details.ref) {
|
|
26
|
-
throw getGenericError();
|
|
27
|
-
}
|
|
28
|
-
return details;
|
|
29
|
-
};
|
|
30
|
-
exports.decode = (licenseKey) => {
|
|
31
|
-
let crc = '';
|
|
32
|
-
let fields = licenseKey.split('|').map((part) => {
|
|
33
|
-
let [name, value] = part.split('=');
|
|
34
|
-
if (name === 'C') {
|
|
35
|
-
crc = value;
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
name,
|
|
39
|
-
value,
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
if (!crc) {
|
|
43
|
-
throw getGenericError();
|
|
44
|
-
}
|
|
45
|
-
const crcParts = crc.split(',').reverse();
|
|
46
|
-
const overallCrc = crcParts.pop();
|
|
47
|
-
crcParts.forEach((fieldCrc, index) => {
|
|
48
|
-
const field = fields[index];
|
|
49
|
-
if (hashing_1.compute_string(field.value) !== fieldCrc) {
|
|
50
|
-
throw getGenericError();
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const fieldsWithoutC = [...fields];
|
|
54
|
-
fieldsWithoutC.pop();
|
|
55
|
-
const fieldsWithoutCString = fieldsWithoutC
|
|
56
|
-
.map((field) => {
|
|
57
|
-
return `${field.name}=${field.value}`;
|
|
58
|
-
})
|
|
59
|
-
.join('|');
|
|
60
|
-
if (hashing_1.compute_string(fieldsWithoutCString) !== overallCrc) {
|
|
61
|
-
throw getGenericError();
|
|
62
|
-
}
|
|
63
|
-
fields = fields.map((f) => {
|
|
64
|
-
return Object.assign(Object.assign({}, f), { value: decodeURI(f.value) });
|
|
65
|
-
});
|
|
66
|
-
return exports.fieldsToLicenseDetails(fields);
|
|
67
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode=exports.fieldsToLicenseDetails=void 0;const e=require("./hashing"),t=()=>new Error("Invalid License");exports.fieldsToLicenseDetails=e=>{var r;const o=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map),s={count:o.get("DeveloperCount")?Number(o.get("DeveloperCount")):0,start:new Date(o.get("StartDate")),end:new Date(o.get("EndDate")),owner:o.get("Owner"),timestamp:o.get("TS")?Number(o.get("TS")):0,trial:"true"===o.get("Trial"),ref:null!==(r=o.get("Ref"))&&void 0!==r?r:""};if(!(s.start&&s.end&&s.owner&&"boolean"==typeof s.trial&&s.ref))throw t();return s},exports.decode=r=>{let o="",s=r.split("|").map((e=>{let[t,r]=e.split("=");return"C"===t&&(o=r),{name:t,value:r}}));if(!o)throw t();const n=o.split(",").reverse(),a=n.pop();n.forEach(((r,o)=>{const n=s[o];if(e.compute_string(n.value)!==r)throw t()}));const i=[...s];i.pop();const l=i.map((e=>`${e.name}=${e.value}`)).join("|");if(e.compute_string(l)!==a)throw t();return s=s.map((e=>Object.assign(Object.assign({},e),{value:decodeURI(e.value)}))),exports.fieldsToLicenseDetails(s)};
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compute_string = void 0;
|
|
4
|
-
const DEFAULT_ReversedPolynomial = 0xedb88320;
|
|
5
|
-
/*
|
|
6
|
-
* CRC-32 implementation
|
|
7
|
-
*/
|
|
8
|
-
function generate(reversedPolynomial = DEFAULT_ReversedPolynomial) {
|
|
9
|
-
var table = new Array();
|
|
10
|
-
var i, j, n;
|
|
11
|
-
for (i = 0; i < 256; i++) {
|
|
12
|
-
n = i;
|
|
13
|
-
for (j = 8; j > 0; j--) {
|
|
14
|
-
if ((n & 1) == 1) {
|
|
15
|
-
n = (n >>> 1) ^ reversedPolynomial;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
n = n >>> 1;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
table[i] = n;
|
|
22
|
-
}
|
|
23
|
-
return table;
|
|
24
|
-
}
|
|
25
|
-
function crc32_initial() {
|
|
26
|
-
return 0xffffffff;
|
|
27
|
-
}
|
|
28
|
-
function crc32_add_byte(table, crc, byte) {
|
|
29
|
-
crc = (crc >>> 8) ^ table[byte ^ (crc & 0x000000ff)];
|
|
30
|
-
return crc;
|
|
31
|
-
}
|
|
32
|
-
function crc32_final(crc) {
|
|
33
|
-
crc = ~crc;
|
|
34
|
-
crc = crc < 0 ? 0xffffffff + crc + 1 : crc;
|
|
35
|
-
return crc;
|
|
36
|
-
}
|
|
37
|
-
function compute_string(str, reversedPolynomial = DEFAULT_ReversedPolynomial) {
|
|
38
|
-
var table = generate(reversedPolynomial);
|
|
39
|
-
var crc = 0;
|
|
40
|
-
var i;
|
|
41
|
-
crc = crc32_initial();
|
|
42
|
-
for (i = 0; i < str.length; i++)
|
|
43
|
-
crc = crc32_add_byte(table, crc, str.charCodeAt(i));
|
|
44
|
-
crc = crc32_final(crc);
|
|
45
|
-
return `${crc}`;
|
|
46
|
-
}
|
|
47
|
-
exports.compute_string = compute_string;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compute_string=void 0;const r=3988292384;function t(r=3988292384){var t,e,n,o=new Array;for(t=0;t<256;t++){for(n=t,e=8;e>0;e--)1==(1&n)?n=n>>>1^r:n>>>=1;o[t]=n}return o}function e(){return 4294967295}function n(r,t,e){return t=t>>>8^r[e^255&t]}function o(r){return r=(r=~r)<0?4294967295+r+1:r}function u(r,u=3988292384){var c,i=t(u),f=0;for(f=e(),c=0;c<r.length;c++)f=n(i,f,r.charCodeAt(c));return`${f=o(f)}`}exports.compute_string=u;
|
|
@@ -15,6 +15,7 @@ exports.renderAlertBehaviourSummary = (alert, api, allowWrap = false) => {
|
|
|
15
15
|
const values = [
|
|
16
16
|
AlertProperties.PreventEdit ? { label: 'Prevent Cell Edit', id: 'preventCellEdit' } : null,
|
|
17
17
|
AlertProperties.HighlightCell ? { label: 'Highlight Cell', id: 'highlightCell' } : null,
|
|
18
|
+
AlertProperties.HighlightRow ? { label: 'Highlight Row', id: 'highlightRow' } : null,
|
|
18
19
|
AlertProperties.JumpToCell ? { label: 'Jump To Cell', id: 'jumptocell' } : null,
|
|
19
20
|
AlertProperties.ShowInDiv
|
|
20
21
|
? {
|
|
@@ -1,65 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LicenseWatermark = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const Logo_1 = require("../../components/Logo");
|
|
7
|
-
const rebass_1 = require("rebass");
|
|
8
|
-
const style = {
|
|
9
|
-
border: '1px solid var(--ab-color-error)',
|
|
10
|
-
padding: '5px',
|
|
11
|
-
fontWeight: 600,
|
|
12
|
-
margin: '5px',
|
|
13
|
-
fontSize: '14px',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
color: 'var(--ab-color-text-on-defaultbackground)',
|
|
16
|
-
background: 'var(--ab-color-defaultbackground)',
|
|
17
|
-
};
|
|
18
|
-
const isStyleValid = (element) => {
|
|
19
|
-
const notAllowedProperties = [
|
|
20
|
-
['display', 'none'],
|
|
21
|
-
['opacity', '0'],
|
|
22
|
-
['position', 'absolute'],
|
|
23
|
-
['position', 'fixed'],
|
|
24
|
-
['position', 'relative'],
|
|
25
|
-
['visibility', 'hidden'],
|
|
26
|
-
];
|
|
27
|
-
for (const [prop, value] of notAllowedProperties) {
|
|
28
|
-
if (element.style[prop] === value) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return true;
|
|
33
|
-
};
|
|
34
|
-
exports.LicenseWatermark = (props) => {
|
|
35
|
-
const ref = React.useRef(null);
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
const checkWatermark = () => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
if (!((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isConnected)) {
|
|
40
|
-
alert('It is not allowed to remove the Adaptable watermark.');
|
|
41
|
-
}
|
|
42
|
-
if (!isStyleValid(ref.current)) {
|
|
43
|
-
alert('It is not allowed to modify the Adaptable watermark.');
|
|
44
|
-
}
|
|
45
|
-
if ((_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.style) {
|
|
46
|
-
ref.current.style.border = style.border;
|
|
47
|
-
ref.current.style.padding = style.padding;
|
|
48
|
-
ref.current.style.fontWeight = `${style.fontWeight}`;
|
|
49
|
-
ref.current.style.margin = style.margin;
|
|
50
|
-
ref.current.style.fontSize = style.fontSize;
|
|
51
|
-
ref.current.style.color = style.color;
|
|
52
|
-
ref.current.style.background = style.background;
|
|
53
|
-
ref.current.style.display = 'flex';
|
|
54
|
-
ref.current.style.position = 'static';
|
|
55
|
-
ref.current.style.opacity = '1';
|
|
56
|
-
ref.current.style.visibility = 'visible';
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const timerId = setInterval(checkWatermark, 5000);
|
|
60
|
-
return () => clearTimeout(timerId);
|
|
61
|
-
}, []);
|
|
62
|
-
return (React.createElement(rebass_1.Flex, { style: style, ref: ref },
|
|
63
|
-
React.createElement(Logo_1.Logo, { style: { marginRight: 10 } }),
|
|
64
|
-
React.createElement("div", null, props.children)));
|
|
65
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseWatermark=void 0;const e=require("tslib"),t=e.__importStar(require("react")),r=require("../../components/Logo"),o=require("rebass"),n={border:"1px solid var(--ab-color-error)",padding:"5px",fontWeight:600,margin:"5px",fontSize:"14px",alignItems:"center",color:"var(--ab-color-text-on-defaultbackground)",background:"var(--ab-color-defaultbackground)"},i=e=>{const t=[["display","none"],["opacity","0"],["position","absolute"],["position","fixed"],["position","relative"],["visibility","hidden"]];for(const[r,o]of t)if(e.style[r]===o)return!1;return!0};exports.LicenseWatermark=e=>{const l=t.useRef(null);return t.useEffect((()=>{const e=setInterval((()=>{var e,t;(null===(e=l.current)||void 0===e?void 0:e.isConnected)||alert("It is not allowed to remove the Adaptable watermark."),i(l.current)||alert("It is not allowed to modify the Adaptable watermark."),(null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.style)&&(l.current.style.border=n.border,l.current.style.padding=n.padding,l.current.style.fontWeight=`${n.fontWeight}`,l.current.style.margin=n.margin,l.current.style.fontSize=n.fontSize,l.current.style.color=n.color,l.current.style.background=n.background,l.current.style.display="flex",l.current.style.position="static",l.current.style.opacity="1",l.current.style.visibility="visible")}),5e3);return()=>clearTimeout(e)}),[]),t.createElement(o.Flex,{style:n,ref:l},t.createElement(r.Logo,{style:{marginRight:10}}),t.createElement("div",null,e.children))};
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -2521,24 +2521,6 @@ class Adaptable {
|
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
2523
|
});
|
|
2524
|
-
/**
|
|
2525
|
-
* Use Case: Data (cell/row) has changed
|
|
2526
|
-
* Action: Any CheckboxFormatColumns need to be updated, as their disabled state may have changed
|
|
2527
|
-
*/
|
|
2528
|
-
this.gridOptions.api.addGlobalListener((type) => {
|
|
2529
|
-
if ([all_modules_1.Events.EVENT_CELL_VALUE_CHANGED, all_modules_1.Events.EVENT_ROW_VALUE_CHANGED].includes(type)) {
|
|
2530
|
-
const activeCheckboxColumnIds = this.api.columnApi
|
|
2531
|
-
.getColumns()
|
|
2532
|
-
.filter((aColumn) => {
|
|
2533
|
-
const checkboxFormatColumn = this.api.formatColumnApi.getCheckBoxStyleFormatColumn(aColumn);
|
|
2534
|
-
return checkboxFormatColumn && !checkboxFormatColumn.IsSuspended;
|
|
2535
|
-
})
|
|
2536
|
-
.map((aColumn) => aColumn.columnId);
|
|
2537
|
-
if (activeCheckboxColumnIds.length) {
|
|
2538
|
-
this.refreshCells(null, activeCheckboxColumnIds, true, true);
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
});
|
|
2542
2524
|
/**
|
|
2543
2525
|
* Row and Cell listeners created in 2020
|
|
2544
2526
|
* These have supplanted many of the events we previously had and simplified things
|
|
@@ -2910,7 +2892,7 @@ class Adaptable {
|
|
|
2910
2892
|
const formatColumn = this.api.formatColumnApi.getFormatColumnForColumn(abColumn);
|
|
2911
2893
|
if (formatColumn && !(formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.IsSuspended) && formatColumn.ColumnStyle) {
|
|
2912
2894
|
if (formatColumn.ColumnStyle.PercentBarStyle) {
|
|
2913
|
-
return this.agGridHelper.
|
|
2895
|
+
return this.agGridHelper.createPercentBarRendererComp(formatColumn);
|
|
2914
2896
|
}
|
|
2915
2897
|
if (formatColumn.ColumnStyle.CheckBoxStyle) {
|
|
2916
2898
|
return this.agGridHelper.createCheckboxRendererComp(abColumn.columnId, abColumn.readOnly);
|
|
@@ -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;
|