@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
@@ -7,6 +7,7 @@ import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptab
7
7
  import { columnFilter } from './Utilities';
8
8
  import ArrayExtensions from '../../../../Utilities/Extensions/ArrayExtensions';
9
9
  import { Box } from '../../../../components/Flex';
10
+ import { CheckBox } from '../../../../components/CheckBox';
10
11
  export const PivotColumnsSectionSummary = () => {
11
12
  const adaptable = useAdaptable();
12
13
  const { data: layout } = useOnePageAdaptableWizardContext();
@@ -28,5 +29,12 @@ export const PivotColumnsSection = (props) => {
28
29
  return (React.createElement(Tabs, { className: "twa:h-full" },
29
30
  React.createElement(Tabs.Tab, null, "Pivot Columns"),
30
31
  React.createElement(Tabs.Content, null,
32
+ React.createElement(Box, { className: "twa:mb-3 twa:px-2" },
33
+ React.createElement(CheckBox, { checked: !!layout.PivotResultColumns, onChange: (checked) => {
34
+ props.onChange({
35
+ ...layout,
36
+ PivotResultColumns: checked,
37
+ });
38
+ } }, "Persist Order of Pivot Result Columns")),
31
39
  React.createElement(ValueSelector, { showFilterInput: true, filter: columnFilter, toIdentifier: (option) => `${option.columnId}`, toLabel: (option) => option.friendlyName ?? option.columnId, options: sortedPivotColumns, value: layout.PivotColumns ?? [], allowReorder: true, onChange: handleColumnsChange }))));
32
40
  };
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import Input from '../../../components/Input';
3
- import Radio from '../../../components/Radio';
4
3
  import FormLayout, { FormRow } from '../../../components/FormLayout';
5
4
  import { Tabs } from '../../../components/Tabs';
6
5
  import { useOnePageAdaptableWizardContext, } from '../../Wizard/OnePageAdaptableWizard';
@@ -12,12 +11,26 @@ import { Flex } from '../../../components/Flex';
12
11
  export const PlusMinusSettingsSummary = (props) => {
13
12
  const { data } = useOnePageAdaptableWizardContext();
14
13
  return (React.createElement(React.Fragment, null,
14
+ React.createElement(SummaryText, null,
15
+ "Name ",
16
+ React.createElement(Tag, null, data.Name || 'Not specified')),
15
17
  React.createElement(SummaryText, null,
16
18
  "Nudge Value ",
17
19
  React.createElement(Tag, null, data.NudgeValue ?? 'Not selected')),
20
+ React.createElement(SummaryText, null,
21
+ "Nudge Type ",
22
+ React.createElement(Tag, null, props.hasCondition ? 'Conditional' : 'Always Apply')),
18
23
  props.hasCondition && React.createElement(PlusMinusRuleSummary, null)));
19
24
  };
20
25
  export const isSettingsValid = (hasCondition) => (data, api, context) => {
26
+ if (!data.Name?.trim()) {
27
+ return 'Name is required';
28
+ }
29
+ const allPlusMinusNudges = api.plusMinusApi.getAllPlusMinus();
30
+ const isDuplicateName = allPlusMinusNudges.some((nudge) => nudge.Name === data.Name && nudge.Uuid !== data.Uuid);
31
+ if (isDuplicateName) {
32
+ return 'A Plus Minus Nudge already exists with that name';
33
+ }
21
34
  if (hasCondition) {
22
35
  if (!data?.Rule?.BooleanExpression) {
23
36
  return 'No valid Rule is specified';
@@ -37,6 +50,12 @@ export const isSettingsValid = (hasCondition) => (data, api, context) => {
37
50
  };
38
51
  export const PlusMinusSettingsWizardSection = (props) => {
39
52
  const { data } = useOnePageAdaptableWizardContext();
53
+ const handleNameChange = (event) => {
54
+ props.onChange({
55
+ ...data,
56
+ Name: event.target.value,
57
+ });
58
+ };
40
59
  const handleNudgeValueChange = (event) => {
41
60
  const newValue = parseFloat(event.target.value);
42
61
  props.onChange({
@@ -45,15 +64,19 @@ export const PlusMinusSettingsWizardSection = (props) => {
45
64
  });
46
65
  };
47
66
  return (React.createElement(Flex, { flexDirection: "column", "data-name": "plus-minus-column-settings", className: "twa:h-full" },
48
- React.createElement(Tabs, { autoFocus: false, className: "twa:p-2" },
49
- React.createElement(Tabs.Tab, null, "Plus Minus Settings"),
67
+ React.createElement(Tabs, { className: "twa:p-2" },
68
+ React.createElement(Tabs.Tab, null, "Settings"),
50
69
  React.createElement(Tabs.Content, null,
51
70
  React.createElement(FormLayout, null,
71
+ React.createElement(FormRow, { label: "Name" },
72
+ React.createElement(Input, { "data-name": "plus-minus-name", className: "twa:flex-1 twa:mr-3", onChange: handleNameChange, placeholder: "Enter Name", value: data.Name ?? '' })),
52
73
  React.createElement(FormRow, { label: "Nudge Value" },
53
- React.createElement(Input, { "data-name": "nudge-value", className: "twa:flex-1 twa:mr-3", onChange: handleNudgeValueChange, placeholder: "Enter Number", type: "number", value: data.NudgeValue ?? '' })),
54
- React.createElement(FormRow, { label: "Nudge Type" },
55
- React.createElement(Flex, null,
56
- React.createElement(Radio, { "data-name": "nudge-type-always", value: "Always", checked: !props.hasCondition, onChange: () => props.onConditionChange(false) }, "Always Apply Nudge"),
57
- React.createElement(Radio, { "data-name": "nudge-type-condition", className: "twa:ml-3", value: "Expression", checked: props.hasCondition, onChange: () => props.onConditionChange(true) }, "Create a Rule")))))),
58
- props.hasCondition && (React.createElement(PlusMinusRuleWizardSection, { defaultPredicateId: "NonBlanks", onChange: props.onChange }))));
74
+ React.createElement(Input, { "data-name": "nudge-value", className: "twa:flex-1 twa:mr-3", onChange: handleNudgeValueChange, placeholder: "Enter Number", type: "number", value: data.NudgeValue ?? '' }))))),
75
+ React.createElement(Tabs, { className: "twa:p-2", selectedIndex: props.hasCondition ? 1 : 0, onSelectedIndexChange: (index) => props.onConditionChange(index === 1) },
76
+ React.createElement(Tabs.Tab, { "data-name": "nudge-type-always" }, "Always Apply"),
77
+ React.createElement(Tabs.Tab, { "data-name": "nudge-type-condition" }, "Conditional"),
78
+ React.createElement(Tabs.Content, null,
79
+ React.createElement(Flex, { className: "twa:text-2 twa:py-2" }, "The nudge value is always applied when using Plus/Minus")),
80
+ React.createElement(Tabs.Content, { className: "twa:p-0" },
81
+ React.createElement(PlusMinusRuleWizardSection, { defaultPredicateId: "NonBlanks", onChange: props.onChange })))));
59
82
  };
@@ -9,7 +9,7 @@ import * as PlusMinusRedux from '../../../Redux/ActionsReducers/PlusMinusRedux';
9
9
  import { ObjectTagsWizardSection, renderObjectTagsSummary, } from '../../Wizard/ObjectTagsWizardSection';
10
10
  import { Box } from '../../../components/Flex';
11
11
  export const PlusMinusWizard = (props) => {
12
- const [plusMinus, setPlusMinus] = React.useState(() => {
12
+ const [plusMinus, doSetPlusMinus] = React.useState(() => {
13
13
  const newPlusMinus = {
14
14
  ...(props.data ? props.data : ObjectFactory.CreateEmptyPlusMinusNudge()),
15
15
  Scope: props?.data?.Scope ?? { All: true },
@@ -22,19 +22,24 @@ export const PlusMinusWizard = (props) => {
22
22
  }
23
23
  return newPlusMinus;
24
24
  });
25
+ const setPlusMinus = React.useCallback((data) => {
26
+ doSetPlusMinus(data);
27
+ }, []);
25
28
  const [hasCondition, setHasCondition] = React.useState(() => {
26
29
  // true if on edit and it has a condition
27
30
  return Boolean(props?.data?.Rule);
28
31
  });
29
32
  React.useEffect(() => {
30
- const preparedData = { ...plusMinus };
31
- if (hasCondition) {
32
- preparedData.Rule = preparedData.Rule ?? { BooleanExpression: '' };
33
- }
34
- else {
35
- delete preparedData.Rule;
36
- }
37
- setPlusMinus(preparedData);
33
+ doSetPlusMinus((prev) => {
34
+ const preparedData = { ...prev };
35
+ if (hasCondition) {
36
+ preparedData.Rule = preparedData.Rule ?? { BooleanExpression: '' };
37
+ }
38
+ else {
39
+ delete preparedData.Rule;
40
+ }
41
+ return preparedData;
42
+ });
38
43
  }, [hasCondition]);
39
44
  const dispatch = useDispatch();
40
45
  const handleFinish = () => {
@@ -47,6 +52,12 @@ export const PlusMinusWizard = (props) => {
47
52
  props.onFinishWizard(plusMinus);
48
53
  };
49
54
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: plusMinus, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
55
+ {
56
+ title: 'Settings',
57
+ isValid: isSettingsValid(hasCondition),
58
+ renderSummary: () => React.createElement(PlusMinusSettingsSummary, { hasCondition: hasCondition }),
59
+ render: () => (React.createElement(PlusMinusSettingsWizardSection, { hasCondition: hasCondition, onConditionChange: setHasCondition, onChange: setPlusMinus })),
60
+ },
50
61
  {
51
62
  title: 'Target',
52
63
  isValid: isScopeValid,
@@ -59,12 +70,6 @@ export const PlusMinusWizard = (props) => {
59
70
  render: () => (React.createElement(Box, { className: "twa:p-2" },
60
71
  React.createElement(PlusMinusScopeWizardSection, { onChange: setPlusMinus }))),
61
72
  },
62
- {
63
- title: 'Settings',
64
- isValid: isSettingsValid(hasCondition),
65
- renderSummary: () => React.createElement(PlusMinusSettingsSummary, { hasCondition: hasCondition }),
66
- render: () => (React.createElement(PlusMinusSettingsWizardSection, { hasCondition: hasCondition, onConditionChange: setHasCondition, onChange: setPlusMinus })),
67
- },
68
73
  {
69
74
  details: 'Select Plus/Minus Tags',
70
75
  title: 'Tags',
@@ -1,11 +1,18 @@
1
1
  import * as React from 'react';
2
2
  import { Tabs } from '../../../../components/Tabs';
3
3
  import FormLayout, { FormRow } from '../../../../components/FormLayout';
4
+ import Input from '../../../../components/Input';
4
5
  import Radio from '../../../../components/Radio';
5
6
  import DropdownButton from '../../../../components/DropdownButton';
6
7
  import { FormDescriptionText } from '../../../Wizard/OnePageAdaptableWizard';
7
8
  import { Box } from '../../../../components/Flex';
8
9
  export const ScheduleSettingsIPushPull = (props) => {
10
+ const handleNameChange = (event) => {
11
+ props.onChange({
12
+ ...props.iPushPull,
13
+ Name: event.target.value,
14
+ });
15
+ };
9
16
  const reportOptions = props.allReports.map((report) => ({
10
17
  label: report.Name,
11
18
  value: report.Name,
@@ -45,9 +52,13 @@ export const ScheduleSettingsIPushPull = (props) => {
45
52
  });
46
53
  return (React.createElement(Box, { "data-name": "schedule-settings-ipushpull" },
47
54
  React.createElement(Tabs, { autoFocus: false },
48
- React.createElement(Tabs.Tab, null, "Ipushpull Schedule Settings"),
55
+ React.createElement(Tabs.Tab, null, "Settings"),
49
56
  React.createElement(Tabs.Content, null,
50
57
  React.createElement(FormLayout, null,
58
+ React.createElement(FormRow, { label: "Name" },
59
+ React.createElement(Input, { "data-name": "schedule-name", className: "twa:w-[300px]", onChange: handleNameChange, placeholder: "Enter Schedule Name", type: "string", value: props.iPushPull?.Name ?? '' })),
60
+ React.createElement(FormRow, { label: "" },
61
+ React.createElement(Box, { className: "twa:h-2" })),
51
62
  React.createElement(FormRow, { label: "Select Report" },
52
63
  React.createElement(DropdownButton, { "data-name": "report-name", disabled: props.allReports.length == 0, items: reportOptions, className: "twa:w-[300px]" }, props?.iPushPull?.IPushPullReport?.ReportName || 'Select Report')),
53
64
  React.createElement(FormRow, { label: "Select Folder" },
@@ -1,9 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { Tabs } from '../../../../components/Tabs';
3
3
  import FormLayout, { FormRow } from '../../../../components/FormLayout';
4
+ import Input from '../../../../components/Input';
4
5
  import DropdownButton from '../../../../components/DropdownButton';
5
6
  import { Box } from '../../../../components/Flex';
6
7
  export const ScheduleSettingsOpenFin = (props) => {
8
+ const handleNameChange = (event) => {
9
+ props.onChange({
10
+ ...props.openFin,
11
+ Name: event.target.value,
12
+ });
13
+ };
7
14
  const reportOptions = props.allReports.map((report) => ({
8
15
  label: report.Name,
9
16
  value: report.Name,
@@ -17,9 +24,13 @@ export const ScheduleSettingsOpenFin = (props) => {
17
24
  }));
18
25
  return (React.createElement(Box, { "data-name": "schedule-settings-openfin" },
19
26
  React.createElement(Tabs, { autoFocus: false },
20
- React.createElement(Tabs.Tab, null, "OpenFin Schedule Settings"),
27
+ React.createElement(Tabs.Tab, null, "Settings"),
21
28
  React.createElement(Tabs.Content, null,
22
29
  React.createElement(FormLayout, null,
30
+ React.createElement(FormRow, { label: "Name" },
31
+ React.createElement(Input, { "data-name": "schedule-name", className: "twa:w-[300px]", onChange: handleNameChange, placeholder: "Enter Schedule Name", type: "string", value: props.openFin?.Name ?? '' })),
32
+ React.createElement(FormRow, { label: "" },
33
+ React.createElement(Box, { className: "twa:h-2" })),
23
34
  React.createElement(FormRow, { label: "Select Report" },
24
35
  React.createElement(DropdownButton, { "data-name": "select-report", columns: ['label'], className: "twa:w-[300px]", disabled: props.allReports.length == 0, items: reportOptions }, props?.openFin?.OpenFinReport?.ReportName || 'Select Report')))))));
25
36
  };
@@ -17,6 +17,12 @@ export const ScheduleSettingsReminder = (props) => {
17
17
  });
18
18
  },
19
19
  }));
20
+ const handleNameChange = (event) => {
21
+ props.onChange({
22
+ ...props.reminderSchedule,
23
+ Name: event.target.value,
24
+ });
25
+ };
20
26
  const handleHeaderChange = (event) => {
21
27
  props.onChange({
22
28
  ...props.reminderSchedule,
@@ -41,11 +47,15 @@ export const ScheduleSettingsReminder = (props) => {
41
47
  DisplaySystemStatusMessage: checked,
42
48
  });
43
49
  };
44
- return (React.createElement(Box, { "data-name": "schedule-settings-remainder" },
50
+ return (React.createElement(Box, { "data-name": "schedule-settings-reminder" },
45
51
  React.createElement(Tabs, { autoFocus: false },
46
- React.createElement(Tabs.Tab, null, "Reminder Schedule Settings"),
52
+ React.createElement(Tabs.Tab, null, "Settings"),
47
53
  React.createElement(Tabs.Content, null,
48
54
  React.createElement(FormLayout, null,
55
+ React.createElement(FormRow, { label: "Name" },
56
+ React.createElement(Input, { "data-name": "schedule-name", className: "twa:w-[300px]", onChange: handleNameChange, placeholder: "Enter Schedule Name", type: "string", value: props.reminderSchedule?.Name ?? '' })),
57
+ React.createElement(FormRow, { label: "" },
58
+ React.createElement(Box, { className: "twa:h-2" })),
49
59
  React.createElement(FormRow, { label: "Header" },
50
60
  React.createElement(Input, { "data-name": "header", className: "twa:w-[300px]", onChange: handleHeaderChange, placeholder: "Enter Reminder Header", type: "string", value: props.reminderSchedule?.Header })),
51
61
  React.createElement(FormRow, { label: "Message" },
@@ -1,9 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import FormLayout, { FormRow } from '../../../../components/FormLayout';
3
+ import Input from '../../../../components/Input';
3
4
  import { Select } from '../../../../components/Select';
4
5
  import { Tabs } from '../../../../components/Tabs';
5
6
  import { Box } from '../../../../components/Flex';
6
7
  export const ScheduleSettingsReport = (props) => {
8
+ const handleNameChange = (event) => {
9
+ props.onChange({
10
+ ...props.report,
11
+ Name: event.target.value,
12
+ });
13
+ };
7
14
  const reportOptions = props.allReports.map((report) => ({
8
15
  label: report.Name,
9
16
  value: report.Name,
@@ -30,9 +37,13 @@ export const ScheduleSettingsReport = (props) => {
30
37
  }));
31
38
  return (React.createElement(Box, { "data-name": "schedule-settings-report" },
32
39
  React.createElement(Tabs, { autoFocus: false, className: "twa:mb-3" },
33
- React.createElement(Tabs.Tab, null, "Report Settings"),
40
+ React.createElement(Tabs.Tab, null, "Settings"),
34
41
  React.createElement(Tabs.Content, null,
35
42
  React.createElement(FormLayout, null,
43
+ React.createElement(FormRow, { label: "Name" },
44
+ React.createElement(Input, { "data-name": "schedule-name", className: "twa:w-[300px]", onChange: handleNameChange, placeholder: "Enter Schedule Name", type: "string", value: props.report?.Name ?? '' })),
45
+ React.createElement(FormRow, { label: "" },
46
+ React.createElement(Box, { className: "twa:h-2" })),
36
47
  React.createElement(FormRow, { label: "Export" },
37
48
  React.createElement(Box, { className: "twa:max-w-[300px]" },
38
49
  React.createElement(Select, { "data-name": "select-report", options: reportOptions, value: props?.report?.ReportName, placeholder: "Select Export", onChange: (value) => props.onChange({
@@ -1,2 +1,3 @@
1
+ import { AdaptableApi } from '../../../../Api/AdaptableApi';
1
2
  import { BaseSchedule } from '../../../../AdaptableState/Common/Schedule';
2
- export declare const isSettingsValid: (schedule: BaseSchedule) => true | "Message type not selected" | "Reminder header not specified" | "Reminder message not specified" | "Report source not specified" | "Report format not selected" | "Report not selected" | "Report folder not selected" | "Report page not selected";
3
+ export declare const isSettingsValid: (schedule: BaseSchedule, api: AdaptableApi) => true | "Name is required" | "A Schedule with this name already exists" | "Message type not selected" | "Reminder header not specified" | "Reminder message not specified" | "Report source not specified" | "Report format not selected" | "Report not selected" | "Report folder not selected" | "Report page not selected";
@@ -1,6 +1,15 @@
1
1
  import { ScheduleType } from '../../../../AdaptableState/Common/Enums';
2
2
  import StringExtensions from '../../../../Utilities/Extensions/StringExtensions';
3
- export const isSettingsValid = (schedule) => {
3
+ export const isSettingsValid = (schedule, api) => {
4
+ // Validate Name - mandatory and unique
5
+ if (!schedule.Name?.trim()) {
6
+ return 'Name is required';
7
+ }
8
+ const allSchedules = api.scheduleApi.getSchedules();
9
+ const isDuplicateName = allSchedules.some((s) => s.Name === schedule.Name && s.Uuid !== schedule.Uuid);
10
+ if (isDuplicateName) {
11
+ return 'A Schedule with this name already exists';
12
+ }
4
13
  if (schedule.ScheduleType === ScheduleType.Reminder) {
5
14
  const reminder = schedule;
6
15
  if (!reminder.MessageType) {
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { Shortcut } from '../../../AdaptableState/ShortcutState';
3
- export declare const isSettingsValid: (data: Shortcut) => string | true;
3
+ import { AdaptableApi } from '../../../types';
4
+ export declare const isSettingsValid: (data: Shortcut, api: AdaptableApi) => string | true;
4
5
  export declare const ShortcutSettingsSummary: React.FunctionComponent;
5
6
  interface ShortcutSettingsWizardProps {
6
7
  availableKeys: Array<string>;
@@ -9,7 +9,15 @@ import { Tag } from '../../../components/Tag';
9
9
  import HelpBlock from '../../../components/HelpBlock';
10
10
  import { Select } from '../../../components/Select';
11
11
  import { Box, Flex } from '../../../components/Flex';
12
- export const isSettingsValid = (data) => {
12
+ export const isSettingsValid = (data, api) => {
13
+ if (!data.Name?.trim()) {
14
+ return 'Name is required';
15
+ }
16
+ const allShortcuts = api.shortcutApi.getShortcuts();
17
+ const isDuplicateName = allShortcuts.some((s) => s.Name === data.Name && s.Uuid !== data.Uuid);
18
+ if (isDuplicateName) {
19
+ return 'A Shortcut already exists with that name';
20
+ }
13
21
  const shortcutKey = data.ShortcutKey && typeof data.ShortcutKey === 'string' ? '' : 'Shortcut key is not selected';
14
22
  const shortcutValue = typeof data.ShortcutValue === 'number' ? '' : 'Shortcut value is not specified';
15
23
  const shortcutOperation = data.ShortcutOperation && typeof data.ShortcutOperation === 'string'
@@ -21,6 +29,9 @@ export const isSettingsValid = (data) => {
21
29
  export const ShortcutSettingsSummary = () => {
22
30
  const { data: shortcut } = useOnePageAdaptableWizardContext();
23
31
  return (React.createElement(React.Fragment, null,
32
+ React.createElement(SummaryText, null,
33
+ "Name ",
34
+ React.createElement(Tag, null, shortcut.Name || 'Not specified')),
24
35
  React.createElement(SummaryText, null,
25
36
  "Shortcut Key ",
26
37
  React.createElement(Tag, null, shortcut.ShortcutKey || 'Not selected')),
@@ -33,6 +44,12 @@ export const ShortcutSettingsSummary = () => {
33
44
  };
34
45
  export const ShortcutSettingsWizard = (props) => {
35
46
  const { data: shortcut } = useOnePageAdaptableWizardContext();
47
+ const handleNameChange = (event) => {
48
+ props.onChange({
49
+ ...shortcut,
50
+ Name: event.target.value,
51
+ });
52
+ };
36
53
  const handleKeyChange = React.useCallback((ShortcutKey) => {
37
54
  props.onChange({
38
55
  ...shortcut,
@@ -63,17 +80,21 @@ export const ShortcutSettingsWizard = (props) => {
63
80
  React.createElement(Tabs.Tab, null, "Shortcut Settings"),
64
81
  React.createElement(Tabs.Content, null,
65
82
  React.createElement(FormLayout, null,
66
- React.createElement(FormRow, null,
83
+ React.createElement(FormRow, { label: "Name" },
84
+ React.createElement(Input, { "data-name": "shortcut-name", className: "twa:flex-1 twa:max-w-[200px] twa:mr-3", onChange: handleNameChange, placeholder: "Enter Name", value: shortcut.Name ?? '' })),
85
+ React.createElement(FormRow, { label: "" },
86
+ React.createElement(Box, { className: "twa:h-2" })),
87
+ React.createElement(FormRow, { label: "" },
67
88
  React.createElement(HelpBlock, { className: "twa:text-2 twa:mb-0" }, "Keyboard key that, when pressed, triggers the Shortcut")),
68
89
  React.createElement(FormRow, { label: "Key" },
69
90
  React.createElement(Flex, { flexDirection: "row" },
70
91
  React.createElement(Select, { "data-name": "shortcut-key", placeholder: "Select Key", options: optionKeys, onChange: (key) => handleKeyChange(key), value: shortcut.ShortcutKey || 'Select Key' }))),
71
- React.createElement(FormRow, null,
92
+ React.createElement(FormRow, { label: "" },
72
93
  React.createElement(HelpBlock, { className: "twa:text-2 twa:mb-0" }, "Mathematical operation performed on Cell's current value (using the Shortcut's 'value') - used to calculate the Cell's new total")),
73
94
  React.createElement(FormRow, { label: "Operation" },
74
95
  React.createElement(Flex, { flexDirection: "row" },
75
96
  React.createElement(Select, { "data-name": "shortcut-operation", placeholder: "Select Operation", options: optionActions, onChange: (operation) => handleOperationChange(operation), value: shortcut.ShortcutOperation }))),
76
- React.createElement(FormRow, null,
97
+ React.createElement(FormRow, { label: "" },
77
98
  React.createElement(HelpBlock, { className: "twa:text-2 twa:mb-0" }, "Number that is used - together with the 'Operation' and the current cell value - to calculate the new total for the cell")),
78
99
  React.createElement(FormRow, { label: "Value" },
79
100
  React.createElement(Flex, { flexDirection: "row" },
@@ -11,8 +11,9 @@ import { shortcutKeys } from '../shortcutKeys';
11
11
  import { useAdaptable } from '../../AdaptableContext';
12
12
  import { ObjectTagsWizardSection, renderObjectTagsSummary, } from '../../Wizard/ObjectTagsWizardSection';
13
13
  import { Box } from '../../../components/Flex';
14
+ import StringExtensions from '../../../Utilities/Extensions/StringExtensions';
14
15
  export const ShortcutWizard = (props) => {
15
- const [shortcut, setShortcut] = React.useState(() => {
16
+ const [shortcut, doSetShortcut] = React.useState(() => {
16
17
  const shortcut = props.data ? cloneObject(props.data) : ObjectFactory.CreateEmptyShortcut();
17
18
  shortcut.Scope = shortcut.Scope ?? { All: true };
18
19
  if (props.popupParams?.column && props.popupParams?.action === 'New') {
@@ -22,10 +23,13 @@ export const ShortcutWizard = (props) => {
22
23
  }
23
24
  return shortcut;
24
25
  });
26
+ const setShortcut = React.useCallback((data) => {
27
+ doSetShortcut(data);
28
+ }, []);
25
29
  const adaptable = useAdaptable();
26
30
  const availableKeys = React.useMemo(() => {
27
31
  const availableKeys = shortcutKeys.filter((key) => adaptable.api.shortcutApi.getShortcuts().every((shortcut) => shortcut.ShortcutKey !== key));
28
- if (shortcut) {
32
+ if (shortcut && StringExtensions.IsNotNullOrEmptyOrWhiteSpace(shortcut.ShortcutKey)) {
29
33
  availableKeys.push(shortcut.ShortcutKey);
30
34
  }
31
35
  availableKeys.sort();
@@ -42,18 +46,6 @@ export const ShortcutWizard = (props) => {
42
46
  props.onFinishWizard(shortcut);
43
47
  };
44
48
  return (React.createElement(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: shortcut, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
45
- {
46
- title: 'Target',
47
- isValid: isScopeValid,
48
- details: 'Specify where Shortcut should be applied',
49
- renderSummary: () => renderScopeSummary(shortcut.Scope, {
50
- scopeWholeRow: 'Shortcut is triggered for all numeric cells',
51
- scopeColumns: 'Shortcut is triggered for cells in selected columns',
52
- scopeDataTypes: 'Shortcut is triggered for all numeric cells',
53
- }),
54
- render: () => (React.createElement(Box, { className: "twa:p-2" },
55
- React.createElement(ShortcutScopeWizardSection, { onChange: setShortcut }))),
56
- },
57
49
  {
58
50
  title: 'Settings',
59
51
  isValid: isSettingsValid,
@@ -69,6 +61,18 @@ export const ShortcutWizard = (props) => {
69
61
  render: () => (React.createElement(Box, { className: "twa:p-2" },
70
62
  React.createElement(ShortcutSettingsWizard, { availableKeys: props.availableKeys ?? availableKeys, onChange: setShortcut }))),
71
63
  },
64
+ {
65
+ title: 'Target',
66
+ isValid: isScopeValid,
67
+ details: 'Specify where Shortcut should be applied',
68
+ renderSummary: () => renderScopeSummary(shortcut.Scope, {
69
+ scopeWholeRow: 'Shortcut is triggered for all numeric cells',
70
+ scopeColumns: 'Shortcut is triggered for cells in selected columns',
71
+ scopeDataTypes: 'Shortcut is triggered for all numeric cells',
72
+ }),
73
+ render: () => (React.createElement(Box, { className: "twa:p-2" },
74
+ React.createElement(ShortcutScopeWizardSection, { onChange: setShortcut }))),
75
+ },
72
76
  {
73
77
  details: 'Select Shortcut Tags',
74
78
  title: 'Tags',
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1770107045244 || Date.now(),
4
- VERSION: "22.0.0-canary.3" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1770223980882 || Date.now(),
4
+ VERSION: "22.0.0-canary.4" || '--current-version--',
5
5
  };
@@ -172,5 +172,6 @@ export interface PivotLayoutModel extends BaseLayoutModel {
172
172
  * Display automatically calculated Totals within EACH Pivot Column Group, in the position specified
173
173
  */
174
174
  PivotColumnTotal?: 'before' | 'after' | boolean;
175
+ PivotResultColumns?: string[] | boolean;
175
176
  }
176
177
  export type LayoutModel = TableLayoutModel | PivotLayoutModel;
@@ -166,7 +166,7 @@ export class LayoutManager extends LMEmitter {
166
166
  this.setupEvents();
167
167
  this.indexColumns();
168
168
  this.setupPivotTotals();
169
- globalThis.layoutManager = this;
169
+ // (globalThis as any).layoutManager = this;
170
170
  }
171
171
  destroy() {
172
172
  if (this.destroyed) {
@@ -344,10 +344,11 @@ export class LayoutManager extends LMEmitter {
344
344
  const columnState = this.gridApi
345
345
  .getColumnState()
346
346
  .filter((col) => !pivotResultColumnsSet.has(col.colId));
347
- let PivotColumns = this.gridApi.getPivotColumns().map((col) => col.getColId());
347
+ const PivotColumns = this.gridApi.getPivotColumns().map((col) => col.getColId());
348
348
  const layout = this.getUndecidedLayoutModelFromGrid(columnState);
349
349
  let ColumnSizing = layout.ColumnSizing || {};
350
350
  let ColumnVisibility = { ...layout.ColumnVisibility };
351
+ const storePivotResultColumns = !!prevLayout?.PivotResultColumns;
351
352
  //let's also include the column widths of the pivotResult columns
352
353
  pivotResultColumns.forEach((col) => {
353
354
  const colId = col.getColId();
@@ -401,6 +402,13 @@ export class LayoutManager extends LMEmitter {
401
402
  GrandTotalRow: layout.GrandTotalRow,
402
403
  PivotExpandLevel: prevLayout?.PivotExpandLevel ?? -1,
403
404
  };
405
+ if (storePivotResultColumns) {
406
+ // Get pivot result columns in display order (not creation order)
407
+ const displayedPivotResultColumns = this.gridApi
408
+ .getAllDisplayedColumns()
409
+ .filter((col) => pivotResultColumnsSet.has(col.getColId()));
410
+ pivotLayout.PivotResultColumns = displayedPivotResultColumns.map((col) => col.getColId());
411
+ }
404
412
  if (layout.SuppressAggFuncInHeader) {
405
413
  pivotLayout.SuppressAggFuncInHeader = layout.SuppressAggFuncInHeader;
406
414
  }
@@ -424,20 +432,20 @@ export class LayoutManager extends LMEmitter {
424
432
  let TableColumns = columnState.map((c) => c.colId);
425
433
  // .filter((colId) => colId !== 'ag-Grid-SelectionColumn');
426
434
  let ColumnSorts = [];
427
- let RowGroupedColumns = [];
435
+ const RowGroupedColumns = [];
428
436
  let RowGroupValues = undefined;
429
437
  let ColumnGroupValues = undefined;
430
438
  let TableAggregationColumns = [];
431
- let ColumnPinning = {};
439
+ const ColumnPinning = {};
432
440
  const gridState = this.gridApi.getState();
433
441
  const prevLayout = this.currentLayout;
434
442
  const prevAggColumns = prevLayout?.TableAggregationColumns ?? prevLayout?.PivotAggregationColumns;
435
- let ColumnSizing = { ...prevLayout?.ColumnSizing };
443
+ const ColumnSizing = { ...prevLayout?.ColumnSizing };
436
444
  const prevAggColumnsMap = prevAggColumns?.reduce((acc, agg) => {
437
445
  acc[agg.ColumnId] = agg;
438
446
  return acc;
439
447
  }, {});
440
- let ColumnVisibility = columnState.reduce((acc, colState) => {
448
+ const ColumnVisibility = columnState.reduce((acc, colState) => {
441
449
  const colId = colState.colId;
442
450
  // normally we take the initial width from this object
443
451
  let initialWidth = this.initialColumnWidths[colId];
@@ -1239,7 +1247,7 @@ export class LayoutManager extends LMEmitter {
1239
1247
  }
1240
1248
  }
1241
1249
  computeColumnStateForPivotLayout(layout) {
1242
- let columnState = {};
1250
+ const columnState = {};
1243
1251
  const pivotColumnsToIndexes = (layout.PivotColumns || []).reduce((acc, colId, index) => {
1244
1252
  acc[colId] = index;
1245
1253
  return acc;
@@ -1270,6 +1278,12 @@ export class LayoutManager extends LMEmitter {
1270
1278
  this.computeColumnSorts(layout, columnState);
1271
1279
  this.computePinnedColumns(layout, columnState);
1272
1280
  this.computePivotAggregations(layout, columnState);
1281
+ // Add pivot result columns to the state for ordering (will be applied with applyOrder: true later)
1282
+ if (Array.isArray(layout.PivotResultColumns)) {
1283
+ layout.PivotResultColumns.forEach((colId) => {
1284
+ columnState.state.push({ colId });
1285
+ });
1286
+ }
1273
1287
  return columnState;
1274
1288
  }
1275
1289
  computePivotAggregations(layout, columnState) {
@@ -1510,6 +1524,10 @@ export class LayoutManager extends LMEmitter {
1510
1524
  });
1511
1525
  // now recompute and apply the last one
1512
1526
  this.computePivotAggregations(layout, columnState);
1527
+ // Apply order only on the final call when PivotResultColumns is specified
1528
+ if (Array.isArray(layout.PivotResultColumns)) {
1529
+ columnState.applyOrder = true;
1530
+ }
1513
1531
  this.gridApi.applyColumnState(columnState);
1514
1532
  // let's also include the column widths of the pivotResult columns
1515
1533
  // we can't simply include those in the columnState because the columnState will also apply order
@@ -132,6 +132,9 @@ export function normalizePivotLayoutModel(layout) {
132
132
  if (!layout.ColumnPinning) {
133
133
  layout.ColumnPinning = {};
134
134
  }
135
+ if (!layout.PivotResultColumns) {
136
+ layout.PivotResultColumns = false;
137
+ }
135
138
  if (!layout.ColumnSizing) {
136
139
  layout.ColumnSizing = {};
137
140
  }
@@ -2157,12 +2157,20 @@ export declare const ADAPTABLE_METAMODEL: {
2157
2157
  name: string;
2158
2158
  kind: string;
2159
2159
  desc: string;
2160
+ isOpt?: undefined;
2161
+ ref?: undefined;
2162
+ } | {
2163
+ name: string;
2164
+ kind: string;
2165
+ desc: string;
2166
+ isOpt: boolean;
2160
2167
  ref?: undefined;
2161
2168
  } | {
2162
2169
  name: string;
2163
2170
  kind: string;
2164
2171
  desc: string;
2165
2172
  ref: string;
2173
+ isOpt?: undefined;
2166
2174
  })[];
2167
2175
  };
2168
2176
  CommandHandler: {
@@ -4068,6 +4076,18 @@ export declare const ADAPTABLE_METAMODEL: {
4068
4076
  kind: string;
4069
4077
  desc: string;
4070
4078
  };
4079
+ Identifiable: {
4080
+ name: string;
4081
+ kind: string;
4082
+ desc: string;
4083
+ props: {
4084
+ name: string;
4085
+ kind: string;
4086
+ desc: string;
4087
+ isOpt: boolean;
4088
+ ref: string;
4089
+ }[];
4090
+ };
4071
4091
  InFilterValue: {
4072
4092
  name: string;
4073
4093
  kind: string;
@@ -4457,6 +4477,16 @@ export declare const ADAPTABLE_METAMODEL: {
4457
4477
  kind: string;
4458
4478
  desc: string;
4459
4479
  };
4480
+ NamedObject: {
4481
+ name: string;
4482
+ kind: string;
4483
+ desc: string;
4484
+ props: {
4485
+ name: string;
4486
+ kind: string;
4487
+ desc: string;
4488
+ }[];
4489
+ };
4460
4490
  NamedQuery: {
4461
4491
  name: string;
4462
4492
  kind: string;