@adaptabletools/adaptable 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",
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",
@@ -60,7 +60,7 @@
60
60
  "tinycolor2": "^1.4.2",
61
61
  "tslib": "^2.3.0",
62
62
  "uuid": "^3.3.2",
63
- "react-toastify": "10.0.1"
63
+ "react-toastify": "9.1.3"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@ag-grid-community/core": ">=31.1.0"
@@ -22,17 +22,19 @@ export var LicenseValidityType;
22
22
  const SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
23
23
  const SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
24
24
  const DEMO_REGEX = /(https):\/\/\S+(\.adaptabletools\.com)/g;
25
- const origin = typeof window !== 'undefined' ? window.location.origin : '';
25
+ const getOrigin = () => {
26
+ return typeof window !== 'undefined' ? window.location.origin : '';
27
+ };
26
28
  const isInsideSandpack = () => {
27
- const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
29
+ const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(getOrigin()) || []);
28
30
  return protocol === 'https' && sandpackUrl === 'sandpack.codesandbox.io';
29
31
  };
30
32
  const isInsideSandbox = () => {
31
- const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
33
+ const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(getOrigin()) || []);
32
34
  return protocol === 'https' && sandboxUrl === '.csb.app';
33
35
  };
34
36
  const isDemoApp = () => {
35
- const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(origin) || []);
37
+ const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(getOrigin()) || []);
36
38
  return protocol === 'https' && demoAppUrl === '.adaptabletools.com';
37
39
  };
38
40
  export class LicenseService {
@@ -31,7 +31,7 @@ class AdaptableView extends React.Component {
31
31
  , {
32
32
  // we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
33
33
  // instance is destroyed and re-created many times
34
- containerId: adaptableOptions.adaptableId, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
34
+ containerId: `Toastify-${adaptableOptions.adaptableId}`, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
35
35
  (watermark === null || watermark === void 0 ? void 0 : watermark.show) && React.createElement(LicenseWatermark, null, watermark === null || watermark === void 0 ? void 0 : watermark.text),
36
36
  React.createElement(WindowPopups, null),
37
37
  React.createElement(FormPopups, null),
@@ -12,7 +12,7 @@ export const showToast = (props) => {
12
12
  });
13
13
  const adaptableOptions = props.api.optionsApi.getAdaptableOptions();
14
14
  const toastProps = ObjectFactory.CreateToastOptions(adaptableOptions.notificationsOptions, {
15
- containerId: adaptableOptions.adaptableId,
15
+ containerId: `Toastify-${adaptableOptions.adaptableId}`,
16
16
  onClose: () => {
17
17
  off();
18
18
  },
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
- import { useAdaptable } from '../AdaptableContext';
3
2
  import { useEffect, useRef, useState } from 'react';
3
+ import { useAdaptable } from '../AdaptableContext';
4
4
  import usePrevious from '../../components/utils/usePrevious';
5
5
  import { DataChangeHistoryModuleId } from '../../Utilities/Constants/ModuleConstants';
6
6
  import { buildActionColumnButton } from './buildActionColumnButton';
7
+ import { AdaptableAgGrid } from '../../agGrid/AdaptableAgGrid';
7
8
  export const DataChangeHistoryGrid = (props) => {
8
9
  const { changeHistoryLog, adaptableContainerId, agGridContainerId, onUndoChange, onClearRow } = props;
9
10
  const mainAdaptableInstance = useAdaptable();
@@ -20,13 +21,12 @@ export const DataChangeHistoryGrid = (props) => {
20
21
  const gridOptions = buildGridOptions(mainAdaptableInstance, changeHistoryLog);
21
22
  const adaptableOptions = buildAdaptableOptions(mainAdaptableInstance, gridOptions, adaptableContainerId, agGridContainerId, undoChangeEnabled, onUndoChange, onClearRow);
22
23
  const modules = mainAdaptableInstance.getAgGridRegisteredModules();
23
- const agGridConfig = {
24
+ const dataChangeHistoryAdaptableApi = await AdaptableAgGrid._initInternal({
25
+ variant: 'vanilla',
26
+ adaptableOptions,
24
27
  gridOptions,
25
- modules: modules,
26
- };
27
- // to avoid direct dependency to Adaptable.ts and thus creating a circular dependency;
28
- const adaptableInitFn = Object.getPrototypeOf(mainAdaptableInstance).constructor.init;
29
- const dataChangeHistoryAdaptableApi = await adaptableInitFn(adaptableOptions, agGridConfig);
28
+ modules,
29
+ });
30
30
  setAdaptableApi(dataChangeHistoryAdaptableApi);
31
31
  };
32
32
  initializeAdaptableGrid();
@@ -5,7 +5,7 @@ import { renderWithAdaptableContext } from '../View/renderWithAdaptableContext';
5
5
  const ActionButtons = (props) => {
6
6
  const { buttons, adaptableApi, context, rerender } = props;
7
7
  return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
8
- var _a, _b;
8
+ var _a, _b, _c, _d, _e, _f;
9
9
  if (button.hidden && button.hidden(button, context)) {
10
10
  return;
11
11
  }
@@ -27,7 +27,8 @@ const ActionButtons = (props) => {
27
27
  }, 16);
28
28
  };
29
29
  const disabled = button.disabled && button.disabled(button, context);
30
- return (React.createElement(SimpleButton, { 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));
30
+ 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}`;
31
+ return (React.createElement(SimpleButton, { 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));
31
32
  })));
32
33
  };
33
34
  export 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;
@@ -8,7 +8,7 @@ import Emitter from '../Utilities/Emitter';
8
8
  import { applyDefaultAdaptableOptions } from './defaultAdaptableOptions';
9
9
  import { AgGridAdapter } from './AgGridAdapter';
10
10
  import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
11
- import { AB_FDC3_COLUMN, AB_SPECIAL_COLUMN, AUTOGENERATED_PK_COLUMN, BLANK_DISTINCT_COLUMN_VALUE, DARK_THEME, DEFAULT_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, LIGHT_THEME, } from '../Utilities/Constants/GeneralConstants';
11
+ import { AB_FDC3_COLUMN, AB_SPECIAL_COLUMN, ADAPTABLE_ROW_ACTION_BUTTONS, AUTOGENERATED_PK_COLUMN, BLANK_DISTINCT_COLUMN_VALUE, DARK_THEME, DEFAULT_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, LIGHT_THEME, } from '../Utilities/Constants/GeneralConstants';
12
12
  import { DataService } from '../Utilities/Services/DataService';
13
13
  import { AdaptableStore } from '../Redux/Store/AdaptableStore';
14
14
  import { AdaptableApiImpl } from '../Api/Implementation/AdaptableApiImpl';
@@ -245,73 +245,6 @@ export class AdaptableAgGrid {
245
245
  return doInit(adaptableInstance);
246
246
  }
247
247
  }
248
- normaliseLayoutState(state, config) {
249
- var _a, _b, _c;
250
- if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
251
- const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
252
- const layoutState = state.Layout || {};
253
- const availableLayouts = layoutState.Layouts || [];
254
- availableLayouts.push(defaultLayout);
255
- layoutState.Layouts = availableLayouts;
256
- layoutState.CurrentLayout = defaultLayout.Name;
257
- state.Layout = layoutState;
258
- }
259
- else {
260
- const layoutState = state.Layout;
261
- // ensure CurrentLayout is valid
262
- if (!layoutState.CurrentLayout ||
263
- !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
264
- layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
265
- }
266
- }
267
- // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
268
- // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
269
- // this is a serious code smell, hopefully we will delete `setLayout()` at some point
270
- const actionRowColDefs = this.api.actionRowApi.internalApi.getColDefsForActionRowColumns();
271
- actionRowColDefs.forEach((actionRowColDef) => {
272
- const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
273
- if (currentLayout && !currentLayout.Columns.includes(actionRowColDef.colId)) {
274
- currentLayout.Columns.push(actionRowColDef.colId);
275
- currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
276
- currentLayout.PinnedColumnsMap[actionRowColDef.colId] = actionRowColDef.pinned;
277
- }
278
- });
279
- /**
280
- * Viewport mode does not support a few
281
- * features instead of complicating the
282
- * logic where layout is applied, it is easier and
283
- * less error prone to just remove it.
284
- */
285
- if (config.gridOptions.rowModelType === 'viewport') {
286
- (_c = state.Layout.Layouts) === null || _c === void 0 ? void 0 : _c.forEach((layout) => {
287
- if (layout.RowGroupedColumns) {
288
- delete layout.RowGroupedColumns;
289
- }
290
- if (layout.AggregationColumns) {
291
- delete layout.AggregationColumns;
292
- }
293
- if (layout.PivotColumns) {
294
- delete layout.PivotColumns;
295
- delete layout.EnablePivot;
296
- }
297
- });
298
- }
299
- return state;
300
- }
301
- normaliseToolPanelState(state) {
302
- var _a, _b, _c;
303
- if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
304
- return state;
305
- }
306
- // no predefined config provided, we will display all the panels collapsed (custom & module)
307
- const defaultToolPanels = [];
308
- (_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 }));
309
- ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
310
- const toolPanelState = state.ToolPanel || {};
311
- toolPanelState.ToolPanels = defaultToolPanels;
312
- state.ToolPanel = toolPanelState;
313
- return state;
314
- }
315
248
  async _initAdaptableAgGrid(config) {
316
249
  var _a, _b;
317
250
  // Phase 1: Preprocess Adaptable Options
@@ -386,6 +319,8 @@ export class AdaptableAgGrid {
386
319
  }
387
320
  this.forPlugins((plugin) => plugin.afterInitServices(this));
388
321
  this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
322
+ // do this now so it sets module entitlements
323
+ this.EntitlementService.setModulesEntitlements();
389
324
  /**
390
325
  * At this point it's mandatory to have the ALL the Adaptable blocks initialized:
391
326
  * Store, APIs, Services, Modules
@@ -427,8 +362,6 @@ export class AdaptableAgGrid {
427
362
  this.temporaryAdaptableStateUpdates();
428
363
  this.redrawBody();
429
364
  this.refreshHeader();
430
- // do this now so it sets module entitlements
431
- this.EntitlementService.setModulesEntitlements();
432
365
  // create the module menu (for use in the dashboard and the toolpanel)
433
366
  // TODO see #create-create-module-menu - make sure it's the same here and there
434
367
  this.ModuleService.createModuleMenus();
@@ -449,6 +382,75 @@ export class AdaptableAgGrid {
449
382
  perfInitAdaptableAgGrid.end();
450
383
  return Promise.resolve(this.api);
451
384
  }
385
+ normaliseLayoutState(state, config) {
386
+ var _a, _b, _c, _d, _e, _f;
387
+ if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
388
+ const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
389
+ const layoutState = state.Layout || {};
390
+ const availableLayouts = layoutState.Layouts || [];
391
+ availableLayouts.push(defaultLayout);
392
+ layoutState.Layouts = availableLayouts;
393
+ layoutState.CurrentLayout = defaultLayout.Name;
394
+ state.Layout = layoutState;
395
+ }
396
+ else {
397
+ const layoutState = state.Layout;
398
+ // ensure CurrentLayout is valid
399
+ if (!layoutState.CurrentLayout ||
400
+ !layoutState.Layouts.find((l) => l.Name === layoutState.CurrentLayout)) {
401
+ layoutState.CurrentLayout = (_b = (_a = layoutState.Layouts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Name;
402
+ }
403
+ }
404
+ // for the initial state, we need to dynamically add the ActionRowColumn (if necessary)
405
+ // for subsequent layout changes, the `Adaptable.setLayout()` method handles this
406
+ // this is a serious code smell, hopefully we will delete `setLayout()` at some point
407
+ const hasActionRowButtons = !!((_c = this.adaptableOptions.actionRowOptions) === null || _c === void 0 ? void 0 : _c.actionRowButtons);
408
+ if (hasActionRowButtons) {
409
+ const currentLayout = state.Layout.Layouts.find((l) => l.Name === state.Layout.CurrentLayout);
410
+ if (currentLayout && !currentLayout.Columns.includes(ADAPTABLE_ROW_ACTION_BUTTONS)) {
411
+ currentLayout.Columns.push(ADAPTABLE_ROW_ACTION_BUTTONS);
412
+ const columnPosition = (_e = (_d = this.adaptableOptions.actionRowOptions) === null || _d === void 0 ? void 0 : _d.actionRowButtonOptions) === null || _e === void 0 ? void 0 : _e.position;
413
+ currentLayout.PinnedColumnsMap = currentLayout.PinnedColumnsMap || {};
414
+ currentLayout.PinnedColumnsMap[ADAPTABLE_ROW_ACTION_BUTTONS] =
415
+ columnPosition === 'pinnedRight' ? 'right' : 'left';
416
+ }
417
+ }
418
+ /**
419
+ * Viewport mode does not support a few
420
+ * features instead of complicating the
421
+ * logic where layout is applied, it is easier and
422
+ * less error prone to just remove it.
423
+ */
424
+ if (config.gridOptions.rowModelType === 'viewport') {
425
+ (_f = state.Layout.Layouts) === null || _f === void 0 ? void 0 : _f.forEach((layout) => {
426
+ if (layout.RowGroupedColumns) {
427
+ delete layout.RowGroupedColumns;
428
+ }
429
+ if (layout.AggregationColumns) {
430
+ delete layout.AggregationColumns;
431
+ }
432
+ if (layout.PivotColumns) {
433
+ delete layout.PivotColumns;
434
+ delete layout.EnablePivot;
435
+ }
436
+ });
437
+ }
438
+ return state;
439
+ }
440
+ normaliseToolPanelState(state) {
441
+ var _a, _b, _c;
442
+ if ((_a = state === null || state === void 0 ? void 0 : state.ToolPanel) === null || _a === void 0 ? void 0 : _a.ToolPanels) {
443
+ return state;
444
+ }
445
+ // no predefined config provided, we will display all the panels collapsed (custom & module)
446
+ const defaultToolPanels = [];
447
+ (_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 }));
448
+ ALL_TOOL_PANELS.forEach((moduleToolPanel) => defaultToolPanels.push({ Name: moduleToolPanel }));
449
+ const toolPanelState = state.ToolPanel || {};
450
+ toolPanelState.ToolPanels = defaultToolPanels;
451
+ state.ToolPanel = toolPanelState;
452
+ return state;
453
+ }
452
454
  applyColumnFiltering() {
453
455
  if (this.api.columnFilterApi.isQuickFilterAvailable()) {
454
456
  if (this.api.columnFilterApi.isQuickFilterVisible()) {
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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" || '',
3
- PUBLISH_TIMESTAMP: 1710766608404 || Date.now(),
4
- VERSION: "18.0.0-canary.7" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1710788423776 || Date.now(),
4
+ VERSION: "18.0.0-canary.8" || '--current-version--',
5
5
  };