@adaptabletools/adaptable 18.0.12 → 18.1.0-canary.0
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/agGrid.d.ts +4 -3
- package/agGrid.js +4 -3
- package/base.css +7 -2
- package/base.css.map +1 -1
- package/index.css +11 -2
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +27 -1
- package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
- package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
- package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
- package/src/Api/ColumnApi.d.ts +1 -1
- package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
- package/src/Api/ExpressionApi.d.ts +2 -2
- package/src/Api/Fdc3Api.d.ts +14 -19
- package/src/Api/Implementation/ConfigApiImpl.js +3 -0
- package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
- package/src/Api/Implementation/Fdc3ApiImpl.js +36 -12
- package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
- package/src/Api/Internal/AlertInternalApi.js +196 -25
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
- package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
- package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
- package/src/Api/Internal/ExportInternalApi.js +31 -17
- package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
- package/src/Api/Internal/ExpressionInternalApi.js +79 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
- package/src/Api/Internal/Fdc3InternalApi.js +6 -10
- package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
- package/src/PredefinedConfig/Common/AdaptableField.js +1 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +18 -1
- package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
- package/src/PredefinedConfig/Common/Fdc3Context.js +43 -31
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
- package/src/PredefinedConfig/Common/Fdc3Intent.js +26 -73
- package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
- package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
- package/src/Strategy/AdaptableModuleBase.js +1 -3
- package/src/Strategy/AlertModule.d.ts +1 -1
- package/src/Strategy/AlertModule.js +8 -8
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +1 -1
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
- package/src/Utilities/Services/Fdc3Service.js +2 -2
- package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
- package/src/Utilities/Services/QueryLanguageService.js +105 -6
- package/src/Utilities/Services/ReportService.js +8 -5
- package/src/Utilities/Services/RowSummaryService.js +3 -1
- package/src/Utilities/divideBy100.d.ts +1 -0
- package/src/Utilities/divideBy100.js +30 -0
- package/src/Utilities/times100.d.ts +1 -0
- package/src/Utilities/times100.js +23 -0
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
- package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
- package/src/View/Components/EntityRulesEditor/index.js +11 -7
- package/src/View/Components/ExpressionWizard.js +1 -1
- package/src/View/Components/FilterForm/QuickFilterValues.js +28 -4
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
- package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
- package/src/View/Components/Selectors/FieldSelector.js +21 -0
- package/src/View/Components/Selectors/PermittedValuesSelector.js +8 -4
- package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
- package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
- package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
- package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -2
- package/src/agGrid/AdaptableAgGrid.js +64 -33
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
- package/src/agGrid/AgGridColumnAdapter.js +22 -0
- package/src/agGrid/AgGridMenuAdapter.js +1 -1
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
- package/src/agGrid/editors/AdaptableDateEditor/index.js +5 -18
- package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +5 -2
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +80 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.js +148 -0
- package/src/components/Accordion.js +1 -1
- package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
- package/src/components/Datepicker/index.js +3 -4
- package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
- package/src/components/ExpressionEditor/DataTableEditor.js +63 -0
- package/src/components/ExpressionEditor/EditorInput.js +22 -9
- package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
- package/src/components/ExpressionEditor/NamedQueryEditor.js +30 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +71 -13
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +30 -22
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +41 -3
- package/src/components/ExpressionEditor/index.d.ts +3 -1
- package/src/components/ExpressionEditor/index.js +66 -91
- package/src/components/Input/NumberInput.d.ts +2 -1
- package/src/components/Input/NumberInput.js +7 -4
- package/src/components/OverlayTrigger/index.js +10 -6
- package/src/components/icons/column-outline.d.ts +3 -0
- package/src/components/icons/column-outline.js +4 -0
- package/src/components/icons/index.js +5 -1
- package/src/components/icons/sync.d.ts +3 -0
- package/src/components/icons/sync.js +4 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +78 -200
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
- package/src/parser/src/predicate/mapExpressionToQlPredicate.js +11 -2
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
- package/src/parser/src/types.d.ts +101 -1
- package/src/types.d.ts +9 -7
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import * as parser from '../../parser/src';
|
|
2
1
|
import { isObservable } from 'rxjs';
|
|
3
|
-
import
|
|
2
|
+
import * as parser from '../../parser/src';
|
|
4
3
|
import { aggregatedBooleanExpressionFunctions, } from '../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
|
|
5
|
-
import {
|
|
4
|
+
import { addGroupByParams, aggregatedScalarExpressionFunctions, } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
6
5
|
import { booleanExpressionFunctions } from '../ExpressionFunctions/booleanExpressionFunctions';
|
|
7
|
-
import {
|
|
6
|
+
import { extractColumnParameters, extractParameter, } from '../ExpressionFunctions/expressionFunctionUtils';
|
|
8
7
|
import { observableExpressionFunctions } from '../ExpressionFunctions/observableExpressionFunctions';
|
|
8
|
+
import { scalarExpressionFunctions } from '../ExpressionFunctions/scalarExpressionFunctions';
|
|
9
9
|
import { getTypedKeys } from '../Extensions/TypeExtensions';
|
|
10
|
+
import { createBaseContext } from '../ObjectFactory';
|
|
11
|
+
import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
|
|
10
12
|
export class QueryLanguageService {
|
|
11
13
|
constructor(adaptableApi) {
|
|
12
14
|
this.adaptableApi = adaptableApi;
|
|
@@ -285,8 +287,11 @@ export class QueryLanguageService {
|
|
|
285
287
|
const generalBooleanExpressionFunctions = this.extractMappedExpressionFunctions(booleanExpressionFunctions, expressionOptions.systemBooleanFunctions, expressionOptions.customBooleanFunctions);
|
|
286
288
|
const generalScalarExpressionFunctions = this.extractMappedExpressionFunctions(scalarExpressionFunctions, expressionOptions.systemScalarFunctions, expressionOptions.customScalarFunctions);
|
|
287
289
|
const generalObservableExpressionFunctions = this.extractMappedExpressionFunctions(observableExpressionFunctions, expressionOptions.systemObservableFunctions);
|
|
288
|
-
const generalAggregatedBooleanExpressionFunctions = this.extractMappedExpressionFunctions(aggregatedBooleanExpressionFunctions, expressionOptions.systemAggregatedBooleanFunctions
|
|
289
|
-
|
|
290
|
+
const generalAggregatedBooleanExpressionFunctions = this.extractMappedExpressionFunctions(aggregatedBooleanExpressionFunctions, expressionOptions.systemAggregatedBooleanFunctions,
|
|
291
|
+
// right now the custom aggregated scalar functions are used in the aggregated boolean functions as well
|
|
292
|
+
// hopefully we'll simplify this in the future
|
|
293
|
+
this.getCustomAggregatedScalarFunctions());
|
|
294
|
+
const generalAggregatedScalarExpressionFunctions = this.extractMappedExpressionFunctions(aggregatedScalarExpressionFunctions, expressionOptions.systemAggregatedScalarFunctions, this.getCustomAggregatedScalarFunctions());
|
|
290
295
|
if (!module) {
|
|
291
296
|
this.adaptableApi.logWarn(`QueryLanguageService.getModuleExpressionFunctions() was called with an undefined 'module' param, this should never happen`);
|
|
292
297
|
return {
|
|
@@ -325,6 +330,100 @@ export class QueryLanguageService {
|
|
|
325
330
|
this.cacheModuleSpecificExpressionFunctions.set(module, moduleExpressionFunctionsMap);
|
|
326
331
|
return moduleExpressionFunctionsMap;
|
|
327
332
|
}
|
|
333
|
+
getCustomAggregatedScalarFunctions() {
|
|
334
|
+
var _a;
|
|
335
|
+
const customAggregatedScalarFunctions = (_a = this.adaptableApi.optionsApi.getExpressionOptions()) === null || _a === void 0 ? void 0 : _a.customAggregatedScalarFunctions;
|
|
336
|
+
if (!customAggregatedScalarFunctions) {
|
|
337
|
+
return {};
|
|
338
|
+
}
|
|
339
|
+
if (typeof customAggregatedScalarFunctions === 'function') {
|
|
340
|
+
return (context) => {
|
|
341
|
+
const customDefinitions = customAggregatedScalarFunctions(context);
|
|
342
|
+
return this.mapCustomAggregatedScalarFunctionsToInternal(customDefinitions);
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
return this.mapCustomAggregatedScalarFunctionsToInternal(customAggregatedScalarFunctions);
|
|
346
|
+
}
|
|
347
|
+
mapCustomAggregatedScalarFunctionsToInternal(aggregatedScalarFunctions) {
|
|
348
|
+
const getValueForColId = (colId, rowNode) => {
|
|
349
|
+
return this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, colId);
|
|
350
|
+
};
|
|
351
|
+
return Object.entries(aggregatedScalarFunctions).reduce((acc, [expressionName, customExpressionDefinition]) => {
|
|
352
|
+
const expression = {
|
|
353
|
+
handler: (args, context) => {
|
|
354
|
+
// There is built in support for column validation
|
|
355
|
+
// TODO: change to extractParameters
|
|
356
|
+
// { colArgs: { [colId]: value } }
|
|
357
|
+
const [aggColParam, ...restOfColParams] = extractColumnParameters(expressionName, args);
|
|
358
|
+
const aggColumnId = aggColParam === null || aggColParam === void 0 ? void 0 : aggColParam.value;
|
|
359
|
+
const groupByParameter = extractParameter(expressionName, 'operand', ['GROUP_BY'], args, {
|
|
360
|
+
isOptional: true,
|
|
361
|
+
});
|
|
362
|
+
const preparedArgs = args.filter((arg) => {
|
|
363
|
+
if (typeof arg === 'object' && arg.name === 'COL') {
|
|
364
|
+
// filter out only first col
|
|
365
|
+
return arg.value !== aggColumnId;
|
|
366
|
+
}
|
|
367
|
+
// filter out all other objects, e.g. GROUP_BY
|
|
368
|
+
return typeof arg !== 'object';
|
|
369
|
+
});
|
|
370
|
+
const aggregationExpressionEvaluation = {
|
|
371
|
+
aggregationParams: {
|
|
372
|
+
reducers: {
|
|
373
|
+
[expressionName]: {
|
|
374
|
+
name: expressionName,
|
|
375
|
+
field: aggColumnId,
|
|
376
|
+
initialValue: customExpressionDefinition.initialValue,
|
|
377
|
+
reducer: (acc, value, rowNode, dataIndex) => {
|
|
378
|
+
const context = Object.assign({ rowNode, args: preparedArgs.map((arg) => {
|
|
379
|
+
// if col, replace with value
|
|
380
|
+
if (typeof arg === 'object' && arg.name === 'COL') {
|
|
381
|
+
return getValueForColId(arg.value, rowNode);
|
|
382
|
+
}
|
|
383
|
+
return arg;
|
|
384
|
+
}), aggColumnId, getValueForColId: (colId) => getValueForColId(colId, rowNode) }, createBaseContext(this.adaptableApi));
|
|
385
|
+
return customExpressionDefinition.reducer(acc, value, dataIndex, context);
|
|
386
|
+
},
|
|
387
|
+
done: (accValue, dataArray) => {
|
|
388
|
+
if (customExpressionDefinition.processReducerValue) {
|
|
389
|
+
return customExpressionDefinition.processReducerValue(accValue, dataArray, Object.assign(Object.assign({}, createBaseContext(this.adaptableApi)), { args }));
|
|
390
|
+
}
|
|
391
|
+
return accValue;
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
rowValueGetter: (rowNode, aggregationValue) => {
|
|
397
|
+
if (customExpressionDefinition.prepareRowValue) {
|
|
398
|
+
return customExpressionDefinition.prepareRowValue(rowNode, aggregationValue, Object.assign(Object.assign({}, createBaseContext(this.adaptableApi)), { aggColumnId,
|
|
399
|
+
args, getValueForColId: (colId) => getValueForColId(colId, rowNode) }));
|
|
400
|
+
}
|
|
401
|
+
return aggregationValue;
|
|
402
|
+
},
|
|
403
|
+
rowFilterFn: (rowNode) => {
|
|
404
|
+
var _a, _b;
|
|
405
|
+
if (customExpressionDefinition.rowFilter) {
|
|
406
|
+
return customExpressionDefinition.rowFilter(rowNode, Object.assign(Object.assign({}, createBaseContext(this.adaptableApi)), { aggColumnId, getValueForColId: (colId) => getValueForColId(colId, rowNode) }));
|
|
407
|
+
}
|
|
408
|
+
return (_b = (_a = context === null || context === void 0 ? void 0 : context.filterFn) === null || _a === void 0 ? void 0 : _a.call(context, rowNode)) !== null && _b !== void 0 ? _b : true;
|
|
409
|
+
},
|
|
410
|
+
getRowNodes: context.getRowNodes,
|
|
411
|
+
};
|
|
412
|
+
addGroupByParams(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
413
|
+
const result = {
|
|
414
|
+
name: expressionName,
|
|
415
|
+
type: 'aggregationScalar',
|
|
416
|
+
value: aggregationExpressionEvaluation,
|
|
417
|
+
};
|
|
418
|
+
return result;
|
|
419
|
+
},
|
|
420
|
+
description: customExpressionDefinition.description,
|
|
421
|
+
signatures: customExpressionDefinition.signatures,
|
|
422
|
+
};
|
|
423
|
+
acc[expressionName] = expression;
|
|
424
|
+
return acc;
|
|
425
|
+
}, {});
|
|
426
|
+
}
|
|
328
427
|
extractMappedExpressionFunctions(availableExpressionFunctions, systemFunctions, customFunctions) {
|
|
329
428
|
const systemFunctionNames = typeof systemFunctions === 'function'
|
|
330
429
|
? systemFunctions({
|
|
@@ -323,16 +323,17 @@ export class ReportService {
|
|
|
323
323
|
if (StringExtensions.IsNullOrEmpty(cellRawValue)) {
|
|
324
324
|
return cellRawValue;
|
|
325
325
|
}
|
|
326
|
-
const
|
|
326
|
+
const column = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
327
|
+
const columnDataType = column.dataType;
|
|
327
328
|
// if this is a date column and there is a custom export date format provided, that will take precedence
|
|
328
|
-
if (
|
|
329
|
+
if (columnDataType === 'Date' && !!this.getCustomExportDateFormat()) {
|
|
329
330
|
const exportDateFormat = this.getCustomExportDateFormat();
|
|
330
331
|
return FormatHelper.DateFormatter(cellRawValue, {
|
|
331
332
|
Pattern: exportDateFormat,
|
|
332
333
|
});
|
|
333
334
|
}
|
|
334
335
|
// otherwise check the general export format types
|
|
335
|
-
let cellExportFormat = this.adaptableApi.exportApi.internalApi.getCellExportFormatType(
|
|
336
|
+
let cellExportFormat = this.adaptableApi.exportApi.internalApi.getCellExportFormatType(column, columnDataType);
|
|
336
337
|
return this.getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId, cellExportFormat);
|
|
337
338
|
}
|
|
338
339
|
getReportFileName(reportName, destination) {
|
|
@@ -395,7 +396,6 @@ export class ReportService {
|
|
|
395
396
|
formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
|
|
396
397
|
return formatColumns;
|
|
397
398
|
};
|
|
398
|
-
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue();
|
|
399
399
|
const displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
|
|
400
400
|
const colDefs = displayedColumns.map((column) => {
|
|
401
401
|
return column.getColDef();
|
|
@@ -419,6 +419,9 @@ export class ReportService {
|
|
|
419
419
|
displayedColumns.forEach((column, columnIndex) => {
|
|
420
420
|
var _a, _b, _c;
|
|
421
421
|
const colDef = colDefs[columnIndex];
|
|
422
|
+
const columnId = column.getId();
|
|
423
|
+
const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
424
|
+
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue(adaptableColumn);
|
|
422
425
|
let cellClassParams;
|
|
423
426
|
const getLazyCellClassParams = () => {
|
|
424
427
|
if (!cellClassParams) {
|
|
@@ -427,7 +430,7 @@ export class ReportService {
|
|
|
427
430
|
node,
|
|
428
431
|
column,
|
|
429
432
|
data: node.data,
|
|
430
|
-
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node,
|
|
433
|
+
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, columnId),
|
|
431
434
|
rowIndex,
|
|
432
435
|
api: agGridApi,
|
|
433
436
|
columnApi: null,
|
|
@@ -94,7 +94,9 @@ export class RowSummaryService {
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
|
|
97
|
-
const rowSummariesResults = rowSummaries
|
|
97
|
+
const rowSummariesResults = rowSummaries
|
|
98
|
+
.filter((rowSummary) => !rowSummary.IsSuspended)
|
|
99
|
+
.map(({ ColumnsMap, Position }) => {
|
|
98
100
|
return {
|
|
99
101
|
Position,
|
|
100
102
|
RowData: Object.entries(ColumnsMap !== null && ColumnsMap !== void 0 ? ColumnsMap : {}).reduce((acc, [columnId, expression]) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function divideBy100(value: any): any;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function divideBy100(value) {
|
|
2
|
+
// the simple solution does not work
|
|
3
|
+
// return value / 100;
|
|
4
|
+
// needed because 4012.3456/100 = 40.123456000000004
|
|
5
|
+
// but we dont want that to happen
|
|
6
|
+
// this solution does not handle -0 correctly
|
|
7
|
+
// return parseFloat((value / 100).toFixed(12));
|
|
8
|
+
if (isNaN(value) || !value) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
const isNegative = value < 0;
|
|
12
|
+
if (isNegative) {
|
|
13
|
+
value = -value;
|
|
14
|
+
}
|
|
15
|
+
const valueAsStr = value.toPrecision();
|
|
16
|
+
const separator = Number(1.1).toLocaleString()[1];
|
|
17
|
+
let indexOfSeparator = valueAsStr.indexOf(separator);
|
|
18
|
+
if (indexOfSeparator === -1) {
|
|
19
|
+
indexOfSeparator = 0;
|
|
20
|
+
}
|
|
21
|
+
let [integer = '', decimal] = valueAsStr.split(separator);
|
|
22
|
+
decimal = decimal || '';
|
|
23
|
+
integer = integer.padStart(2, '0');
|
|
24
|
+
const integerArr = [...integer];
|
|
25
|
+
const num = integerArr.slice(0, integerArr.length - 2).join('') +
|
|
26
|
+
separator +
|
|
27
|
+
integerArr.slice(-2).join('') +
|
|
28
|
+
decimal;
|
|
29
|
+
return Number(num) * (isNegative ? -1 : 1);
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function times100(value: any): any;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function times100(value) {
|
|
2
|
+
// the simple solution does not work
|
|
3
|
+
// return value * 100;
|
|
4
|
+
// needed because 0.12676 * 100 = 12.676000000000002
|
|
5
|
+
// but we dont want that to happen
|
|
6
|
+
// this solution does not handle -0 correctly
|
|
7
|
+
// also 1267.6 * 100 is 126759.99999999999
|
|
8
|
+
// which is not what we want
|
|
9
|
+
// return parseFloat((value * 100).toFixed(12));
|
|
10
|
+
if (isNaN(value) || !value) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
const valueAsStr = value.toPrecision();
|
|
14
|
+
const separator = Number(1.1).toLocaleString()[1];
|
|
15
|
+
const indexOfSeparator = valueAsStr.indexOf(separator);
|
|
16
|
+
if (indexOfSeparator === -1) {
|
|
17
|
+
return value * 100;
|
|
18
|
+
}
|
|
19
|
+
const [integer, decimal] = valueAsStr.split(separator);
|
|
20
|
+
const num = [...`${integer}${decimal !== null && decimal !== void 0 ? decimal : ''}00`];
|
|
21
|
+
num.splice(indexOfSeparator + 2, 0, separator);
|
|
22
|
+
return Number(num.join(''));
|
|
23
|
+
}
|
|
@@ -15,7 +15,7 @@ export const renderAlertMessageSummary = () => {
|
|
|
15
15
|
export const AlertMessageWizardSection = (props) => {
|
|
16
16
|
const { data, api } = useOnePageAdaptableWizardContext();
|
|
17
17
|
const messageType = data.MessageType;
|
|
18
|
-
const messageText = api.alertApi.internalApi.
|
|
18
|
+
const messageText = api.alertApi.internalApi.getAlertDescriptionForDataChange(data);
|
|
19
19
|
const messageHeader = data.MessageHeader;
|
|
20
20
|
const onMessageTextChange = (e) => {
|
|
21
21
|
const { value } = e.target;
|
|
@@ -31,8 +31,8 @@ export const AlertPreview = (_a) => {
|
|
|
31
31
|
}
|
|
32
32
|
const result = {
|
|
33
33
|
alertType: 'generic',
|
|
34
|
-
header: api.alertApi.internalApi.
|
|
35
|
-
message: api.alertApi.internalApi.
|
|
34
|
+
header: api.alertApi.internalApi.getAlertMessageHeaderForDataChange(alertDefinition),
|
|
35
|
+
message: api.alertApi.internalApi.getAlertDescriptionForDataChange(alertDefinition),
|
|
36
36
|
alertDefinition: Object.assign(Object.assign({}, alertDefinition), { AlertForm: alertForm }),
|
|
37
37
|
};
|
|
38
38
|
return result;
|
|
@@ -24,7 +24,8 @@ export const AlertScopeWizardSection = (props) => {
|
|
|
24
24
|
Predicates: [{ PredicateId: 'AnyChange' }],
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
if (newData.Rule.ObservableExpression !== undefined &&
|
|
27
|
+
if (newData.Rule.ObservableExpression !== undefined &&
|
|
28
|
+
!api.columnScopeApi.scopeIsAll(Scope)) {
|
|
28
29
|
// if it had observable expression and the scope is changed to partial
|
|
29
30
|
// we need to reset to not be an observable expression, as observable is not supported
|
|
30
31
|
// for partial scope
|
|
@@ -49,7 +49,7 @@ export const CalculatedColumnExpressionWizardSection = (props) => {
|
|
|
49
49
|
React.createElement(Tabs.Content, null, (() => {
|
|
50
50
|
switch (props.expressionType) {
|
|
51
51
|
case 'ScalarExpression':
|
|
52
|
-
return (React.createElement(ExpressionEditor, { type: 'scalar', module: moduleInfo.ModuleName, style: { paddingLeft: 0 }, value: data.Query.ScalarExpression, onChange: (ScalarExpression) => setCalculatedColumnExpression({ ScalarExpression }), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), isFullExpression: true, api: api }));
|
|
52
|
+
return (React.createElement(ExpressionEditor, { type: 'scalar', module: moduleInfo.ModuleName, style: { paddingLeft: 0 }, value: data.Query.ScalarExpression, onChange: (ScalarExpression) => setCalculatedColumnExpression({ ScalarExpression }), initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), isFullExpression: true, api: api }));
|
|
53
53
|
case 'AggregatedScalarExpression':
|
|
54
54
|
case 'CumulativeAggregatedExpression':
|
|
55
55
|
case 'QuantileAggregatedExpression':
|
|
@@ -7,6 +7,7 @@ import Radio from '../../../components/Radio';
|
|
|
7
7
|
import { ExpressionEditor } from '../../../components/ExpressionEditor';
|
|
8
8
|
import { useAdaptable } from '../../AdaptableContext';
|
|
9
9
|
import { EntityRulePredicatesEditor } from './EntityRulePredicatesEditor';
|
|
10
|
+
import Panel from '../../../components/Panel';
|
|
10
11
|
const QueryTab = (props) => {
|
|
11
12
|
const { type, label, disabled = false } = props, tabProps = __rest(props, ["type", "label", "disabled"]);
|
|
12
13
|
const text = (React.createElement(Flex, { flexDirection: "column" },
|
|
@@ -43,7 +44,7 @@ const RuleTabTitle = (props) => {
|
|
|
43
44
|
return props.showRadio ? (React.createElement(Radio, { tabIndex: -1, margin: 0, checked: props.checked }, props.children)) : (React.createElement(React.Fragment, null, "props.children"));
|
|
44
45
|
};
|
|
45
46
|
export const EntityRulesEditor = (props) => {
|
|
46
|
-
var _a, _b
|
|
47
|
+
var _a, _b;
|
|
47
48
|
const { data, children, descriptions, predicateDefs, showNoRule = false, showPredicate = true, showObservable = true, showBoolean = true, showAggregation = true, flexProps, module, } = props;
|
|
48
49
|
const { api } = useAdaptable();
|
|
49
50
|
const numberOfTabs = [
|
|
@@ -125,12 +126,15 @@ export const EntityRulesEditor = (props) => {
|
|
|
125
126
|
showPredicate ? (React.createElement(Tabs.Content, { "data-name": "Predicate", value: "Predicate" },
|
|
126
127
|
React.createElement(EntityRulePredicatesEditor, { enablePredicateColumnId: props.enablePredicateColumnId, data: data, descriptions: descriptions, predicateDefs: filteredPredicateDefs, getPredicateDefsForColId: props.getPredicateDefsForColId, onChange: props.onChange }))) : null,
|
|
127
128
|
showBoolean ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "BooleanExpression", type: type, label: "Boolean" })) : null,
|
|
128
|
-
showBoolean ? (React.createElement(Tabs.Content, { "data-name": "BooleanExpression", value: 'BooleanExpression',
|
|
129
|
-
|
|
129
|
+
showBoolean ? (React.createElement(Tabs.Content, { "data-name": "BooleanExpression", value: 'BooleanExpression' }, (() => {
|
|
130
|
+
var _a;
|
|
131
|
+
const editor = (React.createElement(ExpressionEditor, { type: 'boolean', module: module, value: (_a = data.Rule) === null || _a === void 0 ? void 0 : _a.BooleanExpression, onChange: setBooleanExpression, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api, showQueryBuilder: props.showQueryBuilder }));
|
|
132
|
+
return props.showQueryBuilder ? React.createElement(Panel, null, editor) : editor;
|
|
133
|
+
})())) : null,
|
|
130
134
|
showObservable ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "ObservableExpression", type: type, label: "Observable" })) : null,
|
|
131
|
-
showObservable ? (React.createElement(Tabs.Content, { "data-name": "ObservableExpression", value: 'ObservableExpression'
|
|
132
|
-
React.createElement(ExpressionEditor, { type: 'observable', module: module, value: (
|
|
135
|
+
showObservable ? (React.createElement(Tabs.Content, { "data-name": "ObservableExpression", value: 'ObservableExpression' },
|
|
136
|
+
React.createElement(ExpressionEditor, { type: 'observable', module: module, value: (_a = data.Rule) === null || _a === void 0 ? void 0 : _a.ObservableExpression, onChange: setReactiveExpression, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }))) : null,
|
|
133
137
|
showAggregation ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "AggregatedBooleanExpression", type: type, label: "Aggregated Boolean" })) : null,
|
|
134
|
-
showAggregation ? (React.createElement(Tabs.Content, { "data-name": "AggregatedBooleanExpression", value: 'AggregatedBooleanExpression'
|
|
135
|
-
React.createElement(ExpressionEditor, { type: 'aggregatedBoolean', module: module, value: (
|
|
138
|
+
showAggregation ? (React.createElement(Tabs.Content, { "data-name": "AggregatedBooleanExpression", value: 'AggregatedBooleanExpression' },
|
|
139
|
+
React.createElement(ExpressionEditor, { type: 'aggregatedBoolean', module: module, value: (_b = data.Rule) === null || _b === void 0 ? void 0 : _b.AggregatedBooleanExpression, onChange: setAggregationExpression, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }))) : null)));
|
|
136
140
|
};
|
|
@@ -28,7 +28,7 @@ export class ExpressionWizard extends React.Component {
|
|
|
28
28
|
render() {
|
|
29
29
|
const initialData = useMemo(() => this.props.api.internalApi.getQueryPreviewData(), []);
|
|
30
30
|
return (React.createElement(React.Fragment, null,
|
|
31
|
-
React.createElement(ExpressionEditor, { type: 'boolean', module: NamedQueryModuleId, value: this.state.expression, onChange: this.handleCustomExpressionChange, initialData: initialData, columns: this.props.api.columnApi.getQueryableColumns(), namedQueries: this.props.api.namedQueryApi.getNamedQueries(), api: this.props.api }),
|
|
31
|
+
React.createElement(ExpressionEditor, { type: 'boolean', module: NamedQueryModuleId, value: this.state.expression, onChange: this.handleCustomExpressionChange, initialData: initialData, columns: this.props.api.columnApi.getQueryableColumns(), fields: this.props.api.expressionApi.internalApi.getAvailableFields(), namedQueries: this.props.api.namedQueryApi.getNamedQueries(), api: this.props.api }),
|
|
32
32
|
' ',
|
|
33
33
|
React.createElement(Flex, { flexDirection: "row", padding: 1, marginBottom: 2, marginLeft: 1, alignItems: "center", "data-name": "expression-wizard-save-option" },
|
|
34
34
|
React.createElement(CheckBox, { marginLeft: 2, disabled: !this.isValidExpression(), marginBottom: 2, checked: this.state.saveToNamedQueries, onChange: (checked) => this.setState({
|
|
@@ -12,6 +12,30 @@ export const QuickFilterValues = (props) => {
|
|
|
12
12
|
const currentOverlayVisible = useRef(false);
|
|
13
13
|
const valuesDropdownRef = React.useRef(null);
|
|
14
14
|
const [quickFilterValues, setQuickFilterValues] = React.useState({ values: [], suppressClientSideFilter: false, dataLoadIsComplete: false });
|
|
15
|
+
const quickFilterValuesWithPredicates = React.useMemo(() => {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
let values = quickFilterValues.values;
|
|
18
|
+
const predicateIds = api.columnFilterApi.internalApi.getValuesFitlerPredicateIds(props.currentColumn);
|
|
19
|
+
if (ArrayExtensions.IsNullOrEmpty(predicateIds)) {
|
|
20
|
+
return values;
|
|
21
|
+
}
|
|
22
|
+
const predicatesPosition = (_c = (_b = (_a = api.optionsApi.getColumnFilterOptions()) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions) === null || _b === void 0 ? void 0 : _b.predicatesPosition) !== null && _c !== void 0 ? _c : 'End';
|
|
23
|
+
const predicateValues = predicateIds.map(predicateId => {
|
|
24
|
+
var _a;
|
|
25
|
+
const predicateDef = api.predicateApi.getPredicateDefById(predicateId);
|
|
26
|
+
return {
|
|
27
|
+
value: predicateId,
|
|
28
|
+
label: ((_a = predicateDef.label) !== null && _a !== void 0 ? _a : predicateId),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
if (predicatesPosition === 'End') {
|
|
32
|
+
values = [...values, ...predicateValues];
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
values = [...predicateValues, ...values];
|
|
36
|
+
}
|
|
37
|
+
return values;
|
|
38
|
+
}, [quickFilterValues.values]);
|
|
15
39
|
const [isDistinctColumnValuesLoading, setIsDistinctColumnValuesLoading] = React.useState(false);
|
|
16
40
|
const [textFilterValue, setTextFilterValue] = React.useState('');
|
|
17
41
|
const [valuesLoadTrigger, setValuesLoadTrigger] = React.useState({
|
|
@@ -102,13 +126,13 @@ export const QuickFilterValues = (props) => {
|
|
|
102
126
|
let selectedValues = props.columnFilter.Predicate.PredicateId === 'Values' ? 'Select Values' : 'Exclude Values';
|
|
103
127
|
if (props.columnFilter.Predicate.Inputs.length) {
|
|
104
128
|
selectedValues = props.columnFilter.Predicate.Inputs.map((input) => {
|
|
105
|
-
var _a
|
|
106
|
-
const label = (
|
|
129
|
+
var _a;
|
|
130
|
+
const label = (_a = quickFilterValuesWithPredicates === null || quickFilterValuesWithPredicates === void 0 ? void 0 : quickFilterValuesWithPredicates.find((distinctValue) => {
|
|
107
131
|
if (input instanceof Date) {
|
|
108
132
|
return isSameDay(input, distinctValue.value);
|
|
109
133
|
}
|
|
110
134
|
return distinctValue.value === input;
|
|
111
|
-
})) === null ||
|
|
135
|
+
})) === null || _a === void 0 ? void 0 : _a.label;
|
|
112
136
|
return label !== null && label !== void 0 ? label : input;
|
|
113
137
|
}).join(', ');
|
|
114
138
|
}
|
|
@@ -177,7 +201,7 @@ export const QuickFilterValues = (props) => {
|
|
|
177
201
|
props.updateColumnFilter(transientColumnFilter);
|
|
178
202
|
}
|
|
179
203
|
} }, "Apply Filter"))),
|
|
180
|
-
React.createElement(ListBoxFilterForm, { disabled: props.isFilterDisabled, suppressClientSideFilter: quickFilterValues.suppressClientSideFilter, isLoading: isDistinctColumnValuesLoading, onFilterChange: handleFilterChange, currentColumn: props.currentColumn, columns: [], columnDistinctValues:
|
|
204
|
+
React.createElement(ListBoxFilterForm, { disabled: props.isFilterDisabled, suppressClientSideFilter: quickFilterValues.suppressClientSideFilter, isLoading: isDistinctColumnValuesLoading, onFilterChange: handleFilterChange, currentColumn: props.currentColumn, columns: [], columnDistinctValues: quickFilterValuesWithPredicates, dataType: props.currentColumn.dataType, uiSelectedColumnValues: props.columnFilter.Predicate.Inputs.filter((input) => input !== ''), useAgGridStyle: true, onColumnValueSelectedChange: (list) => onColumnValueSelectedChange(list) }))));
|
|
181
205
|
} },
|
|
182
206
|
React.createElement(SimpleButton, { "data-name": 'Select Values', style: {
|
|
183
207
|
flex: 1,
|
|
@@ -79,10 +79,14 @@ export const AdaptablePopupModuleView = (props) => {
|
|
|
79
79
|
newButton = (React.createElement(ButtonNew, { onClick: () => handleOpenEditPopup(), tooltip: toolTipText, accessLevel: props.accessLevel }));
|
|
80
80
|
}
|
|
81
81
|
let suspendButton = null;
|
|
82
|
-
|
|
82
|
+
const editableObjects = (items).filter(item => !item.abObject.IsReadOnly);
|
|
83
|
+
if (editableObjects.length &&
|
|
83
84
|
(moduleViewProperties === null || moduleViewProperties === void 0 ? void 0 : moduleViewProperties.getSuspendAllAction) &&
|
|
84
85
|
(moduleViewProperties === null || moduleViewProperties === void 0 ? void 0 : moduleViewProperties.getUnSuspendAllAction)) {
|
|
85
|
-
const isAtLeastOneAbObjectActive =
|
|
86
|
+
const isAtLeastOneAbObjectActive = editableObjects.some((item) => {
|
|
87
|
+
var _a;
|
|
88
|
+
return !((_a = item.abObject) === null || _a === void 0 ? void 0 : _a.IsSuspended);
|
|
89
|
+
});
|
|
86
90
|
const handleSuspendUnsuspendAll = () => {
|
|
87
91
|
if (isAtLeastOneAbObjectActive) {
|
|
88
92
|
const suspendAllAction = moduleViewProperties.getSuspendAllAction();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SelectProps } from '../../../components/Select';
|
|
3
|
+
import { AdaptableColumnDataType } from '../../../types';
|
|
4
|
+
interface FieldSelectorProps {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (fieldExp: string) => void;
|
|
7
|
+
type?: AdaptableColumnDataType;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
menuPosition?: SelectProps<any>['menuPosition'];
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const FieldSelector: React.FunctionComponent<FieldSelectorProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Select } from '../../../components/Select';
|
|
3
|
+
import { useAdaptable } from '../../AdaptableContext';
|
|
4
|
+
export const FieldSelector = (props) => {
|
|
5
|
+
var _a;
|
|
6
|
+
const { api } = useAdaptable();
|
|
7
|
+
const fields = React.useMemo(() => {
|
|
8
|
+
return api.expressionApi.internalApi.getFieldsOfType(props.type);
|
|
9
|
+
}, []);
|
|
10
|
+
const options = fields.map((field) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return ({
|
|
13
|
+
label: (_a = field.label) !== null && _a !== void 0 ? _a : field.name,
|
|
14
|
+
value: field.name,
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return (React.createElement(React.Fragment, null,
|
|
18
|
+
React.createElement(Select, { "data-name": "column-selector", disabled: props.disabled, isMulti: false, menuPosition: props.menuPosition, value: props.value || undefined, placeholder: (_a = props.placeholder) !== null && _a !== void 0 ? _a : 'Select Field', onChange: (fieldValue) => {
|
|
19
|
+
props.onChange(fieldValue);
|
|
20
|
+
}, options: options })));
|
|
21
|
+
};
|
|
@@ -7,7 +7,7 @@ export const PermittedValuesSelector = function (props) {
|
|
|
7
7
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
8
8
|
const [options, setOptions] = React.useState([]);
|
|
9
9
|
const [filter, setFilter] = React.useState('');
|
|
10
|
-
const
|
|
10
|
+
const dataType = React.useMemo(() => {
|
|
11
11
|
return adaptable.api.columnApi.getColumnDataTypeForColumnId(props.columnId);
|
|
12
12
|
}, [props.columnId]);
|
|
13
13
|
React.useEffect(() => {
|
|
@@ -25,10 +25,14 @@ export const PermittedValuesSelector = function (props) {
|
|
|
25
25
|
setOptions(distinctColumnValues);
|
|
26
26
|
})();
|
|
27
27
|
}, [props.columnId, filter]);
|
|
28
|
-
const isCreatable = props.allowNewValues && ['String', 'Number'].includes(
|
|
28
|
+
const isCreatable = (props.allowNewValues && !dataType) || ['String', 'Number'].includes(dataType);
|
|
29
29
|
const handleSingleValueChange = (value) => {
|
|
30
30
|
if (isCreatable) {
|
|
31
|
-
|
|
31
|
+
// try to convert to correct type, when there is not type, e.g. field
|
|
32
|
+
if (!dataType && typeof value === 'string' && !isNaN(parseFloat(value))) {
|
|
33
|
+
props.onChange(parseFloat(value));
|
|
34
|
+
}
|
|
35
|
+
else if (dataType === 'Number') {
|
|
32
36
|
let num = parseFloat(value);
|
|
33
37
|
num = isNaN(num) ? null : num;
|
|
34
38
|
props.onChange(num);
|
|
@@ -43,7 +47,7 @@ export const PermittedValuesSelector = function (props) {
|
|
|
43
47
|
};
|
|
44
48
|
const handleMultiValueChange = (values) => {
|
|
45
49
|
if (isCreatable) {
|
|
46
|
-
if (
|
|
50
|
+
if (dataType === 'Number') {
|
|
47
51
|
const nums = values.map((v) => parseFloat(v)).filter((v) => !isNaN(v));
|
|
48
52
|
props.onChange(nums);
|
|
49
53
|
}
|
|
@@ -66,5 +66,5 @@ export const ReportRowsWizardSection = (props) => {
|
|
|
66
66
|
props.onChange(Object.assign(Object.assign({}, data), { Query: {
|
|
67
67
|
BooleanExpression,
|
|
68
68
|
} }));
|
|
69
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })))));
|
|
69
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })))));
|
|
70
70
|
};
|
|
@@ -5,7 +5,7 @@ export function FormatColumnRuleWizardSection(props) {
|
|
|
5
5
|
const { data, api, moduleInfo } = useOnePageAdaptableWizardContext();
|
|
6
6
|
return (React.createElement(EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: props.defaultPredicateId,
|
|
7
7
|
// TODO see what is this
|
|
8
|
-
predicateDefs: api.formatColumnApi.internalApi.getFormatColumnDefsForScope(data.Scope), getPredicateDefsForColId: (colId) => api.formatColumnApi.internalApi.getFormatColumnDefsForScope({ ColumnIds: [colId] }), showNoRule: true, showBoolean: true, showAggregation: false, showObservable: false, showPredicate: !api.columnScopeApi.scopeIsAll(data.Scope), data: data, onChange: (formatColumn) => props.onChange(formatColumn), descriptions: {
|
|
8
|
+
predicateDefs: api.formatColumnApi.internalApi.getFormatColumnDefsForScope(data.Scope), getPredicateDefsForColId: (colId) => api.formatColumnApi.internalApi.getFormatColumnDefsForScope({ ColumnIds: [colId] }), showNoRule: true, showBoolean: true, showAggregation: false, showObservable: false, showQueryBuilder: true, showPredicate: !api.columnScopeApi.scopeIsAll(data.Scope), data: data, onChange: (formatColumn) => props.onChange(formatColumn), descriptions: {
|
|
9
9
|
selectPredicate: 'Create a Format Column Rule - to be applied when data changes',
|
|
10
10
|
useBooleanQuery: (React.createElement(React.Fragment, null,
|
|
11
11
|
"Use an BooleanQuery if ",
|
|
@@ -88,7 +88,7 @@ export const GridFilterExpressionEditor = (props) => {
|
|
|
88
88
|
},
|
|
89
89
|
} },
|
|
90
90
|
React.createElement(Flex, { height: "100%", flexDirection: "column" },
|
|
91
|
-
React.createElement(ExpressionEditor, Object.assign({}, expressionEditorProps, { type: 'boolean', module: GridFilterModuleId, value: expression, onChange: (expression) => setExpression(expression), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })),
|
|
91
|
+
React.createElement(ExpressionEditor, Object.assign({}, expressionEditorProps, { type: 'boolean', module: GridFilterModuleId, value: expression, onChange: (expression) => setExpression(expression), initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })),
|
|
92
92
|
React.createElement(Flex, { flexDirection: "row", padding: 1, alignItems: "center" },
|
|
93
93
|
props.onDismiss && (React.createElement(SimpleButton, { margin: 1, variant: "text", "data-name": "action-close", onClick: () => {
|
|
94
94
|
props.onDismiss();
|
|
@@ -8,6 +8,7 @@ import { ExpressionEditor } from '../../../../components/ExpressionEditor';
|
|
|
8
8
|
import { GridFilterModuleId } from '../../../../Utilities/Constants/ModuleConstants';
|
|
9
9
|
import StringExtensions from '../../../../Utilities/Extensions/StringExtensions';
|
|
10
10
|
import { useGridFilterOptionsForExpressionEditorProps } from '../../../GridFilter/useGridFilterOptionsForExpressionEditor';
|
|
11
|
+
import Panel from '../../../../components/Panel';
|
|
11
12
|
export const isGridFiltersValid = (layout, api) => {
|
|
12
13
|
var _a;
|
|
13
14
|
const expression = (_a = layout === null || layout === void 0 ? void 0 : layout.GridFilter) === null || _a === void 0 ? void 0 : _a.Expression;
|
|
@@ -30,8 +31,9 @@ export const GridFilterSection = (props) => {
|
|
|
30
31
|
const expressionEditorProps = useGridFilterOptionsForExpressionEditorProps();
|
|
31
32
|
const expressionEditorContent = (React.createElement(ExpressionEditor, Object.assign({}, expressionEditorProps, { allowSaveNamedQuery: false, type: 'boolean', module: GridFilterModuleId, value: (_b = (_a = layout === null || layout === void 0 ? void 0 : layout.GridFilter) === null || _a === void 0 ? void 0 : _a.Expression) !== null && _b !== void 0 ? _b : '', onChange: (expression) => {
|
|
32
33
|
props.onChange(Object.assign(Object.assign({}, layout), { GridFilter: Object.assign(Object.assign({}, layout.GridFilter), { Expression: expression }) }));
|
|
33
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })));
|
|
34
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })));
|
|
34
35
|
return (React.createElement(Tabs, { style: { height: '100%' } },
|
|
35
36
|
React.createElement(Tabs.Tab, null, "Grid Filters"),
|
|
36
|
-
React.createElement(Tabs.Content, null,
|
|
37
|
+
React.createElement(Tabs.Content, null,
|
|
38
|
+
React.createElement(Panel, null, expressionEditorContent))));
|
|
37
39
|
};
|
|
@@ -14,6 +14,7 @@ import { useAdaptable } from '../../../AdaptableContext';
|
|
|
14
14
|
import { ValueSelector } from '../../../Components/ValueSelector';
|
|
15
15
|
import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptableWizard';
|
|
16
16
|
import { columnFilter } from './Utilities';
|
|
17
|
+
import { SuspendToggleButton } from '../../../Components/Buttons/SuspendToggleButton';
|
|
17
18
|
export const areSummaryRowsValid = (layout) => {
|
|
18
19
|
var _a;
|
|
19
20
|
if (!layout.RowSummaries)
|
|
@@ -32,7 +33,6 @@ export const areSummaryRowsValid = (layout) => {
|
|
|
32
33
|
};
|
|
33
34
|
const getAvailableExpressionsForColumnType = (columnType, availableScalarExpressions) => {
|
|
34
35
|
const inputType = mapColumnDataTypeToExpressionFunctionType(columnType);
|
|
35
|
-
// Object.entries(availableScalarExpressions ?? {})
|
|
36
36
|
return summarySupportedExpressions
|
|
37
37
|
.filter((expression) => availableScalarExpressions[expression])
|
|
38
38
|
.map((expression) => {
|
|
@@ -80,6 +80,12 @@ const RowSummaryEditor = ({ rowSummary, onChange, availableScalarExpressions, on
|
|
|
80
80
|
}, [rowSummary.ColumnsMap]);
|
|
81
81
|
return (React.createElement(Panel, { header: React.createElement(Flex, { style: { width: '100%' } },
|
|
82
82
|
React.createElement(Flex, { flex: 1, alignItems: "center" }, "Row Summary"),
|
|
83
|
+
React.createElement(Box, { mr: 2 },
|
|
84
|
+
React.createElement(SuspendToggleButton, { onSuspend: () => {
|
|
85
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: true }));
|
|
86
|
+
}, onUnSuspend: () => {
|
|
87
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: false }));
|
|
88
|
+
}, suspendableObject: rowSummary })),
|
|
83
89
|
React.createElement(SimpleButton, { icon: "delete", onClick: () => {
|
|
84
90
|
onDelete();
|
|
85
91
|
} })), p: 2 },
|
|
@@ -26,5 +26,5 @@ export const NamedQueryExpressionWizardSection = (props) => {
|
|
|
26
26
|
const initialData = useMemo(() => api.internalApi.getQueryPreviewData(), []);
|
|
27
27
|
return (React.createElement(ExpressionEditor, { allowSaveNamedQuery: false, showQueryBuilder: true, type: 'boolean', module: moduleInfo.ModuleName, value: data.BooleanExpression, onChange: (BooleanExpression) => {
|
|
28
28
|
props.onChange(Object.assign(Object.assign({}, data), { BooleanExpression }));
|
|
29
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
|
|
29
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
|
|
30
30
|
};
|