@adaptabletools/adaptable 22.0.0-canary.3 → 22.0.0-canary.4

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 (85) hide show
  1. package/index.css +12 -3
  2. package/index.css.map +1 -1
  3. package/package.json +1 -1
  4. package/src/AdaptableOptions/ActionColumnOptions.d.ts +2 -2
  5. package/src/AdaptableOptions/CustomSortOptions.d.ts +5 -0
  6. package/src/AdaptableOptions/DashboardOptions.d.ts +1 -2
  7. package/src/AdaptableOptions/ToolPanelOptions.d.ts +1 -2
  8. package/src/AdaptableState/AlertState.d.ts +2 -2
  9. package/src/AdaptableState/ChartingState.d.ts +3 -3
  10. package/src/AdaptableState/Common/AdaptableAlert.d.ts +2 -2
  11. package/src/AdaptableState/Common/AdaptableButton.d.ts +2 -2
  12. package/src/AdaptableState/Common/AdaptableFlashingCell.d.ts +2 -2
  13. package/src/AdaptableState/Common/AdaptableObject.d.ts +25 -2
  14. package/src/AdaptableState/Common/RowSummary.d.ts +1 -1
  15. package/src/AdaptableState/Common/Schedule.d.ts +3 -4
  16. package/src/AdaptableState/Common/SystemStatusMessageInfo.d.ts +2 -2
  17. package/src/AdaptableState/CustomSortState.d.ts +2 -2
  18. package/src/AdaptableState/DashboardState.d.ts +2 -2
  19. package/src/AdaptableState/ExportState.d.ts +2 -2
  20. package/src/AdaptableState/FlashingCellState.d.ts +2 -2
  21. package/src/AdaptableState/FormatColumnState.d.ts +2 -2
  22. package/src/AdaptableState/LayoutState.d.ts +8 -3
  23. package/src/AdaptableState/NamedQueryState.d.ts +2 -2
  24. package/src/AdaptableState/PlusMinusState.d.ts +2 -2
  25. package/src/AdaptableState/ShortcutState.d.ts +2 -2
  26. package/src/AdaptableState/StyledColumnState.d.ts +1 -1
  27. package/src/AdaptableState/ThemeState.d.ts +2 -2
  28. package/src/Api/CustomSortApi.d.ts +6 -3
  29. package/src/Api/Implementation/CustomSortApiImpl.d.ts +5 -1
  30. package/src/Api/Implementation/CustomSortApiImpl.js +2 -2
  31. package/src/Api/Implementation/LayoutHelpers.js +7 -0
  32. package/src/Api/Implementation/ScheduleApiImpl.js +1 -0
  33. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +1 -1
  34. package/src/Strategy/AlertModule.js +4 -0
  35. package/src/Strategy/CustomSortModule.js +4 -0
  36. package/src/Strategy/FlashingCellModule.js +5 -0
  37. package/src/Strategy/FormatColumnModule.js +4 -0
  38. package/src/Strategy/LayoutModule.js +4 -4
  39. package/src/Strategy/PlusMinusModule.js +4 -0
  40. package/src/Strategy/ScheduleModule.js +4 -0
  41. package/src/Strategy/ShortcutModule.js +4 -0
  42. package/src/Utilities/Extensions/StringExtensions.d.ts +2 -0
  43. package/src/Utilities/Extensions/StringExtensions.js +16 -0
  44. package/src/Utilities/Helpers/FormatHelper.js +9 -2
  45. package/src/Utilities/ObjectFactory.js +15 -2
  46. package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +2 -1
  47. package/src/View/Alert/Wizard/AlertTypeWizardSection.d.ts +5 -2
  48. package/src/View/Alert/Wizard/AlertTypeWizardSection.js +47 -12
  49. package/src/View/Alert/Wizard/AlertWizard.js +14 -10
  50. package/src/View/Components/Buttons/EntityListActionButtons.d.ts +1 -2
  51. package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.d.ts +1 -2
  52. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.d.ts +2 -1
  53. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +40 -14
  54. package/src/View/CustomSort/Wizard/CustomSortWizard.js +4 -4
  55. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -0
  56. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.d.ts +2 -1
  57. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +34 -14
  58. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +14 -10
  59. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +47 -29
  60. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +20 -9
  61. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +8 -0
  62. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +32 -9
  63. package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +20 -15
  64. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsIPushPull.js +12 -1
  65. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsOpenFin.js +12 -1
  66. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +12 -2
  67. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +12 -1
  68. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.d.ts +2 -1
  69. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/isSettingsValid.js +10 -1
  70. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.d.ts +2 -1
  71. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +25 -4
  72. package/src/View/Shortcut/Wizard/ShortcutWizard.js +18 -14
  73. package/src/env.js +2 -2
  74. package/src/layout-manager/src/LayoutManagerModel.d.ts +1 -0
  75. package/src/layout-manager/src/index.js +25 -7
  76. package/src/layout-manager/src/normalizeLayoutModel.js +3 -0
  77. package/src/metamodel/adaptable.metamodel.d.ts +30 -0
  78. package/src/metamodel/adaptable.metamodel.js +1 -1
  79. package/src/migration/AdaptableUpgradeHelper.js +1 -1
  80. package/src/migration/VersionUpgrade22.d.ts +15 -0
  81. package/src/migration/VersionUpgrade22.js +160 -0
  82. package/src/types.d.ts +1 -2
  83. package/tsconfig.esm.tsbuildinfo +1 -1
  84. package/src/AdaptableState/Common/SuspendableObject.d.ts +0 -10
  85. package/src/AdaptableState/Common/SuspendableObject.js +0 -1
@@ -1,9 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import { AlertType } from '../Utilities/getAlertType';
3
+ import { AdaptableApi, AlertDefinition } from '../../../types';
4
+ export declare const isSettingsValid: (data: AlertDefinition, api: AdaptableApi) => true | "Name is required" | "An Alert already exists with that name";
3
5
  export declare const renderAlertTypeSummary: (alertType: AlertType) => React.JSX.Element;
4
- type AlertBehaviourWizardSectionProps = {
6
+ type AlertTypeWizardSectionProps = {
5
7
  onAlertTypeChange: (alertType: AlertType) => void;
6
8
  alertType: AlertType | null;
9
+ onChange: (data: AlertDefinition) => void;
7
10
  };
8
- export declare const AlertTypeWizardSection: (props: AlertBehaviourWizardSectionProps) => React.JSX.Element;
11
+ export declare const AlertTypeWizardSection: (props: AlertTypeWizardSectionProps) => React.JSX.Element;
9
12
  export {};
@@ -3,20 +3,55 @@ import { Tabs } from '../../../components/Tabs';
3
3
  import { AlertType, getAlertTypeText } from '../Utilities/getAlertType';
4
4
  import { TypeRadio } from '../../Wizard/TypeRadio';
5
5
  import { Tag } from '../../../components/Tag';
6
- import { Box, Flex } from '../../../components/Flex';
6
+ import { Flex } from '../../../components/Flex';
7
+ import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
8
+ import FormLayout, { FormRow } from '../../../components/FormLayout';
9
+ import Input from '../../../components/Input';
10
+ import { SummaryText } from '../../Wizard/OnePageAdaptableWizard';
11
+ export const isSettingsValid = (data, api) => {
12
+ if (!data.Name?.trim()) {
13
+ return 'Name is required';
14
+ }
15
+ const allAlerts = api.alertApi.getAlertDefinitions();
16
+ const isDuplicateName = allAlerts.some((a) => a.Name === data.Name && a.Uuid !== data.Uuid);
17
+ if (isDuplicateName) {
18
+ return 'An Alert already exists with that name';
19
+ }
20
+ return true;
21
+ };
7
22
  export const renderAlertTypeSummary = (alertType) => {
23
+ const { data } = useOnePageAdaptableWizardContext();
8
24
  const text = getAlertTypeText(alertType);
9
- return (React.createElement(Box, null,
10
- React.createElement(Tag, null, text)));
25
+ return (React.createElement(React.Fragment, null,
26
+ React.createElement(SummaryText, null,
27
+ "Name ",
28
+ React.createElement(Tag, null, data.Name || 'Not specified')),
29
+ React.createElement(SummaryText, null,
30
+ "Type ",
31
+ React.createElement(Tag, null, text))));
11
32
  };
12
33
  export const AlertTypeWizardSection = (props) => {
13
- return (React.createElement(Tabs, null,
14
- React.createElement(Tabs.Tab, null, "Alert Type"),
15
- React.createElement(Tabs.Content, null,
16
- React.createElement(Flex, { flexDirection: "column" },
17
- React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.DataChange), description: "A change has been made to the Grid's underlying data", checked: props.alertType === AlertType.DataChange, onClick: () => props.onAlertTypeChange(AlertType.DataChange) }),
18
- React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.RowChange), description: "A Row was added or removed from the data source", checked: props.alertType === AlertType.RowChange, onClick: () => props.onAlertTypeChange(AlertType.RowChange) }),
19
- React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.Aggregation), description: "A change has been made to aggregated data (i.e. from multiple Rows)", onClick: () => props.onAlertTypeChange(AlertType.Aggregation), checked: props.alertType === AlertType.Aggregation }),
20
- React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.Observable), description: "A specified change (or lack of change) over time has been observed in the Grid", onClick: () => props.onAlertTypeChange(AlertType.Observable), checked: props.alertType === AlertType.Observable }),
21
- React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.Validation), description: "A change has broken a data validation rule", checked: props.alertType === AlertType.Validation, onClick: () => props.onAlertTypeChange(AlertType.Validation) })))));
34
+ const { data } = useOnePageAdaptableWizardContext();
35
+ const handleNameChange = (event) => {
36
+ props.onChange({
37
+ ...data,
38
+ Name: event.target.value,
39
+ });
40
+ };
41
+ return (React.createElement(Flex, { flexDirection: "column" },
42
+ React.createElement(Tabs, null,
43
+ React.createElement(Tabs.Tab, null, "Settings"),
44
+ React.createElement(Tabs.Content, null,
45
+ React.createElement(FormLayout, null,
46
+ React.createElement(FormRow, { label: "Name" },
47
+ React.createElement(Input, { "data-name": "alert-name", className: "twa:flex-1 twa:max-w-[200px] twa:mr-3", onChange: handleNameChange, placeholder: "Enter Name", value: data.Name ?? '' }))))),
48
+ React.createElement(Tabs, { className: "twa:mt-2" },
49
+ React.createElement(Tabs.Tab, null, "Alert Type"),
50
+ React.createElement(Tabs.Content, null,
51
+ React.createElement(Flex, { flexDirection: "column" },
52
+ React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.DataChange), description: "A change has been made to the Grid's underlying data", checked: props.alertType === AlertType.DataChange, onClick: () => props.onAlertTypeChange(AlertType.DataChange) }),
53
+ React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.RowChange), description: "A Row was added or removed from the data source", checked: props.alertType === AlertType.RowChange, onClick: () => props.onAlertTypeChange(AlertType.RowChange) }),
54
+ React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.Aggregation), description: "A change has been made to aggregated data (i.e. from multiple Rows)", onClick: () => props.onAlertTypeChange(AlertType.Aggregation), checked: props.alertType === AlertType.Aggregation }),
55
+ React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.Observable), description: "A specified change (or lack of change) over time has been observed in the Grid", onClick: () => props.onAlertTypeChange(AlertType.Observable), checked: props.alertType === AlertType.Observable }),
56
+ React.createElement(TypeRadio, { text: getAlertTypeText(AlertType.Validation), description: "A change has broken a data validation rule", checked: props.alertType === AlertType.Validation, onClick: () => props.onAlertTypeChange(AlertType.Validation) }))))));
22
57
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useState } from 'react';
2
+ import { useState, useCallback } from 'react';
3
3
  import { OnePageAdaptableWizard, OnePageWizardSummary } from '../../Wizard/OnePageAdaptableWizard';
4
4
  import { cloneObject } from '../../../Utilities/Helpers/Helper';
5
5
  import { AlertScopeWizardSection } from './AlertScopeWizardSection';
@@ -15,7 +15,7 @@ import { useDispatch } from 'react-redux';
15
15
  import * as AlertRedux from '../../../Redux/ActionsReducers/AlertRedux';
16
16
  import { useAdaptable } from '../../AdaptableContext';
17
17
  import { ObjectTagsWizardSection, renderObjectTagsSummary, } from '../../Wizard/ObjectTagsWizardSection';
18
- import { AlertTypeWizardSection, renderAlertTypeSummary } from './AlertTypeWizardSection';
18
+ import { AlertTypeWizardSection, renderAlertTypeSummary, isSettingsValid, } from './AlertTypeWizardSection';
19
19
  import { AlertType, getAlertType } from '../Utilities/getAlertType';
20
20
  import { mapAlertDefinition } from '../Utilities/mapAlertDefinition';
21
21
  import { getDefaultAlertDefinition } from '../Utilities/getDefaultAlertDefinition';
@@ -25,7 +25,7 @@ export const AlertWizard = (props) => {
25
25
  const { api } = useAdaptable();
26
26
  const dispatch = useDispatch();
27
27
  const behaviourSpelling = api.internalApi.getCorrectEnglishVariant('Behaviour');
28
- const [alertDefinition, setAlertDefinition] = useState(() => {
28
+ const [alertDefinition, doSetAlertDefinition] = useState(() => {
29
29
  const alertDefinition = props.data
30
30
  ? cloneObject(props.data)
31
31
  : ObjectFactory.CreateEmptyAlertDefinition();
@@ -45,6 +45,9 @@ export const AlertWizard = (props) => {
45
45
  alertDefinition.MessageType = alertDefinition.MessageType ?? ALERT_DEFAULT_MESSAGE_TYPE;
46
46
  return alertDefinition;
47
47
  });
48
+ const setAlertDefinition = useCallback((data) => {
49
+ doSetAlertDefinition(data);
50
+ }, []);
48
51
  // Alert type is based initialy on data, but can be changed by the user
49
52
  // the default objects do not neccesary have enough information to determine the type
50
53
  const [alertType, setAlertType] = useState(() => {
@@ -59,22 +62,23 @@ export const AlertWizard = (props) => {
59
62
  }
60
63
  props.onCloseWizard();
61
64
  };
62
- const updateAlertDefinition = (newAlertDefinition) => {
63
- setAlertDefinition(mapAlertDefinition(api, newAlertDefinition));
64
- };
65
+ const updateAlertDefinition = useCallback((newAlertDefinition) => {
66
+ doSetAlertDefinition(mapAlertDefinition(api, newAlertDefinition));
67
+ }, [api]);
65
68
  const handleAlertTypeChange = (newAlertType) => {
66
69
  setAlertType(newAlertType);
67
- setAlertDefinition(getDefaultAlertDefinition(alertDefinition, newAlertType));
70
+ doSetAlertDefinition(getDefaultAlertDefinition(alertDefinition, newAlertType));
68
71
  };
69
72
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, modal: props.modal, data: alertDefinition, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
70
73
  {
71
- title: 'Type',
74
+ title: 'Name & Type',
75
+ isValid: isSettingsValid,
72
76
  details: (React.createElement(React.Fragment, null,
73
- "Select ",
77
+ "Enter Name and select ",
74
78
  React.createElement("b", null, "what"),
75
79
  " type of change in AdapTable will cause the Alert to fire")),
76
80
  render: () => (React.createElement(Box, { className: "twa:p-2" },
77
- React.createElement(AlertTypeWizardSection, { alertType: alertType, onAlertTypeChange: handleAlertTypeChange }))),
81
+ React.createElement(AlertTypeWizardSection, { alertType: alertType, onAlertTypeChange: handleAlertTypeChange, onChange: setAlertDefinition }))),
78
82
  renderSummary: () => renderAlertTypeSummary(alertType),
79
83
  },
80
84
  {
@@ -2,8 +2,7 @@ import * as React from 'react';
2
2
  import * as Redux from 'redux';
3
3
  import { AccessLevel } from '../../../AdaptableState/Common/Entitlement';
4
4
  import { AdaptableSharedEntityConfig } from '../../../AdaptableState/TeamSharingState';
5
- import { AdaptableObject } from '../../../AdaptableState/Common/AdaptableObject';
6
- import { SuspendableObject } from '../../../AdaptableState/Common/SuspendableObject';
5
+ import { AdaptableObject, SuspendableObject } from '../../../AdaptableState/Common/AdaptableObject';
7
6
  export interface EntityListActionButtonsProps extends React.ClassAttributes<EntityListActionButtons> {
8
7
  editClick?: () => void;
9
8
  cloneClick?: () => void;
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { AdaptableObject } from '../../../../AdaptableState/Common/AdaptableObject';
2
+ import { AdaptableObject, SuspendableObject } from '../../../../AdaptableState/Common/AdaptableObject';
3
3
  import { AccessLevel } from '../../../../AdaptableState/Common/Entitlement';
4
- import { SuspendableObject } from '../../../../AdaptableState/Common/SuspendableObject';
5
4
  interface EntityListSuspendButtonProps {
6
5
  onSuspend: (adaptableObject: AdaptableObject) => void;
7
6
  onUnSuspend: (adaptableObject: AdaptableObject) => void;
@@ -3,7 +3,8 @@ import { CustomSort } from '../../../AdaptableState/CustomSortState';
3
3
  export type CustomSortColumnWizardSectionProps = {
4
4
  onChange: (data: CustomSort) => void;
5
5
  isNew: boolean;
6
+ allCustomSorts: CustomSort[];
6
7
  };
7
8
  export declare const renderCustomSortColumn: (data: CustomSort) => React.JSX.Element;
8
- export declare const isValidCustomSortColumn: (data: CustomSort) => true | string;
9
+ export declare const isValidCustomSortColumn: (data: CustomSort, allCustomSorts: CustomSort[]) => true | string;
9
10
  export declare const CustomSortColumnWizardSection: (props: CustomSortColumnWizardSectionProps) => React.JSX.Element;
@@ -3,14 +3,26 @@ import { Tabs } from '../../../components/Tabs';
3
3
  import { Tag } from '../../../components/Tag';
4
4
  import { NewColumnSelector } from '../../Components/ColumnSelector';
5
5
  import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
6
- import { Box } from '../../../components/Flex';
6
+ import { Box, Flex } from '../../../components/Flex';
7
+ import FormLayout, { FormRow } from '../../../components/FormLayout';
8
+ import Input from '../../../components/Input';
7
9
  export const renderCustomSortColumn = (data) => {
8
10
  const { api } = useOnePageAdaptableWizardContext();
9
11
  return (React.createElement(Box, { className: "twa:text-2 twa:py-2 twa:pr-2" },
10
- "Custom sort column: ",
11
- React.createElement(Tag, null, api.columnApi.getFriendlyNameForColumnId(data.ColumnId))));
12
+ React.createElement(Tag, { className: "twa:mr-2" },
13
+ "Name: ",
14
+ data.Name),
15
+ React.createElement(Tag, null,
16
+ "Column: ",
17
+ api.columnApi.getFriendlyNameForColumnId(data.ColumnId))));
12
18
  };
13
- export const isValidCustomSortColumn = (data) => {
19
+ export const isValidCustomSortColumn = (data, allCustomSorts) => {
20
+ if (!data.Name) {
21
+ return 'Custom Sort Name cannot be blank';
22
+ }
23
+ if (allCustomSorts.some((customSort) => customSort.Name === data.Name && customSort.Uuid !== data.Uuid)) {
24
+ return 'A Custom Sort already exists with that name';
25
+ }
14
26
  if (!data.ColumnId) {
15
27
  return 'You have to select a Column for Custom Sort';
16
28
  }
@@ -42,14 +54,28 @@ export const CustomSortColumnWizardSection = (props) => {
42
54
  });
43
55
  });
44
56
  }, []);
45
- return (React.createElement(Tabs, { style: { height: '100%' } },
46
- React.createElement(Tabs.Tab, null, "Column"),
47
- React.createElement(Tabs.Content, null,
48
- React.createElement(NewColumnSelector, { availableColumns: sortableCols, selected: data.ColumnId ? [data.ColumnId] : [], singleSelect: true, onChange: (ids) => {
49
- props.onChange({
50
- ...data,
51
- SortedValues: [],
52
- ColumnId: ids[0],
53
- });
54
- }, allowReorder: false }))));
57
+ const onNameChange = (event) => {
58
+ props.onChange({
59
+ ...data,
60
+ Name: event.target.value,
61
+ });
62
+ };
63
+ return (React.createElement(Flex, { flexDirection: "column", style: { height: '100%' } },
64
+ React.createElement(Tabs, { className: "twa:mb-3" },
65
+ React.createElement(Tabs.Tab, null, "Settings"),
66
+ React.createElement(Tabs.Content, null,
67
+ React.createElement(Flex, { flexDirection: "row" },
68
+ React.createElement(FormLayout, { className: "twa:max-w-[300px] twa:w-full" },
69
+ React.createElement(FormRow, { label: "Name" },
70
+ React.createElement(Input, { className: "twa:w-full", "data-name": "custom-sort-name", onChange: onNameChange, value: data?.Name ?? '' })))))),
71
+ React.createElement(Tabs, { style: { flex: 1, minHeight: 0 } },
72
+ React.createElement(Tabs.Tab, null, "Column"),
73
+ React.createElement(Tabs.Content, null,
74
+ React.createElement(NewColumnSelector, { availableColumns: sortableCols, selected: data.ColumnId ? [data.ColumnId] : [], singleSelect: true, onChange: (ids) => {
75
+ props.onChange({
76
+ ...data,
77
+ SortedValues: [],
78
+ ColumnId: ids[0],
79
+ });
80
+ }, allowReorder: false })))));
55
81
  };
@@ -37,14 +37,14 @@ export const CustomSortWizard = (props) => {
37
37
  };
38
38
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: customSort, onFinish: handleFinish, onHide: props.onCloseWizard, sections: [
39
39
  {
40
- isValid: isValidCustomSortColumn,
40
+ isValid: (data) => isValidCustomSortColumn(data, allCustomSorts),
41
41
  renderSummary: renderCustomSortColumn,
42
- details: 'Select a Column for Custom Sort',
42
+ details: 'Enter Name and select a Column for Custom Sort',
43
43
  render: () => {
44
44
  return (React.createElement(Box, { className: "twa:p-2 twa:h-full" },
45
- React.createElement(CustomSortColumnWizardSection, { isNew: props.isNew, onChange: setCustomSort })));
45
+ React.createElement(CustomSortColumnWizardSection, { isNew: props.isNew, onChange: setCustomSort, allCustomSorts: allCustomSorts })));
46
46
  },
47
- title: 'Column',
47
+ title: 'Name & Column',
48
48
  },
49
49
  {
50
50
  title: 'Sort Order',
@@ -160,6 +160,7 @@ const buildAdaptableOptions = (mainAdaptableInstance, adaptableContainerId, agGr
160
160
  Revision: Date.now(),
161
161
  FormatColumns: [
162
162
  {
163
+ Name: 'Changed At',
163
164
  Scope: {
164
165
  ColumnIds: ['changeInfo.changedAt'],
165
166
  },
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
- import { FlashingCellDefinition } from '../../../types';
2
+ import { AdaptableApi, FlashingCellDefinition } from '../../../types';
3
3
  type FlashingAlertDurationWizardSectionProps = {
4
4
  readOnly?: boolean;
5
5
  flashingCell?: FlashingCellDefinition;
6
6
  onChange: (data: FlashingCellDefinition) => void;
7
7
  };
8
+ export declare const isSettingsValid: (data: FlashingCellDefinition, api: AdaptableApi) => true | "Name is required" | "A Flashing Cell already exists with that name";
8
9
  export declare const renderFlashingAlertSettingsSummary: (flashingAlert: FlashingCellDefinition) => React.JSX.Element;
9
10
  export declare const FlashingAlertSettingsWizardSection: (props: FlashingAlertDurationWizardSectionProps) => React.JSX.Element;
10
11
  export {};
@@ -2,15 +2,30 @@ import * as React from 'react';
2
2
  import { useRef } from 'react';
3
3
  import Input from '../../../components/Input';
4
4
  import usePrevious from '../../../components/utils/usePrevious';
5
- import Radio from '../../../components/Radio';
6
5
  import { Tabs } from '../../../components/Tabs';
7
6
  import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
8
7
  import { CodeBlock } from '../../../components/CodeBlock';
9
8
  import FormLayout, { FormRow } from '../../../components/FormLayout';
10
9
  import { CheckBox } from '../../../components/CheckBox';
11
10
  import { Box, Flex } from '../../../components/Flex';
11
+ import { Tag } from '../../../components/Tag';
12
+ import { SummaryText } from '../../Wizard/OnePageAdaptableWizard';
13
+ export const isSettingsValid = (data, api) => {
14
+ if (!data.Name?.trim()) {
15
+ return 'Name is required';
16
+ }
17
+ const allFlashingCells = api.flashingCellApi.getFlashingCellDefinitions();
18
+ const isDuplicateName = allFlashingCells.some((fc) => fc.Name === data.Name && fc.Uuid !== data.Uuid);
19
+ if (isDuplicateName) {
20
+ return 'A Flashing Cell already exists with that name';
21
+ }
22
+ return true;
23
+ };
12
24
  export const renderFlashingAlertSettingsSummary = (flashingAlert) => {
13
25
  return (React.createElement(React.Fragment, null,
26
+ React.createElement(SummaryText, null,
27
+ "Name ",
28
+ React.createElement(Tag, null, flashingAlert.Name || 'Not specified')),
14
29
  React.createElement(Box, { className: "twa:text-2" }, flashingAlert.FlashDuration === 'always' ? (React.createElement(React.Fragment, null, "Flashing is never removed")) : (React.createElement(React.Fragment, null,
15
30
  "Flashing is removed after ",
16
31
  React.createElement(CodeBlock, null, flashingAlert.FlashDuration),
@@ -20,6 +35,12 @@ export const renderFlashingAlertSettingsSummary = (flashingAlert) => {
20
35
  export const FlashingAlertSettingsWizardSection = (props) => {
21
36
  let { data: flashingCell } = useOnePageAdaptableWizardContext();
22
37
  flashingCell = flashingCell ?? props.flashingCell;
38
+ const handleNameChange = (event) => {
39
+ props.onChange({
40
+ ...flashingCell,
41
+ Name: event.target.value,
42
+ });
43
+ };
23
44
  const setDuration = (FlashDuration) => {
24
45
  props.onChange({ ...flashingCell, FlashDuration: FlashDuration });
25
46
  };
@@ -58,23 +79,22 @@ export const FlashingAlertSettingsWizardSection = (props) => {
58
79
  React.createElement(Tabs.Tab, null, "Flashing Cell Settings"),
59
80
  React.createElement(Tabs.Content, null,
60
81
  React.createElement(FormLayout, null,
61
- React.createElement(FormRow, { label: "Duration Type" },
62
- React.createElement(Radio, { "data-name": "duration-type-always", className: "twa:mr-3", checked: duration == 'always', tabIndex: -1, onChange: () => handleTypeChange('always') }, "Always"),
63
- React.createElement(Radio, { "data-name": "duration-type-number", checked: duration !== 'always', tabIndex: -1, onChange: () => handleTypeChange('number') }, "Limited (ms)")),
64
- React.createElement(FormRow, { label: "" },
65
- duration !== 'always' && (React.createElement(Flex, { flexDirection: "row", alignItems: "baseline" },
66
- React.createElement(Box, { className: "twa:text-2 twa:mr-2" }, "After"),
67
- React.createElement(Input, { "data-name": "duration-input", readOnly: props.readOnly, type: "text", name: "value", ref: inputRef, className: "twa:mt-2 twa:mr-1", value: duration, onChange: (event) => {
68
- const value = event.target.value;
69
- setDuration(isNaN(Number(value)) ? 500 : Number(value));
70
- } }),
71
- React.createElement(Box, { className: "twa:text-2" }, "milliseconds"))),
72
- duration === 'always' && (React.createElement(Box, { className: "twa:text-3 twa:h-[43px]" }, "Persists the flashing style indeterminately - can be removed manually"))),
82
+ React.createElement(FormRow, { label: "Name" },
83
+ React.createElement(Input, { "data-name": "flashing-cell-name", className: "twa:flex-1 twa:mr-3", onChange: handleNameChange, placeholder: "Enter Name", value: flashingCell.Name ?? '' })),
73
84
  React.createElement(FormRow, { label: "Flash Target" },
74
85
  React.createElement(CheckBox, { "data-name": "flashing-target", onChange: (checked) => handleTargetChange('cell', checked), className: "twa:mr-3", checked: flashingCell?.FlashTarget === 'cell' ||
75
86
  flashingCell?.FlashTarget?.includes?.('cell'), tabIndex: -1 }, "Cell"),
76
87
  React.createElement(CheckBox, { "data-name": "flashing-target-row", className: "twa:mr-3", onChange: (checked) => handleTargetChange('row', checked), checked: flashingCell?.FlashTarget === 'row' ||
77
88
  flashingCell?.FlashTarget?.includes?.('row'), tabIndex: -1 }, "Row"),
78
89
  React.createElement(CheckBox, { "data-name": "flashing-target-aggFuncCell", onChange: (checked) => handleTargetChange('aggFuncCell', checked), checked: flashingCell?.FlashTarget === 'aggFuncCell' ||
79
- flashingCell?.FlashTarget?.includes?.('aggFuncCell'), tabIndex: -1 }, "Aggregated Function Cell")))))));
90
+ flashingCell?.FlashTarget?.includes?.('aggFuncCell'), tabIndex: -1 }, "Aggregated Function Cell")),
91
+ React.createElement(FormRow, { label: "Duration" },
92
+ React.createElement(Flex, { alignItems: "center" },
93
+ React.createElement(CheckBox, { "data-name": "duration-always", checked: duration === 'always', onChange: (checked) => handleTypeChange(checked ? 'always' : 'number'), className: "twa:mr-4", tabIndex: -1 }, "Always"),
94
+ duration !== 'always' && (React.createElement(React.Fragment, null,
95
+ React.createElement(Input, { "data-name": "duration-input", readOnly: props.readOnly, type: "number", name: "value", ref: inputRef, className: "twa:w-20 twa:mr-2", value: duration, onChange: (event) => {
96
+ const value = event.target.value;
97
+ setDuration(isNaN(Number(value)) ? 500 : Number(value));
98
+ } }),
99
+ React.createElement(Box, { className: "twa:text-2" }, "ms"))))))))));
80
100
  };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useState, useCallback } from 'react';
3
3
  import { OnePageAdaptableWizard, OnePageWizardSummary } from '../../Wizard/OnePageAdaptableWizard';
4
- import { FlashingAlertSettingsWizardSection, renderFlashingAlertSettingsSummary, } from './FlashingCellSettingsWizardSection';
4
+ import { FlashingAlertSettingsWizardSection, renderFlashingAlertSettingsSummary, isSettingsValid, } from './FlashingCellSettingsWizardSection';
5
5
  import { cloneObject } from '../../../Utilities/Helpers/Helper';
6
6
  import { FlashingAlertRulesWizardSection, renderFlashingAlertRulesSummary, } from './FlashingCellRulesWizardSection';
7
7
  import { FlashingAlertStyleWizardSection, renderFlashingAlertStyleSummary, } from './FlashingCellStyleWizardSection';
@@ -17,7 +17,7 @@ import { ObjectTagsWizardSection, renderObjectTagsSummary, } from '../../Wizard/
17
17
  import { Box } from '../../../components/Flex';
18
18
  export const FlashingCellWizard = (props) => {
19
19
  const { api } = useAdaptable();
20
- const [flashingCell, setFlashingCell] = useState(() => {
20
+ const [flashingCell, doSetFlashingCell] = useState(() => {
21
21
  let flashingCell = props.data
22
22
  ? cloneObject(props.data)
23
23
  : ObjectFactory.CreateEmptyFlashingCellDefinition();
@@ -33,9 +33,12 @@ export const FlashingCellWizard = (props) => {
33
33
  }
34
34
  return flashingCell;
35
35
  });
36
+ const setFlashingCell = useCallback((data) => {
37
+ doSetFlashingCell(data);
38
+ }, []);
36
39
  const updateProperty = (propName) => {
37
40
  return (value) => {
38
- setFlashingCell((flashingCell) => {
41
+ doSetFlashingCell((flashingCell) => {
39
42
  flashingCell = { ...flashingCell, [propName]: value };
40
43
  return flashingCell;
41
44
  });
@@ -57,6 +60,14 @@ export const FlashingCellWizard = (props) => {
57
60
  props.onFinishWizard(flashingCell);
58
61
  };
59
62
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: flashingCell, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
63
+ {
64
+ details: 'Set Name, Duration and Target Properties',
65
+ isValid: isSettingsValid,
66
+ render: () => (React.createElement(Box, { className: "twa:p-2" },
67
+ React.createElement(FlashingAlertSettingsWizardSection, { onChange: setFlashingCell }))),
68
+ renderSummary: renderFlashingAlertSettingsSummary,
69
+ title: 'Settings',
70
+ },
60
71
  {
61
72
  details: 'Specify which data changes should trigger Cell Flashing',
62
73
  isValid: isScopeValid,
@@ -80,13 +91,6 @@ export const FlashingCellWizard = (props) => {
80
91
  renderSummary: renderFlashingAlertStyleSummary,
81
92
  title: 'Flash Styles',
82
93
  },
83
- {
84
- details: 'Set Duration and Target Properties',
85
- render: () => (React.createElement(Box, { className: "twa:p-2" },
86
- React.createElement(FlashingAlertSettingsWizardSection, { onChange: setFlashingCell }))),
87
- renderSummary: renderFlashingAlertSettingsSummary,
88
- title: 'Settings',
89
- },
90
94
  {
91
95
  details: 'Select Flashing Cell Tags',
92
96
  title: 'Tags',
@@ -5,9 +5,13 @@ import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableW
5
5
  import { Tag } from '../../../components/Tag';
6
6
  import Radio, { RadioGroup } from '../../../components/Radio';
7
7
  import { Box, Flex } from '../../../components/Flex';
8
- import { Card } from '../../../components/Card';
8
+ import { Tabs } from '../../../components/Tabs';
9
+ import Input from '../../../components/Input';
9
10
  export const renderFormatColumnSettingsSummary = (data) => {
10
11
  return (React.createElement(Box, { className: "twa:p-2" },
12
+ React.createElement(Box, { className: "twa:mt-3" },
13
+ "Name ",
14
+ React.createElement(Tag, null, data.Name)),
11
15
  React.createElement(Box, { className: "twa:mt-3" },
12
16
  "Data Rows ",
13
17
  React.createElement(Tag, null, data.RowScope?.ExcludeDataRows ? 'no' : 'yes')),
@@ -30,6 +34,12 @@ export const renderFormatColumnSettingsSummary = (data) => {
30
34
  };
31
35
  export const FormatColumnSettingsWizardSection = (props) => {
32
36
  const { data } = useOnePageAdaptableWizardContext();
37
+ const onNameChange = (event) => {
38
+ props.onChange({
39
+ ...data,
40
+ Name: event.target.value,
41
+ });
42
+ };
33
43
  const onExcludeDataRowsChanged = (ExcludeDataRows) => {
34
44
  props.onChange({
35
45
  ...data,
@@ -66,32 +76,40 @@ export const FormatColumnSettingsWizardSection = (props) => {
66
76
  },
67
77
  });
68
78
  };
69
- return (React.createElement(Card, null,
70
- React.createElement(Card.Title, null, "Settings"),
71
- React.createElement(Card.Body, null,
72
- React.createElement(Flex, { flexDirection: "row" },
73
- React.createElement(FormLayout, null,
74
- data.Target === 'cell' && (React.createElement(React.Fragment, null,
75
- React.createElement(FormRow, { label: "Exclude Data Rows:" },
76
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
77
- React.createElement(CheckBox, { "data-name": "exclude-data-rows-checkbox", checked: data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
78
- React.createElement(FormRow, { label: "Exclude Group Rows:" },
79
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
80
- React.createElement(CheckBox, { "data-name": "exclude-grouped-rows-checkbox", checked: data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
81
- React.createElement(FormRow, { label: "Exclude Row Summaries:" },
82
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
83
- React.createElement(CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked: data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
84
- React.createElement(FormRow, { label: "Exclude Total Rows:" },
85
- React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
86
- React.createElement(CheckBox, { "data-name": "exclude-total-rows-checkbox", checked: data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" }))))),
87
- React.createElement(FormRow, { label: "Apply on Column Group:" },
88
- React.createElement(RadioGroup, { value: data.ColumnGroupScope || 'Both', name: "columnGroupScope", orientation: "horizontal", onRadioChange: (columnGroupScope) => {
89
- props.onChange({
90
- ...data,
91
- ColumnGroupScope: columnGroupScope,
92
- });
93
- } },
94
- React.createElement(Radio, { className: "twa:ml-1", value: "Both" }, "Always"),
95
- React.createElement(Radio, { className: "twa:ml-4", value: "Expanded" }, "Expanded"),
96
- React.createElement(Radio, { className: "twa:ml-4", value: "Collapsed" }, "Collapsed"))))))));
79
+ return (React.createElement(Flex, { flexDirection: "column", style: { height: '100%' } },
80
+ React.createElement(Tabs, { className: "twa:mb-3" },
81
+ React.createElement(Tabs.Tab, null, "Settings"),
82
+ React.createElement(Tabs.Content, null,
83
+ React.createElement(Flex, { flexDirection: "row" },
84
+ React.createElement(FormLayout, { className: "twa:max-w-[300px] twa:w-full" },
85
+ React.createElement(FormRow, { label: "Name" },
86
+ React.createElement(Input, { className: "twa:w-full", "data-name": "format-column-name", onChange: onNameChange, value: data?.Name ?? '' })))))),
87
+ React.createElement(Tabs, null,
88
+ React.createElement(Tabs.Tab, null, "Configuration"),
89
+ React.createElement(Tabs.Content, null,
90
+ React.createElement(Flex, { flexDirection: "row" },
91
+ React.createElement(FormLayout, null,
92
+ data.Target === 'cell' && (React.createElement(React.Fragment, null,
93
+ React.createElement(FormRow, { label: "Exclude Data Rows:" },
94
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
95
+ React.createElement(CheckBox, { "data-name": "exclude-data-rows-checkbox", checked: data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
96
+ React.createElement(FormRow, { label: "Exclude Group Rows:" },
97
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
98
+ React.createElement(CheckBox, { "data-name": "exclude-grouped-rows-checkbox", checked: data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
99
+ React.createElement(FormRow, { label: "Exclude Row Summaries:" },
100
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
101
+ React.createElement(CheckBox, { "data-name": "exclude-summary-rows-checkbox", checked: data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
102
+ React.createElement(FormRow, { label: "Exclude Total Rows:" },
103
+ React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
104
+ React.createElement(CheckBox, { "data-name": "exclude-total-rows-checkbox", checked: data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" }))))),
105
+ React.createElement(FormRow, { label: "Apply on Column Group:" },
106
+ React.createElement(RadioGroup, { value: data.ColumnGroupScope || 'Both', name: "columnGroupScope", orientation: "horizontal", onRadioChange: (columnGroupScope) => {
107
+ props.onChange({
108
+ ...data,
109
+ ColumnGroupScope: columnGroupScope,
110
+ });
111
+ } },
112
+ React.createElement(Radio, { className: "twa:ml-1", value: "Both" }, "Always"),
113
+ React.createElement(Radio, { className: "twa:ml-4", value: "Expanded" }, "When Expanded"),
114
+ React.createElement(Radio, { className: "twa:ml-4", value: "Collapsed" }, "When Collapsed")))))))));
97
115
  };
@@ -7,6 +7,7 @@ import { FormatColumnStyleWizardSection, isFormatColumnStyleValid, renderFormatC
7
7
  import { FormatColumnFormatWizardSection, getFormatDisplayTypeForScope, renderFormatColumnFormatSummary, } from './FormatColumnFormatWizardSection';
8
8
  import { useAdaptable } from '../../AdaptableContext';
9
9
  import { FormatColumnSettingsWizardSection, renderFormatColumnSettingsSummary, } from './FormatColumnSettingsWizardSection';
10
+ import { useSelector } from 'react-redux';
10
11
  import { isScopeValid } from '../../Components/NewScopeComponent';
11
12
  import ObjectFactory from '../../../Utilities/ObjectFactory';
12
13
  import { useDispatch } from 'react-redux';
@@ -57,6 +58,7 @@ const adjustFormatColumn = (formatColumn, api) => {
57
58
  };
58
59
  export function FormatColumnWizard(props) {
59
60
  const { api } = useAdaptable();
61
+ const allFormatColumns = useSelector((state) => state.FormatColumn?.FormatColumns ?? []);
60
62
  const data = props.data ?? props.popupParams?.value;
61
63
  const [formatColumn, doSetFormatColumn] = useState(() => {
62
64
  let formatColumn = data ? cloneObject(data) : ObjectFactory.CreateEmptyFormatColumn();
@@ -92,6 +94,24 @@ export function FormatColumnWizard(props) {
92
94
  props.onFinishWizard(formatColumn);
93
95
  };
94
96
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, modal: props.modal, data: formatColumn, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
97
+ {
98
+ title: 'Settings',
99
+ details: 'Enter Name and set Additional Properties',
100
+ isValid: (formatColumnData) => {
101
+ if (!formatColumnData.Name) {
102
+ return 'Format Column Name cannot be blank';
103
+ }
104
+ if (allFormatColumns.some((fc) => fc.Name === formatColumnData.Name && fc.Uuid !== formatColumnData.Uuid)) {
105
+ return 'A Format Column already exists with that name';
106
+ }
107
+ return true;
108
+ },
109
+ renderSummary: renderFormatColumnSettingsSummary,
110
+ render: () => {
111
+ return (React.createElement(Box, { className: "twa:p-2" },
112
+ React.createElement(FormatColumnSettingsWizardSection, { onChange: setFormatColumn })));
113
+ },
114
+ },
95
115
  {
96
116
  title: 'Scope',
97
117
  details: 'Select which Columns will be formatted',
@@ -142,15 +162,6 @@ export function FormatColumnWizard(props) {
142
162
  return React.createElement(FormatColumnFormatWizardSection, { onChange: setFormatColumn });
143
163
  },
144
164
  },
145
- {
146
- title: 'Settings',
147
- details: 'Set Additional Properties',
148
- renderSummary: renderFormatColumnSettingsSummary,
149
- render: () => {
150
- return (React.createElement(Box, { className: "twa:p-2" },
151
- React.createElement(FormatColumnSettingsWizardSection, { onChange: setFormatColumn })));
152
- },
153
- },
154
165
  {
155
166
  details: 'Select Format Column Tags',
156
167
  title: 'Tags',