@adaptabletools/adaptable 13.0.5 → 13.0.7

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.5",
3
+ "version": "13.0.7",
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: 1667157994936;
1
+ declare const _default: 1667316496830;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1667157994936;
3
+ exports.default = 1667316496830;
@@ -1,7 +1,8 @@
1
1
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
2
2
  import { FilterActionOnDataChange } from '../PredefinedConfig/Common/FilterActionOnDataChange';
3
- import { SystemFilterPredicateId, SystemFilterPredicateIds } from '../../types';
3
+ import { AdaptablePredicateDef, SystemFilterPredicateId, SystemFilterPredicateIds } from '../../types';
4
4
  import { StrictExtract } from '../Utilities/Extensions/TypeExtensions';
5
+ import { BaseContext } from '../types';
5
6
  /**
6
7
  * Options for managing Filtering in AdapTable
7
8
  */
@@ -148,9 +149,9 @@ export interface FilterOptions {
148
149
  */
149
150
  enableFilterOnSpecialColumns?: boolean;
150
151
  /**
151
- * Which Adaptable System Filter Predicates are available
152
+ * Set which System Filter Predicates are available, using list or function
152
153
  */
153
- systemFilters?: SystemFilterPredicateIds;
154
+ systemFilters?: SystemFilterPredicateIds | ((context: SystemFiltersPredicateContext) => SystemFilterPredicateIds);
154
155
  /**
155
156
  * Whether to display Quick Filter Bar between Column Header and the Grid (provided its been setup)
156
157
  * @defaultValue true
@@ -176,3 +177,12 @@ export interface FilterOptions {
176
177
  */
177
178
  showSuspendFilterButton?: boolean;
178
179
  }
180
+ /**
181
+ * Context used for providing System Filters
182
+ */
183
+ export interface SystemFiltersPredicateContext extends BaseContext {
184
+ /**
185
+ * AdapTable-provided System Filter Predicate Definitions
186
+ */
187
+ systemFiltersPredicateDefs: AdaptablePredicateDef[];
188
+ }
@@ -127,11 +127,11 @@ export interface InstrumentColumn extends FDC3Column {
127
127
  */
128
128
  permidColumnId?: string;
129
129
  /**
130
- * Column which holds a FIGI value as instrument data
130
+ * Column which holds a [FIGI](https://www.openfigi.com/about/figi) value as instrument data
131
131
  */
132
132
  figiColumnId?: string;
133
133
  /**
134
- * FDC3 Intents invoked by Column; can be: `ViewChart` `ViewQuote` `ViewNews` `ViewAnalysis` `ViewInstrument`
134
+ * Instrument-related FDC3 Intents; can be: `ViewChart` `ViewQuote` `ViewNews` `ViewAnalysis` `ViewInstrument`
135
135
  */
136
136
  intents?: InstrumentIntents;
137
137
  }
@@ -152,7 +152,7 @@ export interface PositionColumn extends FDC3Column {
152
152
  */
153
153
  instrumentColumnId: string;
154
154
  /**
155
- * FDC3 Intents invoked by Column; can be: `ViewChart` `ViewNews` `ViewAnalysis`
155
+ * Position-related FDC3 Intents; can be: `ViewChart` `ViewNews` `ViewAnalysis`
156
156
  */
157
157
  intents?: PositionIntents;
158
158
  }
@@ -178,7 +178,7 @@ export interface ContactColumn extends FDC3Column {
178
178
  */
179
179
  fds_idColumnId?: string;
180
180
  /**
181
- * FDC3 Intents invoked by Column; can be: `StartCall` `StartChat` `ViewContact`
181
+ * Contact-related FDC3 Intents; can be: `StartCall` `StartChat` `ViewContact`
182
182
  */
183
183
  intents?: ContactIntents;
184
184
  }
@@ -207,7 +207,7 @@ export interface OrganizationColumn extends FDC3Column {
207
207
  */
208
208
  fds_idColumnId?: string;
209
209
  /**
210
- * FDC3 Intents invoked by Column; can be: `ViewNews` `ViewAnalysis`
210
+ * Organization-related FDC3 Intents; can be: `ViewNews` `ViewAnalysis`
211
211
  */
212
212
  intents?: OrganizationIntents;
213
213
  }
@@ -229,7 +229,7 @@ export interface CountryColumn extends FDC3Column {
229
229
  */
230
230
  isoalpha3ColumnId?: string;
231
231
  /**
232
- * FDC3 Intents invoked by Column; can be: `ViewChart`
232
+ * Country-related FDC3 Intents; can only be: `ViewChart`
233
233
  */
234
234
  intents?: CountryIntents;
235
235
  }
@@ -134,7 +134,7 @@ export interface Holidays {
134
134
  /**
135
135
  * Context used for isHoliday function
136
136
  */
137
- export interface HolidayContext {
137
+ export interface HolidayContext extends BaseContext {
138
138
  /**
139
139
  * Date being checked
140
140
  */
@@ -66,6 +66,10 @@ export interface LayoutOptions {
66
66
  * Options for leveraging Object Tags to extend Layouts
67
67
  */
68
68
  layoutTagOptions?: LayoutTagOptions;
69
+ /**
70
+ * Columns displayed in Table that opens when viewing contents of Pivot Cells
71
+ */
72
+ pivotPreviewColumns?: string[] | ((context: PivotPreviewColumnsContext) => string[]);
69
73
  }
70
74
  export interface LayoutTagOptions {
71
75
  /**
@@ -132,3 +136,16 @@ export interface AutoGenerateTagsForLayoutsContext extends BaseContext {
132
136
  */
133
137
  objectTags: AdaptableObjectTag[];
134
138
  }
139
+ /**
140
+ * Context uses for pivotPreviewColumns function in Layout Options
141
+ */
142
+ export interface PivotPreviewColumnsContext extends BaseContext {
143
+ /**
144
+ * Current Layout
145
+ */
146
+ layout: Layout;
147
+ /**
148
+ * Column being opened
149
+ */
150
+ columnId: string;
151
+ }
@@ -172,4 +172,24 @@ export interface AlertApi {
172
172
  * @param alertDefinition Alert Definition to use
173
173
  */
174
174
  getAlertRuleDescription(alertDefinition: AlertDefinition): string;
175
+ /**
176
+ * Was Adaptable Alert fired due to a Cell Change
177
+ * @param alert AdaptableAlert to check
178
+ */
179
+ isCellChangedAdaptableAlert(alert: AdaptableAlert): boolean;
180
+ /**
181
+ * Was Adaptable Alert fired due to a Row Change
182
+ * @param alert AdaptableAlert to check
183
+ */
184
+ isRowChangedAdaptableAlert(alert: AdaptableAlert): boolean;
185
+ /**
186
+ * Is Adaptable Alert a Generic one
187
+ * @param alert AdaptableAlert to check
188
+ */
189
+ isGenericAdaptableAlert(alert: AdaptableAlert): boolean;
190
+ /**
191
+ * Returns for the Alert Type for an Adaptable Alert
192
+ * @param alert AdaptableAlert to check
193
+ */
194
+ getAlertTypeForAdaptableAlert(alert: AdaptableAlert): 'cellChanged' | 'rowChanged' | 'generic';
175
195
  }
@@ -44,4 +44,8 @@ export declare class AlertApiImpl extends ApiBase implements AlertApi {
44
44
  unSuspendAlertDefinition(alertDefinition: AlertDefinition): AlertDefinition;
45
45
  getAlertDescription(alertDefinition: AlertDefinition, cellDataChangedInfo?: CellDataChangedInfo): string;
46
46
  getAlertRuleDescription(alert: AlertDefinition): string;
47
+ isCellChangedAdaptableAlert(alert: AdaptableAlert): boolean;
48
+ isRowChangedAdaptableAlert(alert: AdaptableAlert): boolean;
49
+ isGenericAdaptableAlert(alert: AdaptableAlert): boolean;
50
+ getAlertTypeForAdaptableAlert(alert: AdaptableAlert): 'cellChanged' | 'rowChanged' | 'generic';
47
51
  }
@@ -323,5 +323,17 @@ class AlertApiImpl extends ApiBase_1.ApiBase {
323
323
  : this.adaptable.api.internalApi.getAdaptableQueryExpressionText(alert.Rule);
324
324
  return ruleDescription;
325
325
  }
326
+ isCellChangedAdaptableAlert(alert) {
327
+ return alert.alertType === 'cellChanged';
328
+ }
329
+ isRowChangedAdaptableAlert(alert) {
330
+ return alert.alertType === 'rowChanged';
331
+ }
332
+ isGenericAdaptableAlert(alert) {
333
+ return alert.alertType === 'generic';
334
+ }
335
+ getAlertTypeForAdaptableAlert(alert) {
336
+ return alert.alertType;
337
+ }
326
338
  }
327
339
  exports.AlertApiImpl = AlertApiImpl;
@@ -23,11 +23,15 @@ class CalendarApiImpl extends ApiBase_1.ApiBase {
23
23
  }
24
24
  isWorkingDay(dateToCheck) {
25
25
  const holidays = this.getGeneralOptions().holidays;
26
+ if (!holidays) {
27
+ return dateToCheck.getDay() != 0 && dateToCheck.getDay() != 6;
28
+ }
26
29
  if (holidays.isHoliday) {
27
30
  const context = {
28
31
  dateToCheck: dateToCheck,
29
32
  userName: this.getOptions().userName,
30
33
  adaptableId: this.getOptions().adaptableId,
34
+ adaptableApi: this.getAdaptableApi(),
31
35
  };
32
36
  if (holidays.isHoliday(context)) {
33
37
  return false;
@@ -28,7 +28,7 @@ export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
28
28
  isDateColumn(column: AdaptableColumn): boolean;
29
29
  getColumnDataTypeFromColumnId(columnId: string): AdaptableColumnDataType | undefined;
30
30
  getFriendlyNameFromColumn(columnId: string, column: AdaptableColumn): string;
31
- getFriendlyNameFromColumnId(columnId: string): string;
31
+ getFriendlyNameFromColumnId(columnId: string): string | undefined;
32
32
  getFriendlyNamesFromColumnIds(columnIds: string[]): string[];
33
33
  getColumnIdFromFriendlyName(friendlyName: string): string;
34
34
  getColumnIdsFromFriendlyNames(friendlyNames: string[]): string[];
@@ -115,6 +115,9 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
115
115
  return columnId + GeneralConstants.MISSING_COLUMN;
116
116
  }
117
117
  getFriendlyNameFromColumnId(columnId) {
118
+ if (this.isAutoPivotColumn(columnId)) {
119
+ return GeneralConstants.EMPTY_STRING;
120
+ }
118
121
  const foundColumn = this.getColumns().find((c) => c.columnId == columnId);
119
122
  if (foundColumn) {
120
123
  return this.getFriendlyNameFromColumn(columnId, foundColumn);
@@ -180,6 +183,9 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
180
183
  if (ArrayExtensions_1.default.IsNullOrEmpty(this.getColumns())) {
181
184
  return;
182
185
  }
186
+ if (this.isAutoPivotColumn(columnId)) {
187
+ return;
188
+ }
183
189
  const foundColumn = this.getColumns().find((c) => c.columnId == columnId);
184
190
  if (foundColumn) {
185
191
  return foundColumn;
@@ -10,7 +10,15 @@ const LoggingHelper_1 = require("../../Utilities/Helpers/LoggingHelper");
10
10
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
11
11
  class FilterApiImpl extends ApiBase_1.ApiBase {
12
12
  getAllSystemFilterIds() {
13
- return this.getFilterOptions().systemFilters;
13
+ const systemFilters = this.getFilterOptions().systemFilters;
14
+ if (typeof systemFilters === 'function') {
15
+ const systemFiltersPredicateContext = {
16
+ adaptableApi: this.adaptable.api,
17
+ systemFiltersPredicateDefs: this.adaptable.api.predicateApi.getSystemPredicateDefs(),
18
+ };
19
+ return systemFilters(systemFiltersPredicateContext);
20
+ }
21
+ return systemFilters;
14
22
  }
15
23
  findPredicateDefByShortcut(shortcut, column) {
16
24
  return this.getFilterPredicateDefsForColumn(column).find((i) => { var _a; return (_a = i.shortcuts) === null || _a === void 0 ? void 0 : _a.includes(shortcut); });
@@ -236,7 +236,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
236
236
  return returnColumnMenuItems;
237
237
  }
238
238
  createViewPivotItemsMenuItem(menuContext) {
239
- var _a, _b;
239
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
240
240
  // current group => menuContext.rowNode.field;
241
241
  if (((_b = (_a = menuContext.selectedCellInfo) === null || _a === void 0 ? void 0 : _a.gridCells) === null || _b === void 0 ? void 0 : _b.length) !== 1) {
242
242
  return;
@@ -251,6 +251,19 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
251
251
  if (!isPivotColumn && this.api.columnApi.getColumnDataTypeFromColumnId(columnId) !== 'Number') {
252
252
  return;
253
253
  }
254
+ /**
255
+ * Cannot base the values on the pivot column id, because the value or the field may have underscrores
256
+ *
257
+ *
258
+ * e.g. pivot_license_MIT License_stargazers_count
259
+ */
260
+ // pivot_status_Booked_price
261
+ // price
262
+ const aggColumn = (_f = (_e = (_d = (_c = agGridColumn === null || agGridColumn === void 0 ? void 0 : agGridColumn.getColDef) === null || _c === void 0 ? void 0 : _c.call(agGridColumn).pivotValueColumn) === null || _d === void 0 ? void 0 : _d.getColDef) === null || _e === void 0 ? void 0 : _e.call(_d)) === null || _f === void 0 ? void 0 : _f.field;
263
+ // Booked
264
+ const pivotValue = (_j = (_h = (_g = agGridColumn === null || agGridColumn === void 0 ? void 0 : agGridColumn.getColDef) === null || _g === void 0 ? void 0 : _g.call(agGridColumn)) === null || _h === void 0 ? void 0 : _h.pivotKeys) === null || _j === void 0 ? void 0 : _j[0];
265
+ // status - the preview works only with one column
266
+ const pivotColumnId = (_k = currentLayout === null || currentLayout === void 0 ? void 0 : currentLayout.PivotColumns) === null || _k === void 0 ? void 0 : _k[0];
254
267
  function getData(rows) {
255
268
  return [
256
269
  ...rows.map((row) => {
@@ -271,6 +284,10 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
271
284
  columnId,
272
285
  rowGroups,
273
286
  rows: data,
287
+ layout: currentLayout,
288
+ aggColumn,
289
+ pivotValue,
290
+ pivotColumnId,
274
291
  };
275
292
  return {
276
293
  isVisible: true,
@@ -14,25 +14,47 @@ const tableDOMProps = {
14
14
  };
15
15
  const PivotDetailsPopoup = (props) => {
16
16
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
17
- const primaryKey = adaptable.api.internalApi.getAdaptableOptions().primaryKey;
18
- const { hasPivotValue, rows, rowGroups, columnId, } = props.popupProps;
17
+ const adaptableApi = adaptable.api;
18
+ const primaryKey = adaptableApi.internalApi.getAdaptableOptions().primaryKey;
19
+ const { hasPivotValue, rows, rowGroups, columnId, layout, aggColumn, pivotValue, pivotColumnId, } = props.popupProps;
19
20
  let data = rows;
20
- const getFriendlyName = (columnId) => adaptable.api.columnApi.getFriendlyNameFromColumnId(columnId);
21
- let columns = {
22
- [primaryKey]: { field: primaryKey, header: getFriendlyName(primaryKey) },
23
- };
24
- if (hasPivotValue) {
25
- const [prefix, pivotColumnId, pivotValue, aggColumn] = columnId.split('_');
26
- columns = Object.assign(Object.assign({}, columns), { [aggColumn]: { field: aggColumn, header: getFriendlyName(aggColumn) }, [pivotColumnId]: { field: pivotColumnId, header: getFriendlyName(pivotColumnId) } });
27
- data = rows.filter((row) => (row === null || row === void 0 ? void 0 : row[pivotColumnId]) === pivotValue);
28
- }
29
- else {
30
- columns = Object.assign(Object.assign({}, columns), { [columnId]: { field: columnId, header: getFriendlyName(columnId) } });
31
- }
32
- columns = Object.assign(Object.assign({}, columns), rowGroups.reduce((acc, groupColId) => {
33
- acc[groupColId] = { field: groupColId, header: getFriendlyName(groupColId) };
34
- return acc;
35
- }, {}));
21
+ const columns = React.useMemo(() => {
22
+ var _a, _b;
23
+ const getFriendlyName = (columnId) => adaptableApi.columnApi.getFriendlyNameFromColumnId(columnId);
24
+ const pivotPreviewOptionColumn = (_b = (_a = adaptableApi.internalApi.getAdaptableOptions()) === null || _a === void 0 ? void 0 : _a.layoutOptions) === null || _b === void 0 ? void 0 : _b.pivotPreviewColumns;
25
+ let pivotPreviewExtraColumns = [];
26
+ if (typeof pivotPreviewOptionColumn === 'function') {
27
+ const pivotPreviewColumnsContext = {
28
+ layout: layout,
29
+ columnId: columnId,
30
+ adaptableApi: adaptableApi,
31
+ };
32
+ pivotPreviewExtraColumns = pivotPreviewOptionColumn(pivotPreviewColumnsContext);
33
+ }
34
+ else if (Array.isArray(pivotPreviewOptionColumn)) {
35
+ pivotPreviewExtraColumns = pivotPreviewOptionColumn;
36
+ }
37
+ let columns = {
38
+ [primaryKey]: { field: primaryKey, header: getFriendlyName(primaryKey) },
39
+ };
40
+ if (hasPivotValue) {
41
+ // pivot_license_MIT License_stargazers_count
42
+ // splitting by _ does not work
43
+ columns = Object.assign(Object.assign({}, columns), { [aggColumn]: { field: aggColumn, header: getFriendlyName(aggColumn) }, [pivotColumnId]: { field: pivotColumnId, header: getFriendlyName(pivotColumnId) } });
44
+ data = rows.filter((row) => (row === null || row === void 0 ? void 0 : row[pivotColumnId]) === pivotValue);
45
+ }
46
+ else {
47
+ columns = Object.assign(Object.assign({}, columns), { [columnId]: { field: columnId, header: getFriendlyName(columnId) } });
48
+ }
49
+ const extraColumns = [];
50
+ if (Array.isArray(rowGroups) && rowGroups.length > 0) {
51
+ extraColumns.push(...rowGroups);
52
+ }
53
+ if (Array.isArray(pivotPreviewExtraColumns) && pivotPreviewExtraColumns.length > 0) {
54
+ extraColumns.push(...pivotPreviewExtraColumns);
55
+ }
56
+ return Object.assign(Object.assign({}, columns), extraColumns.reduce((acc, colId) => (Object.assign(Object.assign({}, acc), { [colId]: { field: colId, header: getFriendlyName(colId) } })), {}));
57
+ }, [props.popupProps]);
36
58
  return (React.createElement(InfiniteTable_1.DataSource, { data: data, primaryKey: columnId },
37
59
  React.createElement(InfiniteTable_1.InfiniteTable, { columnTypes: {
38
60
  default: {
@@ -2873,10 +2873,10 @@ export declare const ADAPTABLE_METAMODEL: {
2873
2873
  description: string;
2874
2874
  uiLabel: string;
2875
2875
  isOptional: boolean;
2876
- reference: string;
2877
2876
  gridInfo?: undefined;
2878
2877
  noCode?: undefined;
2879
2878
  defaultValue?: undefined;
2879
+ reference?: undefined;
2880
2880
  } | {
2881
2881
  name: string;
2882
2882
  kind: string;
@@ -3766,6 +3766,16 @@ export declare const ADAPTABLE_METAMODEL: {
3766
3766
  gridInfo?: undefined;
3767
3767
  noCode?: undefined;
3768
3768
  defaultValue?: undefined;
3769
+ } | {
3770
+ name: string;
3771
+ kind: string;
3772
+ description: string;
3773
+ uiLabel: string;
3774
+ isOptional: boolean;
3775
+ gridInfo?: undefined;
3776
+ noCode?: undefined;
3777
+ defaultValue?: undefined;
3778
+ reference?: undefined;
3769
3779
  })[];
3770
3780
  };
3771
3781
  LayoutState: {
@@ -4123,6 +4133,24 @@ export declare const ADAPTABLE_METAMODEL: {
4123
4133
  reference: string;
4124
4134
  }[];
4125
4135
  };
4136
+ PivotPreviewColumnsContext: {
4137
+ name: string;
4138
+ kind: string;
4139
+ description: string;
4140
+ properties: ({
4141
+ name: string;
4142
+ kind: string;
4143
+ description: string;
4144
+ uiLabel: string;
4145
+ reference?: undefined;
4146
+ } | {
4147
+ name: string;
4148
+ kind: string;
4149
+ description: string;
4150
+ uiLabel: string;
4151
+ reference: string;
4152
+ })[];
4153
+ };
4126
4154
  PluginsApi: {
4127
4155
  name: string;
4128
4156
  kind: string;
@@ -4939,6 +4967,17 @@ export declare const ADAPTABLE_METAMODEL: {
4939
4967
  kind: string;
4940
4968
  description: string;
4941
4969
  };
4970
+ SystemFiltersPredicateContext: {
4971
+ name: string;
4972
+ kind: string;
4973
+ description: string;
4974
+ properties: {
4975
+ name: string;
4976
+ kind: string;
4977
+ description: string;
4978
+ uiLabel: string;
4979
+ }[];
4980
+ };
4942
4981
  SystemReportName: {
4943
4982
  name: string;
4944
4983
  kind: string;