@adaptabletools/adaptable 11.2.3 → 11.3.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/bundle.cjs.js +106 -106
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -0
- package/src/AdaptableOptions/AdaptableOptions.d.ts +7 -0
- package/src/AdaptableOptions/EditOptions.d.ts +92 -4
- package/src/AdaptableOptions/FinancePluginOptions.d.ts +33 -3
- package/src/AdaptableOptions/FormatColumnOptions.d.ts +10 -0
- package/src/AdaptableOptions/{SmartEdit.js → FormatColumnOptions.js} +0 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -3
- package/src/Api/ColumnApi.d.ts +4 -1
- package/src/Api/EventApi.d.ts +4 -1
- package/src/Api/Events/RowFormSubmitted.d.ts +19 -0
- package/src/Api/Events/RowFormSubmitted.js +2 -0
- package/src/Api/FinanceApi.d.ts +3 -2
- package/src/Api/FormatColumnApi.d.ts +28 -1
- package/src/Api/GridApi.d.ts +14 -0
- package/src/Api/Implementation/ColumnApiImpl.js +4 -1
- package/src/Api/Implementation/FilterApiImpl.js +2 -7
- package/src/Api/Implementation/FormatColumnApiImpl.d.ts +6 -0
- package/src/Api/Implementation/FormatColumnApiImpl.js +34 -0
- package/src/Api/Implementation/GridApiImpl.d.ts +3 -0
- package/src/Api/Implementation/GridApiImpl.js +40 -0
- package/src/Api/Implementation/InternalApiImpl.d.ts +4 -0
- package/src/Api/Implementation/InternalApiImpl.js +37 -7
- package/src/Api/Implementation/SmartEditApiImpl.d.ts +2 -1
- package/src/Api/Implementation/SmartEditApiImpl.js +3 -0
- package/src/Api/Implementation/UserInterfaceApiImpl.js +3 -21
- package/src/Api/InternalApi.d.ts +4 -1
- package/src/Api/SmartEditApi.d.ts +6 -1
- package/src/PredefinedConfig/CalculatedColumnState.d.ts +5 -0
- package/src/PredefinedConfig/Common/AdaptableForm.d.ts +3 -2
- package/src/PredefinedConfig/Common/AdaptableFormat.d.ts +6 -3
- package/src/PredefinedConfig/Common/AdaptableObject.d.ts +2 -11
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +17 -1
- package/src/PredefinedConfig/Common/BaseContext.d.ts +1 -1
- package/src/PredefinedConfig/Common/FDC3Context.d.ts +5 -1
- package/src/PredefinedConfig/SystemState.d.ts +1 -2
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +1 -1
- package/src/Strategy/DashboardModule.js +3 -0
- package/src/Strategy/FormatColumnModule.js +1 -1
- package/src/Strategy/LayoutModule.js +4 -4
- package/src/Strategy/SmartEditModule.d.ts +1 -1
- package/src/Strategy/SmartEditModule.js +5 -6
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +9 -0
- package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +2 -4
- package/src/Utilities/Helpers/AdaptableHelper.js +1 -0
- package/src/Utilities/Services/Interface/IRowEditService.d.ts +8 -0
- package/src/Utilities/Services/Interface/IRowEditService.js +2 -0
- package/src/Utilities/Services/RowEditService.d.ts +25 -0
- package/src/Utilities/Services/RowEditService.js +165 -0
- package/src/View/AdaptableView.js +8 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -2
- package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +1 -1
- package/src/View/Components/FilterForm/FilterForm.d.ts +4 -1
- package/src/View/Components/FilterForm/ListBoxFilterForm.d.ts +4 -1
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +7 -7
- package/src/View/Components/FilterForm/QuickFilterForm.js +15 -2
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +2 -0
- package/src/View/Components/Popups/AdaptableToaster.js +1 -0
- package/src/View/Components/Popups/FormPopups/FormPopups.js +2 -2
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +3 -2
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +51 -22
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +1 -1
- package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +1 -1
- package/src/View/SmartEdit/SmartEditPopup.d.ts +1 -1
- package/src/View/SmartEdit/SmartEditPopup.js +1 -2
- package/src/View/SmartEdit/SmartEditViewPanel.d.ts +1 -1
- package/src/View/SmartEdit/SmartEditViewPanel.js +1 -2
- package/src/agGrid/ActionColumnRenderer.d.ts +6 -1
- package/src/agGrid/ActionColumnRenderer.js +6 -4
- package/src/agGrid/Adaptable.d.ts +3 -0
- package/src/agGrid/Adaptable.js +142 -39
- package/src/agGrid/rowEditIcons.d.ts +4 -0
- package/src/agGrid/rowEditIcons.js +9 -0
- package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +6 -16
- package/src/components/Datepicker/index.js +19 -18
- package/src/components/WindowModal/WindowModal.d.ts +2 -0
- package/src/components/WindowModal/WindowModal.js +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +89 -2
- package/src/metamodel/adaptable.metamodel.js +208 -11
- package/src/types.d.ts +6 -5
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/AdaptableOptions/SmartEdit.d.ts +0 -34
- package/src/View/Components/Forms/AdaptableForm.d.ts +0 -6
- package/src/View/Components/Forms/AdaptableForm.js +0 -21
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RowEditService = void 0;
|
|
4
|
+
class RowEditService {
|
|
5
|
+
constructor(adaptableApi) {
|
|
6
|
+
this.adaptableApi = adaptableApi;
|
|
7
|
+
this.adaptableInstance = this.adaptableApi.internalApi.getAdaptableInstance();
|
|
8
|
+
this.rowEditFormOptions =
|
|
9
|
+
this.adaptableApi.internalApi.getAdaptableInstance().adaptableOptions.editOptions.rowFormOptions;
|
|
10
|
+
}
|
|
11
|
+
buildRowEditForm(rowNode) {
|
|
12
|
+
return this.buildRowForm('rowEdited', rowNode);
|
|
13
|
+
}
|
|
14
|
+
buildRowCreateForm(clonedRowNode) {
|
|
15
|
+
return this.buildRowForm('rowCreated', clonedRowNode);
|
|
16
|
+
}
|
|
17
|
+
buildRowForm(type, rowNode) {
|
|
18
|
+
const formFields = this.buildRowFormFields(type, rowNode);
|
|
19
|
+
const formButtons = this.buildRowFormButtons(type, rowNode);
|
|
20
|
+
const formTitle = this.getFormTitle(type, rowNode);
|
|
21
|
+
const formDescription = this.getFormDescription(type, rowNode);
|
|
22
|
+
const rowForm = {
|
|
23
|
+
title: formTitle,
|
|
24
|
+
description: formDescription,
|
|
25
|
+
fields: formFields,
|
|
26
|
+
buttons: formButtons,
|
|
27
|
+
};
|
|
28
|
+
return rowForm;
|
|
29
|
+
}
|
|
30
|
+
getFormTitle(type, rowNode) {
|
|
31
|
+
if (this.rowEditFormOptions.formTitle == undefined) {
|
|
32
|
+
return type === 'rowCreated' ? 'Create New Row' : 'Edit Row';
|
|
33
|
+
}
|
|
34
|
+
return typeof this.rowEditFormOptions.formTitle === 'function'
|
|
35
|
+
? this.rowEditFormOptions.formTitle(this.buildFormParamContext(type, rowNode))
|
|
36
|
+
: this.rowEditFormOptions.formTitle;
|
|
37
|
+
}
|
|
38
|
+
getFormDescription(type, rowNode) {
|
|
39
|
+
return typeof this.rowEditFormOptions.formDescription === 'function'
|
|
40
|
+
? this.rowEditFormOptions.formDescription(this.buildFormParamContext(type, rowNode))
|
|
41
|
+
: this.rowEditFormOptions.formDescription;
|
|
42
|
+
}
|
|
43
|
+
buildFormParamContext(type, rowNode) {
|
|
44
|
+
return {
|
|
45
|
+
rowNode,
|
|
46
|
+
adaptableApi: this.adaptableApi,
|
|
47
|
+
type: type,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
buildRowFormFields(type, rowNode) {
|
|
51
|
+
const relevantColumns = this.adaptableApi.columnApi.getColumns().filter((column) => {
|
|
52
|
+
// if there is NO rowNode, do NOT display the non-editable fields as they will be empty
|
|
53
|
+
return !!rowNode || this.isColumnEditable(column, rowNode);
|
|
54
|
+
});
|
|
55
|
+
return relevantColumns.map((column) => this.buildFormField(type, column, rowNode));
|
|
56
|
+
}
|
|
57
|
+
buildRowFormButtons(type, rowNode) {
|
|
58
|
+
// 1. check if there are custom user provided buttons
|
|
59
|
+
if (Array.isArray(this.rowEditFormOptions.formButtons)) {
|
|
60
|
+
return this.rowEditFormOptions.formButtons;
|
|
61
|
+
}
|
|
62
|
+
// 2. else return the standard ones
|
|
63
|
+
const cancelButton = {
|
|
64
|
+
label: 'Cancel',
|
|
65
|
+
buttonStyle: {
|
|
66
|
+
variant: 'raised',
|
|
67
|
+
tone: 'neutral',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const saveButton = {
|
|
71
|
+
label: 'Save',
|
|
72
|
+
buttonStyle: {
|
|
73
|
+
variant: 'raised',
|
|
74
|
+
tone: 'success',
|
|
75
|
+
},
|
|
76
|
+
onClick: (button, context) => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
const eventInfo = type === 'rowCreated'
|
|
79
|
+
? {
|
|
80
|
+
type: 'rowCreated',
|
|
81
|
+
formData: context.formData,
|
|
82
|
+
adaptableApi: context.adaptableApi,
|
|
83
|
+
clonedRowNode: rowNode,
|
|
84
|
+
}
|
|
85
|
+
: {
|
|
86
|
+
type: 'rowEdited',
|
|
87
|
+
formData: context.formData,
|
|
88
|
+
rowNode: rowNode,
|
|
89
|
+
adaptableApi: context.adaptableApi,
|
|
90
|
+
};
|
|
91
|
+
this.adaptableApi.eventApi.emit('RowFormSubmitted', eventInfo);
|
|
92
|
+
(_b = (_a = this.adaptableInstance.adaptableOptions.editOptions.rowFormOptions).onFormSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, eventInfo);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
return [cancelButton, saveButton];
|
|
96
|
+
}
|
|
97
|
+
isColumnEditable(column, rowNode) {
|
|
98
|
+
return rowNode
|
|
99
|
+
? this.adaptableInstance.isCellEditable(rowNode, this.adaptableInstance.getAgGridColumnForColumnId(column.columnId))
|
|
100
|
+
: !column.readOnly;
|
|
101
|
+
}
|
|
102
|
+
buildFormField(type, column, rowNode) {
|
|
103
|
+
const isColumnEditable = this.isColumnEditable(column, rowNode);
|
|
104
|
+
const fieldValueOptions = this.getFieldValueOptions(column, rowNode);
|
|
105
|
+
const fieldType = isColumnEditable
|
|
106
|
+
? !!(fieldValueOptions === null || fieldValueOptions === void 0 ? void 0 : fieldValueOptions.length)
|
|
107
|
+
? 'select'
|
|
108
|
+
: this.getFieldTypeFromColumnType(column)
|
|
109
|
+
: 'textOutput';
|
|
110
|
+
const defaultValue = rowNode
|
|
111
|
+
? isColumnEditable
|
|
112
|
+
? this.adaptableInstance.getRawValueFromRowNode(rowNode, column.columnId)
|
|
113
|
+
: this.adaptableInstance.getDisplayValueFromRowNode(rowNode, column.columnId)
|
|
114
|
+
: null;
|
|
115
|
+
return {
|
|
116
|
+
label: this.getFormFieldLabel(type, column, rowNode),
|
|
117
|
+
name: column.columnId,
|
|
118
|
+
defaultValue,
|
|
119
|
+
fieldType,
|
|
120
|
+
options: fieldValueOptions,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
getFormFieldLabel(type, column, rowNode) {
|
|
124
|
+
const customFieldLabel = typeof this.rowEditFormOptions.formFieldLabel === 'function'
|
|
125
|
+
? this.rowEditFormOptions.formFieldLabel(this.buildFormFieldLabelContext(type, column, rowNode))
|
|
126
|
+
: undefined;
|
|
127
|
+
return customFieldLabel !== null && customFieldLabel !== void 0 ? customFieldLabel : column.friendlyName;
|
|
128
|
+
}
|
|
129
|
+
buildFormFieldLabelContext(type, column, rowNode) {
|
|
130
|
+
return {
|
|
131
|
+
rowNode,
|
|
132
|
+
column,
|
|
133
|
+
adaptableApi: this.adaptableApi,
|
|
134
|
+
type: type,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
getFieldTypeFromColumnType(column) {
|
|
138
|
+
switch (column.dataType) {
|
|
139
|
+
case 'Boolean':
|
|
140
|
+
return 'checkbox';
|
|
141
|
+
case 'Date':
|
|
142
|
+
return 'date';
|
|
143
|
+
case 'Number':
|
|
144
|
+
return 'number';
|
|
145
|
+
default:
|
|
146
|
+
// everything else is a plain text input
|
|
147
|
+
return 'text';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
getFieldValueOptions(column, rowNode) {
|
|
151
|
+
const editLookUpItem = this.adaptableApi.userInterfaceApi.getEditLookUpItemForColumn(column);
|
|
152
|
+
if (!editLookUpItem) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const gridCell = rowNode
|
|
156
|
+
? this.adaptableInstance.getGridCellFromRowNode(rowNode, column.columnId)
|
|
157
|
+
: undefined;
|
|
158
|
+
const editLookUpValues = this.adaptableApi.internalApi.getEditLookUpValuesForColumn(editLookUpItem, column, gridCell);
|
|
159
|
+
return editLookUpValues === null || editLookUpValues === void 0 ? void 0 : editLookUpValues.map((value) => ({
|
|
160
|
+
value,
|
|
161
|
+
label: value,
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.RowEditService = RowEditService;
|
|
@@ -20,14 +20,20 @@ class AdaptableView extends React.Component {
|
|
|
20
20
|
render() {
|
|
21
21
|
var _a, _b, _c, _d;
|
|
22
22
|
const watermark = (_d = (_c = (_b = (_a = this.props.AdaptableApi) === null || _a === void 0 ? void 0 : _a.internalApi) === null || _b === void 0 ? void 0 : _b.getSystemState()) === null || _c === void 0 ? void 0 : _c.License) === null || _d === void 0 ? void 0 : _d.watermark;
|
|
23
|
+
const adaptableOptions = this.props.AdaptableApi.internalApi.getAdaptableOptions();
|
|
23
24
|
return (React.createElement("div", null,
|
|
24
25
|
this.props.AdaptableApi.internalApi.getModuleService().isModuleAvailable('Dashboard') && (React.createElement(Dashboard_1.Dashboard, { api: this.props.AdaptableApi })),
|
|
25
26
|
React.createElement(AdaptableLoadingScreen_1.AdaptableLoadingScreen, { onClose: this.props.onCloseLoadingPopup, showLoadingScreen: this.props.PopupState.LoadingPopup.ShowLoadingPopup }),
|
|
26
27
|
this.props.PopupState.PromptPopup.ShowPromptPopup && (React.createElement(AdaptablePopupPrompt_1.AdaptablePopupPrompt, { message: this.props.PopupState.PromptPopup.Message, header: this.props.PopupState.PromptPopup.Header, onClose: this.props.onClosePromptPopup, onConfirm: this.props.onConfirmPromptPopup, onConfirmActionCreator: this.props.PopupState.PromptPopup.ConfirmActionCreator, defaultValue: this.props.PopupState.PromptPopup.DefaultValue })),
|
|
27
28
|
React.createElement(AdaptablePopupConfirmation_1.AdaptablePopupConfirmation, { header: this.props.PopupState.ConfirmationPopup.Header, messsage: this.props.PopupState.ConfirmationPopup.Msg, showPopup: this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup, cancelButtonText: this.props.PopupState.ConfirmationPopup.CancelButtonText, confirmButtonText: this.props.PopupState.ConfirmationPopup.ConfirmButtonText, onCancel: this.props.onCancelConfirmationPopup, onConfirm: this.props.onConfirmConfirmationPopup, showInputBox: this.props.PopupState.ConfirmationPopup.ShowInputBox, messageType: this.props.PopupState.ConfirmationPopup.MessageType, api: this.props.AdaptableApi }),
|
|
28
29
|
Boolean(this.props.PopupState.ScreenPopup.ShowScreenPopup) && (React.createElement(AdaptablePopup_1.AdaptablePopup, { componentName: this.props.PopupState.ScreenPopup.ComponentName, componentModule: this.props.PopupState.ScreenPopup.ComponentModule, onHide: this.props.onCloseScreenPopup, api: this.props.AdaptableApi, onClearParams: () => this.props.onClearPopupParams(), moduleParams: this.props.PopupState.ScreenPopup.Params, moduleProps: this.props.PopupState.ScreenPopup.PopupProps })),
|
|
29
|
-
React.createElement(react_toastify_1.ToastContainer
|
|
30
|
-
|
|
30
|
+
React.createElement(react_toastify_1.ToastContainer
|
|
31
|
+
// we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
|
|
32
|
+
// instance is destroyed and re-created many times
|
|
33
|
+
, {
|
|
34
|
+
// we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
|
|
35
|
+
// instance is destroyed and re-created many times
|
|
36
|
+
containerId: adaptableOptions.adaptableId, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
|
|
31
37
|
(watermark === null || watermark === void 0 ? void 0 : watermark.show) && React.createElement(License_1.LicenseWatermark, null, watermark === null || watermark === void 0 ? void 0 : watermark.text),
|
|
32
38
|
React.createElement(WindowPopups_1.WindowPopups, null),
|
|
33
39
|
React.createElement(FormPopups_1.FormPopups, null),
|
|
@@ -70,7 +70,7 @@ exports.CalculatedColumnExpressionWizardSection = (props) => {
|
|
|
70
70
|
props.onChange(Object.assign(Object.assign({}, data), { Query: calculatedColumnQuery, CalculatedColumnSettings: Object.assign(Object.assign({}, data.CalculatedColumnSettings), { DataType: dataType, Pivotable,
|
|
71
71
|
Aggregatable }) }));
|
|
72
72
|
};
|
|
73
|
-
return (React.createElement(Tabs_1.Tabs, { onValueChange: setType, value: selectedTab, p: 2, style: { flex: 1, overflow: 'auto' } },
|
|
73
|
+
return (React.createElement(Tabs_1.Tabs, { onValueChange: setType, value: selectedTab, p: 2, style: { height: '100%', flex: 1, overflow: 'auto' } },
|
|
74
74
|
React.createElement(QueryTab, { value: "ScalarExpression", type: type, label: "Scalar" }),
|
|
75
75
|
React.createElement(Tabs_1.Tabs.Content, { value: 'ScalarExpression' },
|
|
76
76
|
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.queryApi.getAllNamedQuery(), isFullExpression: true, api: api })),
|
|
@@ -73,7 +73,7 @@ exports.CalculatedColumnSettingsWizardSection = (props) => {
|
|
|
73
73
|
const ColumnName = data.FriendlyName;
|
|
74
74
|
const ColumnId = data.ColumnId;
|
|
75
75
|
let { DataType: dataType } = (_a = data.CalculatedColumnSettings) !== null && _a !== void 0 ? _a : {};
|
|
76
|
-
const { Width, ShowToolTip, HeaderToolTip } = (_b = data.CalculatedColumnSettings) !== null && _b !== void 0 ? _b : {};
|
|
76
|
+
const { Width, ShowToolTip, HeaderToolTip, ExternallyEvaluatedExpression } = (_b = data.CalculatedColumnSettings) !== null && _b !== void 0 ? _b : {};
|
|
77
77
|
const handleSpecialColumnSettingsChange = (settings) => {
|
|
78
78
|
props.onChange(Object.assign(Object.assign({}, data), { CalculatedColumnSettings: Object.assign(Object.assign({}, data.CalculatedColumnSettings), settings) }));
|
|
79
79
|
};
|
|
@@ -118,7 +118,14 @@ exports.CalculatedColumnSettingsWizardSection = (props) => {
|
|
|
118
118
|
}) })),
|
|
119
119
|
' ',
|
|
120
120
|
React.createElement(FormLayout_1.FormRow, { label: "" },
|
|
121
|
-
React.createElement(CheckBox_1.CheckBox, { "data-name": "column-show-tooltip", onChange: (checked) => handleSpecialColumnSettingsChange({ ShowToolTip: checked }), checked: ShowToolTip }, "Show Expression as Cell Tooltip"))
|
|
121
|
+
React.createElement(CheckBox_1.CheckBox, { "data-name": "column-show-tooltip", onChange: (checked) => handleSpecialColumnSettingsChange({ ShowToolTip: checked }), checked: ShowToolTip }, "Show Expression as Cell Tooltip")),
|
|
122
|
+
React.createElement(FormLayout_1.FormRow, { label: "" },
|
|
123
|
+
React.createElement(CheckBox_1.CheckBox, { "data-name": "column-external-expression-evaluation", onChange: (checked) => handleSpecialColumnSettingsChange({ ExternallyEvaluatedExpression: checked }), checked: ExternallyEvaluatedExpression }, "Suppress Expression Evaluation"),
|
|
124
|
+
ExternallyEvaluatedExpression && (React.createElement(rebass_1.Box, { "data-name": "note-external-expression-evaluation", p: 2, style: {
|
|
125
|
+
background: 'var(--ab-color-primary)',
|
|
126
|
+
borderRadius: 'var(--ab__border-radius)',
|
|
127
|
+
whiteSpace: 'pre-wrap',
|
|
128
|
+
} }, "The column value is loaded from the row data property with the same name as the ColumnId"))))))),
|
|
122
129
|
ErrorMessage ? React.createElement(ErrorBox_1.default, { marginTop: 2 }, ErrorMessage) : null,
|
|
123
130
|
React.createElement(SpecialColumnSettingsWizardStep_1.SpecialColumnSettingsWizardStep, { isEditable: false, settings: data.CalculatedColumnSettings, onChange: handleSpecialColumnSettingsChange })));
|
|
124
131
|
};
|
|
@@ -36,6 +36,6 @@ exports.AdaptableObjectCompactListItem = (props) => {
|
|
|
36
36
|
};
|
|
37
37
|
exports.AdaptableObjectCompactList = (props) => {
|
|
38
38
|
return (React.createElement("div", { className: baseClassName }, props.abObjects.map((abObject) => {
|
|
39
|
-
return React.createElement(exports.AdaptableObjectCompactListItem, { abObject: abObject, module: props.module });
|
|
39
|
+
return (React.createElement(exports.AdaptableObjectCompactListItem, { key: abObject.Uuid, abObject: abObject, module: props.module }));
|
|
40
40
|
})));
|
|
41
41
|
};
|
|
@@ -4,7 +4,10 @@ import { ColumnMenuTab } from '../../../PredefinedConfig/Common/Enums';
|
|
|
4
4
|
import { ColumnFilter } from '../../../PredefinedConfig/FilterState';
|
|
5
5
|
export interface FilterFormState {
|
|
6
6
|
columnFilters: ColumnFilter[];
|
|
7
|
-
distinctColumnValues:
|
|
7
|
+
distinctColumnValues: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: any;
|
|
10
|
+
}[];
|
|
8
11
|
isDistinctColumnValuesLoading: boolean;
|
|
9
12
|
showTab: boolean;
|
|
10
13
|
selectedTab: ColumnMenuTab;
|
|
@@ -5,7 +5,10 @@ export interface ListBoxFilterFormProps extends ListGroupProps {
|
|
|
5
5
|
currentColumn: AdaptableColumn;
|
|
6
6
|
columns: AdaptableColumn[];
|
|
7
7
|
useAgGridStyle?: boolean;
|
|
8
|
-
columnDistinctValues:
|
|
8
|
+
columnDistinctValues: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: any;
|
|
11
|
+
}[];
|
|
9
12
|
uiSelectedColumnValues: Array<string>;
|
|
10
13
|
onColumnValueSelectedChange: (SelectedValues: Array<any>) => void;
|
|
11
14
|
dataType: 'String' | 'Number' | 'NumberArray' | 'Boolean' | 'Date' | 'Object' | 'Unknown';
|
|
@@ -40,9 +40,9 @@ exports.ListBoxFilterForm = (props) => {
|
|
|
40
40
|
setUiSelectedColumnValues([...UiSelectedColumnValues, item]);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
const columnValuesItemsElements = props.columnDistinctValues.map((
|
|
44
|
-
const isActive = UiSelectedColumnValues.indexOf(
|
|
45
|
-
const columnValue =
|
|
43
|
+
const columnValuesItemsElements = props.columnDistinctValues.map((distinctValue, index) => {
|
|
44
|
+
const isActive = UiSelectedColumnValues.indexOf(distinctValue.value) >= 0;
|
|
45
|
+
const columnValue = distinctValue.value;
|
|
46
46
|
if (StringExtensions_1.StringExtensions.IsNullOrEmpty(columnValue)) {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
@@ -53,13 +53,13 @@ exports.ListBoxFilterForm = (props) => {
|
|
|
53
53
|
}
|
|
54
54
|
if (props.useAgGridStyle) {
|
|
55
55
|
return renderItemForAgGridStyle({
|
|
56
|
-
key: 'columnValue' +
|
|
57
|
-
children:
|
|
56
|
+
key: 'columnValue' + index,
|
|
57
|
+
children: distinctValue.label,
|
|
58
58
|
checked: isActive,
|
|
59
|
-
onChange: () => onClickItemColumnValue(
|
|
59
|
+
onChange: () => onClickItemColumnValue(distinctValue.value),
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
return (React.createElement(ListGroupItem_1.default, { noZebra: props.useAgGridStyle, key: 'columnValue' +
|
|
62
|
+
return (React.createElement(ListGroupItem_1.default, { noZebra: props.useAgGridStyle, key: 'columnValue' + index, onClick: () => onClickItemColumnValue(distinctValue.value), active: isActive, value: columnValue }, distinctValue.label));
|
|
63
63
|
});
|
|
64
64
|
const textClear = (React.createElement(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { autoFocus: true, type: "text", placeholder: "Search Column Values", value: FilterValue, style: {
|
|
65
65
|
paddingTop: 'var(--ab-space-1)',
|
|
@@ -19,6 +19,7 @@ const CheckBox_1 = require("../../../components/CheckBox");
|
|
|
19
19
|
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
20
20
|
const runIfNotResolvedIn_1 = require("../../../Utilities/runIfNotResolvedIn");
|
|
21
21
|
const getDefaultColumnFilterPredicate_1 = require("./getDefaultColumnFilterPredicate");
|
|
22
|
+
const date_fns_1 = require("date-fns");
|
|
22
23
|
class QuickFilterFormComponent extends React.Component {
|
|
23
24
|
constructor(props) {
|
|
24
25
|
super(props);
|
|
@@ -214,6 +215,19 @@ class QuickFilterFormComponent extends React.Component {
|
|
|
214
215
|
if (this.props.quickFilterValuesTrigger === 'click') {
|
|
215
216
|
showEvent = 'click';
|
|
216
217
|
}
|
|
218
|
+
let selectedValues = filter.Predicate.PredicateId === 'Values' ? 'Select Values' : 'Exclude Values';
|
|
219
|
+
if (filter.Predicate.Inputs.length) {
|
|
220
|
+
selectedValues = filter.Predicate.Inputs.map((input) => {
|
|
221
|
+
var _a, _b;
|
|
222
|
+
const label = (_b = (_a = this.state.distinctColumnValues) === null || _a === void 0 ? void 0 : _a.find((distinctValue) => {
|
|
223
|
+
if (input instanceof Date) {
|
|
224
|
+
return date_fns_1.isSameDay(input, distinctValue.value);
|
|
225
|
+
}
|
|
226
|
+
return distinctValue.value === input;
|
|
227
|
+
})) === null || _b === void 0 ? void 0 : _b.label;
|
|
228
|
+
return label !== null && label !== void 0 ? label : input;
|
|
229
|
+
}).join(', ');
|
|
230
|
+
}
|
|
217
231
|
return (React.createElement(OverlayTrigger_1.default, { alignHorizontal: "left", showEvent: showEvent,
|
|
218
232
|
// cannot hide on blur, because the form input receives the input when this is opened
|
|
219
233
|
hideEvent: "mouseleave", hideDelay: 300, ref: (api) => {
|
|
@@ -248,8 +262,7 @@ class QuickFilterFormComponent extends React.Component {
|
|
|
248
262
|
borderRadius: 0,
|
|
249
263
|
borderLeftWidth: 0,
|
|
250
264
|
borderColor: 'var(--ab-color-primarydark)',
|
|
251
|
-
}, disabled: ArrayExtensions_1.default.IsNullOrEmptyOrContainsSingleEmptyValue(this.state.distinctColumnValues) },
|
|
252
|
-
(filter.Predicate.PredicateId === 'Values' ? 'Select Values' : 'Exclude Values'))));
|
|
265
|
+
}, disabled: ArrayExtensions_1.default.IsNullOrEmptyOrContainsSingleEmptyValue(this.state.distinctColumnValues) }, selectedValues)));
|
|
253
266
|
}
|
|
254
267
|
onColumnValuesChange(columnValues) {
|
|
255
268
|
var _a;
|
|
@@ -32,6 +32,8 @@ const WindowDialog = (props) => {
|
|
|
32
32
|
handleSelector: isActionModule
|
|
33
33
|
? `.${baseClassName} .ab-Panel__header`
|
|
34
34
|
: '.ab-Adaptable-Popup__TopBar',
|
|
35
|
+
minHeight: 460,
|
|
36
|
+
minWidth: 400,
|
|
35
37
|
size: popupSettings.size,
|
|
36
38
|
position: popupSettings.position,
|
|
37
39
|
onChange: handleWindowSettings,
|
|
@@ -11,6 +11,7 @@ exports.showToast = (props) => {
|
|
|
11
11
|
// leak where the api is still kept around in memory by the toaster
|
|
12
12
|
let api = props.api;
|
|
13
13
|
const off = api.eventApi.on('AdaptableDestroy', () => {
|
|
14
|
+
react_toastify_1.toast.dismiss(); // remove all toasts
|
|
14
15
|
api = null;
|
|
15
16
|
});
|
|
16
17
|
const toastProps = ObjectFactory_1.default.CreateToastOptions(props.api.internalApi.getAdaptableOptions().notificationsOptions, {
|
|
@@ -20,8 +20,8 @@ exports.FormDialog = ({ id, formProps, form, prepareContext, }) => {
|
|
|
20
20
|
dispatch(PopupRedux_1.PopupHideForm(id));
|
|
21
21
|
};
|
|
22
22
|
const context = Object.assign({ adaptableApi: adaptable.api, formData: data }, formProps);
|
|
23
|
-
return (React.createElement(Dialog_1.default, { isOpen: true, showCloseButton: false, style: { minHeight: 'auto', minWidth: 400 }, onDismiss: handleDismiss },
|
|
24
|
-
React.createElement(rebass_1.
|
|
23
|
+
return (React.createElement(Dialog_1.default, { isOpen: true, showCloseButton: false, style: { minHeight: 'auto', minWidth: 400, maxHeight: '80vh' }, onDismiss: handleDismiss },
|
|
24
|
+
React.createElement(rebass_1.Flex, { flexDirection: 'column', "data-name": "form-dialog", padding: 4, height: '100%' },
|
|
25
25
|
React.createElement(AdaptableFormComponent_1.AdaptableFormComponent, { formDef: form, data: data, context: context, onChange: setData, api: adaptable.api, displayTitle: true, onButtonClick: async (button) => {
|
|
26
26
|
var _a;
|
|
27
27
|
handleDismiss();
|
|
@@ -3,6 +3,7 @@ import { FormatColumn } from '../../../PredefinedConfig/FormatColumnState';
|
|
|
3
3
|
import { AdaptableFormat } from '../../../PredefinedConfig/Common/AdaptableFormat';
|
|
4
4
|
import { AdaptableScope } from '../../../PredefinedConfig/Common/AdaptableScope';
|
|
5
5
|
import { AdaptableApi } from '../../../Api/AdaptableApi';
|
|
6
|
+
import { FormatColumnApi } from '../../../types';
|
|
6
7
|
export declare type FormatColumnFormatWizardSectionProps = {
|
|
7
8
|
onChange: (data: FormatColumn) => void;
|
|
8
9
|
};
|
|
@@ -10,7 +11,7 @@ export interface FormatColumnFormatWizardState {
|
|
|
10
11
|
DisplayFormat: AdaptableFormat;
|
|
11
12
|
NumericFormat?: 'Percent' | 'Thousand' | 'Million' | 'Dollar' | 'Sterling' | undefined;
|
|
12
13
|
}
|
|
13
|
-
export declare const getFormatColumnFormatSummaryValue: (data: FormatColumn) => string;
|
|
14
|
-
export declare const renderFormatColumnFormatSummary: (data: FormatColumn) => JSX.Element;
|
|
14
|
+
export declare const getFormatColumnFormatSummaryValue: (data: FormatColumn, formattedColumnApi: FormatColumnApi) => string;
|
|
15
|
+
export declare const renderFormatColumnFormatSummary: (data: FormatColumn, api: AdaptableApi) => JSX.Element;
|
|
15
16
|
export declare const getFormatDisplayTypeForScope: (scope: AdaptableScope, api: AdaptableApi) => 'Number' | 'Date' | 'String' | undefined;
|
|
16
17
|
export declare const FormatColumnFormatWizardSection: (props: FormatColumnFormatWizardSectionProps) => JSX.Element;
|
|
@@ -10,7 +10,6 @@ const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlo
|
|
|
10
10
|
const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
|
|
11
11
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
|
|
12
12
|
const CheckBox_1 = require("../../../components/CheckBox");
|
|
13
|
-
const FormatHelper_1 = tslib_1.__importDefault(require("../../../Utilities/Helpers/FormatHelper"));
|
|
14
13
|
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
15
14
|
const AdaptableObjectRow_1 = require("../../Components/AdaptableObjectRow");
|
|
16
15
|
const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
|
|
@@ -18,6 +17,7 @@ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
|
18
17
|
const Tabs_1 = require("../../../components/Tabs");
|
|
19
18
|
const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
|
|
20
19
|
const Tag_1 = require("../../../components/Tag");
|
|
20
|
+
const AdaptableContext_1 = require("../../AdaptableContext");
|
|
21
21
|
const DOLLAR_OPTIONS = {
|
|
22
22
|
FractionDigits: 2,
|
|
23
23
|
FractionSeparator: '.',
|
|
@@ -77,26 +77,45 @@ const DateFormatPresets = [
|
|
|
77
77
|
'yyyyMMdd',
|
|
78
78
|
'HH:mm:ss',
|
|
79
79
|
];
|
|
80
|
-
exports.getFormatColumnFormatSummaryValue = (data) => {
|
|
80
|
+
exports.getFormatColumnFormatSummaryValue = (data, formattedColumnApi) => {
|
|
81
81
|
let content = 'N/A';
|
|
82
82
|
if (!data.DisplayFormat) {
|
|
83
83
|
content = 'N/A';
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
86
|
if (data.DisplayFormat.Formatter === 'NumberFormatter') {
|
|
87
|
-
content =
|
|
87
|
+
content = formattedColumnApi.getNumberFormattedValue(12345.6789, data.DisplayFormat.Options);
|
|
88
88
|
}
|
|
89
89
|
if (data.DisplayFormat.Formatter === 'DateFormatter') {
|
|
90
|
-
content =
|
|
90
|
+
content = formattedColumnApi.getDateFormattedValue(new Date(), data.DisplayFormat.Options);
|
|
91
91
|
}
|
|
92
92
|
if (data.DisplayFormat.Formatter === 'StringFormatter') {
|
|
93
|
-
content =
|
|
93
|
+
content = formattedColumnApi.getStringFormattedValue('Hello World ', data.DisplayFormat.Options);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
return content;
|
|
97
97
|
};
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
function splitArrayInTwo(arr) {
|
|
99
|
+
const half = Math.floor(arr.length - 1 / 2);
|
|
100
|
+
return [arr.slice(0, half), arr.slice(half)];
|
|
101
|
+
}
|
|
102
|
+
const renderCustomFormatter = (data, customFormatter, setFormatOption) => {
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
return (React.createElement(FormLayout_1.FormRow, { key: customFormatter.id, label: (_a = customFormatter.label) !== null && _a !== void 0 ? _a : customFormatter.id },
|
|
105
|
+
React.createElement(CheckBox_1.CheckBox, { checked: (_c = (_b = data.DisplayFormat.Options.CustomDisplayFormats) === null || _b === void 0 ? void 0 : _b.some) === null || _c === void 0 ? void 0 : _c.call(_b, (item) => item === customFormatter.id), onChange: (checked) => {
|
|
106
|
+
var _a, _b, _c;
|
|
107
|
+
let newCustomFormats = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Options) === null || _b === void 0 ? void 0 : _b.CustomDisplayFormats) !== null && _c !== void 0 ? _c : [];
|
|
108
|
+
if (checked) {
|
|
109
|
+
newCustomFormats = [...newCustomFormats, customFormatter.id];
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
newCustomFormats = newCustomFormats.filter((item) => item !== customFormatter.id);
|
|
113
|
+
}
|
|
114
|
+
setFormatOption('CustomDisplayFormats', newCustomFormats);
|
|
115
|
+
} })));
|
|
116
|
+
};
|
|
117
|
+
exports.renderFormatColumnFormatSummary = (data, api) => {
|
|
118
|
+
return React.createElement(Tag_1.Tag, null, exports.getFormatColumnFormatSummaryValue(data, api.formatColumnApi));
|
|
100
119
|
};
|
|
101
120
|
exports.getFormatDisplayTypeForScope = (scope, api) => {
|
|
102
121
|
if (scope == undefined) {
|
|
@@ -131,7 +150,7 @@ exports.getFormatDisplayTypeForScope = (scope, api) => {
|
|
|
131
150
|
}
|
|
132
151
|
return undefined;
|
|
133
152
|
};
|
|
134
|
-
const renderDateFormat = (data, _onChange, setFormatOption) => {
|
|
153
|
+
const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
|
|
135
154
|
if (data.DisplayFormat.Formatter !== 'DateFormatter') {
|
|
136
155
|
return null;
|
|
137
156
|
}
|
|
@@ -147,7 +166,8 @@ const renderDateFormat = (data, _onChange, setFormatOption) => {
|
|
|
147
166
|
React.createElement(FormLayout_1.default, null,
|
|
148
167
|
React.createElement(FormLayout_1.FormRow, { label: "Pattern" },
|
|
149
168
|
React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Pattern, onChange: (e) => setFormatOption('Pattern', e.currentTarget.value), mr: 2 }),
|
|
150
|
-
React.createElement("span", null,
|
|
169
|
+
React.createElement("span", null, formatColumnApi.getDateFormattedValue(new Date(), data.DisplayFormat.Options))),
|
|
170
|
+
customFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))))),
|
|
151
171
|
React.createElement(Tabs_1.Tabs, { marginTop: 2 },
|
|
152
172
|
React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
|
|
153
173
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
@@ -159,7 +179,7 @@ const renderDateFormat = (data, _onChange, setFormatOption) => {
|
|
|
159
179
|
DateFormatPresets.map((Pattern, index) => (React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { key: index, colItems: [
|
|
160
180
|
{ Content: Pattern, Size: 1 },
|
|
161
181
|
{
|
|
162
|
-
Content:
|
|
182
|
+
Content: formatColumnApi.getDateFormattedValue(new Date(), { Pattern }),
|
|
163
183
|
Size: 1,
|
|
164
184
|
},
|
|
165
185
|
{
|
|
@@ -168,7 +188,7 @@ const renderDateFormat = (data, _onChange, setFormatOption) => {
|
|
|
168
188
|
},
|
|
169
189
|
] })))))));
|
|
170
190
|
};
|
|
171
|
-
const renderNumberFormat = (data, onChange, setFormatOption) => {
|
|
191
|
+
const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, formatColumnApi) => {
|
|
172
192
|
if (data.DisplayFormat.Formatter !== 'NumberFormatter') {
|
|
173
193
|
return null;
|
|
174
194
|
}
|
|
@@ -220,6 +240,7 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
|
|
|
220
240
|
data.DisplayFormat.Options.Multiplier === MILLION_OPTIONS.Multiplier; //isEqual(data.DisplayFormat.Options, MILLION_OPTIONS);
|
|
221
241
|
const IS_DOLLAR = data.DisplayFormat.Options.Prefix === '$'; //isEqual(data.DisplayFormat.Options, DOLLAR_OPTIONS);
|
|
222
242
|
const IS_STERLING = data.DisplayFormat.Options.Prefix === '£'; //isEqual(data.DisplayFormat, STERLING_OPTIONS);
|
|
243
|
+
const [leftCustomFormatters, rightCustomFormatters] = splitArrayInTwo(customFormatters);
|
|
223
244
|
return (React.createElement(rebass_1.Box, { "data-name": 'format-column-display-format', padding: 2 },
|
|
224
245
|
React.createElement(Tabs_1.Tabs, null,
|
|
225
246
|
React.createElement(Tabs_1.Tabs.Tab, null, "Format"),
|
|
@@ -233,7 +254,8 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
|
|
|
233
254
|
React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
|
|
234
255
|
React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
|
|
235
256
|
React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
|
|
236
|
-
React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) }))
|
|
257
|
+
React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
|
|
258
|
+
leftCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))),
|
|
237
259
|
React.createElement(FormLayout_1.default, null,
|
|
238
260
|
React.createElement(FormLayout_1.FormRow, { label: "Fraction Digits" },
|
|
239
261
|
React.createElement(Input_1.default, { type: "number", min: "0",
|
|
@@ -250,7 +272,8 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
|
|
|
250
272
|
React.createElement(FormLayout_1.FormRow, { label: "Parentheses" },
|
|
251
273
|
React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Parentheses, onChange: (checked) => setFormatOption('Parentheses', checked) })),
|
|
252
274
|
React.createElement(FormLayout_1.FormRow, { label: "Truncate" },
|
|
253
|
-
React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) }))
|
|
275
|
+
React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) })),
|
|
276
|
+
rightCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption)))))),
|
|
254
277
|
React.createElement(Tabs_1.Tabs, { marginTop: 2, autoFocus: false, keyboardNavigation: false },
|
|
255
278
|
React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
|
|
256
279
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
@@ -273,26 +296,26 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
|
|
|
273
296
|
React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
|
|
274
297
|
{ Content: '12345.6789', Size: 1 },
|
|
275
298
|
{
|
|
276
|
-
Content:
|
|
299
|
+
Content: formatColumnApi.getNumberFormattedValue(12345.6789, data.DisplayFormat.Options),
|
|
277
300
|
Size: 1,
|
|
278
301
|
},
|
|
279
302
|
] }),
|
|
280
303
|
React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
|
|
281
304
|
{ Content: '-12345.6789', Size: 1 },
|
|
282
305
|
{
|
|
283
|
-
Content:
|
|
306
|
+
Content: formatColumnApi.getNumberFormattedValue(-12345.6789, data.DisplayFormat.Options),
|
|
284
307
|
Size: 1,
|
|
285
308
|
},
|
|
286
309
|
] }),
|
|
287
310
|
React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
|
|
288
311
|
{ Content: '0.123', Size: 1 },
|
|
289
312
|
{
|
|
290
|
-
Content:
|
|
313
|
+
Content: formatColumnApi.getNumberFormattedValue(0.123, data.DisplayFormat.Options),
|
|
291
314
|
Size: 1,
|
|
292
315
|
},
|
|
293
316
|
] })))));
|
|
294
317
|
};
|
|
295
|
-
const renderStringFormat = (data, _onChange, setFormatOption) => {
|
|
318
|
+
const renderStringFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
|
|
296
319
|
if (data.DisplayFormat.Formatter !== 'StringFormatter') {
|
|
297
320
|
return null;
|
|
298
321
|
}
|
|
@@ -311,7 +334,8 @@ const renderStringFormat = (data, _onChange, setFormatOption) => {
|
|
|
311
334
|
React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
|
|
312
335
|
React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
|
|
313
336
|
React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
|
|
314
|
-
React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) }))
|
|
337
|
+
React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
|
|
338
|
+
customFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption)))))),
|
|
315
339
|
React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
|
|
316
340
|
React.createElement(Tabs_1.Tabs.Tab, null, "Example"),
|
|
317
341
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
@@ -323,14 +347,18 @@ const renderStringFormat = (data, _onChange, setFormatOption) => {
|
|
|
323
347
|
{ Content: '"Hello World "', Size: 1 },
|
|
324
348
|
{
|
|
325
349
|
Content: '"' +
|
|
326
|
-
|
|
350
|
+
formatColumnApi.getStringFormattedValue('Hello World ', data.DisplayFormat.Options) +
|
|
327
351
|
'"',
|
|
328
352
|
Size: 1,
|
|
329
353
|
},
|
|
330
354
|
] })))));
|
|
331
355
|
};
|
|
332
356
|
exports.FormatColumnFormatWizardSection = (props) => {
|
|
357
|
+
var _a, _b, _c;
|
|
333
358
|
const { data } = OnePageAdaptableWizard_1.useOnePageWizardContext();
|
|
359
|
+
const adaptable = AdaptableContext_1.useAdaptable();
|
|
360
|
+
const formatColumnApi = adaptable.api.formatColumnApi;
|
|
361
|
+
const customDisplayFormatters = (_c = (_b = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.formatColumnOptions) === null || _b === void 0 ? void 0 : _b.customDisplayFormatters) !== null && _c !== void 0 ? _c : [];
|
|
334
362
|
const update = (updated) => {
|
|
335
363
|
props.onChange(Object.assign(Object.assign({}, data), updated));
|
|
336
364
|
};
|
|
@@ -341,14 +369,15 @@ exports.FormatColumnFormatWizardSection = (props) => {
|
|
|
341
369
|
update({ DisplayFormat });
|
|
342
370
|
};
|
|
343
371
|
const Type = data.DisplayFormat && data.DisplayFormat.Formatter;
|
|
372
|
+
const customNumberFormatters = customDisplayFormatters.filter((displayFormatter) => adaptable.api.scopeApi.isScopeInScope(displayFormatter.scope, data.Scope));
|
|
344
373
|
if (Type === 'NumberFormatter') {
|
|
345
|
-
return renderNumberFormat(data, update, setFormatOption);
|
|
374
|
+
return renderNumberFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
|
|
346
375
|
}
|
|
347
376
|
if (Type === 'DateFormatter') {
|
|
348
|
-
return renderDateFormat(data, update, setFormatOption);
|
|
377
|
+
return renderDateFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
|
|
349
378
|
}
|
|
350
379
|
if (Type === 'StringFormatter') {
|
|
351
|
-
return renderStringFormat(data, update, setFormatOption);
|
|
380
|
+
return renderStringFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
|
|
352
381
|
}
|
|
353
382
|
return (React.createElement(HelpBlock_1.default, { margin: 3 },
|
|
354
383
|
"Setting a Display Format is only available if ",
|
|
@@ -125,7 +125,7 @@ function FormatColumnWizard(props) {
|
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
title: 'Display Format',
|
|
128
|
-
renderSummary: FormatColumnFormatWizardSection_1.renderFormatColumnFormatSummary,
|
|
128
|
+
renderSummary: (data) => FormatColumnFormatWizardSection_1.renderFormatColumnFormatSummary(data, api),
|
|
129
129
|
render: () => {
|
|
130
130
|
return React.createElement(FormatColumnFormatWizardSection_1.FormatColumnFormatWizardSection, { onChange: setFormatColumn });
|
|
131
131
|
},
|
|
@@ -43,7 +43,7 @@ export declare class LayoutEditorWizard extends React.Component<LayoutEditorWiza
|
|
|
43
43
|
Uuid?: string;
|
|
44
44
|
Source?: "Config" | "User";
|
|
45
45
|
IsReadOnly?: boolean;
|
|
46
|
-
Tags?:
|
|
46
|
+
Tags?: string[];
|
|
47
47
|
};
|
|
48
48
|
canNext(): boolean;
|
|
49
49
|
canBack(): boolean;
|
|
@@ -3,7 +3,7 @@ import * as SmartEditRedux from '../../Redux/ActionsReducers/SmartEditRedux';
|
|
|
3
3
|
import * as SystemRedux from '../../Redux/ActionsReducers/SystemRedux';
|
|
4
4
|
import { ModuleViewPopupProps } from '../Components/SharedProps/ModuleViewPopupProps';
|
|
5
5
|
import { PreviewInfo } from '../../Utilities/Interface/Preview';
|
|
6
|
-
import { SmartEditOperation } from '../../AdaptableOptions/
|
|
6
|
+
import { SmartEditOperation } from '../../AdaptableOptions/EditOptions';
|
|
7
7
|
interface SmartEditPopupProps extends ModuleViewPopupProps<SmartEditPopupComponent> {
|
|
8
8
|
SmartEditValue: number;
|
|
9
9
|
SmartEditOperation: SmartEditOperation;
|