@adaptabletools/adaptable-cjs 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 +6 -1
- 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 +35 -11
- 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 +80 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
- package/src/Api/Internal/Fdc3InternalApi.js +5 -9
- package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
- package/src/PredefinedConfig/Common/AdaptableField.js +2 -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 +44 -32
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
- package/src/PredefinedConfig/Common/Fdc3Intent.js +27 -74
- 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 +14 -13
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
- 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 +34 -0
- package/src/Utilities/times100.d.ts +1 -0
- package/src/Utilities/times100.js +27 -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 +26 -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 +63 -32
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
- package/src/agGrid/AgGridColumnAdapter.js +24 -1
- 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 +6 -19
- 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 +6 -2
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +84 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.js +153 -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 +68 -0
- package/src/components/ExpressionEditor/EditorInput.js +21 -8
- package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
- package/src/components/ExpressionEditor/NamedQueryEditor.js +35 -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 +72 -14
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +27 -19
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +46 -4
- package/src/components/ExpressionEditor/index.d.ts +3 -1
- package/src/components/ExpressionEditor/index.js +67 -92
- package/src/components/Input/NumberInput.d.ts +2 -1
- package/src/components/Input/NumberInput.js +6 -5
- 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 +7 -0
- package/src/components/icons/index.js +5 -1
- package/src/components/icons/sync.d.ts +3 -0
- package/src/components/icons/sync.js +7 -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 +13 -3
- 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.cjs.tsbuildinfo +1 -1
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryLanguageService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const parser = tslib_1.__importStar(require("../../parser/src"));
|
|
6
5
|
const rxjs_1 = require("rxjs");
|
|
7
|
-
const
|
|
6
|
+
const parser = tslib_1.__importStar(require("../../parser/src"));
|
|
8
7
|
const aggregatedBooleanExpressionFunctions_1 = require("../ExpressionFunctions/aggregatedBooleanExpressionFunctions");
|
|
9
|
-
const
|
|
8
|
+
const aggregatedScalarExpressionFunctions_1 = require("../ExpressionFunctions/aggregatedScalarExpressionFunctions");
|
|
10
9
|
const booleanExpressionFunctions_1 = require("../ExpressionFunctions/booleanExpressionFunctions");
|
|
11
|
-
const
|
|
10
|
+
const expressionFunctionUtils_1 = require("../ExpressionFunctions/expressionFunctionUtils");
|
|
12
11
|
const observableExpressionFunctions_1 = require("../ExpressionFunctions/observableExpressionFunctions");
|
|
12
|
+
const scalarExpressionFunctions_1 = require("../ExpressionFunctions/scalarExpressionFunctions");
|
|
13
13
|
const TypeExtensions_1 = require("../Extensions/TypeExtensions");
|
|
14
|
+
const ObjectFactory_1 = require("../ObjectFactory");
|
|
15
|
+
const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
|
|
14
16
|
class QueryLanguageService {
|
|
15
17
|
constructor(adaptableApi) {
|
|
16
18
|
this.adaptableApi = adaptableApi;
|
|
@@ -289,8 +291,11 @@ class QueryLanguageService {
|
|
|
289
291
|
const generalBooleanExpressionFunctions = this.extractMappedExpressionFunctions(booleanExpressionFunctions_1.booleanExpressionFunctions, expressionOptions.systemBooleanFunctions, expressionOptions.customBooleanFunctions);
|
|
290
292
|
const generalScalarExpressionFunctions = this.extractMappedExpressionFunctions(scalarExpressionFunctions_1.scalarExpressionFunctions, expressionOptions.systemScalarFunctions, expressionOptions.customScalarFunctions);
|
|
291
293
|
const generalObservableExpressionFunctions = this.extractMappedExpressionFunctions(observableExpressionFunctions_1.observableExpressionFunctions, expressionOptions.systemObservableFunctions);
|
|
292
|
-
const generalAggregatedBooleanExpressionFunctions = this.extractMappedExpressionFunctions(aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions, expressionOptions.systemAggregatedBooleanFunctions
|
|
293
|
-
|
|
294
|
+
const generalAggregatedBooleanExpressionFunctions = this.extractMappedExpressionFunctions(aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions, expressionOptions.systemAggregatedBooleanFunctions,
|
|
295
|
+
// right now the custom aggregated scalar functions are used in the aggregated boolean functions as well
|
|
296
|
+
// hopefully we'll simplify this in the future
|
|
297
|
+
this.getCustomAggregatedScalarFunctions());
|
|
298
|
+
const generalAggregatedScalarExpressionFunctions = this.extractMappedExpressionFunctions(aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions, expressionOptions.systemAggregatedScalarFunctions, this.getCustomAggregatedScalarFunctions());
|
|
294
299
|
if (!module) {
|
|
295
300
|
this.adaptableApi.logWarn(`QueryLanguageService.getModuleExpressionFunctions() was called with an undefined 'module' param, this should never happen`);
|
|
296
301
|
return {
|
|
@@ -329,6 +334,100 @@ class QueryLanguageService {
|
|
|
329
334
|
this.cacheModuleSpecificExpressionFunctions.set(module, moduleExpressionFunctionsMap);
|
|
330
335
|
return moduleExpressionFunctionsMap;
|
|
331
336
|
}
|
|
337
|
+
getCustomAggregatedScalarFunctions() {
|
|
338
|
+
var _a;
|
|
339
|
+
const customAggregatedScalarFunctions = (_a = this.adaptableApi.optionsApi.getExpressionOptions()) === null || _a === void 0 ? void 0 : _a.customAggregatedScalarFunctions;
|
|
340
|
+
if (!customAggregatedScalarFunctions) {
|
|
341
|
+
return {};
|
|
342
|
+
}
|
|
343
|
+
if (typeof customAggregatedScalarFunctions === 'function') {
|
|
344
|
+
return (context) => {
|
|
345
|
+
const customDefinitions = customAggregatedScalarFunctions(context);
|
|
346
|
+
return this.mapCustomAggregatedScalarFunctionsToInternal(customDefinitions);
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
return this.mapCustomAggregatedScalarFunctionsToInternal(customAggregatedScalarFunctions);
|
|
350
|
+
}
|
|
351
|
+
mapCustomAggregatedScalarFunctionsToInternal(aggregatedScalarFunctions) {
|
|
352
|
+
const getValueForColId = (colId, rowNode) => {
|
|
353
|
+
return this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, colId);
|
|
354
|
+
};
|
|
355
|
+
return Object.entries(aggregatedScalarFunctions).reduce((acc, [expressionName, customExpressionDefinition]) => {
|
|
356
|
+
const expression = {
|
|
357
|
+
handler: (args, context) => {
|
|
358
|
+
// There is built in support for column validation
|
|
359
|
+
// TODO: change to extractParameters
|
|
360
|
+
// { colArgs: { [colId]: value } }
|
|
361
|
+
const [aggColParam, ...restOfColParams] = (0, expressionFunctionUtils_1.extractColumnParameters)(expressionName, args);
|
|
362
|
+
const aggColumnId = aggColParam === null || aggColParam === void 0 ? void 0 : aggColParam.value;
|
|
363
|
+
const groupByParameter = (0, expressionFunctionUtils_1.extractParameter)(expressionName, 'operand', ['GROUP_BY'], args, {
|
|
364
|
+
isOptional: true,
|
|
365
|
+
});
|
|
366
|
+
const preparedArgs = args.filter((arg) => {
|
|
367
|
+
if (typeof arg === 'object' && arg.name === 'COL') {
|
|
368
|
+
// filter out only first col
|
|
369
|
+
return arg.value !== aggColumnId;
|
|
370
|
+
}
|
|
371
|
+
// filter out all other objects, e.g. GROUP_BY
|
|
372
|
+
return typeof arg !== 'object';
|
|
373
|
+
});
|
|
374
|
+
const aggregationExpressionEvaluation = {
|
|
375
|
+
aggregationParams: {
|
|
376
|
+
reducers: {
|
|
377
|
+
[expressionName]: {
|
|
378
|
+
name: expressionName,
|
|
379
|
+
field: aggColumnId,
|
|
380
|
+
initialValue: customExpressionDefinition.initialValue,
|
|
381
|
+
reducer: (acc, value, rowNode, dataIndex) => {
|
|
382
|
+
const context = Object.assign({ rowNode, args: preparedArgs.map((arg) => {
|
|
383
|
+
// if col, replace with value
|
|
384
|
+
if (typeof arg === 'object' && arg.name === 'COL') {
|
|
385
|
+
return getValueForColId(arg.value, rowNode);
|
|
386
|
+
}
|
|
387
|
+
return arg;
|
|
388
|
+
}), aggColumnId, getValueForColId: (colId) => getValueForColId(colId, rowNode) }, (0, ObjectFactory_1.createBaseContext)(this.adaptableApi));
|
|
389
|
+
return customExpressionDefinition.reducer(acc, value, dataIndex, context);
|
|
390
|
+
},
|
|
391
|
+
done: (accValue, dataArray) => {
|
|
392
|
+
if (customExpressionDefinition.processReducerValue) {
|
|
393
|
+
return customExpressionDefinition.processReducerValue(accValue, dataArray, Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.adaptableApi)), { args }));
|
|
394
|
+
}
|
|
395
|
+
return accValue;
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
rowValueGetter: (rowNode, aggregationValue) => {
|
|
401
|
+
if (customExpressionDefinition.prepareRowValue) {
|
|
402
|
+
return customExpressionDefinition.prepareRowValue(rowNode, aggregationValue, Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.adaptableApi)), { aggColumnId,
|
|
403
|
+
args, getValueForColId: (colId) => getValueForColId(colId, rowNode) }));
|
|
404
|
+
}
|
|
405
|
+
return aggregationValue;
|
|
406
|
+
},
|
|
407
|
+
rowFilterFn: (rowNode) => {
|
|
408
|
+
var _a, _b;
|
|
409
|
+
if (customExpressionDefinition.rowFilter) {
|
|
410
|
+
return customExpressionDefinition.rowFilter(rowNode, Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.adaptableApi)), { aggColumnId, getValueForColId: (colId) => getValueForColId(colId, rowNode) }));
|
|
411
|
+
}
|
|
412
|
+
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;
|
|
413
|
+
},
|
|
414
|
+
getRowNodes: context.getRowNodes,
|
|
415
|
+
};
|
|
416
|
+
(0, aggregatedScalarExpressionFunctions_1.addGroupByParams)(groupByParameter === null || groupByParameter === void 0 ? void 0 : groupByParameter.value, aggregationExpressionEvaluation);
|
|
417
|
+
const result = {
|
|
418
|
+
name: expressionName,
|
|
419
|
+
type: 'aggregationScalar',
|
|
420
|
+
value: aggregationExpressionEvaluation,
|
|
421
|
+
};
|
|
422
|
+
return result;
|
|
423
|
+
},
|
|
424
|
+
description: customExpressionDefinition.description,
|
|
425
|
+
signatures: customExpressionDefinition.signatures,
|
|
426
|
+
};
|
|
427
|
+
acc[expressionName] = expression;
|
|
428
|
+
return acc;
|
|
429
|
+
}, {});
|
|
430
|
+
}
|
|
332
431
|
extractMappedExpressionFunctions(availableExpressionFunctions, systemFunctions, customFunctions) {
|
|
333
432
|
const systemFunctionNames = typeof systemFunctions === 'function'
|
|
334
433
|
? systemFunctions({
|
|
@@ -327,16 +327,17 @@ class ReportService {
|
|
|
327
327
|
if (StringExtensions_1.default.IsNullOrEmpty(cellRawValue)) {
|
|
328
328
|
return cellRawValue;
|
|
329
329
|
}
|
|
330
|
-
const
|
|
330
|
+
const column = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
331
|
+
const columnDataType = column.dataType;
|
|
331
332
|
// if this is a date column and there is a custom export date format provided, that will take precedence
|
|
332
|
-
if (
|
|
333
|
+
if (columnDataType === 'Date' && !!this.getCustomExportDateFormat()) {
|
|
333
334
|
const exportDateFormat = this.getCustomExportDateFormat();
|
|
334
335
|
return FormatHelper_1.default.DateFormatter(cellRawValue, {
|
|
335
336
|
Pattern: exportDateFormat,
|
|
336
337
|
});
|
|
337
338
|
}
|
|
338
339
|
// otherwise check the general export format types
|
|
339
|
-
let cellExportFormat = this.adaptableApi.exportApi.internalApi.getCellExportFormatType(
|
|
340
|
+
let cellExportFormat = this.adaptableApi.exportApi.internalApi.getCellExportFormatType(column, columnDataType);
|
|
340
341
|
return this.getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId, cellExportFormat);
|
|
341
342
|
}
|
|
342
343
|
getReportFileName(reportName, destination) {
|
|
@@ -399,7 +400,6 @@ class ReportService {
|
|
|
399
400
|
formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
|
|
400
401
|
return formatColumns;
|
|
401
402
|
};
|
|
402
|
-
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue();
|
|
403
403
|
const displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
|
|
404
404
|
const colDefs = displayedColumns.map((column) => {
|
|
405
405
|
return column.getColDef();
|
|
@@ -423,6 +423,9 @@ class ReportService {
|
|
|
423
423
|
displayedColumns.forEach((column, columnIndex) => {
|
|
424
424
|
var _a, _b, _c;
|
|
425
425
|
const colDef = colDefs[columnIndex];
|
|
426
|
+
const columnId = column.getId();
|
|
427
|
+
const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
428
|
+
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue(adaptableColumn);
|
|
426
429
|
let cellClassParams;
|
|
427
430
|
const getLazyCellClassParams = () => {
|
|
428
431
|
if (!cellClassParams) {
|
|
@@ -431,7 +434,7 @@ class ReportService {
|
|
|
431
434
|
node,
|
|
432
435
|
column,
|
|
433
436
|
data: node.data,
|
|
434
|
-
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node,
|
|
437
|
+
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, columnId),
|
|
435
438
|
rowIndex,
|
|
436
439
|
api: agGridApi,
|
|
437
440
|
columnApi: null,
|
|
@@ -98,7 +98,9 @@ class RowSummaryService {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const rowSummaries = (_a = this.api.layoutApi.getCurrentLayout().RowSummaries) !== null && _a !== void 0 ? _a : [];
|
|
101
|
-
const rowSummariesResults = rowSummaries
|
|
101
|
+
const rowSummariesResults = rowSummaries
|
|
102
|
+
.filter((rowSummary) => !rowSummary.IsSuspended)
|
|
103
|
+
.map(({ ColumnsMap, Position }) => {
|
|
102
104
|
return {
|
|
103
105
|
Position,
|
|
104
106
|
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,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.divideBy100 = void 0;
|
|
4
|
+
function divideBy100(value) {
|
|
5
|
+
// the simple solution does not work
|
|
6
|
+
// return value / 100;
|
|
7
|
+
// needed because 4012.3456/100 = 40.123456000000004
|
|
8
|
+
// but we dont want that to happen
|
|
9
|
+
// this solution does not handle -0 correctly
|
|
10
|
+
// return parseFloat((value / 100).toFixed(12));
|
|
11
|
+
if (isNaN(value) || !value) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
const isNegative = value < 0;
|
|
15
|
+
if (isNegative) {
|
|
16
|
+
value = -value;
|
|
17
|
+
}
|
|
18
|
+
const valueAsStr = value.toPrecision();
|
|
19
|
+
const separator = Number(1.1).toLocaleString()[1];
|
|
20
|
+
let indexOfSeparator = valueAsStr.indexOf(separator);
|
|
21
|
+
if (indexOfSeparator === -1) {
|
|
22
|
+
indexOfSeparator = 0;
|
|
23
|
+
}
|
|
24
|
+
let [integer = '', decimal] = valueAsStr.split(separator);
|
|
25
|
+
decimal = decimal || '';
|
|
26
|
+
integer = integer.padStart(2, '0');
|
|
27
|
+
const integerArr = [...integer];
|
|
28
|
+
const num = integerArr.slice(0, integerArr.length - 2).join('') +
|
|
29
|
+
separator +
|
|
30
|
+
integerArr.slice(-2).join('') +
|
|
31
|
+
decimal;
|
|
32
|
+
return Number(num) * (isNegative ? -1 : 1);
|
|
33
|
+
}
|
|
34
|
+
exports.divideBy100 = divideBy100;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function times100(value: any): any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.times100 = void 0;
|
|
4
|
+
function times100(value) {
|
|
5
|
+
// the simple solution does not work
|
|
6
|
+
// return value * 100;
|
|
7
|
+
// needed because 0.12676 * 100 = 12.676000000000002
|
|
8
|
+
// but we dont want that to happen
|
|
9
|
+
// this solution does not handle -0 correctly
|
|
10
|
+
// also 1267.6 * 100 is 126759.99999999999
|
|
11
|
+
// which is not what we want
|
|
12
|
+
// return parseFloat((value * 100).toFixed(12));
|
|
13
|
+
if (isNaN(value) || !value) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
const valueAsStr = value.toPrecision();
|
|
17
|
+
const separator = Number(1.1).toLocaleString()[1];
|
|
18
|
+
const indexOfSeparator = valueAsStr.indexOf(separator);
|
|
19
|
+
if (indexOfSeparator === -1) {
|
|
20
|
+
return value * 100;
|
|
21
|
+
}
|
|
22
|
+
const [integer, decimal] = valueAsStr.split(separator);
|
|
23
|
+
const num = [...`${integer}${decimal !== null && decimal !== void 0 ? decimal : ''}00`];
|
|
24
|
+
num.splice(indexOfSeparator + 2, 0, separator);
|
|
25
|
+
return Number(num.join(''));
|
|
26
|
+
}
|
|
27
|
+
exports.times100 = times100;
|
|
@@ -20,7 +20,7 @@ exports.renderAlertMessageSummary = renderAlertMessageSummary;
|
|
|
20
20
|
const AlertMessageWizardSection = (props) => {
|
|
21
21
|
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
22
22
|
const messageType = data.MessageType;
|
|
23
|
-
const messageText = api.alertApi.internalApi.
|
|
23
|
+
const messageText = api.alertApi.internalApi.getAlertDescriptionForDataChange(data);
|
|
24
24
|
const messageHeader = data.MessageHeader;
|
|
25
25
|
const onMessageTextChange = (e) => {
|
|
26
26
|
const { value } = e.target;
|
|
@@ -35,8 +35,8 @@ const AlertPreview = (_a) => {
|
|
|
35
35
|
}
|
|
36
36
|
const result = {
|
|
37
37
|
alertType: 'generic',
|
|
38
|
-
header: api.alertApi.internalApi.
|
|
39
|
-
message: api.alertApi.internalApi.
|
|
38
|
+
header: api.alertApi.internalApi.getAlertMessageHeaderForDataChange(alertDefinition),
|
|
39
|
+
message: api.alertApi.internalApi.getAlertDescriptionForDataChange(alertDefinition),
|
|
40
40
|
alertDefinition: Object.assign(Object.assign({}, alertDefinition), { AlertForm: alertForm }),
|
|
41
41
|
};
|
|
42
42
|
return result;
|
|
@@ -28,7 +28,8 @@ const AlertScopeWizardSection = (props) => {
|
|
|
28
28
|
Predicates: [{ PredicateId: 'AnyChange' }],
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
if (newData.Rule.ObservableExpression !== undefined &&
|
|
31
|
+
if (newData.Rule.ObservableExpression !== undefined &&
|
|
32
|
+
!api.columnScopeApi.scopeIsAll(Scope)) {
|
|
32
33
|
// if it had observable expression and the scope is changed to partial
|
|
33
34
|
// we need to reset to not be an observable expression, as observable is not supported
|
|
34
35
|
// for partial scope
|
|
@@ -55,7 +55,7 @@ const CalculatedColumnExpressionWizardSection = (props) => {
|
|
|
55
55
|
React.createElement(Tabs_1.Tabs.Content, null, (() => {
|
|
56
56
|
switch (props.expressionType) {
|
|
57
57
|
case 'ScalarExpression':
|
|
58
|
-
return (React.createElement(ExpressionEditor_1.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 }));
|
|
58
|
+
return (React.createElement(ExpressionEditor_1.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 }));
|
|
59
59
|
case 'AggregatedScalarExpression':
|
|
60
60
|
case 'CumulativeAggregatedExpression':
|
|
61
61
|
case 'QuantileAggregatedExpression':
|
|
@@ -10,6 +10,7 @@ const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
|
|
|
10
10
|
const ExpressionEditor_1 = require("../../../components/ExpressionEditor");
|
|
11
11
|
const AdaptableContext_1 = require("../../AdaptableContext");
|
|
12
12
|
const EntityRulePredicatesEditor_1 = require("./EntityRulePredicatesEditor");
|
|
13
|
+
const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
|
|
13
14
|
const QueryTab = (props) => {
|
|
14
15
|
const { type, label, disabled = false } = props, tabProps = tslib_1.__rest(props, ["type", "label", "disabled"]);
|
|
15
16
|
const text = (React.createElement(rebass_1.Flex, { flexDirection: "column" },
|
|
@@ -47,7 +48,7 @@ const RuleTabTitle = (props) => {
|
|
|
47
48
|
return props.showRadio ? (React.createElement(Radio_1.default, { tabIndex: -1, margin: 0, checked: props.checked }, props.children)) : (React.createElement(React.Fragment, null, "props.children"));
|
|
48
49
|
};
|
|
49
50
|
const EntityRulesEditor = (props) => {
|
|
50
|
-
var _a, _b
|
|
51
|
+
var _a, _b;
|
|
51
52
|
const { data, children, descriptions, predicateDefs, showNoRule = false, showPredicate = true, showObservable = true, showBoolean = true, showAggregation = true, flexProps, module, } = props;
|
|
52
53
|
const { api } = (0, AdaptableContext_1.useAdaptable)();
|
|
53
54
|
const numberOfTabs = [
|
|
@@ -129,13 +130,16 @@ const EntityRulesEditor = (props) => {
|
|
|
129
130
|
showPredicate ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "Predicate", value: "Predicate" },
|
|
130
131
|
React.createElement(EntityRulePredicatesEditor_1.EntityRulePredicatesEditor, { enablePredicateColumnId: props.enablePredicateColumnId, data: data, descriptions: descriptions, predicateDefs: filteredPredicateDefs, getPredicateDefsForColId: props.getPredicateDefsForColId, onChange: props.onChange }))) : null,
|
|
131
132
|
showBoolean ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "BooleanExpression", type: type, label: "Boolean" })) : null,
|
|
132
|
-
showBoolean ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "BooleanExpression", value: 'BooleanExpression',
|
|
133
|
-
|
|
133
|
+
showBoolean ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "BooleanExpression", value: 'BooleanExpression' }, (() => {
|
|
134
|
+
var _a;
|
|
135
|
+
const editor = (React.createElement(ExpressionEditor_1.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 }));
|
|
136
|
+
return props.showQueryBuilder ? React.createElement(Panel_1.default, null, editor) : editor;
|
|
137
|
+
})())) : null,
|
|
134
138
|
showObservable ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "ObservableExpression", type: type, label: "Observable" })) : null,
|
|
135
|
-
showObservable ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "ObservableExpression", value: 'ObservableExpression'
|
|
136
|
-
React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'observable', module: module, value: (
|
|
139
|
+
showObservable ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "ObservableExpression", value: 'ObservableExpression' },
|
|
140
|
+
React.createElement(ExpressionEditor_1.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,
|
|
137
141
|
showAggregation ? (React.createElement(QueryTab, { showRadio: showRadioButtons, value: "AggregatedBooleanExpression", type: type, label: "Aggregated Boolean" })) : null,
|
|
138
|
-
showAggregation ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "AggregatedBooleanExpression", value: 'AggregatedBooleanExpression'
|
|
139
|
-
React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'aggregatedBoolean', module: module, value: (
|
|
142
|
+
showAggregation ? (React.createElement(Tabs_1.Tabs.Content, { "data-name": "AggregatedBooleanExpression", value: 'AggregatedBooleanExpression' },
|
|
143
|
+
React.createElement(ExpressionEditor_1.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)));
|
|
140
144
|
};
|
|
141
145
|
exports.EntityRulesEditor = EntityRulesEditor;
|
|
@@ -32,7 +32,7 @@ class ExpressionWizard extends React.Component {
|
|
|
32
32
|
render() {
|
|
33
33
|
const initialData = (0, react_1.useMemo)(() => this.props.api.internalApi.getQueryPreviewData(), []);
|
|
34
34
|
return (React.createElement(React.Fragment, null,
|
|
35
|
-
React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'boolean', module: ModuleConstants_1.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 }),
|
|
35
|
+
React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'boolean', module: ModuleConstants_1.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 }),
|
|
36
36
|
' ',
|
|
37
37
|
React.createElement(rebass_1.Flex, { flexDirection: "row", padding: 1, marginBottom: 2, marginLeft: 1, alignItems: "center", "data-name": "expression-wizard-save-option" },
|
|
38
38
|
React.createElement(CheckBox_1.CheckBox, { marginLeft: 2, disabled: !this.isValidExpression(), marginBottom: 2, checked: this.state.saveToNamedQueries, onChange: (checked) => this.setState({
|
|
@@ -16,6 +16,30 @@ const QuickFilterValues = (props) => {
|
|
|
16
16
|
const currentOverlayVisible = (0, react_1.useRef)(false);
|
|
17
17
|
const valuesDropdownRef = React.useRef(null);
|
|
18
18
|
const [quickFilterValues, setQuickFilterValues] = React.useState({ values: [], suppressClientSideFilter: false, dataLoadIsComplete: false });
|
|
19
|
+
const quickFilterValuesWithPredicates = React.useMemo(() => {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
let values = quickFilterValues.values;
|
|
22
|
+
const predicateIds = api.columnFilterApi.internalApi.getValuesFitlerPredicateIds(props.currentColumn);
|
|
23
|
+
if (ArrayExtensions_1.default.IsNullOrEmpty(predicateIds)) {
|
|
24
|
+
return values;
|
|
25
|
+
}
|
|
26
|
+
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';
|
|
27
|
+
const predicateValues = predicateIds.map(predicateId => {
|
|
28
|
+
var _a;
|
|
29
|
+
const predicateDef = api.predicateApi.getPredicateDefById(predicateId);
|
|
30
|
+
return {
|
|
31
|
+
value: predicateId,
|
|
32
|
+
label: ((_a = predicateDef.label) !== null && _a !== void 0 ? _a : predicateId),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
if (predicatesPosition === 'End') {
|
|
36
|
+
values = [...values, ...predicateValues];
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
values = [...predicateValues, ...values];
|
|
40
|
+
}
|
|
41
|
+
return values;
|
|
42
|
+
}, [quickFilterValues.values]);
|
|
19
43
|
const [isDistinctColumnValuesLoading, setIsDistinctColumnValuesLoading] = React.useState(false);
|
|
20
44
|
const [textFilterValue, setTextFilterValue] = React.useState('');
|
|
21
45
|
const [valuesLoadTrigger, setValuesLoadTrigger] = React.useState({
|
|
@@ -106,13 +130,13 @@ const QuickFilterValues = (props) => {
|
|
|
106
130
|
let selectedValues = props.columnFilter.Predicate.PredicateId === 'Values' ? 'Select Values' : 'Exclude Values';
|
|
107
131
|
if (props.columnFilter.Predicate.Inputs.length) {
|
|
108
132
|
selectedValues = props.columnFilter.Predicate.Inputs.map((input) => {
|
|
109
|
-
var _a
|
|
110
|
-
const label = (
|
|
133
|
+
var _a;
|
|
134
|
+
const label = (_a = quickFilterValuesWithPredicates === null || quickFilterValuesWithPredicates === void 0 ? void 0 : quickFilterValuesWithPredicates.find((distinctValue) => {
|
|
111
135
|
if (input instanceof Date) {
|
|
112
136
|
return (0, date_fns_1.isSameDay)(input, distinctValue.value);
|
|
113
137
|
}
|
|
114
138
|
return distinctValue.value === input;
|
|
115
|
-
})) === null ||
|
|
139
|
+
})) === null || _a === void 0 ? void 0 : _a.label;
|
|
116
140
|
return label !== null && label !== void 0 ? label : input;
|
|
117
141
|
}).join(', ');
|
|
118
142
|
}
|
|
@@ -181,7 +205,7 @@ const QuickFilterValues = (props) => {
|
|
|
181
205
|
props.updateColumnFilter(transientColumnFilter);
|
|
182
206
|
}
|
|
183
207
|
} }, "Apply Filter"))),
|
|
184
|
-
React.createElement(ListBoxFilterForm_1.ListBoxFilterForm, { disabled: props.isFilterDisabled, suppressClientSideFilter: quickFilterValues.suppressClientSideFilter, isLoading: isDistinctColumnValuesLoading, onFilterChange: handleFilterChange, currentColumn: props.currentColumn, columns: [], columnDistinctValues:
|
|
208
|
+
React.createElement(ListBoxFilterForm_1.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) }))));
|
|
185
209
|
} },
|
|
186
210
|
React.createElement(SimpleButton_1.default, { "data-name": 'Select Values', style: {
|
|
187
211
|
flex: 1,
|
|
@@ -83,10 +83,14 @@ const AdaptablePopupModuleView = (props) => {
|
|
|
83
83
|
newButton = (React.createElement(ButtonNew_1.ButtonNew, { onClick: () => handleOpenEditPopup(), tooltip: toolTipText, accessLevel: props.accessLevel }));
|
|
84
84
|
}
|
|
85
85
|
let suspendButton = null;
|
|
86
|
-
|
|
86
|
+
const editableObjects = (items).filter(item => !item.abObject.IsReadOnly);
|
|
87
|
+
if (editableObjects.length &&
|
|
87
88
|
(moduleViewProperties === null || moduleViewProperties === void 0 ? void 0 : moduleViewProperties.getSuspendAllAction) &&
|
|
88
89
|
(moduleViewProperties === null || moduleViewProperties === void 0 ? void 0 : moduleViewProperties.getUnSuspendAllAction)) {
|
|
89
|
-
const isAtLeastOneAbObjectActive =
|
|
90
|
+
const isAtLeastOneAbObjectActive = editableObjects.some((item) => {
|
|
91
|
+
var _a;
|
|
92
|
+
return !((_a = item.abObject) === null || _a === void 0 ? void 0 : _a.IsSuspended);
|
|
93
|
+
});
|
|
90
94
|
const handleSuspendUnsuspendAll = () => {
|
|
91
95
|
if (isAtLeastOneAbObjectActive) {
|
|
92
96
|
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,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldSelector = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const Select_1 = require("../../../components/Select");
|
|
7
|
+
const AdaptableContext_1 = require("../../AdaptableContext");
|
|
8
|
+
const FieldSelector = (props) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const { api } = (0, AdaptableContext_1.useAdaptable)();
|
|
11
|
+
const fields = React.useMemo(() => {
|
|
12
|
+
return api.expressionApi.internalApi.getFieldsOfType(props.type);
|
|
13
|
+
}, []);
|
|
14
|
+
const options = fields.map((field) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return ({
|
|
17
|
+
label: (_a = field.label) !== null && _a !== void 0 ? _a : field.name,
|
|
18
|
+
value: field.name,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return (React.createElement(React.Fragment, null,
|
|
22
|
+
React.createElement(Select_1.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) => {
|
|
23
|
+
props.onChange(fieldValue);
|
|
24
|
+
}, options: options })));
|
|
25
|
+
};
|
|
26
|
+
exports.FieldSelector = FieldSelector;
|
|
@@ -11,7 +11,7 @@ const PermittedValuesSelector = function (props) {
|
|
|
11
11
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
12
12
|
const [options, setOptions] = React.useState([]);
|
|
13
13
|
const [filter, setFilter] = React.useState('');
|
|
14
|
-
const
|
|
14
|
+
const dataType = React.useMemo(() => {
|
|
15
15
|
return adaptable.api.columnApi.getColumnDataTypeForColumnId(props.columnId);
|
|
16
16
|
}, [props.columnId]);
|
|
17
17
|
React.useEffect(() => {
|
|
@@ -29,10 +29,14 @@ const PermittedValuesSelector = function (props) {
|
|
|
29
29
|
setOptions(distinctColumnValues);
|
|
30
30
|
})();
|
|
31
31
|
}, [props.columnId, filter]);
|
|
32
|
-
const isCreatable = props.allowNewValues && ['String', 'Number'].includes(
|
|
32
|
+
const isCreatable = (props.allowNewValues && !dataType) || ['String', 'Number'].includes(dataType);
|
|
33
33
|
const handleSingleValueChange = (value) => {
|
|
34
34
|
if (isCreatable) {
|
|
35
|
-
|
|
35
|
+
// try to convert to correct type, when there is not type, e.g. field
|
|
36
|
+
if (!dataType && typeof value === 'string' && !isNaN(parseFloat(value))) {
|
|
37
|
+
props.onChange(parseFloat(value));
|
|
38
|
+
}
|
|
39
|
+
else if (dataType === 'Number') {
|
|
36
40
|
let num = parseFloat(value);
|
|
37
41
|
num = isNaN(num) ? null : num;
|
|
38
42
|
props.onChange(num);
|
|
@@ -47,7 +51,7 @@ const PermittedValuesSelector = function (props) {
|
|
|
47
51
|
};
|
|
48
52
|
const handleMultiValueChange = (values) => {
|
|
49
53
|
if (isCreatable) {
|
|
50
|
-
if (
|
|
54
|
+
if (dataType === 'Number') {
|
|
51
55
|
const nums = values.map((v) => parseFloat(v)).filter((v) => !isNaN(v));
|
|
52
56
|
props.onChange(nums);
|
|
53
57
|
}
|
|
@@ -72,6 +72,6 @@ const ReportRowsWizardSection = (props) => {
|
|
|
72
72
|
props.onChange(Object.assign(Object.assign({}, data), { Query: {
|
|
73
73
|
BooleanExpression,
|
|
74
74
|
} }));
|
|
75
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })))));
|
|
75
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })))));
|
|
76
76
|
};
|
|
77
77
|
exports.ReportRowsWizardSection = ReportRowsWizardSection;
|
|
@@ -9,7 +9,7 @@ function FormatColumnRuleWizardSection(props) {
|
|
|
9
9
|
const { data, api, moduleInfo } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
10
10
|
return (React.createElement(EntityRulesEditor_1.EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: props.defaultPredicateId,
|
|
11
11
|
// TODO see what is this
|
|
12
|
-
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: {
|
|
12
|
+
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: {
|
|
13
13
|
selectPredicate: 'Create a Format Column Rule - to be applied when data changes',
|
|
14
14
|
useBooleanQuery: (React.createElement(React.Fragment, null,
|
|
15
15
|
"Use an BooleanQuery if ",
|
|
@@ -92,7 +92,7 @@ const GridFilterExpressionEditor = (props) => {
|
|
|
92
92
|
},
|
|
93
93
|
} },
|
|
94
94
|
React.createElement(rebass_1.Flex, { height: "100%", flexDirection: "column" },
|
|
95
|
-
React.createElement(ExpressionEditor_1.ExpressionEditor, Object.assign({}, expressionEditorProps, { type: 'boolean', module: ModuleConstants_1.GridFilterModuleId, value: expression, onChange: (expression) => setExpression(expression), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })),
|
|
95
|
+
React.createElement(ExpressionEditor_1.ExpressionEditor, Object.assign({}, expressionEditorProps, { type: 'boolean', module: ModuleConstants_1.GridFilterModuleId, value: expression, onChange: (expression) => setExpression(expression), initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })),
|
|
96
96
|
React.createElement(rebass_1.Flex, { flexDirection: "row", padding: 1, alignItems: "center" },
|
|
97
97
|
props.onDismiss && (React.createElement(SimpleButton_1.default, { margin: 1, variant: "text", "data-name": "action-close", onClick: () => {
|
|
98
98
|
props.onDismiss();
|
|
@@ -12,6 +12,7 @@ const ExpressionEditor_1 = require("../../../../components/ExpressionEditor");
|
|
|
12
12
|
const ModuleConstants_1 = require("../../../../Utilities/Constants/ModuleConstants");
|
|
13
13
|
const StringExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/StringExtensions"));
|
|
14
14
|
const useGridFilterOptionsForExpressionEditor_1 = require("../../../GridFilter/useGridFilterOptionsForExpressionEditor");
|
|
15
|
+
const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
|
|
15
16
|
const isGridFiltersValid = (layout, api) => {
|
|
16
17
|
var _a;
|
|
17
18
|
const expression = (_a = layout === null || layout === void 0 ? void 0 : layout.GridFilter) === null || _a === void 0 ? void 0 : _a.Expression;
|
|
@@ -36,9 +37,10 @@ const GridFilterSection = (props) => {
|
|
|
36
37
|
const expressionEditorProps = (0, useGridFilterOptionsForExpressionEditor_1.useGridFilterOptionsForExpressionEditorProps)();
|
|
37
38
|
const expressionEditorContent = (React.createElement(ExpressionEditor_1.ExpressionEditor, Object.assign({}, expressionEditorProps, { allowSaveNamedQuery: false, type: 'boolean', module: ModuleConstants_1.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) => {
|
|
38
39
|
props.onChange(Object.assign(Object.assign({}, layout), { GridFilter: Object.assign(Object.assign({}, layout.GridFilter), { Expression: expression }) }));
|
|
39
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })));
|
|
40
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })));
|
|
40
41
|
return (React.createElement(Tabs_1.Tabs, { style: { height: '100%' } },
|
|
41
42
|
React.createElement(Tabs_1.Tabs.Tab, null, "Grid Filters"),
|
|
42
|
-
React.createElement(Tabs_1.Tabs.Content, null,
|
|
43
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
44
|
+
React.createElement(Panel_1.default, null, expressionEditorContent))));
|
|
43
45
|
};
|
|
44
46
|
exports.GridFilterSection = GridFilterSection;
|
|
@@ -18,6 +18,7 @@ const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
|
18
18
|
const ValueSelector_1 = require("../../../Components/ValueSelector");
|
|
19
19
|
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
20
20
|
const Utilities_1 = require("./Utilities");
|
|
21
|
+
const SuspendToggleButton_1 = require("../../../Components/Buttons/SuspendToggleButton");
|
|
21
22
|
const areSummaryRowsValid = (layout) => {
|
|
22
23
|
var _a;
|
|
23
24
|
if (!layout.RowSummaries)
|
|
@@ -37,7 +38,6 @@ const areSummaryRowsValid = (layout) => {
|
|
|
37
38
|
exports.areSummaryRowsValid = areSummaryRowsValid;
|
|
38
39
|
const getAvailableExpressionsForColumnType = (columnType, availableScalarExpressions) => {
|
|
39
40
|
const inputType = (0, adaptableQlUtils_1.mapColumnDataTypeToExpressionFunctionType)(columnType);
|
|
40
|
-
// Object.entries(availableScalarExpressions ?? {})
|
|
41
41
|
return RowSummary_1.summarySupportedExpressions
|
|
42
42
|
.filter((expression) => availableScalarExpressions[expression])
|
|
43
43
|
.map((expression) => {
|
|
@@ -86,6 +86,12 @@ const RowSummaryEditor = ({ rowSummary, onChange, availableScalarExpressions, on
|
|
|
86
86
|
}, [rowSummary.ColumnsMap]);
|
|
87
87
|
return (React.createElement(Panel_1.default, { header: React.createElement(rebass_1.Flex, { style: { width: '100%' } },
|
|
88
88
|
React.createElement(rebass_1.Flex, { flex: 1, alignItems: "center" }, "Row Summary"),
|
|
89
|
+
React.createElement(rebass_1.Box, { mr: 2 },
|
|
90
|
+
React.createElement(SuspendToggleButton_1.SuspendToggleButton, { onSuspend: () => {
|
|
91
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: true }));
|
|
92
|
+
}, onUnSuspend: () => {
|
|
93
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: false }));
|
|
94
|
+
}, suspendableObject: rowSummary })),
|
|
89
95
|
React.createElement(SimpleButton_1.default, { icon: "delete", onClick: () => {
|
|
90
96
|
onDelete();
|
|
91
97
|
} })), p: 2 },
|