@adaptabletools/adaptable 13.0.0-canary.3 → 13.0.0-canary.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "13.0.0-canary.3",
3
+ "version": "13.0.0-canary.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",
@@ -1,2 +1,2 @@
1
- declare const _default: 1663245222592;
1
+ declare const _default: 1663256074117;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1663245222592;
3
+ exports.default = 1663256074117;
@@ -65,6 +65,12 @@ export interface GeneralOptions {
65
65
  * Value to use for 'Unbalanced Groups' (string columns)
66
66
  */
67
67
  unbalancedGroupsKey?: string | ((context: UnbalancedGroupsKeyContext) => string);
68
+ /**
69
+ * Starting with v13, ConditionalStyle module is deprecated, and it's functionality is merged into the FormatColumn module. By default, all existing conditional styles are migrated to format columns. By setting this property to TRUE, the conditional styles are not migrated.
70
+ *
71
+ * @defaultValue false
72
+ */
73
+ keepDeprecatedConditionalStyles?: boolean;
68
74
  }
69
75
  /**
70
76
  * Comparer object for Column Values - used for custom sorting
@@ -89,13 +89,13 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
89
89
  return false;
90
90
  }
91
91
  isNumericColumn(column) {
92
- return column.dataType == 'Number';
92
+ return (column === null || column === void 0 ? void 0 : column.dataType) == 'Number';
93
93
  }
94
94
  isBooleanColumn(column) {
95
- return column.dataType == 'Boolean';
95
+ return (column === null || column === void 0 ? void 0 : column.dataType) == 'Boolean';
96
96
  }
97
97
  isDateColumn(column) {
98
- return column.dataType == 'Date';
98
+ return (column === null || column === void 0 ? void 0 : column.dataType) == 'Date';
99
99
  }
100
100
  getColumnDataTypeFromColumnId(columnId) {
101
101
  const column = this.getColumnFromId(columnId); // this.getColumns().find(c => c.ColumnId == columnId);
@@ -142,4 +142,5 @@ export declare class InternalApiImpl extends ApiBase implements InternalApi {
142
142
  getValueForTag(adaptableObjectTag: AdaptableObjectTag): string | number;
143
143
  getEditLookUpValuesForColumn(editLookUpItem: EditLookUpPermittedValues, column: AdaptableColumn, gridCell?: GridCell): any[] | undefined;
144
144
  getAdaptableQueryExpressionText(query: Partial<AdaptableQuery>): string;
145
+ shouldKeepDeprecatedConditionalStyles(): boolean;
145
146
  }
@@ -650,5 +650,9 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
650
650
  ? this.adaptable.api.queryLanguageApi.getAdaptableQueryExpressionWithColumnFriendlyNames(query)
651
651
  : this.adaptable.api.queryLanguageApi.getAdaptableQueryExpression(query);
652
652
  }
653
+ shouldKeepDeprecatedConditionalStyles() {
654
+ var _a, _b;
655
+ return (_b = (_a = this.getOptions()) === null || _a === void 0 ? void 0 : _a.generalOptions) === null || _b === void 0 ? void 0 : _b.keepDeprecatedConditionalStyles;
656
+ }
653
657
  }
654
658
  exports.InternalApiImpl = InternalApiImpl;
@@ -3,7 +3,7 @@ import { ToolPanelApi } from '../ToolPanelApi';
3
3
  import { ToolPanelState, ToolPanelVisibilityMode } from '../../PredefinedConfig/ToolPanelState';
4
4
  import { CustomToolPanel, ToolPanelButtonContext } from '../../AdaptableOptions/ToolPanelOptions';
5
5
  import { AdaptableButton } from '../../PredefinedConfig/Common/AdaptableButton';
6
- import { AdaptableToolPanel } from '../../PredefinedConfig/Common/Types';
6
+ import { AdaptableModuleButtons, AdaptableToolPanel } from '../../PredefinedConfig/Common/Types';
7
7
  export declare class ToolPanelApiImpl extends ApiBase implements ToolPanelApi {
8
8
  getToolPanelState(): ToolPanelState;
9
9
  showToolPanelPopup(): void;
@@ -14,6 +14,8 @@ export declare class ToolPanelApiImpl extends ApiBase implements ToolPanelApi {
14
14
  getCustomToolPanelByName(name: string): CustomToolPanel | undefined;
15
15
  setAdaptableToolPanelVisibilityMode(adaptableToolPanel: AdaptableToolPanel, visibilityMode: ToolPanelVisibilityMode): void;
16
16
  setCustomToolPanelVisibilityMode(customToolPanelName: string, visibilityMode: ToolPanelVisibilityMode): void;
17
+ setModuleButtons(moduleButtons: AdaptableModuleButtons): void;
18
+ getModuleButtons(): AdaptableModuleButtons;
17
19
  private setExpandedToolPanelVisibility;
18
20
  private setCollapsedToolPanelVisibility;
19
21
  }
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const ApiBase_1 = require("./ApiBase");
6
6
  const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
7
7
  const ToolPanelRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ToolPanelRedux"));
8
+ const ToolPanelRedux_1 = require("../../Redux/ActionsReducers/ToolPanelRedux");
8
9
  class ToolPanelApiImpl extends ApiBase_1.ApiBase {
9
10
  getToolPanelState() {
10
11
  return this.getAdaptableState().ToolPanel;
@@ -51,6 +52,13 @@ class ToolPanelApiImpl extends ApiBase_1.ApiBase {
51
52
  this.setCollapsedToolPanelVisibility(customToolPanelName);
52
53
  }
53
54
  }
55
+ setModuleButtons(moduleButtons) {
56
+ this.dispatchAction((0, ToolPanelRedux_1.ToolPanelSetModuleButtons)(moduleButtons));
57
+ }
58
+ getModuleButtons() {
59
+ var _a, _b;
60
+ return (_b = (_a = this.getToolPanelState()) === null || _a === void 0 ? void 0 : _a.ModuleButtons) !== null && _b !== void 0 ? _b : [];
61
+ }
54
62
  setExpandedToolPanelVisibility(toolPanelName) {
55
63
  this.dispatchAction(ToolPanelRedux.ToolPanelExpandToolPanel(toolPanelName));
56
64
  }
@@ -144,4 +144,5 @@ export interface InternalApi {
144
144
  getValueForTag(adaptableObjectTag: AdaptableObjectTag): string | number;
145
145
  getEditLookUpValuesForColumn(editLookUpItem: EditLookUpPermittedValues, column: AdaptableColumn, gridCell?: GridCell): any[] | undefined;
146
146
  getAdaptableQueryExpressionText(query: Partial<AdaptableQuery>): string;
147
+ shouldKeepDeprecatedConditionalStyles(): boolean;
147
148
  }
@@ -1,7 +1,7 @@
1
1
  import { ToolPanelState, ToolPanelVisibilityMode } from '../PredefinedConfig/ToolPanelState';
2
2
  import { CustomToolPanel, ToolPanelButtonContext } from '../AdaptableOptions/ToolPanelOptions';
3
3
  import { AdaptableButton } from '../PredefinedConfig/Common/AdaptableButton';
4
- import { AdaptableToolPanel } from '../PredefinedConfig/Common/Types';
4
+ import { AdaptableModuleButtons, AdaptableToolPanel } from '../PredefinedConfig/Common/Types';
5
5
  /**
6
6
  * Functions for managing the AdapTable ToolPanel Component (at side of grid)
7
7
  */
@@ -47,4 +47,13 @@ export interface ToolPanelApi {
47
47
  * @param visibilityMode
48
48
  */
49
49
  setCustomToolPanelVisibilityMode(customToolPanelName: string, visibilityMode: ToolPanelVisibilityMode): void;
50
+ /**
51
+ * Sets the Module buttons in the Adaptable ToolPanel
52
+ * @param moduleButtons the module buttons
53
+ */
54
+ setModuleButtons(moduleButtons: AdaptableModuleButtons): void;
55
+ /**
56
+ * Sets the Module buttons from the Adaptable ToolPanel
57
+ */
58
+ getModuleButtons(): AdaptableModuleButtons;
50
59
  }
@@ -7,8 +7,10 @@ import { AdaptableModuleBase } from './AdaptableModuleBase';
7
7
  import { IConditionalStyleModule } from './Interface/IConditionalStyleModule';
8
8
  import { AdaptableObject } from '../PredefinedConfig/Common/AdaptableObject';
9
9
  import { AdaptableModuleView, AdaptableObjectView } from './Interface/IModule';
10
+ import { AccessLevel } from '../types';
10
11
  export declare class ConditionalStyleModule extends AdaptableModuleBase implements IConditionalStyleModule {
11
12
  constructor(api: AdaptableApi);
13
+ getViewAccessLevel(): AccessLevel;
12
14
  getModuleAdaptableObjects(config?: {
13
15
  includeLayoutNotAssociatedObjects?: boolean;
14
16
  }): AdaptableObject[];
@@ -13,10 +13,15 @@ const ConditionalStyleWizard_1 = require("../View/ConditionalStyle/Wizard/Condit
13
13
  const getRuleViewItems_1 = require("./Utilities/getRuleViewItems");
14
14
  const getStyleViewItems_1 = require("./Utilities/getStyleViewItems");
15
15
  const getObjectTagsViewItems_1 = require("./Utilities/getObjectTagsViewItems");
16
+ const ConditionalStylePopupHeader_1 = require("../View/ConditionalStyle/ConditionalStylePopupHeader");
16
17
  class ConditionalStyleModule extends AdaptableModuleBase_1.AdaptableModuleBase {
17
18
  constructor(api) {
18
19
  super(ModuleConstants.ConditionalStyleModuleId, ModuleConstants.ConditionalStyleFriendlyName, 'conditional-style', 'ConditionalStylePopup', 'Style columns and rows dynamically based on rules and cell values', api);
19
20
  }
21
+ getViewAccessLevel() {
22
+ const keepDeprecatedConditionalStyles = this.api.internalApi.shouldKeepDeprecatedConditionalStyles();
23
+ return keepDeprecatedConditionalStyles ? super.getViewAccessLevel() : 'Hidden';
24
+ }
20
25
  getModuleAdaptableObjects(config) {
21
26
  return this.api.conditionalStyleApi.getAllConditionalStyle(config);
22
27
  }
@@ -209,6 +214,7 @@ class ConditionalStyleModule extends AdaptableModuleBase_1.AdaptableModuleBase {
209
214
  }
210
215
  getViewProperties() {
211
216
  return {
217
+ HeaderComponent: ConditionalStylePopupHeader_1.ConditionalStylePopupHeader,
212
218
  getDeleteAction: (conditionalStyle) => ConditionalStyleRedux.ConditionalStyleDelete(conditionalStyle),
213
219
  getSuspendAction: (conditionalStyle) => ConditionalStyleRedux.ConditionalStyleSuspend(conditionalStyle),
214
220
  getUnSuspendAction: (conditionalStyle) => ConditionalStyleRedux.ConditionalStyleUnSuspend(conditionalStyle),
@@ -14,6 +14,8 @@ export declare class FormatColumnModule extends AdaptableModuleBase implements I
14
14
  getExplicitlyReferencedColumnIds(formatColumn: FormatColumn): string[];
15
15
  hasNamedQueryReferences(): boolean;
16
16
  updateOldConfig(): void;
17
+ private updateConditionalStylesColumnsOldConfig;
18
+ private updateGradientColumnsOldConfig;
17
19
  private getExistingFormatColumn;
18
20
  addColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem[] | undefined;
19
21
  getTeamSharingAction(): TeamSharingImportInfo<FormatColumn>;
@@ -62,6 +62,52 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
62
62
  .FormatColumn) === null || _a === void 0 ? void 0 : _a.FormatColumns) === null || _b === void 0 ? void 0 : _b.some((formatColumn) => !!formatColumn.HeaderName)) {
63
63
  (0, LoggingHelper_1.ConsoleLogWarning)(`DEPRECATED: The 'FormatColumn.HeaderName' property is deprecated; use a Layout custom Column Header instead!`);
64
64
  }
65
+ this.updateGradientColumnsOldConfig();
66
+ const keepDeprecatedConditionalStyles = this.api.internalApi.shouldKeepDeprecatedConditionalStyles();
67
+ if (!keepDeprecatedConditionalStyles) {
68
+ this.updateConditionalStylesColumnsOldConfig();
69
+ // update ConditionalStyle StatusBarPanel
70
+ const oldStatusBars = this.api.internalApi.getState().StatusBar.StatusBars;
71
+ let replaceConditionalStyleStatusBar = false;
72
+ const newStatusBars = oldStatusBars.map((statusBar) => (Object.assign(Object.assign({}, statusBar), { StatusBarPanels: [
73
+ ...new Set(statusBar.StatusBarPanels.map((statusBarPanel) => {
74
+ if (statusBarPanel === 'ConditionalStyle') {
75
+ replaceConditionalStyleStatusBar = true;
76
+ return 'FormatColumn';
77
+ }
78
+ return statusBarPanel;
79
+ })),
80
+ ] })));
81
+ if (replaceConditionalStyleStatusBar) {
82
+ this.api.statusBarApi.setStatusBarPanels(newStatusBars);
83
+ }
84
+ // update ConditionalStyle dashboard buttons
85
+ const dashboardModuleButtons = this.api.internalApi.getState().Dashboard.ModuleButtons;
86
+ if (dashboardModuleButtons.includes('ConditionalStyle')) {
87
+ dashboardModuleButtons[dashboardModuleButtons.indexOf('ConditionalStyle')] = 'FormatColumn';
88
+ this.api.dashboardApi.setModuleButtons([...new Set(dashboardModuleButtons)]);
89
+ }
90
+ // update ConditionalStyle toolPanel buttons
91
+ const toolPanelModuleButtons = this.api.internalApi.getState().ToolPanel.ModuleButtons;
92
+ if (toolPanelModuleButtons.includes('ConditionalStyle')) {
93
+ toolPanelModuleButtons[toolPanelModuleButtons.indexOf('ConditionalStyle')] = 'FormatColumn';
94
+ this.api.toolPanelApi.setModuleButtons([...new Set(dashboardModuleButtons)]);
95
+ }
96
+ }
97
+ }
98
+ updateConditionalStylesColumnsOldConfig() {
99
+ var _a;
100
+ const oldConditionalStyles = (_a = this.api.internalApi.getState().ConditionalStyle) === null || _a === void 0 ? void 0 : _a.ConditionalStyles;
101
+ if (!(oldConditionalStyles === null || oldConditionalStyles === void 0 ? void 0 : oldConditionalStyles.length)) {
102
+ return;
103
+ }
104
+ (0, LoggingHelper_1.ConsoleLogWarning)(`DEPRECATED: The 'ConditionalStyle.ConditionalStyles' property is deprecated; use 'FormatColumn' instead!`);
105
+ // remove conditional styles
106
+ this.api.conditionalStyleApi.deleteConditionalStyles(oldConditionalStyles);
107
+ // add as format column
108
+ this.api.formatColumnApi.addFormatColumns(oldConditionalStyles);
109
+ }
110
+ updateGradientColumnsOldConfig() {
65
111
  let newFormatColumns = [];
66
112
  let existingFormatColumns = [];
67
113
  // 1. Convert Gradient Columns to Format Columns
@@ -88,6 +88,7 @@ export interface AdaptableModuleView {
88
88
  */
89
89
  actions?: AdaptableModuleViewAction[];
90
90
  onMount?: () => void;
91
+ HeaderComponent?: React.FunctionComponent;
91
92
  onOpenEditPopup?: (abObject?: AdaptableObject) => void;
92
93
  getDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
93
94
  getCompactDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
@@ -152,6 +152,7 @@ exports.DefaultAdaptableOptions = {
152
152
  customSortComparers: undefined,
153
153
  englishVariant: 'GB',
154
154
  unbalancedGroupsKey: undefined,
155
+ keepDeprecatedConditionalStyles: false,
155
156
  },
156
157
  layoutOptions: {
157
158
  includeExpandedRowGroups: false,
@@ -111,6 +111,7 @@ const AdaptablePopupModuleView = (props) => {
111
111
  "s not available in current Layout")));
112
112
  };
113
113
  return (React.createElement(PopupPanel_1.PopupPanel, { glyphicon: moduleInfo.Glyph, infoLink: moduleInfo.HelpPage, headerText: moduleInfo.FriendlyName, button: newButton, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() },
114
+ moduleViewProperties.HeaderComponent && React.createElement(moduleViewProperties.HeaderComponent, null),
114
115
  toggleButtonShowLayoutAssociatedObjects(),
115
116
  (items === null || items === void 0 ? void 0 : items.length) ? (React.createElement(AdaptableObjectList_1.AdaptableObjectList, { module: props.module, items: items })) : (React.createElement(EmptyContent_1.default, null, emptyContent !== null && emptyContent !== void 0 ? emptyContent : `Click 'New' to create a new ${moduleInfo.FriendlyName}`)),
116
117
  isWizardOpen && EditWizard && (React.createElement(EditWizard, { abObjectType: abObjectType, moduleInfo: moduleInfo, data: null, popupParams: props.popupParams, configEntities: null, onCloseWizard: handleWizardClose, onFinishWizard: handleWizardClose }))));
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const ConditionalStylePopupHeader: React.FunctionComponent;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConditionalStylePopupHeader = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const HelpBlock_1 = tslib_1.__importDefault(require("../../components/HelpBlock"));
7
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
8
+ const AdaptableContext_1 = require("../AdaptableContext");
9
+ const ConditionalStylePopupHeader = () => {
10
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
11
+ return (React.createElement(HelpBlock_1.default, null,
12
+ "Conditional Styles are deprecated, use",
13
+ ' ',
14
+ React.createElement(SimpleButton_1.default, { onClick: () => adaptable.api.settingsPanelApi.showSettingsPanel('FormatColumn'), variant: "outlined" }, "Format Columns"),
15
+ ' ',
16
+ "instead."));
17
+ };
18
+ exports.ConditionalStylePopupHeader = ConditionalStylePopupHeader;
@@ -125,7 +125,7 @@ const getFormatDisplayTypeForScope = (scope, api) => {
125
125
  }
126
126
  // need to see if all columns are numeric or date
127
127
  if ('ColumnIds' in scope) {
128
- const columns = scope.ColumnIds.map((c) => api.columnApi.getColumnFromId(c));
128
+ const columns = scope.ColumnIds.map((c) => api.columnApi.getColumnFromId(c)).filter(Boolean);
129
129
  const columnDataTypes = (0, uniq_1.default)(columns.map((c) => c.dataType));
130
130
  if (columnDataTypes.length == 1 && columnDataTypes[0] == 'Number') {
131
131
  return 'Number';