@adaptabletools/adaptable 16.0.0 → 16.0.1-canary.1
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 +162 -164
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +6 -1
- package/src/AdaptableOptions/CalendarOptions.d.ts +3 -3
- package/src/AdaptableOptions/CommentsOptions.d.ts +23 -0
- package/src/AdaptableOptions/Fdc3Options.d.ts +65 -48
- package/src/AdaptableOptions/FilterOptions.d.ts +7 -2
- package/src/AdaptableOptions/FinancePluginOptions.d.ts +2 -306
- package/src/AdaptableOptions/OpenFinPluginOptions.d.ts +0 -6
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +0 -17
- package/src/Api/CommentsApi.d.ts +6 -6
- package/src/Api/EventApi.d.ts +2 -14
- package/src/Api/GridApi.d.ts +13 -13
- package/src/Api/Implementation/ApiBase.d.ts +2 -0
- package/src/Api/Implementation/ApiBase.js +3 -0
- package/src/Api/Implementation/CalendarApiImpl.js +1 -2
- package/src/Api/Implementation/CommentsApiImpl.d.ts +3 -3
- package/src/Api/Implementation/CommentsApiImpl.js +3 -3
- package/src/Api/Implementation/GridApiImpl.js +2 -2
- package/src/Api/Implementation/OptionsApiImpl.d.ts +2 -1
- package/src/Api/Implementation/OptionsApiImpl.js +3 -0
- package/src/Api/Implementation/PluginsApiImpl.d.ts +0 -2
- package/src/Api/Implementation/PluginsApiImpl.js +0 -6
- package/src/Api/Internal/AdaptableInternalApi.js +1 -1
- package/src/Api/Internal/Fdc3InternalApi.d.ts +2 -0
- package/src/Api/Internal/Fdc3InternalApi.js +13 -2
- package/src/Api/OptionsApi.d.ts +5 -1
- package/src/Api/PluginsApi.d.ts +0 -5
- package/src/PredefinedConfig/CommentsState.d.ts +30 -3
- package/src/PredefinedConfig/Common/Entitlement.d.ts +1 -1
- package/src/PredefinedConfig/Common/Fdc3Context.d.ts +6 -0
- package/src/PredefinedConfig/SystemState.d.ts +2 -2
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +4 -4
- package/src/Strategy/CommentsModule.d.ts +2 -2
- package/src/Strategy/CommentsModule.js +11 -11
- package/src/Strategy/Fdc3Module.d.ts +0 -1
- package/src/Strategy/Fdc3Module.js +0 -3
- package/src/Utilities/Constants/GeneralConstants.d.ts +0 -1
- package/src/Utilities/Constants/GeneralConstants.js +2 -3
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -1
- package/src/Utilities/Services/Fdc3Service.js +9 -4
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +10 -7
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.d.ts +1 -7
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.js +621 -268
- package/src/View/Comments/CommentPopup.js +5 -5
- package/src/agGrid/Adaptable.d.ts +2 -1
- package/src/agGrid/Adaptable.js +5 -1
- package/src/agGrid/attachAddaptableColumnTypes.js +1 -0
- package/src/metamodel/adaptable.metamodel.d.ts +45 -404
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +4 -6
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/Api/FinanceApi.d.ts +0 -125
- package/src/PredefinedConfig/Common/FDC3Context_DEPR.d.ts +0 -246
- package/src/PredefinedConfig/Common/FDC3Context_DEPR.js +0 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/index.d.ts +0 -1
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/index.js +0 -5
- /package/src/{Api/FinanceApi.js → AdaptableOptions/CommentsOptions.js} +0 -0
package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.js
CHANGED
|
@@ -1,280 +1,633 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
3
|
+
/*
|
|
4
|
+
|
|
5
|
+
This is no longer required since we cannot build FDC3 columns
|
|
6
|
+
But keeping it like this as it was rather useful ...
|
|
7
|
+
|
|
8
|
+
import { ColDef } from '@ag-grid-community/core';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { Box, BoxProps, Flex } from 'rebass';
|
|
11
|
+
import { CheckBox } from '../../../../components/CheckBox';
|
|
12
|
+
import DropdownButton, { DropdownButtonProps } from '../../../../components/DropdownButton';
|
|
13
|
+
import FormLayout, { FormRow } from '../../../../components/FormLayout';
|
|
14
|
+
import HelpBlock from '../../../../components/HelpBlock';
|
|
15
|
+
import Input from '../../../../components/Input';
|
|
16
|
+
import SimpleButton from '../../../../components/SimpleButton';
|
|
17
|
+
import {
|
|
18
|
+
AdaptableConfig,
|
|
19
|
+
AdaptableOptions,
|
|
20
|
+
ContactColumn,
|
|
21
|
+
CountryColumn,
|
|
22
|
+
FDC3Column_Depr,
|
|
23
|
+
FinancePluginOptions,
|
|
24
|
+
InstrumentColumn,
|
|
25
|
+
OrganizationColumn,
|
|
26
|
+
PositionColumn,
|
|
27
|
+
} from '../../../../types';
|
|
28
|
+
import StringExtensions from '../../../../Utilities/Extensions/StringExtensions';
|
|
29
|
+
import { NocodeWizardFormBox } from '../Components/FormBox';
|
|
30
|
+
|
|
31
|
+
const LocalDropdownButton = (props: DropdownButtonProps) => (
|
|
32
|
+
<DropdownButton {...props} width="100%" columns={['label']} />
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const AlertMessage: React.FunctionComponent<React.PropsWithChildren<BoxProps>> = (props) => (
|
|
36
|
+
<Box color="var(--ab-color-error)" {...props} />
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
type FDC3ColumnsKey = Exclude<
|
|
40
|
+
keyof FinancePluginOptions['fdc3Columns'],
|
|
41
|
+
'customFDC3Columns' | 'customFDC3Intents'
|
|
42
|
+
>;
|
|
43
|
+
|
|
44
|
+
type AnyFDC3Column =
|
|
45
|
+
| InstrumentColumn
|
|
46
|
+
| PositionColumn
|
|
47
|
+
| ContactColumn
|
|
48
|
+
| CountryColumn
|
|
49
|
+
| OrganizationColumn;
|
|
50
|
+
|
|
51
|
+
interface FDC3ColumnField<COLUMN_TYPE, INTENTS> {
|
|
52
|
+
fields: {
|
|
53
|
+
label: string;
|
|
54
|
+
id: keyof COLUMN_TYPE;
|
|
55
|
+
value?: string;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
}[];
|
|
58
|
+
intents: INTENTS;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const fdc3ColumnDefinitions: {
|
|
62
|
+
instrumentColumns: FDC3ColumnField<
|
|
63
|
+
Omit<InstrumentColumn, 'intents'>,
|
|
64
|
+
InstrumentColumn['intents']
|
|
65
|
+
>;
|
|
66
|
+
positionColumns: FDC3ColumnField<Omit<PositionColumn, 'intents'>, PositionColumn['intents']>;
|
|
67
|
+
contactColumns: FDC3ColumnField<Omit<ContactColumn, 'intents'>, ContactColumn['intents']>;
|
|
68
|
+
countryColumns: FDC3ColumnField<Omit<CountryColumn, 'intents'>, CountryColumn['intents']>;
|
|
69
|
+
organizationColumns: FDC3ColumnField<
|
|
70
|
+
Omit<OrganizationColumn, 'intents'>,
|
|
71
|
+
OrganizationColumn['intents']
|
|
72
|
+
>;
|
|
73
|
+
} = {
|
|
74
|
+
instrumentColumns: {
|
|
75
|
+
fields: [
|
|
76
|
+
{ label: 'Ticker', id: 'tickerColumnId' },
|
|
77
|
+
{ label: 'ISIN', id: 'isinColumnId' },
|
|
78
|
+
{ label: 'CUSIP', id: 'cusipColumnId' },
|
|
79
|
+
{ label: 'SEDOL', id: 'sedolColumnId' },
|
|
80
|
+
{ label: 'RIC', id: 'ricColumnId' },
|
|
81
|
+
{ label: 'BBG', id: 'bbgColumnId' },
|
|
82
|
+
{ label: 'PERMID', id: 'permidColumnId' },
|
|
83
|
+
{ label: 'FIGI', id: 'figiColumnId' },
|
|
84
|
+
],
|
|
85
|
+
intents: ['ViewChart', 'ViewQuote', 'ViewNews', 'ViewAnalysis', 'ViewInstrument'],
|
|
86
|
+
},
|
|
87
|
+
positionColumns: {
|
|
88
|
+
fields: [{ label: 'Instrument', id: 'instrumentColumnId', required: true }],
|
|
89
|
+
intents: ['ViewChart', 'ViewNews', 'ViewAnalysis'],
|
|
90
|
+
},
|
|
91
|
+
contactColumns: {
|
|
92
|
+
fields: [
|
|
93
|
+
{ label: 'Email', id: 'emailColumnId' },
|
|
94
|
+
{ label: 'FDS_ID', id: 'fds_idColumnId' },
|
|
95
|
+
],
|
|
96
|
+
intents: ['StartCall', 'StartChat', 'ViewContact'],
|
|
97
|
+
},
|
|
98
|
+
countryColumns: {
|
|
99
|
+
fields: [
|
|
100
|
+
{ label: 'ISOALPHA2', id: 'isoalpha2ColumnId' },
|
|
101
|
+
{ label: 'ISOALPHA3', id: 'isoalpha3ColumnId' },
|
|
102
|
+
],
|
|
103
|
+
intents: ['ViewChart'],
|
|
104
|
+
},
|
|
105
|
+
organizationColumns: {
|
|
106
|
+
fields: [
|
|
107
|
+
{ label: 'LEI', id: 'leiColumnId' },
|
|
108
|
+
{ label: 'PERM ID', id: 'permidColumnId' },
|
|
109
|
+
{ label: 'FDS ID', id: 'fds_idColumnId' },
|
|
110
|
+
],
|
|
111
|
+
intents: ['ViewNews', 'ViewAnalysis'],
|
|
112
|
+
},
|
|
57
113
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
114
|
+
|
|
115
|
+
const FDC3ColumnSelector: React.FunctionComponent<{
|
|
116
|
+
label: string;
|
|
117
|
+
id: string;
|
|
118
|
+
value?: string;
|
|
119
|
+
required?: boolean;
|
|
120
|
+
onChange: (columnId: string) => void;
|
|
121
|
+
columnOptions: { label: string; value: string }[];
|
|
122
|
+
}> = (props) => {
|
|
123
|
+
const options = React.useMemo(() => {
|
|
124
|
+
return props.columnOptions.map((columnOption) => ({
|
|
125
|
+
...columnOption,
|
|
126
|
+
onClick: () => props.onChange(columnOption.value),
|
|
127
|
+
}));
|
|
128
|
+
}, [props.onChange]);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<FormRow
|
|
132
|
+
label={
|
|
133
|
+
<>
|
|
134
|
+
{props.label} {props.required && <AlertMessage as="span">*</AlertMessage>}{' '}
|
|
135
|
+
</>
|
|
136
|
+
}
|
|
137
|
+
>
|
|
138
|
+
<LocalDropdownButton items={options}>
|
|
139
|
+
{StringExtensions.Humanize(props.value) || 'Select Column'}
|
|
140
|
+
</LocalDropdownButton>
|
|
141
|
+
</FormRow>
|
|
142
|
+
);
|
|
68
143
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
144
|
+
|
|
145
|
+
const FDC3InstrumentColumnBuilder: React.FunctionComponent<{
|
|
146
|
+
column: InstrumentColumn;
|
|
147
|
+
columnOptions: { label: string; value: string }[];
|
|
148
|
+
onColumnFieldChange: (fieldId: string, columnId: string) => void;
|
|
149
|
+
onIntentToggle: (intent: string) => void;
|
|
150
|
+
}> = (props) => {
|
|
151
|
+
const fields = fdc3ColumnDefinitions.instrumentColumns.fields;
|
|
152
|
+
return (
|
|
153
|
+
<Flex>
|
|
154
|
+
<FormLayout mr={2}>
|
|
155
|
+
{fields.slice(0, 4).map((field) => (
|
|
156
|
+
<FDC3ColumnSelector
|
|
157
|
+
{...field}
|
|
158
|
+
key={field.id}
|
|
159
|
+
value={(props.column[field.id] as string) ?? 'Select Column'}
|
|
160
|
+
onChange={(columnId) => props.onColumnFieldChange(field.id, columnId)}
|
|
161
|
+
columnOptions={props.columnOptions}
|
|
162
|
+
/>
|
|
163
|
+
))}
|
|
164
|
+
</FormLayout>
|
|
165
|
+
<FormLayout>
|
|
166
|
+
{fields.slice(4).map((field) => (
|
|
167
|
+
<FDC3ColumnSelector
|
|
168
|
+
{...field}
|
|
169
|
+
key={field.id}
|
|
170
|
+
value={(props.column[field.id] as string) ?? 'Select Column'}
|
|
171
|
+
onChange={(columnId) => props.onColumnFieldChange(field.id, columnId)}
|
|
172
|
+
columnOptions={props.columnOptions}
|
|
173
|
+
/>
|
|
174
|
+
))}
|
|
175
|
+
</FormLayout>
|
|
176
|
+
<Flex ml={3} flexDirection="column">
|
|
177
|
+
{fdc3ColumnDefinitions.instrumentColumns.intents.map((intent) => (
|
|
178
|
+
<CheckBox
|
|
179
|
+
checked={props.column.intents?.includes?.(intent)}
|
|
180
|
+
onClick={() => props.onIntentToggle(intent)}
|
|
181
|
+
key={intent}
|
|
182
|
+
>
|
|
183
|
+
{intent}
|
|
184
|
+
</CheckBox>
|
|
185
|
+
))}
|
|
186
|
+
</Flex>
|
|
187
|
+
</Flex>
|
|
188
|
+
);
|
|
84
189
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
190
|
+
|
|
191
|
+
const FDC3BaseColumnBuilder: React.FunctionComponent<{
|
|
192
|
+
fdc3ColumnType: FDC3ColumnsKey;
|
|
193
|
+
columnOptions: { label: string; value: string }[];
|
|
194
|
+
column: AnyFDC3Column;
|
|
195
|
+
onColumnFieldChange: (fieldId: string, columnId?: string) => void;
|
|
196
|
+
onIntentToggle: (intent: string) => void;
|
|
197
|
+
}> = (props) => {
|
|
198
|
+
const fields = fdc3ColumnDefinitions[props.fdc3ColumnType].fields;
|
|
199
|
+
const intents = fdc3ColumnDefinitions[props.fdc3ColumnType].intents;
|
|
200
|
+
return (
|
|
201
|
+
<Flex>
|
|
202
|
+
<FormLayout>
|
|
203
|
+
{fields.map((field) => (
|
|
204
|
+
<FDC3ColumnSelector
|
|
205
|
+
{...field}
|
|
206
|
+
key={field.id}
|
|
207
|
+
columnOptions={props.columnOptions}
|
|
208
|
+
onChange={(columnId) => props.onColumnFieldChange(field.id, columnId)}
|
|
209
|
+
value={(props.column as any)?.[field.id] ?? ''}
|
|
210
|
+
/>
|
|
211
|
+
))}
|
|
212
|
+
<FormRow label="">
|
|
213
|
+
<Flex flexDirection="column">
|
|
214
|
+
{intents.map((intent: string) => (
|
|
215
|
+
<CheckBox
|
|
216
|
+
checked={((props.column?.intents as string[]) ?? []).includes(intent)}
|
|
217
|
+
onClick={() => props.onIntentToggle(intent)}
|
|
218
|
+
key={intent}
|
|
219
|
+
>
|
|
220
|
+
{intent}
|
|
221
|
+
</CheckBox>
|
|
222
|
+
))}
|
|
223
|
+
</Flex>
|
|
224
|
+
</FormRow>
|
|
225
|
+
</FormLayout>
|
|
226
|
+
</Flex>
|
|
227
|
+
);
|
|
99
228
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
229
|
+
|
|
230
|
+
const FDC3ColumnBuilder: React.FunctionComponent<{
|
|
231
|
+
columnOptions: { label: string; value: string }[];
|
|
232
|
+
fdc3Column: FDC3Column_Depr;
|
|
233
|
+
fdc3ColumnType?: FDC3ColumnsKey;
|
|
234
|
+
onChange: (fdc3Column: FDC3Column_Depr) => void;
|
|
235
|
+
beforeContent?: React.ReactElement;
|
|
236
|
+
disabled?: boolean;
|
|
237
|
+
footer: React.ReactElement;
|
|
238
|
+
}> = (props) => {
|
|
239
|
+
const handleColumnFieldChange = React.useCallback(
|
|
240
|
+
(fieldId: string, columnId?: string) => {
|
|
241
|
+
props.onChange({
|
|
242
|
+
...props.fdc3Column,
|
|
243
|
+
[fieldId]: columnId,
|
|
244
|
+
});
|
|
245
|
+
},
|
|
246
|
+
[props.fdc3Column, props.onChange]
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
const handleIntentToggle = React.useCallback(
|
|
250
|
+
(intent: string) => {
|
|
251
|
+
const newFDC3Column = { ...props.fdc3Column };
|
|
252
|
+
newFDC3Column.intents = newFDC3Column.intents ?? [];
|
|
253
|
+
if ((newFDC3Column.intents as string[]).includes(intent)) {
|
|
254
|
+
(newFDC3Column.intents as string[]) = (newFDC3Column.intents as string[]).filter(
|
|
255
|
+
(i: string) => i !== intent
|
|
256
|
+
);
|
|
257
|
+
} else {
|
|
258
|
+
(newFDC3Column.intents as string[]).push(intent);
|
|
259
|
+
}
|
|
260
|
+
props.onChange(newFDC3Column);
|
|
261
|
+
},
|
|
262
|
+
[props.fdc3Column]
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
const columnOptions = React.useMemo(() => {
|
|
266
|
+
return props.columnOptions.map((columnOption) => ({
|
|
267
|
+
...columnOption,
|
|
268
|
+
onClick: () => {
|
|
269
|
+
props.onChange({
|
|
270
|
+
...props.fdc3Column,
|
|
271
|
+
columnId: columnOption.value,
|
|
272
|
+
});
|
|
273
|
+
},
|
|
274
|
+
}));
|
|
275
|
+
}, [props.fdc3Column]);
|
|
276
|
+
|
|
277
|
+
const handleNameColumnIdChange = React.useCallback(
|
|
278
|
+
(event: any) => {
|
|
279
|
+
props.onChange({
|
|
280
|
+
...props.fdc3Column,
|
|
281
|
+
nameColumnId: event.target.value ?? '',
|
|
282
|
+
});
|
|
283
|
+
},
|
|
284
|
+
[props.fdc3Column]
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
const handleShowBroadcastToggle = React.useCallback(() => {
|
|
288
|
+
props.onChange({
|
|
289
|
+
...props.fdc3Column,
|
|
290
|
+
showBroadcastContextMenu: !props.fdc3Column?.showBroadcastContextMenu,
|
|
291
|
+
});
|
|
292
|
+
}, [props.fdc3Column]);
|
|
293
|
+
|
|
294
|
+
const handleBroadcastLabelChange = React.useCallback(
|
|
295
|
+
(event: any) => {
|
|
296
|
+
props.onChange({
|
|
297
|
+
...props.fdc3Column,
|
|
298
|
+
broadcastContextMenuLabel: event.target.value ?? '',
|
|
299
|
+
});
|
|
300
|
+
},
|
|
301
|
+
[props.fdc3Column]
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<NocodeWizardFormBox>
|
|
306
|
+
<Flex flexWrap="wrap">
|
|
307
|
+
<FormLayout mr={3} mb={3}>
|
|
308
|
+
{props.beforeContent}
|
|
309
|
+
<FormRow
|
|
310
|
+
label={
|
|
311
|
+
<>
|
|
312
|
+
Column <AlertMessage as="span">*</AlertMessage>{' '}
|
|
313
|
+
</>
|
|
314
|
+
}
|
|
315
|
+
>
|
|
316
|
+
<LocalDropdownButton disabled={props.disabled} items={columnOptions}>
|
|
317
|
+
{columnOptions.find((item) => item.value === props.fdc3Column?.columnId)?.label ??
|
|
318
|
+
'Select Column'}
|
|
319
|
+
</LocalDropdownButton>
|
|
320
|
+
</FormRow>
|
|
321
|
+
<FormRow label="FDC3 Name">
|
|
322
|
+
<Input
|
|
323
|
+
disabled={props.disabled}
|
|
324
|
+
onChange={handleNameColumnIdChange}
|
|
325
|
+
value={props.fdc3Column?.nameColumnId ?? ''}
|
|
326
|
+
/>
|
|
327
|
+
</FormRow>
|
|
328
|
+
|
|
329
|
+
<FormRow label="">
|
|
330
|
+
<CheckBox
|
|
331
|
+
disabled={props.disabled}
|
|
332
|
+
checked={Boolean(props.fdc3Column?.showBroadcastContextMenu)}
|
|
333
|
+
onChange={handleShowBroadcastToggle}
|
|
334
|
+
>
|
|
335
|
+
Show Broadcast <br /> Context Menu
|
|
336
|
+
</CheckBox>
|
|
337
|
+
</FormRow>
|
|
338
|
+
|
|
339
|
+
<FormRow label="Broadcast Label">
|
|
340
|
+
<Input
|
|
341
|
+
disabled={props.disabled || !Boolean(props.fdc3Column?.showBroadcastContextMenu)}
|
|
342
|
+
onChange={handleBroadcastLabelChange}
|
|
343
|
+
value={
|
|
344
|
+
typeof props.fdc3Column?.broadcastContextMenuLabel === 'string'
|
|
345
|
+
? props.fdc3Column?.broadcastContextMenuLabel
|
|
346
|
+
: ''
|
|
347
|
+
}
|
|
348
|
+
/>
|
|
349
|
+
</FormRow>
|
|
350
|
+
</FormLayout>
|
|
351
|
+
|
|
352
|
+
<Box flex={1}>
|
|
353
|
+
{props.fdc3ColumnType === 'instrumentColumns' ? (
|
|
354
|
+
<FDC3InstrumentColumnBuilder
|
|
355
|
+
onIntentToggle={handleIntentToggle}
|
|
356
|
+
onColumnFieldChange={(...args) => handleColumnFieldChange(...args)}
|
|
357
|
+
column={props.fdc3Column as InstrumentColumn}
|
|
358
|
+
columnOptions={props.columnOptions}
|
|
359
|
+
/>
|
|
360
|
+
) : (
|
|
361
|
+
props.fdc3ColumnType && (
|
|
362
|
+
<FDC3BaseColumnBuilder
|
|
363
|
+
onColumnFieldChange={(...args) => handleColumnFieldChange(...args)}
|
|
364
|
+
onIntentToggle={handleIntentToggle}
|
|
365
|
+
column={props.fdc3Column}
|
|
366
|
+
fdc3ColumnType={props.fdc3ColumnType}
|
|
367
|
+
columnOptions={props.columnOptions}
|
|
368
|
+
/>
|
|
369
|
+
)
|
|
370
|
+
)}
|
|
371
|
+
</Box>
|
|
372
|
+
</Flex>
|
|
373
|
+
{props.footer}
|
|
374
|
+
</NocodeWizardFormBox>
|
|
375
|
+
);
|
|
156
376
|
};
|
|
157
|
-
|
|
158
|
-
|
|
377
|
+
|
|
378
|
+
const FDC3ColumnEditor: React.FunctionComponent<{
|
|
379
|
+
onChange: (fdc3Column: AnyFDC3Column) => void;
|
|
380
|
+
columnOptions: { label: string; value: string }[];
|
|
381
|
+
fdc3Column: AnyFDC3Column;
|
|
382
|
+
fdc3ColumnType: FDC3ColumnsKey;
|
|
383
|
+
footer: React.ReactElement;
|
|
384
|
+
}> = (props) => {
|
|
385
|
+
return (
|
|
386
|
+
<FDC3ColumnBuilder
|
|
387
|
+
columnOptions={props.columnOptions}
|
|
388
|
+
fdc3Column={props.fdc3Column}
|
|
389
|
+
fdc3ColumnType={props.fdc3ColumnType}
|
|
390
|
+
onChange={props.onChange}
|
|
391
|
+
footer={props.footer}
|
|
392
|
+
/>
|
|
393
|
+
);
|
|
159
394
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
395
|
+
|
|
396
|
+
const FDC3ColumnCreator: React.FunctionComponent<{
|
|
397
|
+
onNew: (fdc3ColumnType: FDC3ColumnsKey, fdc3Column: FDC3Column_Depr) => void;
|
|
398
|
+
columnOptions: { label: string; value: string }[];
|
|
399
|
+
}> = (props) => {
|
|
400
|
+
const [fdc3Column, setFDC3Column] = React.useState<AnyFDC3Column>();
|
|
401
|
+
const [fdc3ColumnType, setFDC3ColumnType] = React.useState<FDC3ColumnsKey>();
|
|
402
|
+
|
|
403
|
+
const handleOnNew = React.useCallback(() => {
|
|
404
|
+
props.onNew(fdc3ColumnType, fdc3Column);
|
|
405
|
+
setFDC3Column(null);
|
|
406
|
+
setFDC3ColumnType(null);
|
|
407
|
+
}, [fdc3Column]);
|
|
408
|
+
|
|
409
|
+
const fdc3ColumnOptions: { label: string; columnField: FDC3ColumnsKey; onClick: () => void }[] =
|
|
410
|
+
React.useMemo(() => {
|
|
411
|
+
return [
|
|
412
|
+
{
|
|
413
|
+
label: 'Instrument',
|
|
414
|
+
columnField: 'instrumentColumns',
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
label: 'Position',
|
|
418
|
+
columnField: 'positionColumns',
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
label: 'Contact',
|
|
422
|
+
columnField: 'contactColumns',
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
label: 'Country',
|
|
426
|
+
columnField: 'countryColumns',
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
label: 'Organization',
|
|
430
|
+
columnField: 'organizationColumns',
|
|
431
|
+
},
|
|
432
|
+
].map((item: { label: string; columnField: FDC3ColumnsKey }) => ({
|
|
433
|
+
...item,
|
|
434
|
+
onClick: () => {
|
|
435
|
+
setFDC3ColumnType(item.columnField);
|
|
436
|
+
setFDC3Column({ columnId: '' });
|
|
437
|
+
},
|
|
438
|
+
}));
|
|
195
439
|
}, []);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
440
|
+
|
|
441
|
+
const typeSelector = (
|
|
442
|
+
<FormRow label="FDC3 Type">
|
|
443
|
+
<LocalDropdownButton items={fdc3ColumnOptions}>
|
|
444
|
+
{fdc3ColumnOptions.find((item) => item.columnField === fdc3ColumnType)?.label ??
|
|
445
|
+
'Select Column'}
|
|
446
|
+
</LocalDropdownButton>
|
|
447
|
+
</FormRow>
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
const fieldsDisabled = !fdc3ColumnType;
|
|
451
|
+
|
|
452
|
+
const errors: string[] = [];
|
|
453
|
+
if (fdc3Column && !fdc3Column.columnId) {
|
|
454
|
+
errors.push('Column is required.');
|
|
455
|
+
}
|
|
456
|
+
if (fdc3Column) {
|
|
457
|
+
const fields = fdc3ColumnDefinitions[fdc3ColumnType].fields;
|
|
458
|
+
fields.forEach((field) => {
|
|
459
|
+
if (field.required && !(fdc3Column as any)[field.id]) {
|
|
460
|
+
errors.push(`${field.label} is required.`);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return (
|
|
466
|
+
<FDC3ColumnBuilder
|
|
467
|
+
disabled={fieldsDisabled}
|
|
468
|
+
columnOptions={props.columnOptions}
|
|
469
|
+
fdc3Column={fdc3Column}
|
|
470
|
+
fdc3ColumnType={fdc3ColumnType}
|
|
471
|
+
onChange={(newFDC3Column) => setFDC3Column(newFDC3Column)}
|
|
472
|
+
beforeContent={typeSelector}
|
|
473
|
+
footer={
|
|
474
|
+
<Flex>
|
|
475
|
+
<Box flex={1} />
|
|
476
|
+
<Flex alignItems="center" mr={3}>
|
|
477
|
+
{errors.slice(0, 1).map((error) => (
|
|
478
|
+
<AlertMessage key={error} ml={2}>
|
|
479
|
+
{error}
|
|
480
|
+
</AlertMessage>
|
|
481
|
+
))}
|
|
482
|
+
</Flex>
|
|
483
|
+
|
|
484
|
+
<SimpleButton
|
|
485
|
+
disabled={fieldsDisabled || !fdc3Column.columnId}
|
|
486
|
+
onClick={handleOnNew}
|
|
487
|
+
icon="plus"
|
|
488
|
+
variant="raised"
|
|
489
|
+
>
|
|
490
|
+
Add FDC3 Column
|
|
491
|
+
</SimpleButton>
|
|
492
|
+
</Flex>
|
|
493
|
+
}
|
|
494
|
+
/>
|
|
495
|
+
);
|
|
215
496
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
497
|
+
|
|
498
|
+
const FinanceFormSectionTitle: React.FunctionComponent<React.PropsWithChildren<BoxProps>> = (
|
|
499
|
+
props
|
|
500
|
+
) => (
|
|
501
|
+
<Box {...props} mb={2}>
|
|
502
|
+
<HelpBlock>{props.children}</HelpBlock>
|
|
503
|
+
</Box>
|
|
504
|
+
);
|
|
505
|
+
|
|
506
|
+
export interface FinanceFormProps {
|
|
507
|
+
adaptableConfig: AdaptableConfig;
|
|
508
|
+
onChangedAdaptableConfig: (adaptableConfig: AdaptableConfig) => void;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export const FinanceForm: React.FunctionComponent<React.PropsWithChildren<FinanceFormProps>> = (
|
|
512
|
+
props
|
|
513
|
+
) => {
|
|
514
|
+
const columnOptions = props.adaptableConfig.gridOptions?.columnDefs?.map?.((item: ColDef) => ({
|
|
515
|
+
label: StringExtensions.Humanize(item.headerName ?? item.field),
|
|
516
|
+
value: item.field,
|
|
517
|
+
}));
|
|
518
|
+
|
|
519
|
+
const financePlugin = props.adaptableConfig.adaptableOptions?.plugins?.find(
|
|
520
|
+
(item) => item.pluginId === 'finance'
|
|
521
|
+
);
|
|
522
|
+
const financePluginOptions = (financePlugin?.options ?? {}) as FinancePluginOptions;
|
|
523
|
+
const fdc3Columns = financePluginOptions?.fdc3Columns ?? {};
|
|
524
|
+
|
|
525
|
+
const handleSetFdc3Columns = (key: FDC3ColumnsKey, newFDC3Columns: any) => {
|
|
526
|
+
// Unfurtunatly finance plugin options need to be mutated.
|
|
527
|
+
// It is the only was without instanciating the plugin again.
|
|
528
|
+
// But that would mean to inport the finance plugin inside the nocode plugin.
|
|
529
|
+
financePluginOptions.fdc3Columns = financePluginOptions.fdc3Columns ?? {};
|
|
530
|
+
financePluginOptions.fdc3Columns[key] = newFDC3Columns;
|
|
531
|
+
|
|
532
|
+
// on change is called with a new array of plugins so the component refreshes.
|
|
533
|
+
props.onChangedAdaptableConfig({
|
|
534
|
+
...props.adaptableConfig,
|
|
535
|
+
adaptableOptions: {
|
|
536
|
+
...props.adaptableConfig.adaptableOptions,
|
|
537
|
+
plugins: [...props.adaptableConfig.adaptableOptions.plugins],
|
|
538
|
+
},
|
|
226
539
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
const renderEditor = (fdc3ColumnType: FDC3ColumnsKey, fdc3ColumnsItems: AnyFDC3Column[]) => {
|
|
543
|
+
return fdc3ColumnsItems.map((fdc3Column, currentFDCColumnId) => (
|
|
544
|
+
<Box key={currentFDCColumnId} mb={3}>
|
|
545
|
+
<FDC3ColumnEditor
|
|
546
|
+
columnOptions={columnOptions}
|
|
547
|
+
fdc3Column={fdc3Column}
|
|
548
|
+
fdc3ColumnType={fdc3ColumnType}
|
|
549
|
+
onChange={(editedFDC3Column) => {
|
|
550
|
+
const newFDC3Columns = fdc3ColumnsItems.map((fdc3Column, index) => {
|
|
551
|
+
if (index === currentFDCColumnId) {
|
|
552
|
+
return editedFDC3Column;
|
|
553
|
+
}
|
|
554
|
+
return fdc3Column;
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
handleSetFdc3Columns(fdc3ColumnType, newFDC3Columns);
|
|
558
|
+
}}
|
|
559
|
+
footer={
|
|
560
|
+
<Flex>
|
|
561
|
+
<Box flex={1} />
|
|
562
|
+
<SimpleButton
|
|
563
|
+
onClick={() => {
|
|
564
|
+
const newFDC3Columns = fdc3ColumnsItems.filter(
|
|
565
|
+
(_, index) => index !== currentFDCColumnId
|
|
566
|
+
);
|
|
567
|
+
handleSetFdc3Columns(fdc3ColumnType, newFDC3Columns);
|
|
568
|
+
}}
|
|
569
|
+
tone="error"
|
|
570
|
+
variant="raised"
|
|
571
|
+
icon="delete"
|
|
572
|
+
>
|
|
573
|
+
Delete
|
|
574
|
+
</SimpleButton>
|
|
575
|
+
</Flex>
|
|
576
|
+
}
|
|
577
|
+
/>
|
|
578
|
+
</Box>
|
|
579
|
+
));
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
return (
|
|
583
|
+
<Box p={2} className="ab-FinanceForm">
|
|
584
|
+
<Box mb={3}>
|
|
585
|
+
<HelpBlock mb={3}>Create FDC3 Column</HelpBlock>
|
|
586
|
+
<FDC3ColumnCreator
|
|
587
|
+
columnOptions={columnOptions}
|
|
588
|
+
onNew={(type, fdc3Column) => {
|
|
589
|
+
handleSetFdc3Columns(type, [...(fdc3Columns[type] ?? []), fdc3Column]);
|
|
590
|
+
}}
|
|
591
|
+
/>
|
|
592
|
+
</Box>
|
|
593
|
+
|
|
594
|
+
{Boolean(fdc3Columns.instrumentColumns?.length) && (
|
|
595
|
+
<Box>
|
|
596
|
+
<FinanceFormSectionTitle>Instrument Columns</FinanceFormSectionTitle>
|
|
597
|
+
{renderEditor('instrumentColumns', fdc3Columns.instrumentColumns)}
|
|
598
|
+
</Box>
|
|
599
|
+
)}
|
|
600
|
+
|
|
601
|
+
{Boolean(fdc3Columns.positionColumns?.length) && (
|
|
602
|
+
<Box>
|
|
603
|
+
<FinanceFormSectionTitle>Position Columns</FinanceFormSectionTitle>
|
|
604
|
+
{renderEditor('positionColumns', fdc3Columns.positionColumns)}
|
|
605
|
+
</Box>
|
|
606
|
+
)}
|
|
607
|
+
|
|
608
|
+
{Boolean(fdc3Columns.contactColumns?.length) && (
|
|
609
|
+
<Box>
|
|
610
|
+
<FinanceFormSectionTitle>Contact Columns</FinanceFormSectionTitle>
|
|
611
|
+
{renderEditor('contactColumns', fdc3Columns.contactColumns)}
|
|
612
|
+
</Box>
|
|
613
|
+
)}
|
|
614
|
+
|
|
615
|
+
{Boolean(fdc3Columns.countryColumns?.length) && (
|
|
616
|
+
<Box>
|
|
617
|
+
<FinanceFormSectionTitle>Country Columns</FinanceFormSectionTitle>
|
|
618
|
+
{renderEditor('countryColumns', fdc3Columns.countryColumns)}
|
|
619
|
+
</Box>
|
|
620
|
+
)}
|
|
621
|
+
|
|
622
|
+
{Boolean(fdc3Columns.organizationColumns?.length) && (
|
|
623
|
+
<Box>
|
|
624
|
+
<FinanceFormSectionTitle>Organization Columns</FinanceFormSectionTitle>
|
|
625
|
+
{renderEditor('organizationColumns', fdc3Columns.organizationColumns)}
|
|
626
|
+
</Box>
|
|
627
|
+
)}
|
|
628
|
+
</Box>
|
|
629
|
+
);
|
|
279
630
|
};
|
|
280
|
-
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
*/
|