@adaptabletools/adaptable-cjs 18.0.0-canary.10 → 18.0.0-canary.12
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/base.css +4 -0
- package/base.css.map +1 -1
- package/index.css +6 -0
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +2 -2
- package/src/AdaptableOptions/ColumnOptions.d.ts +7 -4
- package/src/AdaptableOptions/CommentOptions.d.ts +9 -7
- package/src/AdaptableOptions/NoteOptions.d.ts +4 -1
- package/src/Api/AdaptableApi.d.ts +2 -2
- package/src/Api/ColumnApi.d.ts +4 -0
- package/src/Api/CommentApi.d.ts +11 -12
- package/src/Api/ConfigApi.d.ts +2 -2
- package/src/Api/EventApi.d.ts +7 -9
- package/src/Api/Events/CommentChanged.d.ts +11 -0
- package/src/Api/GridApi.d.ts +4 -0
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -2
- package/src/Api/Implementation/AdaptableApiImpl.js +2 -2
- package/src/Api/Implementation/ApiBase.d.ts +2 -2
- package/src/Api/Implementation/ApiBase.js +1 -1
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +10 -0
- package/src/Api/Implementation/CommentsApiImpl.d.ts +1 -2
- package/src/Api/Implementation/ConfigApiImpl.d.ts +2 -2
- package/src/Api/Implementation/ConfigApiImpl.js +2 -2
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/GridApiImpl.js +9 -0
- package/src/Api/Implementation/{NotesApiImpl.d.ts → NoteApiImpl.d.ts} +7 -7
- package/src/Api/Implementation/{NotesApiImpl.js → NoteApiImpl.js} +6 -6
- package/src/Api/Implementation/OptionsApiImpl.d.ts +4 -5
- package/src/Api/Implementation/OptionsApiImpl.js +2 -12
- package/src/Api/Internal/AdaptableInternalApi.d.ts +1 -1
- package/src/Api/Internal/ExportInternalApi.d.ts +2 -1
- package/src/Api/Internal/ExportInternalApi.js +4 -1
- package/src/Api/Internal/NotesInternalApi.d.ts +1 -1
- package/src/Api/Internal/NotesInternalApi.js +3 -3
- package/src/Api/{NotesApi.d.ts → NoteApi.d.ts} +14 -14
- package/src/Api/OptionsApi.d.ts +8 -12
- package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
- package/src/PredefinedConfig/CommentState.d.ts +13 -13
- package/src/PredefinedConfig/Common/RowSummary.d.ts +6 -0
- package/src/PredefinedConfig/{NotesState.d.ts → NoteState.d.ts} +2 -2
- package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -2
- package/src/PredefinedConfig/Selection/GridCell.d.ts +13 -0
- package/src/PredefinedConfig/SystemState.d.ts +2 -3
- package/src/Redux/ActionsReducers/NotesRedux.d.ts +6 -6
- package/src/Redux/ActionsReducers/NotesRedux.js +1 -1
- package/src/Redux/ActionsReducers/SystemRedux.js +3 -3
- package/src/Redux/Store/AdaptableStore.js +3 -9
- package/src/Strategy/CommentsModule.js +4 -4
- package/src/Strategy/NotesModule.js +5 -5
- package/src/Utilities/Services/CellPopupService.js +2 -2
- package/src/Utilities/Services/Interface/IReportService.d.ts +1 -4
- package/src/Utilities/Services/LicenseService/index.js +1 -198
- package/src/Utilities/Services/ReportService.d.ts +7 -5
- package/src/Utilities/Services/ReportService.js +238 -22
- package/src/Utilities/license/decode.js +1 -70
- package/src/Utilities/license/hashing.js +1 -47
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +2 -2
- package/src/View/Components/NewScopeComponent.js +2 -2
- package/src/View/Components/Popups/GridCellPopup/GridCellPopup.js +1 -1
- package/src/View/GridFilter/GridFilterViewPanel.js +1 -1
- package/src/View/Layout/LayoutViewPanel.js +2 -1
- package/src/View/Layout/Wizard/LayoutWizard.js +3 -2
- package/src/View/License/LicenseWatermark.js +1 -66
- package/src/View/Notes/NotesPopup.js +3 -3
- package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +2 -0
- package/src/agGrid/AdaptableAgGrid.js +93 -54
- package/src/agGrid/AgGridAdapter.d.ts +1 -0
- package/src/agGrid/AgGridAdapter.js +3 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +1 -1
- package/src/agGrid/AgGridColumnAdapter.js +2 -2
- package/src/agGrid/AgGridOptionsService.d.ts +4 -1
- package/src/agGrid/AgGridOptionsService.js +22 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +41 -3
- package/src/metamodel/adaptable.metamodel.js +1 -9429
- package/src/types.d.ts +22 -20
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/src/Api/Events/CommentsChangedInfo.d.ts +0 -5
- package/src/PredefinedConfig/CellAddress.d.ts +0 -13
- package/src/PredefinedConfig/CellAddress.js +0 -5
- /package/src/Api/Events/{CommentsChangedInfo.js → CommentChanged.js} +0 -0
- /package/src/Api/{NotesApi.js → NoteApi.js} +0 -0
- /package/src/PredefinedConfig/{NotesState.js → NoteState.js} +0 -0
|
@@ -1,198 +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 clamp_1 = tslib_1.__importDefault(require("lodash/clamp"));
|
|
9
|
-
const DocumentationLinkConstants_1 = require("../../Constants/DocumentationLinkConstants");
|
|
10
|
-
const decode_1 = require("../../license/decode");
|
|
11
|
-
const shouldLogThankYouMessage_1 = require("./shouldLogThankYouMessage");
|
|
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 DEMO_REGEX = /(https):\/\/\S+(\.adaptabletools\.com)/g;
|
|
29
|
-
const getOrigin = () => {
|
|
30
|
-
return typeof window !== 'undefined' ? window.location.origin : '';
|
|
31
|
-
};
|
|
32
|
-
const isInsideSandpack = () => {
|
|
33
|
-
const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(getOrigin()) || []);
|
|
34
|
-
return protocol === 'https' && sandpackUrl === 'sandpack.codesandbox.io';
|
|
35
|
-
};
|
|
36
|
-
const isInsideSandbox = () => {
|
|
37
|
-
const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(getOrigin()) || []);
|
|
38
|
-
return protocol === 'https' && sandboxUrl === '.csb.app';
|
|
39
|
-
};
|
|
40
|
-
const isDemoApp = () => {
|
|
41
|
-
const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(getOrigin()) || []);
|
|
42
|
-
return protocol === 'https' && demoAppUrl === '.adaptabletools.com';
|
|
43
|
-
};
|
|
44
|
-
class LicenseService {
|
|
45
|
-
constructor(adaptable, licenseKey, packageDetails) {
|
|
46
|
-
this.adaptable = adaptable;
|
|
47
|
-
this.licenseKey = licenseKey;
|
|
48
|
-
this.packageDetails = packageDetails;
|
|
49
|
-
this.adaptable = adaptable;
|
|
50
|
-
this.adaptable.api.eventApi.on('AdaptableReady', () => {
|
|
51
|
-
requestAnimationFrame(() => {
|
|
52
|
-
// using a rAF because we want to make sure that the window.location.origin is available (Master/Detail is fidgity sometimes)
|
|
53
|
-
this.init();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
init() {
|
|
58
|
-
let details = null;
|
|
59
|
-
if (this.licenseKey) {
|
|
60
|
-
try {
|
|
61
|
-
details = (0, decode_1.decode)(this.licenseKey);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
details = error;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (!isInsideSandpack() && !isInsideSandbox() && !isDemoApp()) {
|
|
68
|
-
this.handleLicenseValidation(details, this.getValidityType(details, this.packageDetails));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
getValidityType(details, packageDetails) {
|
|
72
|
-
if (!details) {
|
|
73
|
-
return LicenseValidityType.NO_LICENSE;
|
|
74
|
-
}
|
|
75
|
-
if (details instanceof Error) {
|
|
76
|
-
return LicenseValidityType.INVALID_LICENSE;
|
|
77
|
-
}
|
|
78
|
-
const currentVersionReleaseDate = new Date(packageDetails.publishedAt);
|
|
79
|
-
const licenseEndDate = new Date(details.end);
|
|
80
|
-
const currentDate = new Date();
|
|
81
|
-
const isExpired = licenseEndDate < currentDate;
|
|
82
|
-
const isTrial = details.trial;
|
|
83
|
-
const isScope = licenseEndDate > currentVersionReleaseDate;
|
|
84
|
-
let validityType = null;
|
|
85
|
-
if (isExpired) {
|
|
86
|
-
if (isScope) {
|
|
87
|
-
if (isTrial) {
|
|
88
|
-
validityType = LicenseValidityType.NON_PRODUCTION_EXPIRED_IN_SCOPE;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
validityType = LicenseValidityType.COMMERCIAL_EXPIRED_IN_SCOPE;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
if (isTrial) {
|
|
96
|
-
validityType = LicenseValidityType.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
validityType = LicenseValidityType.COMMERCIAL_EXPIRED_OUT_OF_SCOPE;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
if (isTrial) {
|
|
105
|
-
validityType = LicenseValidityType.NON_PRODUCTION_VALID;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
validityType = LicenseValidityType.COMMERCIAL_VALID;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return validityType;
|
|
112
|
-
}
|
|
113
|
-
handleLicenseValidation(details, validityType) {
|
|
114
|
-
var _a;
|
|
115
|
-
const nowAtMidnight = new Date();
|
|
116
|
-
nowAtMidnight.setHours(0, 0, 0, 0);
|
|
117
|
-
let daysLeft = 0;
|
|
118
|
-
if (!(details instanceof Error) && (details === null || details === void 0 ? void 0 : details.end)) {
|
|
119
|
-
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);
|
|
120
|
-
daysLeft = (0, clamp_1.default)(daysLeft, 0, Infinity);
|
|
121
|
-
}
|
|
122
|
-
let APP_NAME = '';
|
|
123
|
-
let forApp = '';
|
|
124
|
-
if (details &&
|
|
125
|
-
!(details instanceof Error) &&
|
|
126
|
-
details.appName &&
|
|
127
|
-
details.appName != decode_1.GENERIC_APP_NAME) {
|
|
128
|
-
APP_NAME = details.appName;
|
|
129
|
-
forApp = ` for application [APP_NAME]`;
|
|
130
|
-
}
|
|
131
|
-
const annotateMessage = (message, link = DocumentationLinkConstants_1.LicenseDocsLink, email = EMAIL, days = daysLeft, appName = APP_NAME) => {
|
|
132
|
-
return message
|
|
133
|
-
.replace('[LINK]', link)
|
|
134
|
-
.replace('[EMAIL]', email)
|
|
135
|
-
.replace('[APP_NAME]', appName)
|
|
136
|
-
.replace('[DAYS]', `${days}`);
|
|
137
|
-
};
|
|
138
|
-
switch (validityType) {
|
|
139
|
-
case 'NO_LICENSE':
|
|
140
|
-
case 'NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE':
|
|
141
|
-
this.adaptable.logger.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');
|
|
142
|
-
this.showNotification('No AdapTable License found.');
|
|
143
|
-
this.showWatermark('This instance of AdapTable does not have a license, and some functionality has therefore been removed.');
|
|
144
|
-
this.disableStatePersistence();
|
|
145
|
-
break;
|
|
146
|
-
case 'INVALID_LICENSE':
|
|
147
|
-
this.adaptable.logger.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');
|
|
148
|
-
this.showNotification('Corrupted AdapTable License found.');
|
|
149
|
-
this.showWatermark(`This instance of AdapTable has a corrupted License, and some functionality has therefore been removed.`);
|
|
150
|
-
this.disableStatePersistence();
|
|
151
|
-
break;
|
|
152
|
-
case 'NON_PRODUCTION_VALID':
|
|
153
|
-
this.adaptable.logger.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');
|
|
154
|
-
break;
|
|
155
|
-
case 'NON_PRODUCTION_EXPIRED_IN_SCOPE':
|
|
156
|
-
this.adaptable.logger.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');
|
|
157
|
-
this.showWatermark('AdapTable License has expired');
|
|
158
|
-
break;
|
|
159
|
-
case 'COMMERCIAL_VALID':
|
|
160
|
-
if (daysLeft <= COMMERCIAL_LICENSE_SHOW_INFO_DAYS_BEFORE_EXPIRE) {
|
|
161
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`This AdapTable license${forApp} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`), 'Info');
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
try {
|
|
165
|
-
if ((0, shouldLogThankYouMessage_1.shouldLogThankYouMessage)()) {
|
|
166
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`Thank you for using a valid AdapTable license${forApp}. Your license will expire in [DAYS] days.`), 'Info');
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
catch (ex) { }
|
|
170
|
-
}
|
|
171
|
-
break;
|
|
172
|
-
case 'COMMERCIAL_EXPIRED_IN_SCOPE':
|
|
173
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`This AdapTable license${forApp} has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)`), 'Warning');
|
|
174
|
-
break;
|
|
175
|
-
case 'COMMERCIAL_EXPIRED_OUT_OF_SCOPE':
|
|
176
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`This AdapTable license${forApp} has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.`), 'Error');
|
|
177
|
-
this.showNotification('Adaptable License has expired');
|
|
178
|
-
this.showWatermark('Adaptable License has expired');
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
showNotification(text) {
|
|
183
|
-
this.adaptable.api.internalApi.dispatchReduxAction((0, PopupRedux_1.PopupShowAlert)({
|
|
184
|
-
alertType: 'generic',
|
|
185
|
-
header: 'License Error',
|
|
186
|
-
message: text,
|
|
187
|
-
alertDefinition: ObjectFactory_1.default.CreateInternalAlertDefinitionForMessages('Error'),
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
showWatermark(text) {
|
|
191
|
-
this.adaptable.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemLicenseShowWatermark)(text));
|
|
192
|
-
}
|
|
193
|
-
disableStatePersistence() {
|
|
194
|
-
this.adaptable.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemLicenseDisablePersistence)());
|
|
195
|
-
}
|
|
196
|
-
destroy() { }
|
|
197
|
-
}
|
|
198
|
-
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")),i=e.__importDefault(require("lodash/clamp")),o=require("../../Constants/DocumentationLinkConstants"),n=require("../../license/decode"),r=require("./shouldLogThankYouMessage"),l="sales@adaptabletools.com",c=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 h=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,E=/(https):\/\/\S+(\.csb\.app)/g,_=/(https):\/\/\S+(\.adaptabletools\.com)/g,I=()=>"undefined"!=typeof window?window.location.origin:"",O=()=>{const[e,a,t]=Array.from(h.exec(I())||[]);return"https"===a&&"sandpack.codesandbox.io"===t},u=()=>{const[e,a,t]=Array.from(E.exec(I())||[]);return"https"===a&&".csb.app"===t},A=()=>{const[e,a,t]=Array.from(_.exec(I())||[]);return"https"===a&&".adaptabletools.com"===t};class N{constructor(e,a,t){this.adaptable=e,this.licenseKey=a,this.packageDetails=t,this.adaptable=e,this.adaptable.api.eventApi.on("AdaptableReady",(()=>{requestAnimationFrame((()=>{this.init()}))}))}init(){let e=null;if(this.licenseKey)try{e=(0,n.decode)(this.licenseKey)}catch(a){e=a}O()||u()||A()||this.handleLicenseValidation(e,this.getValidityType(e,this.packageDetails))}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),i=s<new Date,o=e.trial;let n=null;return n=i?s>t?o?p.NON_PRODUCTION_EXPIRED_IN_SCOPE:p.COMMERCIAL_EXPIRED_IN_SCOPE:o?p.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:p.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:o?p.NON_PRODUCTION_VALID:p.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const s=new Date;s.setHours(0,0,0,0);let p=0;e instanceof Error||!(null==e?void 0:e.end)||(p=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-s.getTime())/d),p=(0,i.default)(p,0,1/0));let h="",E="";!e||e instanceof Error||!e.appName||e.appName==n.GENERIC_APP_NAME||(h=e.appName,E=" for application [APP_NAME]");const _=(e,a=o.LicenseDocsLink,t=l,s=p,i=h)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[APP_NAME]",i).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":this.adaptable.logger.consoleLogByMessageType(_("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":this.adaptable.logger.consoleLogByMessageType(_("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":this.adaptable.logger.consoleLogByMessageType(_("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":this.adaptable.logger.consoleLogByMessageType(_("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":if(p<=c)this.adaptable.logger.consoleLogByMessageType(_(`This AdapTable license${E} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{(0,r.shouldLogThankYouMessage)()&&this.adaptable.logger.consoleLogByMessageType(_(`Thank you for using a valid AdapTable license${E}. Your license will expire in [DAYS] days.`),"Info")}catch(e){}break;case"COMMERCIAL_EXPIRED_IN_SCOPE":this.adaptable.logger.consoleLogByMessageType(_(`This AdapTable license${E} 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":this.adaptable.logger.consoleLogByMessageType(_(`This AdapTable license${E} 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((0,t.PopupShowAlert)({alertType:"generic",header:"License Error",message:e,alertDefinition:s.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseShowWatermark)(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseDisablePersistence)())}destroy(){}}exports.LicenseService=N;
|
|
@@ -10,11 +10,8 @@ export declare class ReportService implements IReportService {
|
|
|
10
10
|
private cellClassKey2excelStyleIdMap;
|
|
11
11
|
private excelStylesWithFormattedDate;
|
|
12
12
|
constructor(adaptableApi: AdaptableApi);
|
|
13
|
-
|
|
14
|
-
registerExcelStyle(excelStyle: Partial<ExcelStyle>, cellClassKey: string): void;
|
|
15
|
-
getRegisteredExcelStyles(): ExcelStyle[];
|
|
13
|
+
destroy(): void;
|
|
16
14
|
getExcelStyleIdForCellClassKey(cellClassKey: string): string;
|
|
17
|
-
registerExcelStyleWithFormattedDate(cellClassId: string, isoFormattedValue: string): void;
|
|
18
15
|
getExcelStyleWithFormattedDate(cellClassId: string): string;
|
|
19
16
|
CreateSystemReport(systemReportName: SystemReportName): Report;
|
|
20
17
|
IsSystemReport(reportName: string): boolean;
|
|
@@ -33,7 +30,12 @@ export declare class ReportService implements IReportService {
|
|
|
33
30
|
getCellExportValueFromRowNode(rowNode: IRowNode, columnId: string): any;
|
|
34
31
|
getCellExportValueFromRawValue(rowNode: IRowNode, cellRawValue: any, columnId: string): any;
|
|
35
32
|
getReportFileName(reportName: string, destination: SystemExportDestination | CustomDestination): string;
|
|
36
|
-
destroy(): void;
|
|
37
33
|
private getCustomExportDateFormat;
|
|
38
34
|
private getCellExportValueFromRawValueByType;
|
|
35
|
+
buildExcelStylesForVisualReports(): ExcelStyle[];
|
|
36
|
+
createExcelStyleMemoization(): void;
|
|
37
|
+
private convertCSSToExcelStyle;
|
|
38
|
+
private resetExcelStyleMemoization;
|
|
39
|
+
private registerExcelStyle;
|
|
40
|
+
private registerExcelStyleWithFormattedDate;
|
|
39
41
|
}
|
|
@@ -11,6 +11,8 @@ const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/String
|
|
|
11
11
|
const ModuleConstants_1 = require("../Constants/ModuleConstants");
|
|
12
12
|
const uuid_1 = require("../../components/utils/uuid");
|
|
13
13
|
const ObjectFactory_1 = require("../ObjectFactory");
|
|
14
|
+
const StyleHelper_1 = require("../Helpers/StyleHelper");
|
|
15
|
+
const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
|
|
14
16
|
class ReportService {
|
|
15
17
|
constructor(adaptableApi) {
|
|
16
18
|
this.adaptableApi = adaptableApi;
|
|
@@ -19,29 +21,12 @@ class ReportService {
|
|
|
19
21
|
this.excelStylesWithFormattedDate = {};
|
|
20
22
|
this.adaptableApi = adaptableApi;
|
|
21
23
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.cellClassKey2excelStyleIdMap = {};
|
|
25
|
-
this.excelStylesWithFormattedDate = {};
|
|
26
|
-
}
|
|
27
|
-
registerExcelStyle(excelStyle, cellClassKey) {
|
|
28
|
-
const excelStyleKey = JSON.stringify(excelStyle);
|
|
29
|
-
if (!this.excelStylesCache[excelStyleKey]) {
|
|
30
|
-
const excelStyleId = (0, uuid_1.createUuid)();
|
|
31
|
-
const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
|
|
32
|
-
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
33
|
-
}
|
|
34
|
-
this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
|
|
35
|
-
}
|
|
36
|
-
getRegisteredExcelStyles() {
|
|
37
|
-
return Object.values(this.excelStylesCache);
|
|
24
|
+
destroy() {
|
|
25
|
+
// TO DO
|
|
38
26
|
}
|
|
39
27
|
getExcelStyleIdForCellClassKey(cellClassKey) {
|
|
40
28
|
return this.cellClassKey2excelStyleIdMap[cellClassKey];
|
|
41
29
|
}
|
|
42
|
-
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
43
|
-
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
44
|
-
}
|
|
45
30
|
getExcelStyleWithFormattedDate(cellClassId) {
|
|
46
31
|
return this.excelStylesWithFormattedDate[cellClassId];
|
|
47
32
|
}
|
|
@@ -369,9 +354,6 @@ class ReportService {
|
|
|
369
354
|
}
|
|
370
355
|
return fileName;
|
|
371
356
|
}
|
|
372
|
-
destroy() {
|
|
373
|
-
// TO DO
|
|
374
|
-
}
|
|
375
357
|
getCustomExportDateFormat() {
|
|
376
358
|
return this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
377
359
|
}
|
|
@@ -383,5 +365,239 @@ class ReportService {
|
|
|
383
365
|
: // type === formattedValue
|
|
384
366
|
this.adaptableApi.gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
|
|
385
367
|
}
|
|
368
|
+
// aggregate and merge all acive Adaptable styles with the user proviided ExcelStyles
|
|
369
|
+
buildExcelStylesForVisualReports() {
|
|
370
|
+
// for historical reasons, the styles are merged as class variables
|
|
371
|
+
// we could/should refactor this to be more functional
|
|
372
|
+
this.createExcelStyleMemoization();
|
|
373
|
+
return Object.values(this.excelStylesCache);
|
|
374
|
+
}
|
|
375
|
+
createExcelStyleMemoization() {
|
|
376
|
+
this.resetExcelStyleMemoization();
|
|
377
|
+
// we memoize as much as possible, as this is called quite A LOT
|
|
378
|
+
const adaptableColumnMap = {};
|
|
379
|
+
const getAdaptableColumnWithColumnId = (columnId) => {
|
|
380
|
+
const memoizedColumn = adaptableColumnMap[columnId];
|
|
381
|
+
if (memoizedColumn) {
|
|
382
|
+
return memoizedColumn;
|
|
383
|
+
}
|
|
384
|
+
const abColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
385
|
+
adaptableColumnMap[columnId] = abColumn;
|
|
386
|
+
return abColumn;
|
|
387
|
+
};
|
|
388
|
+
const formatColumnsWithDisplayFormatForColumn = {};
|
|
389
|
+
const getFormatColumnsWithDisplayFormatForColumn = (columnId) => {
|
|
390
|
+
const memoizedFormatColumns = formatColumnsWithDisplayFormatForColumn[columnId];
|
|
391
|
+
if (memoizedFormatColumns) {
|
|
392
|
+
return memoizedFormatColumns;
|
|
393
|
+
}
|
|
394
|
+
const abColumn = getAdaptableColumnWithColumnId(columnId);
|
|
395
|
+
const formatColumns = this.adaptableApi.formatColumnApi.internalApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
|
|
396
|
+
formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
|
|
397
|
+
return formatColumns;
|
|
398
|
+
};
|
|
399
|
+
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue();
|
|
400
|
+
const displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
|
|
401
|
+
const colDefs = displayedColumns.map((column) => {
|
|
402
|
+
return column.getColDef();
|
|
403
|
+
});
|
|
404
|
+
const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
|
|
405
|
+
const agGridApi = this.adaptableApi.agGridApi;
|
|
406
|
+
const userExcelStyles = this.adaptableApi.internalApi
|
|
407
|
+
.getAdaptableInstance()
|
|
408
|
+
.agGridAdapter.getUserGridOptionsProperty('excelStyles') || [];
|
|
409
|
+
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
|
|
410
|
+
var _a;
|
|
411
|
+
const rowParams = {
|
|
412
|
+
node,
|
|
413
|
+
data: node.data,
|
|
414
|
+
rowIndex,
|
|
415
|
+
api: agGridApi,
|
|
416
|
+
columnApi: null,
|
|
417
|
+
context: ((_a = agGridApi.__getContext) === null || _a === void 0 ? void 0 : _a.call(agGridApi)) || {},
|
|
418
|
+
};
|
|
419
|
+
const getRowStyleFn = agGridApi.getGridOption('getRowStyle');
|
|
420
|
+
const rowStyle = getRowStyleFn ? getRowStyleFn(rowParams) : {};
|
|
421
|
+
displayedColumns.forEach((column, columnIndex) => {
|
|
422
|
+
var _a, _b, _c;
|
|
423
|
+
const colDef = colDefs[columnIndex];
|
|
424
|
+
let cellClassParams;
|
|
425
|
+
const getLazyCellClassParams = () => {
|
|
426
|
+
if (!cellClassParams) {
|
|
427
|
+
cellClassParams = {
|
|
428
|
+
colDef,
|
|
429
|
+
node,
|
|
430
|
+
column,
|
|
431
|
+
data: node.data,
|
|
432
|
+
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId()),
|
|
433
|
+
rowIndex,
|
|
434
|
+
api: agGridApi,
|
|
435
|
+
columnApi: null,
|
|
436
|
+
context: {},
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
return cellClassParams;
|
|
440
|
+
};
|
|
441
|
+
const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
|
|
442
|
+
const excelStyles = [];
|
|
443
|
+
// add user defined excel styles
|
|
444
|
+
let userColDefCellClass = this.adaptableApi.internalApi
|
|
445
|
+
.getAdaptableInstance()
|
|
446
|
+
.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
|
|
447
|
+
const userDefinedCellClass = typeof userColDefCellClass === 'function'
|
|
448
|
+
? userColDefCellClass(getLazyCellClassParams())
|
|
449
|
+
: userColDefCellClass;
|
|
450
|
+
const userDefinedExcelStyle = userDefinedCellClass &&
|
|
451
|
+
userExcelStyles.find((excelStyle) => {
|
|
452
|
+
var _a;
|
|
453
|
+
return typeof userDefinedCellClass === 'string'
|
|
454
|
+
? userDefinedCellClass === excelStyle.id
|
|
455
|
+
: (_a = userDefinedCellClass === null || userDefinedCellClass === void 0 ? void 0 : userDefinedCellClass.includes) === null || _a === void 0 ? void 0 : _a.call(userDefinedCellClass, excelStyle.id);
|
|
456
|
+
});
|
|
457
|
+
if (userDefinedExcelStyle) {
|
|
458
|
+
excelStyles.push(userDefinedExcelStyle);
|
|
459
|
+
}
|
|
460
|
+
// add adaptable derived styles (format column etc.)
|
|
461
|
+
const adaptableStyle = Object.assign(Object.assign({}, rowStyle), Object.keys(cellStyle).reduce((result, key) => {
|
|
462
|
+
if (cellStyle[key] !== null) {
|
|
463
|
+
result[key] = cellStyle[key];
|
|
464
|
+
}
|
|
465
|
+
return result;
|
|
466
|
+
}, {}));
|
|
467
|
+
const sanitizedAdaptableStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableStyle);
|
|
468
|
+
if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
|
|
469
|
+
excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
|
|
470
|
+
}
|
|
471
|
+
const excelDataType = this.adaptableApi.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
|
|
472
|
+
const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
|
|
473
|
+
// don't add the cell style if it has no adaptable custom styles
|
|
474
|
+
if (!excelStyles.length &&
|
|
475
|
+
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
476
|
+
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
const cellClassId = this.adaptableApi.internalApi
|
|
480
|
+
.getAdaptableInstance()
|
|
481
|
+
.agGridColumnAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.internalApi
|
|
482
|
+
.getAdaptableInstance()
|
|
483
|
+
.getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
|
|
484
|
+
const finalCellExcelStyle = Object.assign({}, ...excelStyles);
|
|
485
|
+
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
486
|
+
let dateFormatPattern = this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
487
|
+
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
488
|
+
if (!dateFormatPattern) {
|
|
489
|
+
const mostRelevantFormatColumn = this.adaptableApi.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
|
|
490
|
+
dateFormatPattern =
|
|
491
|
+
((_a = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Formatter) === 'DateFormatter' &&
|
|
492
|
+
((_c = (_b = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _b === void 0 ? void 0 : _b.Options) === null || _c === void 0 ? void 0 : _c.Pattern);
|
|
493
|
+
}
|
|
494
|
+
if (dateFormatPattern) {
|
|
495
|
+
const normalisedValue = this.adaptableApi.internalApi
|
|
496
|
+
.getAdaptableInstance()
|
|
497
|
+
.getNormalisedValueFromRawValue(rawValue, abColumn);
|
|
498
|
+
if (normalisedValue) {
|
|
499
|
+
// we have to pass the date in the ISO format to Excel
|
|
500
|
+
// see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
|
|
501
|
+
// we can NOT use Date.toISOString() because we don't want the timezone corrections to kick in
|
|
502
|
+
const isoFormattedValue = (0, FormatHelper_1.DateFormatter)(normalisedValue, {
|
|
503
|
+
Pattern: `yyyy-MM-dd'T'HH:mm:ss.SSS`,
|
|
504
|
+
});
|
|
505
|
+
if (isoFormattedValue) {
|
|
506
|
+
finalCellExcelStyle.dataType = 'DateTime';
|
|
507
|
+
finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
|
|
508
|
+
// create a new cell key to ensure any user provided className does not interfere
|
|
509
|
+
const cellKey = this.adaptableApi.internalApi
|
|
510
|
+
.getAdaptableInstance()
|
|
511
|
+
.agGridColumnAdapter.getExcelClassNameForCell(column.getColId(), this.adaptableApi.internalApi
|
|
512
|
+
.getAdaptableInstance()
|
|
513
|
+
.getPrimaryKeyValueFromRowNode(node));
|
|
514
|
+
// we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
|
|
515
|
+
this.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
this.registerExcelStyle(finalCellExcelStyle, cellClassId);
|
|
521
|
+
});
|
|
522
|
+
}, forAllVisibleRowNodesDoConfig);
|
|
523
|
+
}
|
|
524
|
+
convertCSSToExcelStyle(style) {
|
|
525
|
+
const getHexColor = (color) => {
|
|
526
|
+
const preparedColor = (0, StyleHelper_1.getVariableColor)(color);
|
|
527
|
+
const t = (0, tinycolor2_1.default)(preparedColor);
|
|
528
|
+
const a = t.getAlpha();
|
|
529
|
+
return tinycolor2_1.default.mix((0, tinycolor2_1.default)('white'), t, a * 100).toHexString();
|
|
530
|
+
};
|
|
531
|
+
let result = {};
|
|
532
|
+
if (style.backgroundColor != null) {
|
|
533
|
+
result.interior = {
|
|
534
|
+
color: getHexColor(style.backgroundColor),
|
|
535
|
+
pattern: 'Solid',
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
if (style.borderColor != null) {
|
|
539
|
+
const excelBorder = {
|
|
540
|
+
color: style.borderColor,
|
|
541
|
+
lineStyle: 'Continuous',
|
|
542
|
+
weight: 1,
|
|
543
|
+
};
|
|
544
|
+
result.borders = {
|
|
545
|
+
borderBottom: excelBorder,
|
|
546
|
+
borderLeft: excelBorder,
|
|
547
|
+
borderRight: excelBorder,
|
|
548
|
+
borderTop: excelBorder,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
if (style.textAlign) {
|
|
552
|
+
result.alignment = {
|
|
553
|
+
horizontal: StringExtensions_1.default.CapitaliseFirstLetter(style.textAlign),
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
if (style.color != null) {
|
|
557
|
+
if (!result.font) {
|
|
558
|
+
result.font = {};
|
|
559
|
+
}
|
|
560
|
+
result.font = {
|
|
561
|
+
color: getHexColor(style.color),
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
if (style.fontStyle === 'italic') {
|
|
565
|
+
if (!result.font) {
|
|
566
|
+
result.font = {};
|
|
567
|
+
}
|
|
568
|
+
result.font.italic = true;
|
|
569
|
+
}
|
|
570
|
+
if (style.fontWeight != null &&
|
|
571
|
+
(style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)) {
|
|
572
|
+
if (!result.font) {
|
|
573
|
+
result.font = {};
|
|
574
|
+
}
|
|
575
|
+
result.font.bold = true;
|
|
576
|
+
}
|
|
577
|
+
if (style.fontSize != null) {
|
|
578
|
+
if (!result.font) {
|
|
579
|
+
result.font = {};
|
|
580
|
+
}
|
|
581
|
+
result.font.size = (0, StyleHelper_1.convertCSSAbsoluteFontSizeToPt)(style.fontSize);
|
|
582
|
+
}
|
|
583
|
+
return result;
|
|
584
|
+
}
|
|
585
|
+
resetExcelStyleMemoization() {
|
|
586
|
+
this.excelStylesCache = {};
|
|
587
|
+
this.cellClassKey2excelStyleIdMap = {};
|
|
588
|
+
this.excelStylesWithFormattedDate = {};
|
|
589
|
+
}
|
|
590
|
+
registerExcelStyle(excelStyle, cellClassKey) {
|
|
591
|
+
const excelStyleKey = JSON.stringify(excelStyle);
|
|
592
|
+
if (!this.excelStylesCache[excelStyleKey]) {
|
|
593
|
+
const excelStyleId = (0, uuid_1.createUuid)();
|
|
594
|
+
const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
|
|
595
|
+
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
596
|
+
}
|
|
597
|
+
this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
|
|
598
|
+
}
|
|
599
|
+
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
600
|
+
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
601
|
+
}
|
|
386
602
|
}
|
|
387
603
|
exports.ReportService = ReportService;
|
|
@@ -1,70 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decode = exports.fieldsToLicenseDetails = exports.GENERIC_APP_NAME = void 0;
|
|
4
|
-
const hashing_1 = require("./hashing");
|
|
5
|
-
const getGenericError = () => new Error('Invalid License');
|
|
6
|
-
exports.GENERIC_APP_NAME = 'GenericAdaptableApp';
|
|
7
|
-
const fieldsToLicenseDetails = (fields) => {
|
|
8
|
-
var _a;
|
|
9
|
-
const fieldsMap = fields.reduce((acc, field) => {
|
|
10
|
-
acc.set(field.name, field.value);
|
|
11
|
-
return acc;
|
|
12
|
-
}, new Map());
|
|
13
|
-
const details = {
|
|
14
|
-
start: new Date(fieldsMap.get('StartDate')),
|
|
15
|
-
end: new Date(fieldsMap.get('EndDate')),
|
|
16
|
-
owner: fieldsMap.get('Owner'),
|
|
17
|
-
appName: fieldsMap.get('AppName') || exports.GENERIC_APP_NAME,
|
|
18
|
-
timestamp: fieldsMap.get('TS') ? Number(fieldsMap.get('TS')) : 0,
|
|
19
|
-
trial: fieldsMap.get('Trial') === 'true' ? true : false,
|
|
20
|
-
ref: (_a = fieldsMap.get('Ref')) !== null && _a !== void 0 ? _a : '',
|
|
21
|
-
};
|
|
22
|
-
if (!details.start ||
|
|
23
|
-
!details.end ||
|
|
24
|
-
!details.owner ||
|
|
25
|
-
typeof details.trial !== 'boolean' ||
|
|
26
|
-
!details.ref) {
|
|
27
|
-
throw getGenericError();
|
|
28
|
-
}
|
|
29
|
-
return details;
|
|
30
|
-
};
|
|
31
|
-
exports.fieldsToLicenseDetails = fieldsToLicenseDetails;
|
|
32
|
-
const decode = (licenseKey) => {
|
|
33
|
-
let crc = '';
|
|
34
|
-
let fields = licenseKey.split('|').map((part) => {
|
|
35
|
-
let [name, value] = part.split('=');
|
|
36
|
-
if (name === 'C') {
|
|
37
|
-
crc = value;
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
name,
|
|
41
|
-
value,
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
if (!crc) {
|
|
45
|
-
throw getGenericError();
|
|
46
|
-
}
|
|
47
|
-
const crcParts = crc.split(',').reverse();
|
|
48
|
-
const overallCrc = crcParts.pop();
|
|
49
|
-
crcParts.forEach((fieldCrc, index) => {
|
|
50
|
-
const field = fields[index];
|
|
51
|
-
if ((0, hashing_1.compute_string)(field.value) !== fieldCrc) {
|
|
52
|
-
throw getGenericError();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
const fieldsWithoutC = [...fields];
|
|
56
|
-
fieldsWithoutC.pop();
|
|
57
|
-
const fieldsWithoutCString = fieldsWithoutC
|
|
58
|
-
.map((field) => {
|
|
59
|
-
return `${field.name}=${field.value}`;
|
|
60
|
-
})
|
|
61
|
-
.join('|');
|
|
62
|
-
if ((0, hashing_1.compute_string)(fieldsWithoutCString) !== overallCrc) {
|
|
63
|
-
throw getGenericError();
|
|
64
|
-
}
|
|
65
|
-
fields = fields.map((f) => {
|
|
66
|
-
return Object.assign(Object.assign({}, f), { value: decodeURI(f.value) });
|
|
67
|
-
});
|
|
68
|
-
return (0, exports.fieldsToLicenseDetails)(fields);
|
|
69
|
-
};
|
|
70
|
-
exports.decode = decode;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode=exports.fieldsToLicenseDetails=exports.GENERIC_APP_NAME=void 0;const e=require("./hashing"),t=()=>new Error("Invalid License");exports.GENERIC_APP_NAME="GenericAdaptableApp";const r=e=>{var r;const s=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map),o={start:new Date(s.get("StartDate")),end:new Date(s.get("EndDate")),owner:s.get("Owner"),appName:s.get("AppName")||exports.GENERIC_APP_NAME,timestamp:s.get("TS")?Number(s.get("TS")):0,trial:"true"===s.get("Trial"),ref:null!==(r=s.get("Ref"))&&void 0!==r?r:""};if(!(o.start&&o.end&&o.owner&&"boolean"==typeof o.trial&&o.ref))throw t();return o};exports.fieldsToLicenseDetails=r;const s=r=>{let s="",o=r.split("|").map((e=>{let[t,r]=e.split("=");return"C"===t&&(s=r),{name:t,value:r}}));if(!s)throw t();const a=s.split(",").reverse(),n=a.pop();a.forEach(((r,s)=>{const a=o[s];if((0,e.compute_string)(a.value)!==r)throw t()}));const i=[...o];i.pop();const p=i.map((e=>`${e.name}=${e.value}`)).join("|");if((0,e.compute_string)(p)!==n)throw t();return o=o.map((e=>Object.assign(Object.assign({},e),{value:decodeURI(e.value)}))),(0,exports.fieldsToLicenseDetails)(o)};exports.decode=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(t=r){var e,n,o,u=new Array;for(e=0;e<256;e++){for(o=e,n=8;n>0;n--)1&~o?o>>>=1:o=o>>>1^t;u[e]=o}return u}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(u,c=r){var i,f=t(c),s=0;for(s=e(),i=0;i<u.length;i++)s=n(f,s,u.charCodeAt(i));return`${s=o(s)}`}exports.compute_string=u;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { CalculatedColumn } from '../../../types';
|
|
3
3
|
import { AdaptableOnePageWizardProps } from '../../Wizard/Interface/IAdaptableWizard';
|
|
4
4
|
export declare const calculatedColumnTypes: readonly ["ScalarExpression", "AggregatedScalarExpression", "CumulativeAggregatedExpression", "QuantileAggregatedExpression"];
|
|
5
|
-
export type ExpressionType = typeof calculatedColumnTypes[number];
|
|
5
|
+
export type ExpressionType = (typeof calculatedColumnTypes)[number];
|
|
6
6
|
export interface CalculatedColumnWizardProps extends AdaptableOnePageWizardProps<CalculatedColumn> {
|
|
7
7
|
}
|
|
8
8
|
export declare const CalculatedColumnWizard: (props: CalculatedColumnWizardProps) => JSX.Element;
|