@adaptabletools/adaptable-cjs 18.0.0-canary.7 → 18.0.0-canary.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "18.0.0-canary.7",
3
+ "version": "18.0.0-canary.8",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -61,7 +61,7 @@
61
61
  "tinycolor2": "^1.4.2",
62
62
  "tslib": "^2.3.0",
63
63
  "uuid": "^3.3.2",
64
- "react-toastify": "10.0.1"
64
+ "react-toastify": "9.1.3"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "ag-grid-community": ">=31.1.0"
@@ -26,17 +26,19 @@ var LicenseValidityType;
26
26
  const SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
27
27
  const SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
28
28
  const DEMO_REGEX = /(https):\/\/\S+(\.adaptabletools\.com)/g;
29
- const origin = typeof window !== 'undefined' ? window.location.origin : '';
29
+ const getOrigin = () => {
30
+ return typeof window !== 'undefined' ? window.location.origin : '';
31
+ };
30
32
  const isInsideSandpack = () => {
31
- const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
33
+ const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(getOrigin()) || []);
32
34
  return protocol === 'https' && sandpackUrl === 'sandpack.codesandbox.io';
33
35
  };
34
36
  const isInsideSandbox = () => {
35
- const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
37
+ const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(getOrigin()) || []);
36
38
  return protocol === 'https' && sandboxUrl === '.csb.app';
37
39
  };
38
40
  const isDemoApp = () => {
39
- const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(origin) || []);
41
+ const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(getOrigin()) || []);
40
42
  return protocol === 'https' && demoAppUrl === '.adaptabletools.com';
41
43
  };
42
44
  class LicenseService {
@@ -35,7 +35,7 @@ class AdaptableView extends React.Component {
35
35
  , {
36
36
  // we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
37
37
  // instance is destroyed and re-created many times
38
- containerId: adaptableOptions.adaptableId, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
38
+ containerId: `Toastify-${adaptableOptions.adaptableId}`, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
39
39
  (watermark === null || watermark === void 0 ? void 0 : watermark.show) && React.createElement(License_1.LicenseWatermark, null, watermark === null || watermark === void 0 ? void 0 : watermark.text),
40
40
  React.createElement(WindowPopups_1.WindowPopups, null),
41
41
  React.createElement(FormPopups_1.FormPopups, null),
@@ -16,7 +16,7 @@ const showToast = (props) => {
16
16
  });
17
17
  const adaptableOptions = props.api.optionsApi.getAdaptableOptions();
18
18
  const toastProps = ObjectFactory_1.default.CreateToastOptions(adaptableOptions.notificationsOptions, {
19
- containerId: adaptableOptions.adaptableId,
19
+ containerId: `Toastify-${adaptableOptions.adaptableId}`,
20
20
  onClose: () => {
21
21
  off();
22
22
  },
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataChangeHistoryGrid = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
- const AdaptableContext_1 = require("../AdaptableContext");
7
6
  const react_1 = require("react");
7
+ const AdaptableContext_1 = require("../AdaptableContext");
8
8
  const usePrevious_1 = tslib_1.__importDefault(require("../../components/utils/usePrevious"));
9
9
  const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
10
10
  const buildActionColumnButton_1 = require("./buildActionColumnButton");
11
+ const AdaptableAgGrid_1 = require("../../agGrid/AdaptableAgGrid");
11
12
  const DataChangeHistoryGrid = (props) => {
12
13
  const { changeHistoryLog, adaptableContainerId, agGridContainerId, onUndoChange, onClearRow } = props;
13
14
  const mainAdaptableInstance = (0, AdaptableContext_1.useAdaptable)();
@@ -24,13 +25,12 @@ const DataChangeHistoryGrid = (props) => {
24
25
  const gridOptions = buildGridOptions(mainAdaptableInstance, changeHistoryLog);
25
26
  const adaptableOptions = buildAdaptableOptions(mainAdaptableInstance, gridOptions, adaptableContainerId, agGridContainerId, undoChangeEnabled, onUndoChange, onClearRow);
26
27
  const modules = mainAdaptableInstance.getAgGridRegisteredModules();
27
- const agGridConfig = {
28
+ const dataChangeHistoryAdaptableApi = await AdaptableAgGrid_1.AdaptableAgGrid._initInternal({
29
+ variant: 'vanilla',
30
+ adaptableOptions,
28
31
  gridOptions,
29
- modules: modules,
30
- };
31
- // to avoid direct dependency to Adaptable.ts and thus creating a circular dependency;
32
- const adaptableInitFn = Object.getPrototypeOf(mainAdaptableInstance).constructor.init;
33
- const dataChangeHistoryAdaptableApi = await adaptableInitFn(adaptableOptions, agGridConfig);
32
+ modules,
33
+ });
34
34
  setAdaptableApi(dataChangeHistoryAdaptableApi);
35
35
  };
36
36
  initializeAdaptableGrid();
@@ -9,7 +9,7 @@ const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext
9
9
  const ActionButtons = (props) => {
10
10
  const { buttons, adaptableApi, context, rerender } = props;
11
11
  return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
12
- var _a, _b;
12
+ var _a, _b, _c, _d, _e, _f;
13
13
  if (button.hidden && button.hidden(button, context)) {
14
14
  return;
15
15
  }
@@ -31,7 +31,8 @@ const ActionButtons = (props) => {
31
31
  }, 16);
32
32
  };
33
33
  const disabled = button.disabled && button.disabled(button, context);
34
- return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
34
+ const identifier = (_d = (_c = (_a = button.label) !== null && _a !== void 0 ? _a : (_b = button.icon) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : button.tooltip) !== null && _d !== void 0 ? _d : `${index + 1}`;
35
+ return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${identifier}`, variant: (_e = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _e !== void 0 ? _e : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_f = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _f !== void 0 ? _f : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
35
36
  })));
36
37
  };
37
38
  const ReactActionColumnRenderer = (props) => {
@@ -126,9 +126,9 @@ export declare class AdaptableAgGrid implements IAdaptable {
126
126
  * @private
127
127
  */
128
128
  static _initInternal(config: AdaptableInitInternalConfig): Promise<AdaptableApi>;
129
+ private _initAdaptableAgGrid;
129
130
  private normaliseLayoutState;
130
131
  private normaliseToolPanelState;
131
- private _initAdaptableAgGrid;
132
132
  applyColumnFiltering(): void;
133
133
  applyGridFiltering(): void;
134
134
  private refreshColDefs;
@@ -249,73 +249,6 @@ class AdaptableAgGrid {
249
249
  return doInit(adaptableInstance);
250
250
  }
251
251
  }
252
- normaliseLayoutState(state, config) {
253
- var _a, _b, _c;
254
- if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
255
- const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
256
- const layoutState = state.Layout || {};
257
- const availableLayouts = layoutState.Layouts || [];
258
- availableLayouts.push(defaultLayout);
259
- layoutState.Layouts = availableLayouts;
260
- layoutState.CurrentLayout = defaultLayout.Name;
261
- state.Layout = layoutState;
262
- }
263
- else {
264
- const layoutState = state.Layout;
265
- // ensure CurrentLayout is valid
266
- if (!layoutState.CurrentLayout ||
267
- !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
268
- layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
269
- }
270
- }
271
- // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
272
- // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
273
- // this is a serious code smell, hopefully we will delete `setLayout()` at some point
274
- const actionRowColDefs = this.api.actionRowApi.internalApi.getColDefsForActionRowColumns();
275
- actionRowColDefs.forEach((actionRowColDef) => {
276
- const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
277
- if (currentLayout && !currentLayout.Columns.includes(actionRowColDef.colId)) {
278
- currentLayout.Columns.push(actionRowColDef.colId);
279
- currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
280
- currentLayout.PinnedColumnsMap[actionRowColDef.colId] = actionRowColDef.pinned;
281
- }
282
- });
283
- /**
284
- * Viewport mode does not support a few
285
- * features instead of complicating the
286
- * logic where layout is applied, it is easier and
287
- * less error prone to just remove it.
288
- */
289
- if (config.gridOptions.rowModelType === 'viewport') {
290
- (_c = state.Layout.Layouts) === null || _c === void 0 ? void 0 : _c.forEach((layout) => {
291
- if (layout.RowGroupedColumns) {
292
- delete layout.RowGroupedColumns;
293
- }
294
- if (layout.AggregationColumns) {
295
- delete layout.AggregationColumns;
296
- }
297
- if (layout.PivotColumns) {
298
- delete layout.PivotColumns;
299
- delete layout.EnablePivot;
300
- }
301
- });
302
- }
303
- return state;
304
- }
305
- normaliseToolPanelState(state) {
306
- var _a, _b, _c;
307
- if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
308
- return state;
309
- }
310
- // no predefined config provided, we will display all the panels collapsed (custom & module)
311
- const defaultToolPanels = [];
312
- (_c = (_b = this.adaptableOptions.toolPanelOptions) === null || _b === void 0 ? void 0 : _b.customToolPanels) === null || _c === void 0 ? void 0 : _c.forEach((customToolPanel) => defaultToolPanels.push({ Name: customToolPanel.name }));
313
- Types_1.ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
314
- const toolPanelState = state.ToolPanel || {};
315
- toolPanelState.ToolPanels = defaultToolPanels;
316
- state.ToolPanel = toolPanelState;
317
- return state;
318
- }
319
252
  async _initAdaptableAgGrid(config) {
320
253
  var _a, _b;
321
254
  // Phase 1: Preprocess Adaptable Options
@@ -390,6 +323,8 @@ class AdaptableAgGrid {
390
323
  }
391
324
  this.forPlugins((plugin) => plugin.afterInitServices(this));
392
325
  this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
326
+ // do this now so it sets module entitlements
327
+ this.EntitlementService.setModulesEntitlements();
393
328
  /**
394
329
  * At this point it's mandatory to have the ALL the Adaptable blocks initialized:
395
330
  * Store, APIs, Services, Modules
@@ -431,8 +366,6 @@ class AdaptableAgGrid {
431
366
  this.temporaryAdaptableStateUpdates();
432
367
  this.redrawBody();
433
368
  this.refreshHeader();
434
- // do this now so it sets module entitlements
435
- this.EntitlementService.setModulesEntitlements();
436
369
  // create the module menu (for use in the dashboard and the toolpanel)
437
370
  // TODO see #create-create-module-menu - make sure it's the same here and there
438
371
  this.ModuleService.createModuleMenus();
@@ -453,6 +386,75 @@ class AdaptableAgGrid {
453
386
  perfInitAdaptableAgGrid.end();
454
387
  return Promise.resolve(this.api);
455
388
  }
389
+ normaliseLayoutState(state, config) {
390
+ var _a, _b, _c, _d, _e, _f;
391
+ if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
392
+ const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
393
+ const layoutState = state.Layout || {};
394
+ const availableLayouts = layoutState.Layouts || [];
395
+ availableLayouts.push(defaultLayout);
396
+ layoutState.Layouts = availableLayouts;
397
+ layoutState.CurrentLayout = defaultLayout.Name;
398
+ state.Layout = layoutState;
399
+ }
400
+ else {
401
+ const layoutState = state.Layout;
402
+ // ensure CurrentLayout is valid
403
+ if (!layoutState.CurrentLayout ||
404
+ !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
405
+ layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
406
+ }
407
+ }
408
+ // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
409
+ // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
410
+ // this is a serious code smell, hopefully we will delete `setLayout()` at some point
411
+ const hasActionRowButtons = !!((_c = this.adaptableOptions.actionRowOptions) === null || _c === void 0 ? void 0 : _c.actionRowButtons);
412
+ if (hasActionRowButtons) {
413
+ const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
414
+ if (currentLayout && !currentLayout.Columns.includes(GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS)) {
415
+ currentLayout.Columns.push(GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS);
416
+ const columnPosition = (_e = (_d = this.adaptableOptions.actionRowOptions) === null || _d === void 0 ? void 0 : _d.actionRowButtonOptions) === null || _e === void 0 ? void 0 : _e.position;
417
+ currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
418
+ currentLayout.PinnedColumnsMap[GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS] =
419
+ columnPosition === 'pinnedRight' ? 'right' : 'left';
420
+ }
421
+ }
422
+ /**
423
+ * Viewport mode does not support a few
424
+ * features instead of complicating the
425
+ * logic where layout is applied, it is easier and
426
+ * less error prone to just remove it.
427
+ */
428
+ if (config.gridOptions.rowModelType === 'viewport') {
429
+ (_f = state.Layout.Layouts) === null || _f === void 0 ? void 0 : _f.forEach((layout) => {
430
+ if (layout.RowGroupedColumns) {
431
+ delete layout.RowGroupedColumns;
432
+ }
433
+ if (layout.AggregationColumns) {
434
+ delete layout.AggregationColumns;
435
+ }
436
+ if (layout.PivotColumns) {
437
+ delete layout.PivotColumns;
438
+ delete layout.EnablePivot;
439
+ }
440
+ });
441
+ }
442
+ return state;
443
+ }
444
+ normaliseToolPanelState(state) {
445
+ var _a, _b, _c;
446
+ if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
447
+ return state;
448
+ }
449
+ // no predefined config provided, we will display all the panels collapsed (custom & module)
450
+ const defaultToolPanels = [];
451
+ (_c = (_b = this.adaptableOptions.toolPanelOptions) === null || _b === void 0 ? void 0 : _b.customToolPanels) === null || _c === void 0 ? void 0 : _c.forEach((customToolPanel) => defaultToolPanels.push({ Name: customToolPanel.name }));
452
+ Types_1.ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
453
+ const toolPanelState = state.ToolPanel || {};
454
+ toolPanelState.ToolPanels = defaultToolPanels;
455
+ state.ToolPanel = toolPanelState;
456
+ return state;
457
+ }
456
458
  applyColumnFiltering() {
457
459
  if (this.api.columnFilterApi.isQuickFilterAvailable()) {
458
460
  if (this.api.columnFilterApi.isQuickFilterVisible()) {
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
5
- PUBLISH_TIMESTAMP: 1710766638384 || Date.now(),
6
- VERSION: "18.0.0-canary.7" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1710788450625 || Date.now(),
6
+ VERSION: "18.0.0-canary.8" || '--current-version--',
7
7
  };