@adaptabletools/adaptable 11.1.1-canary.1 → 11.1.1-canary.2

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/index.css CHANGED
@@ -3728,14 +3728,12 @@ html.ab--theme-dark .ab-ListBoxFilterForm--aggrid-style {
3728
3728
  width: 100%; }
3729
3729
 
3730
3730
  .ab-ActionColumn {
3731
- position: relative;
3732
- height: 100%; }
3731
+ height: 100%;
3732
+ display: flex;
3733
+ column-gap: var(--ab-space-1); }
3733
3734
 
3734
3735
  .ab-ActionColumn > button.ab-SimpleButton {
3735
- height: 100%;
3736
- position: absolute;
3737
- top: 0;
3738
- left: 0; }
3736
+ height: 100%; }
3739
3737
 
3740
3738
  .Toastify__toast-container {
3741
3739
  border-style: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "11.1.1-canary.1",
3
+ "version": "11.1.1-canary.2",
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: 1648368512196;
1
+ declare const _default: 1648502167403;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1648368512196;
3
+ exports.default = 1648502167403;
@@ -33,29 +33,25 @@ export interface UserInterfaceOptions {
33
33
  */
34
34
  permittedValues?: PermittedValues[];
35
35
  /**
36
- * Dropdown values displayed when column is being edited.
37
- * When not defined it defaults to permittedValues.
36
+ * Dropdown values displayed when column is being edited; when not defined defaults to permittedValues
38
37
  */
39
38
  editLookUpItems?: EditLookUpPermittedValues[];
40
39
  /**
41
- * Dropdown values for filter options inside floating and header filter.
42
- * When not defined it defaults to permittedValues.
40
+ * Custom column values for 'IN' filter; when not defined defaults to permittedValues
43
41
  */
44
42
  filterPermittedValues?: FilterPermittedValues[];
45
43
  /**
46
- * Custom column values for defining custom sort.
47
- * When not defined it defaults to permittedValues.
44
+ * Custom column values for defining Custom Sort; when not defined defaults to permittedValues
48
45
  */
49
46
  customSortPermittedValues?: CustomSortPermittedValues[];
50
47
  /**
51
- * Custom column values for editing via bulk-update.
52
- * When not defined it defaults to permittedValues.
48
+ * Custom column values for editing via bulk-update; when not defined defaults to permittedValues
53
49
  */
54
50
  bulkUpdatePermittedValues?: BulkUpdatePermittedValues[];
55
51
  /**
56
- * Colours to display in Colour Picker (in place of AdapTable's default set)
52
+ * Colours to display in Colour Picker (in place of AdapTable's default set); can be hardcoded list or function
57
53
  */
58
- colorPalette?: string[] | (() => string[]);
54
+ colorPalette?: string[] | ((currentTheme: string) => string[]);
59
55
  /**
60
56
  * Columns which contain an AdapTable Button - used for performing Actions
61
57
  */
@@ -155,9 +151,9 @@ export interface ActionColumn extends AdaptableObject {
155
151
  */
156
152
  friendlyName?: string;
157
153
  /**
158
- * Button to display in the Column
154
+ * Button (or list of buttons) to display in the Column
159
155
  */
160
- actionColumnButton: AdaptableButton<ActionColumnButtonContext>;
156
+ actionColumnButton: AdaptableButton<ActionColumnButtonContext> | AdaptableButton<ActionColumnButtonContext>[];
161
157
  /**
162
158
  * Shows Action Column also in grouped rows
163
159
  */
@@ -8,7 +8,9 @@ class UserInterfaceApiImpl extends ApiBase_1.ApiBase {
8
8
  let colorPalette = this.getUserInterfaceOptions().colorPalette;
9
9
  // first do the function then get hardcoded items
10
10
  if (colorPalette != null && typeof colorPalette === 'function') {
11
- return colorPalette();
11
+ const currentTheme = this.adaptable.api.themeApi.getCurrentTheme();
12
+ const colours = colorPalette(currentTheme);
13
+ return colours;
12
14
  }
13
15
  else {
14
16
  let arr = colorPalette;
@@ -645,7 +645,7 @@ const adaptableMiddleware = (adaptable) => function (middlewareAPI) {
645
645
  case QuickSearchRedux.QUICK_SEARCH_RUN: {
646
646
  let returnAction = next(action);
647
647
  adaptable.redrawBody();
648
- // if set then reun a query on the text
648
+ // if set then return a query on the text
649
649
  if (adaptable.adaptableOptions.searchOptions.filterResultsAfterQuickSearch) {
650
650
  const actionTyped = action;
651
651
  const searchText = actionTyped.quickSearchText;
@@ -1,5 +1,5 @@
1
1
  import { ExpressionFunction } from '../../parser/src/types';
2
- declare type AggregationFunctionName = 'WHERE' | 'COL' | AggregationFunction | ComparisonFunction;
2
+ export declare type AggregationFunctionName = 'WHERE' | 'COL' | AggregationFunction | ComparisonFunction;
3
3
  declare type AggregationFunction = 'SUM';
4
4
  declare type ComparisonFunction = 'EQ' | 'NEQ' | 'LT' | 'GT' | 'LTE' | 'GTE';
5
5
  export declare const aggregatedBooleanExpressionFunctions: Record<AggregationFunctionName, ExpressionFunction>;
@@ -1,5 +1,5 @@
1
1
  import { ExpressionFunction } from '../../parser/src/types';
2
- declare type ObservableFunctionName = 'WHERE' | 'COL' | 'TIMEFRAME' | ObservableFunction | ChangeFunction;
2
+ export declare type ObservableFunctionName = 'WHERE' | 'COL' | 'TIMEFRAME' | ObservableFunction | ChangeFunction;
3
3
  declare type ObservableFunction = 'ROW_CHANGE' | 'GRID_CHANGE';
4
4
  declare type ChangeFunction = 'MAX' | 'MIN' | 'NONE' | 'COUNT';
5
5
  export declare const observableExpressionFunctions: Record<ObservableFunctionName, ExpressionFunction>;
@@ -1,9 +1,4 @@
1
- import { ICellRendererComp, ICellRendererParams, ITooltipComp, ITooltipParams } from '@ag-grid-community/all-modules';
2
- export declare class CustomTooltip implements ITooltipComp {
3
- private eGui;
4
- init(params: ITooltipParams): void;
5
- getGui(): any;
6
- }
1
+ import { ICellRendererComp, ICellRendererParams } from '@ag-grid-community/all-modules';
7
2
  export declare class ActionColumnRenderer implements ICellRendererComp {
8
3
  private eGui;
9
4
  private eventListener;
@@ -1,85 +1,76 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionColumnRenderer = exports.CustomTooltip = void 0;
3
+ exports.ActionColumnRenderer = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const SimpleButton_1 = tslib_1.__importDefault(require("../components/SimpleButton"));
6
6
  const react_dom_1 = require("react-dom");
7
7
  const React = tslib_1.__importStar(require("react"));
8
- class CustomTooltip {
9
- init(params) {
10
- this.eGui = document.createElement('div');
11
- this.eGui.classList.add('custom-tooltip');
12
- let { field, lastValidation, validationFailedMsg } = params.value;
13
- this.eGui.innerHTML = `
14
- <div class="validation-msg">
15
- FIELD-${field.toUpperCase()} - invalid value:
16
- "<span class="invalid-value"> ${lastValidation} </span>",
17
- ${validationFailedMsg}
18
- </div>
19
- `;
20
- }
21
- getGui() {
22
- return this.eGui;
23
- }
24
- }
25
- exports.CustomTooltip = CustomTooltip;
8
+ const uuid_1 = require("../components/utils/uuid");
26
9
  class ActionColumnRenderer {
27
10
  // gets called once before the renderer is used
28
11
  init(params) {
29
12
  var _a;
30
13
  const adaptable = params.api.__adaptable;
31
- let actionCol = (_a = adaptable.api.userInterfaceApi
14
+ const actionCol = (_a = adaptable.api.userInterfaceApi
32
15
  .getAllActionColumn()) === null || _a === void 0 ? void 0 : _a.find((ac) => ac.columnId == params.colDef.colId);
33
- if (actionCol) {
16
+ if (actionCol && actionCol.actionColumnButton) {
17
+ let actionButtons = Array.isArray(actionCol.actionColumnButton)
18
+ ? actionCol.actionColumnButton
19
+ : [actionCol.actionColumnButton];
20
+ if (!actionButtons.length) {
21
+ return;
22
+ }
23
+ // actionButtons don't have IDs, so we need to generate them to be used later as a react component key
24
+ actionButtons = actionButtons.map((actionButton) => (Object.assign(Object.assign({}, actionButton), { Uuid: uuid_1.createUuid() })));
34
25
  // create the cell
35
26
  this.eGui = document.createElement('div');
36
27
  this.eGui.className = 'ab-ActionColumn';
37
- let pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
38
- let button = actionCol.actionColumnButton;
39
- let context = {
40
- actionColumn: actionCol,
41
- primaryKeyValue: pkValue,
42
- rowNode: params.node,
43
- adaptableApi: adaptable.api,
44
- };
45
28
  // if its a group node then only show if set to do so
46
29
  if (adaptable.api.gridApi.isGroupRowNode(params.node) && !actionCol.includeGroupedRows) {
47
30
  this.eGui.innerHTML = '';
48
31
  return;
49
32
  }
50
- if (button.hidden && button.hidden(button, context)) {
51
- this.eGui.innerHTML = '';
52
- return;
53
- }
54
- const disabled = button.disabled && button.disabled(button, context);
55
- const renderButton = (adaptableApi, context) => {
56
- var _a, _b;
57
- const defaultIconProps = {
58
- style: {
59
- height: 15,
60
- width: 15,
61
- },
62
- };
63
- const iconProps = button.icon && Object.assign({}, defaultIconProps, button.icon);
64
- let buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
65
- let buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
66
- let buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
67
- const handleClick = () => {
68
- button.onClick(button, context);
69
- // Timeout to let any updates to be done before re-rendering the component
70
- setTimeout(() => {
71
- // when called again it triggers a re-render
72
- // https:reactjs.org/docs/react-dom.html#render
73
- doRender();
74
- }, 16);
75
- };
76
- return (React.createElement(SimpleButton_1.default, { key: button.Uuid, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, 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' },
77
- button.icon ? React.createElement("img", Object.assign({}, iconProps)) : null,
78
- buttonLabel));
33
+ const pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
34
+ const buttonContext = {
35
+ actionColumn: actionCol,
36
+ primaryKeyValue: pkValue,
37
+ rowNode: params.node,
38
+ adaptableApi: adaptable.api,
39
+ };
40
+ const renderActionButtons = (buttons, adaptableApi, context) => {
41
+ return (React.createElement(React.Fragment, null, buttons.map((button) => {
42
+ var _a, _b;
43
+ if (button.hidden && button.hidden(button, context)) {
44
+ return;
45
+ }
46
+ const defaultIconProps = {
47
+ style: {
48
+ height: 15,
49
+ width: 15,
50
+ },
51
+ };
52
+ const iconProps = button.icon && Object.assign({}, defaultIconProps, button.icon);
53
+ const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
54
+ const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
55
+ const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
56
+ const handleClick = () => {
57
+ button.onClick(button, context);
58
+ // Timeout to let any updates to be done before re-rendering the component
59
+ setTimeout(() => {
60
+ // when called again it triggers a re-render
61
+ // https:reactjs.org/docs/react-dom.html#render
62
+ doRender();
63
+ }, 16);
64
+ };
65
+ const disabled = button.disabled && button.disabled(button, context);
66
+ return (React.createElement(SimpleButton_1.default, { key: button.Uuid, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, 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' },
67
+ button.icon ? React.createElement("img", Object.assign({}, iconProps)) : null,
68
+ buttonLabel));
69
+ })));
79
70
  };
80
71
  const eGui = this.eGui;
81
72
  function doRender() {
82
- react_dom_1.render(renderButton(adaptable.api, context), eGui);
73
+ react_dom_1.render(renderActionButtons(actionButtons, adaptable.api, buttonContext), eGui);
83
74
  }
84
75
  this.render = doRender;
85
76
  doRender();
@@ -74,6 +74,7 @@ export declare class Adaptable implements IAdaptable {
74
74
  private _id;
75
75
  private currentColumnDefs?;
76
76
  private rowListeners;
77
+ private isCheckedColumnDataType;
77
78
  _on: (eventName: string, callback: EmitterCallback) => (() => void);
78
79
  _onIncludeFired: (eventName: string, callback: EmitterCallback) => (() => void);
79
80
  _emit: (eventName: string, data?: any) => Promise<any>;
@@ -100,6 +100,7 @@ class Adaptable {
100
100
  constructor() {
101
101
  this.colDefPropertyCache = new Map();
102
102
  this.gridOptionsPropertyCache = new Map();
103
+ this.isCheckedColumnDataType = false;
103
104
  // only for our private / internal events used within Adaptable
104
105
  // public events are emitted through the EventApi
105
106
  this._on = (eventName, callback) => {
@@ -3675,7 +3676,7 @@ class Adaptable {
3675
3676
  updateColumnDataTypeIfRowDataIsEmpty() {
3676
3677
  var _a, _b;
3677
3678
  // gridOptions?.rowData is not updated when setting data via the api
3678
- if (!((_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
3679
+ if (!this.isCheckedColumnDataType && !((_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
3679
3680
  // the columns dataType is based on the rawData, when type is not set on the column
3680
3681
  // when data is loaded async, the dataType initially is dataType=unknown
3681
3682
  // to fix this, we need to update the columnDefs when we data is loaded
@@ -3683,6 +3684,8 @@ class Adaptable {
3683
3684
  // this influences the floating filter
3684
3685
  // need to trigger header redraw, if not, the columnDef update is not picked-up
3685
3686
  this.redrawHeader();
3687
+ // ensures the check is performed only once
3688
+ this.isCheckedColumnDataType = true;
3686
3689
  }
3687
3690
  }
3688
3691
  runAdaptableComparerFunction(columnId, columnValues) {
@@ -15,7 +15,7 @@ exports.ADAPTABLE_METAMODEL = {
15
15
  {
16
16
  "name": "actionColumnButton",
17
17
  "kind": "unknown",
18
- "description": "Button to display in the Column",
18
+ "description": "Button (or list of buttons) to display in the Column",
19
19
  "uiLabel": "Action Column Button"
20
20
  },
21
21
  {
@@ -11486,14 +11486,14 @@ exports.ADAPTABLE_METAMODEL = {
11486
11486
  {
11487
11487
  "name": "bulkUpdatePermittedValues",
11488
11488
  "kind": "unknown",
11489
- "description": "Custom column values for editing via bulk-update. When not defined it defaults to permittedValues.",
11489
+ "description": "Custom column values for editing via bulk-update; when not defined defaults to permittedValues",
11490
11490
  "uiLabel": "Bulk Update Permitted Values",
11491
11491
  "isOptional": true
11492
11492
  },
11493
11493
  {
11494
11494
  "name": "colorPalette",
11495
11495
  "kind": "unknown",
11496
- "description": "Colours to display in Colour Picker (in place of AdapTable&#39;s default set)",
11496
+ "description": "Colours to display in Colour Picker (in place of AdapTable&#39;s default set); can be hardcoded list or function",
11497
11497
  "uiLabel": "Color Palette",
11498
11498
  "isOptional": true
11499
11499
  },
@@ -11507,7 +11507,7 @@ exports.ADAPTABLE_METAMODEL = {
11507
11507
  {
11508
11508
  "name": "customSortPermittedValues",
11509
11509
  "kind": "unknown",
11510
- "description": "Custom column values for defining custom sort. When not defined it defaults to permittedValues.",
11510
+ "description": "Custom column values for defining Custom Sort; when not defined defaults to permittedValues",
11511
11511
  "uiLabel": "Custom Sort Permitted Values",
11512
11512
  "isOptional": true
11513
11513
  },
@@ -11530,14 +11530,14 @@ exports.ADAPTABLE_METAMODEL = {
11530
11530
  {
11531
11531
  "name": "editLookUpItems",
11532
11532
  "kind": "unknown",
11533
- "description": "Dropdown values displayed when column is being edited. When not defined it defaults to permittedValues.",
11533
+ "description": "Dropdown values displayed when column is being edited; when not defined defaults to permittedValues",
11534
11534
  "uiLabel": "Edit Look Up Items",
11535
11535
  "isOptional": true
11536
11536
  },
11537
11537
  {
11538
11538
  "name": "filterPermittedValues",
11539
11539
  "kind": "unknown",
11540
- "description": "Dropdown values for filter options inside floating and header filter. When not defined it defaults to permittedValues.",
11540
+ "description": "Custom column values for &#39;IN&#39; filter; when not defined defaults to permittedValues",
11541
11541
  "uiLabel": "Filter Permitted Values",
11542
11542
  "isOptional": true
11543
11543
  },
package/src/types.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  export type { ExpressionFunction, ExpressionFunctionDocBlock, ExpressionFunctionHandler, ExpressionContext, ExpressionFunctionMap, } from './../src/parser/src/types';
2
2
  export type { AdaptableNoCodeWizardOptions, IAdaptableNoCodeWizard, } from './AdaptableInterfaces/AdaptableNoCodeWizard';
3
+ export type { BooleanFunctionName } from './Utilities/ExpressionFunctions/booleanExpressionFunctions';
4
+ export type { ScalarFunctionName } from './Utilities/ExpressionFunctions/scalarExpressionFunctions';
5
+ export type { ObservableFunctionName } from './Utilities/ExpressionFunctions/observableExpressionFunctions';
6
+ export type { AggregationFunctionName } from './Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions';
7
+ export type { AggregatedScalarFunctionName } from './Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions';
3
8
  export type { AdaptableOptions } from './AdaptableOptions/AdaptableOptions';
4
9
  export { AdaptablePlugin } from './AdaptableOptions/AdaptablePlugin';
5
10
  export type { ContainerOptions } from './AdaptableOptions/ContainerOptions';
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "11.1.1-canary.1";
1
+ declare const _default: "11.1.1-canary.2";
2
2
  export default _default;
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '11.1.1-canary.1'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
3
+ exports.default = '11.1.1-canary.2'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version