@adaptabletools/adaptable-cjs 22.0.0-canary.4 → 22.0.0-canary.6

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.
Files changed (108) hide show
  1. package/index.css +46 -26
  2. package/index.css.map +1 -1
  3. package/package.json +1 -1
  4. package/src/AdaptableOptions/CustomSortOptions.d.ts +1 -2
  5. package/src/AdaptableState/AlertState.d.ts +6 -2
  6. package/src/AdaptableState/ChartingState.d.ts +5 -5
  7. package/src/AdaptableState/Common/AdaptableObject.d.ts +0 -9
  8. package/src/AdaptableState/Common/AdaptableStyle.d.ts +1 -1
  9. package/src/AdaptableState/Common/ColumnHighlightInfo.d.ts +18 -0
  10. package/src/AdaptableState/Common/Schedule.d.ts +6 -2
  11. package/src/AdaptableState/CustomSortState.d.ts +6 -2
  12. package/src/AdaptableState/DashboardState.d.ts +3 -3
  13. package/src/AdaptableState/ExportState.d.ts +3 -3
  14. package/src/AdaptableState/FlashingCellState.d.ts +6 -2
  15. package/src/AdaptableState/FormatColumnState.d.ts +6 -2
  16. package/src/AdaptableState/InternalState.d.ts +2 -0
  17. package/src/AdaptableState/LayoutState.d.ts +4 -4
  18. package/src/AdaptableState/NamedQueryState.d.ts +3 -3
  19. package/src/AdaptableState/PlusMinusState.d.ts +6 -2
  20. package/src/AdaptableState/ShortcutState.d.ts +6 -2
  21. package/src/AdaptableState/ThemeState.d.ts +3 -3
  22. package/src/Api/GridApi.d.ts +18 -3
  23. package/src/Api/Implementation/GridApiImpl.d.ts +4 -0
  24. package/src/Api/Implementation/GridApiImpl.js +14 -0
  25. package/src/Api/Implementation/LayoutHelpers.js +4 -4
  26. package/src/Redux/ActionsReducers/InternalRedux.d.ts +15 -0
  27. package/src/Redux/ActionsReducers/InternalRedux.js +42 -3
  28. package/src/Redux/Store/AdaptableStore.js +21 -0
  29. package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +2 -2
  30. package/src/View/Components/ColumnFilter/FloatingFilter.js +41 -3
  31. package/src/View/Components/ColumnFilter/components/ColumnFilterMenu.js +54 -2
  32. package/src/View/Components/StyleComponent.d.ts +1 -0
  33. package/src/View/Components/StyleComponent.js +84 -33
  34. package/src/View/GridFilter/GridFilterExpressionEditor.js +6 -1
  35. package/src/View/GridFilter/GridFilterViewPanel.js +33 -70
  36. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +2 -2
  37. package/src/agGrid/AdaptableAgGrid.js +9 -0
  38. package/src/agGrid/AgGridColumnAdapter.d.ts +1 -0
  39. package/src/agGrid/AgGridColumnAdapter.js +14 -3
  40. package/src/components/ColorPicker/ColorPicker.js +5 -4
  41. package/src/components/ExpressionEditor/ExpressionFunctionDocumentation.js +1 -1
  42. package/src/components/Select/Select.js +77 -14
  43. package/src/env.js +2 -2
  44. package/src/layout-manager/src/LayoutManagerModel.d.ts +1 -1
  45. package/src/layout-manager/src/index.js +5 -5
  46. package/src/layout-manager/src/normalizeLayoutModel.js +2 -2
  47. package/src/metamodel/adaptable.metamodel.d.ts +25 -18
  48. package/src/metamodel/adaptable.metamodel.js +1 -1
  49. package/src/types.d.ts +2 -2
  50. package/tsconfig.cjs.tsbuildinfo +1 -1
  51. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.d.ts +0 -1
  52. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.js +0 -633
  53. package/src/View/Alert/AlertEntityRow.d.ts +0 -11
  54. package/src/View/Alert/AlertEntityRow.js +0 -33
  55. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +0 -21
  56. package/src/View/CalculatedColumn/CalculatedColumnSummary.js +0 -63
  57. package/src/View/Components/Buttons/ButtonFunction.d.ts +0 -7
  58. package/src/View/Components/Buttons/ButtonFunction.js +0 -13
  59. package/src/View/Components/Buttons/ButtonGeneral.d.ts +0 -5
  60. package/src/View/Components/Buttons/ButtonGeneral.js +0 -12
  61. package/src/View/Components/Buttons/ButtonPreviewDelete.d.ts +0 -4
  62. package/src/View/Components/Buttons/ButtonPreviewDelete.js +0 -8
  63. package/src/View/Components/Buttons/ButtonShow.d.ts +0 -5
  64. package/src/View/Components/Buttons/ButtonShow.js +0 -12
  65. package/src/View/Components/Buttons/ButtonShowChart.d.ts +0 -5
  66. package/src/View/Components/Buttons/ButtonShowChart.js +0 -12
  67. package/src/View/Components/Buttons/ButtonUndo.d.ts +0 -5
  68. package/src/View/Components/Buttons/ButtonUndo.js +0 -12
  69. package/src/View/Components/ExpressionWizard.d.ts +0 -24
  70. package/src/View/Components/ExpressionWizard.js +0 -82
  71. package/src/View/Components/FilterForm/Waiting.d.ts +0 -10
  72. package/src/View/Components/FilterForm/Waiting.js +0 -19
  73. package/src/View/Components/Panels/PanelFooter.d.ts +0 -10
  74. package/src/View/Components/Panels/PanelFooter.js +0 -14
  75. package/src/View/Components/Panels/PanelWithTwoButtons.d.ts +0 -12
  76. package/src/View/Components/Panels/PanelWithTwoButtons.js +0 -20
  77. package/src/View/Components/Panels/ToolPanelSettingsPanel.d.ts +0 -8
  78. package/src/View/Components/Panels/ToolPanelSettingsPanel.js +0 -31
  79. package/src/View/Components/Selectors/ColumnSelectorOld.d.ts +0 -18
  80. package/src/View/Components/Selectors/ColumnSelectorOld.js +0 -50
  81. package/src/View/Components/SharedProps/WizardScopeState.d.ts +0 -4
  82. package/src/View/Components/WizardSummaryRow.d.ts +0 -9
  83. package/src/View/Components/WizardSummaryRow.js +0 -16
  84. package/src/View/CustomSort/CustomSortSummary.d.ts +0 -23
  85. package/src/View/CustomSort/CustomSortSummary.js +0 -110
  86. package/src/View/DataImport/DataImportWizard/sections/ImportSection.d.ts +0 -9
  87. package/src/View/DataImport/DataImportWizard/sections/ImportSection.js +0 -24
  88. package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +0 -19
  89. package/src/View/Export/Wizard/ReportColumnTypeWizard.js +0 -73
  90. package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +0 -19
  91. package/src/View/Export/Wizard/ReportRowTypeWizard.js +0 -73
  92. package/src/View/Export/Wizard/ReportSettingsWizard.d.ts +0 -21
  93. package/src/View/Export/Wizard/ReportSettingsWizard.js +0 -61
  94. package/src/View/Export/Wizard/ReportSummaryWizard.d.ts +0 -15
  95. package/src/View/Export/Wizard/ReportSummaryWizard.js +0 -40
  96. package/src/View/Filter/FilterSummary.d.ts +0 -18
  97. package/src/View/Filter/FilterSummary.js +0 -53
  98. package/src/View/FormatColumn/FormatColumnSummary.d.ts +0 -22
  99. package/src/View/FormatColumn/FormatColumnSummary.js +0 -95
  100. package/src/View/FreeTextColumn/FreeTextColumnSummary.d.ts +0 -22
  101. package/src/View/FreeTextColumn/FreeTextColumnSummary.js +0 -93
  102. package/src/View/GridInfo/GridInfoPopup/AdaptableOptionsComponent.d.ts +0 -7
  103. package/src/View/GridInfo/GridInfoPopup/AdaptableOptionsComponent.js +0 -99
  104. package/src/View/PlusMinus/PlusMinusSummary.d.ts +0 -22
  105. package/src/View/PlusMinus/PlusMinusSummary.js +0 -100
  106. package/src/View/Wizard/WizardLegend.d.ts +0 -12
  107. package/src/View/Wizard/WizardLegend.js +0 -28
  108. /package/src/{View/Components/SharedProps/WizardScopeState.js → AdaptableState/Common/ColumnHighlightInfo.js} +0 -0
@@ -1,633 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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-enterprise';
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
- },
113
- };
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
- );
143
- };
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
- );
189
- };
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
- );
228
- };
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
- );
376
- };
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
- );
394
- };
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
- }));
439
- }, []);
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
- );
496
- };
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
- },
539
- });
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
- );
630
- };
631
-
632
-
633
- */
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import { SharedEntityRowProps } from '../Components/SharedProps/ConfigEntityRowProps';
3
- import { AlertDefinition } from '../../AdaptableState/AlertState';
4
- import { AdaptableMessageType } from '../../AdaptableState/Common/AdaptableMessageType';
5
- export interface AlertEntityRowProps extends SharedEntityRowProps<AlertEntityRow> {
6
- onChangeMessageType: (alertDefinition: AlertDefinition, Type: AdaptableMessageType) => void;
7
- }
8
- export declare class AlertEntityRow extends React.Component<AlertEntityRowProps, {}> {
9
- render(): any;
10
- onMessageTypeChanged(alertDefinition: AlertDefinition, value: AdaptableMessageType): void;
11
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlertEntityRow = void 0;
4
- const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
6
- const EntityListActionButtons_1 = require("../Components/Buttons/EntityListActionButtons");
7
- const AdaptableObjectRow_1 = require("../Components/AdaptableObjectRow");
8
- const EntityRowItem_1 = require("../Components/EntityRowItem");
9
- const DropdownButton_1 = tslib_1.__importDefault(require("../../components/DropdownButton"));
10
- const Helper_1 = require("../../Utilities/Helpers/Helper");
11
- class AlertEntityRow extends React.Component {
12
- render() {
13
- let alertDefinition = this.props.adaptableObject;
14
- let messageTypes = ['Info', 'Success', 'Warning', 'Error'];
15
- let colItems = (0, Helper_1.cloneObject)(this.props.colItems);
16
- colItems[0].Content = (React.createElement(EntityRowItem_1.EntityRowItem, { Content: this.props.api.columnScopeApi.getScopeToString(alertDefinition.Scope) }));
17
- colItems[1].Content = (React.createElement(EntityRowItem_1.EntityRowItem, { Content: this.props.api.alertApi.internalApi.getAlertRuleDescription(alertDefinition) }));
18
- colItems[2].Content = (React.createElement("div", null,
19
- React.createElement(DropdownButton_1.default, { showClearButton: false, items: messageTypes.map((item) => ({
20
- value: item,
21
- label: item,
22
- onClick: () => this.onMessageTypeChanged(alertDefinition, item),
23
- })), columns: ['label'], accessLevel: this.props.accessLevel }, alertDefinition.MessageType)));
24
- colItems[3].Content = (React.createElement(EntityListActionButtons_1.EntityListActionButtons, { showSuspend: true, suspendableObject: alertDefinition, confirmDeleteAction: this.props.onDeleteConfirm, showShare: this.props.teamSharingActivated, editClick: () => this.props.onEdit(alertDefinition), shareClick: (config) => this.props.onShare(config),
25
- //overrideDisableEdit={!this.props.Column}
26
- entityType: this.props.moduleInfo.FriendlyName, accessLevel: this.props.accessLevel, onSuspend: this.props.onSuspend, onUnSuspend: this.props.onUnSuspend }));
27
- return React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { isSuspended: alertDefinition.IsSuspended, colItems: colItems });
28
- }
29
- onMessageTypeChanged(alertDefinition, value) {
30
- this.props.onChangeMessageType(alertDefinition, value);
31
- }
32
- }
33
- exports.AlertEntityRow = AlertEntityRow;