@adaptabletools/adaptable 12.0.0-canary.0 → 12.0.0-canary.3

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 (149) hide show
  1. package/base.css +561 -283
  2. package/bundle.cjs.js +162 -148
  3. package/index.css +631 -280
  4. package/package.json +3 -3
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/AdaptableNoCodeWizard.d.ts +1 -0
  8. package/src/AdaptableOptions/AlertOptions.d.ts +5 -9
  9. package/src/AdaptableOptions/DashboardOptions.d.ts +1 -5
  10. package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +2 -2
  11. package/src/AdaptableOptions/EditOptions.d.ts +26 -8
  12. package/src/AdaptableOptions/ExportOptions.d.ts +4 -7
  13. package/src/AdaptableOptions/GeneralOptions.d.ts +12 -2
  14. package/src/AdaptableOptions/ToolPanelOptions.d.ts +1 -5
  15. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +21 -3
  16. package/src/Api/AlertApi.d.ts +3 -3
  17. package/src/Api/ColumnApi.d.ts +7 -2
  18. package/src/Api/EventApi.d.ts +11 -0
  19. package/src/Api/Events/RowFormSubmitted.d.ts +15 -0
  20. package/src/Api/Events/SearchChanged.d.ts +1 -1
  21. package/src/Api/ExportApi.d.ts +2 -2
  22. package/src/Api/FilterApi.d.ts +69 -1
  23. package/src/Api/Implementation/AlertApiImpl.d.ts +3 -3
  24. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
  25. package/src/Api/Implementation/ColumnApiImpl.js +15 -14
  26. package/src/Api/Implementation/ConfigApiImpl.js +1 -1
  27. package/src/Api/Implementation/ExportApiImpl.d.ts +2 -2
  28. package/src/Api/Implementation/FilterApiImpl.d.ts +16 -1
  29. package/src/Api/Implementation/FilterApiImpl.js +141 -0
  30. package/src/Api/Implementation/FormatColumnApiImpl.js +2 -2
  31. package/src/Api/Implementation/GridApiImpl.js +7 -3
  32. package/src/Api/Implementation/InternalApiImpl.d.ts +3 -3
  33. package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -15
  34. package/src/Api/Implementation/LayoutApiImpl.js +0 -152
  35. package/src/Api/Implementation/PredicateApiImpl.d.ts +2 -0
  36. package/src/Api/Implementation/PredicateApiImpl.js +18 -0
  37. package/src/Api/LayoutApi.d.ts +1 -72
  38. package/src/Api/PredicateApi.d.ts +7 -0
  39. package/src/PredefinedConfig/AlertState.d.ts +4 -4
  40. package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +1 -1
  41. package/src/PredefinedConfig/Common/FormContext.d.ts +11 -0
  42. package/src/PredefinedConfig/Common/FormContext.js +2 -0
  43. package/src/Redux/ActionsReducers/LayoutRedux.js +0 -1
  44. package/src/Redux/ActionsReducers/PopupRedux.d.ts +3 -2
  45. package/src/Redux/Store/AdaptableStore.js +6 -0
  46. package/src/Strategy/AdaptableModuleBase.js +1 -2
  47. package/src/Strategy/BulkUpdateModule.js +3 -4
  48. package/src/Strategy/CellSummaryModule.js +1 -2
  49. package/src/Strategy/FilterModule.js +15 -18
  50. package/src/Strategy/LayoutModule.js +1 -0
  51. package/src/Strategy/PlusMinusModule.js +1 -4
  52. package/src/Strategy/SmartEditModule.js +2 -2
  53. package/src/Utilities/Constants/GeneralConstants.d.ts +2 -0
  54. package/src/Utilities/Constants/GeneralConstants.js +3 -1
  55. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -0
  56. package/src/Utilities/Services/CalculatedColumnExpressionService.js +6 -7
  57. package/src/Utilities/Services/RowEditService.d.ts +1 -0
  58. package/src/Utilities/Services/RowEditService.js +34 -2
  59. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.d.ts +8 -3
  60. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +3 -2
  61. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationForm.js +9 -2
  62. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.d.ts +30 -0
  63. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +87 -0
  64. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.d.ts +18 -0
  65. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.js +16 -0
  66. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/index.d.ts +2 -9
  67. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/index.js +2 -75
  68. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/useSelection.d.ts +3 -1
  69. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/useSelection.js +9 -4
  70. package/src/View/AdaptableWizardView/Utils.d.ts +1 -0
  71. package/src/View/AdaptableWizardView/Utils.js +24 -0
  72. package/src/View/AdaptableWizardView/Wizard.d.ts +54 -0
  73. package/src/View/AdaptableWizardView/Wizard.js +98 -0
  74. package/src/View/AdaptableWizardView/index.d.ts +1 -22
  75. package/src/View/AdaptableWizardView/index.js +2 -103
  76. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +1 -1
  77. package/src/View/Alert/Wizard/AlertButtonsEditor.d.ts +3 -3
  78. package/src/View/Alert/Wizard/AlertDisplayWizardSection.js +2 -2
  79. package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +1 -1
  80. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +2 -2
  81. package/src/View/BulkUpdate/BulkUpdatePopup.js +2 -3
  82. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +3 -4
  83. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +5 -6
  84. package/src/View/CellSummary/CellSummaryDetails.js +2 -2
  85. package/src/View/Components/FilterForm/FilterForm.js +1 -1
  86. package/src/View/Components/FilterForm/QuickFilterForm.js +1 -1
  87. package/src/View/Components/PreviewResultsPanel.js +3 -3
  88. package/src/View/Components/WizardSummaryPage.js +2 -2
  89. package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +1 -1
  90. package/src/View/ConditionalStyle/Wizard/ConditionalStyleScopeWizardSection.js +1 -1
  91. package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.js +1 -1
  92. package/src/View/ConditionalStyle/Wizard/ConditionalStyleStyleWizardSection.js +1 -1
  93. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +2 -2
  94. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +1 -1
  95. package/src/View/DataChangeHistory/buildActionColumnButton.d.ts +2 -2
  96. package/src/View/Export/Wizard/ReportColumnsWizardSection.js +1 -1
  97. package/src/View/Export/Wizard/ReportNameWizardSection.js +1 -1
  98. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  99. package/src/View/Filter/ActiveFiltersPanel.js +1 -1
  100. package/src/View/Filter/FilterSummary.js +1 -1
  101. package/src/View/Filter/FilterViewPanel.js +2 -2
  102. package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +2 -2
  103. package/src/View/FlashingCell/Wizard/FlashingCellScopeWizardSection.js +1 -1
  104. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +1 -1
  105. package/src/View/FlashingCell/Wizard/FlashingCellStyleWizardSection.js +1 -1
  106. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  107. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
  108. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +1 -1
  109. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +1 -1
  110. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +5 -6
  111. package/src/View/GridInfo/ColumnInfoComponent.js +1 -1
  112. package/src/View/GridInfo/GridInfoPopup.js +1 -1
  113. package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +2 -2
  114. package/src/View/PlusMinus/Wizard/PlusMinusScopeWizardSection.js +1 -1
  115. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +2 -2
  116. package/src/View/Query/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  117. package/src/View/Query/Wizard/NamedQuerySettingsWizardSection.js +1 -1
  118. package/src/View/Schedule/Wizard/ScheduleScheduleSummary.js +1 -1
  119. package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +1 -1
  120. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsSummary.js +1 -1
  121. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsWizard.js +1 -1
  122. package/src/View/Shortcut/Wizard/ShortcutScopeWizardSection.js +1 -1
  123. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +2 -2
  124. package/src/View/UIHelper.js +6 -6
  125. package/src/View/Wizard/Interface/IAdaptableWizard.d.ts +2 -2
  126. package/src/View/Wizard/ObjectTagsWizardSection.js +1 -1
  127. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +5 -6
  128. package/src/View/Wizard/OnePageAdaptableWizard.js +35 -169
  129. package/src/View/Wizard/OnePageWizards.d.ts +37 -0
  130. package/src/View/Wizard/OnePageWizards.js +187 -0
  131. package/src/View/Wizard/useKeyboardNavigation.d.ts +1 -1
  132. package/src/agGrid/Adaptable.js +25 -11
  133. package/src/agGrid/FilterWrapper.js +2 -2
  134. package/src/agGrid/agGridHelper.d.ts +2 -3
  135. package/src/agGrid/agGridHelper.js +37 -33
  136. package/src/agGrid/rowEditIcons.d.ts +1 -0
  137. package/src/agGrid/rowEditIcons.js +2 -1
  138. package/src/components/Datepicker/Caption.js +1 -1
  139. package/src/components/InfiniteTable/index.js +1 -0
  140. package/src/components/List/GridList/index.js +1 -1
  141. package/src/components/WindowModal/WindowModal.js +13 -7
  142. package/src/components/icons/add-row.d.ts +3 -0
  143. package/src/components/icons/add-row.js +7 -0
  144. package/src/components/icons/index.js +2 -0
  145. package/src/metamodel/adaptable.metamodel.d.ts +106 -22
  146. package/src/metamodel/adaptable.metamodel.js +238 -121
  147. package/src/types.d.ts +5 -4
  148. package/version.d.ts +1 -1
  149. package/version.js +1 -1
@@ -1,9 +1,2 @@
1
- import * as React from 'react';
2
- import { AdaptableOptions } from '../../../types';
3
- interface ConfigurationDialogProps extends React.HTMLProps<HTMLElement> {
4
- adaptableOptions: AdaptableOptions;
5
- onFinish: (adaptableOptions: AdaptableOptions) => void;
6
- onCancel: () => void;
7
- }
8
- declare const ConfigurationDialog: (props: ConfigurationDialogProps) => JSX.Element;
9
- export default ConfigurationDialog;
1
+ import { ConfigurationWizard } from './ConfigurationWizard';
2
+ export default ConfigurationWizard;
@@ -1,77 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const React = tslib_1.__importStar(require("react"));
5
- const rebass_1 = require("rebass");
6
- const react_1 = require("react");
7
- const Dialog_1 = tslib_1.__importDefault(require("../../../components/Dialog"));
8
- const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
9
- const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
10
- const ColumnsList_1 = tslib_1.__importDefault(require("./ColumnsList"));
11
- const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
12
- const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
13
- const ConfigurationForm_1 = tslib_1.__importDefault(require("./ConfigurationForm"));
14
- const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
15
- const ConfigurationDialog = (props) => {
16
- const [abOptions, setABOptions] = react_1.useState(props.adaptableOptions);
17
- const [finishEnabled, setFinishEnabled] = react_1.useState(true);
18
- const [currentStep, setCurrentStep] = react_1.useState(0);
19
- let canFinish = finishEnabled;
20
- if (!abOptions.adaptableId) {
21
- canFinish = false;
22
- }
23
- let canNext = canFinish && currentStep === 0;
24
- const columnsHandle = React.useRef();
25
- const onadaptableIdChange = (event) => {
26
- const newABOptions = Object.assign({}, abOptions);
27
- newABOptions.adaptableId = event.target.value;
28
- setABOptions(newABOptions);
29
- };
30
- const onFinish = () => {
31
- const newABOptions = Object.assign({}, abOptions);
32
- newABOptions.gridOptions = Object.assign({}, abOptions.gridOptions);
33
- newABOptions.gridOptions.columnDefs = columnsHandle.current.getColumns().map((c) => {
34
- const col = Object.assign(Object.assign({}, c), { headerName: c.caption || StringExtensions_1.default.Humanize(c.field) });
35
- delete col.caption;
36
- return col;
37
- });
38
- newABOptions.primaryKey = columnsHandle.current.getPrimaryKey();
39
- setABOptions(newABOptions);
40
- props.onFinish(newABOptions);
41
- };
42
- const onNext = () => {
43
- setCurrentStep(1);
44
- };
45
- const stepOne = (React.createElement(React.Fragment, null,
46
- React.createElement(Panel_1.default, { header: 'Configure AdapTable', border: "none", bodyScroll: false, bodyProps: {
47
- padding: 0,
48
- style: { overflow: 'auto', display: 'flex', flexFlow: 'column' },
49
- }, borderRadius: "none", style: { fontSize: 16, flex: 1 } },
50
- React.createElement(Panel_1.default, { style: { minHeight: 50 }, border: "none" },
51
- React.createElement(FormLayout_1.default, null,
52
- React.createElement(FormLayout_1.FormRow, { label: "AdaptableId" },
53
- React.createElement(Input_1.default, { value: abOptions.adaptableId, onChange: onadaptableIdChange, style: { minWidth: '20rem' } })))),
54
- React.createElement(ColumnsList_1.default, { handle: columnsHandle, onValidityChange: (valid) => {
55
- setFinishEnabled(valid);
56
- }, columns: abOptions.gridOptions.columnDefs }))));
57
- const stepTwo = (React.createElement(React.Fragment, null,
58
- React.createElement(Panel_1.default, { header: 'Configure AdapTable', border: "none", style: { flex: 1, overflow: 'auto' } },
59
- React.createElement(ConfigurationForm_1.default, { adaptableOptions: abOptions, onChangeadaptableOptions: (abOptions) => {
60
- setABOptions(abOptions);
61
- } }))));
62
- return (React.createElement(Dialog_1.default, { modal: true, isOpen: true, showCloseButton: false },
63
- React.createElement(rebass_1.Flex, { flexDirection: "column", style: {
64
- height: '100%',
65
- width: '90vw',
66
- maxWidth: 1000,
67
- maxHeight: '90vh',
68
- } },
69
- currentStep === 0 ? stepOne : stepTwo,
70
- React.createElement(rebass_1.Flex, { flexDirection: "row", padding: 2, backgroundColor: "primary", alignItems: "center" },
71
- React.createElement(SimpleButton_1.default, { tone: "neutral", variant: "text", tooltip: "Cancel configuration ", onClick: props.onCancel }, "Cancel"),
72
- React.createElement("div", { style: { flex: 1 } }),
73
- React.createElement(SimpleButton_1.default, { variant: "outlined", onClick: () => setCurrentStep(0), disabled: currentStep === 0, marginRight: 2, tone: "neutral" }, "Back"),
74
- React.createElement(SimpleButton_1.default, { variant: "outlined", onClick: onNext, disabled: !canNext, marginRight: 2, tone: "neutral" }, "Next"),
75
- React.createElement(SimpleButton_1.default, { tone: "accent", variant: "raised", icon: 'check', onClick: onFinish, disabled: !canFinish }, "Finish")))));
76
- };
77
- exports.default = ConfigurationDialog;
3
+ const ConfigurationWizard_1 = require("./ConfigurationWizard");
4
+ exports.default = ConfigurationWizard_1.ConfigurationWizard;
@@ -1,6 +1,8 @@
1
1
  declare const useSelection: (columns: {
2
2
  [key: string]: any;
3
- }[], defaultValue: boolean, fieldName: string | null, changeListeners?: {
3
+ }[], defaultValue: boolean | {
4
+ [key: string]: boolean;
5
+ }, fieldName: string | null, changeListeners?: {
4
6
  onChange?: (column: any, flag: boolean) => void;
5
7
  onBatchChange?: (flag: boolean) => void;
6
8
  }) => {
@@ -5,10 +5,15 @@ const useSelection = (columns, defaultValue, fieldName, changeListeners) => {
5
5
  changeListeners = changeListeners || {};
6
6
  const onChange = changeListeners.onChange || ((column, flag) => { });
7
7
  const onBatchChange = changeListeners.onBatchChange || ((flag) => { });
8
- const [selected, setSelected] = react_1.useState(columns.reduce((acc, col) => {
9
- acc[col.field] = fieldName ? col[fieldName] : defaultValue;
10
- return acc;
11
- }, {}));
8
+ const [selected, setSelected] = react_1.useState(typeof defaultValue === 'object'
9
+ ? defaultValue
10
+ : columns.reduce((acc, col) => {
11
+ const flag = fieldName ? col[fieldName] : defaultValue;
12
+ if (flag) {
13
+ acc[col.field] = flag;
14
+ }
15
+ return acc;
16
+ }, {}));
12
17
  const getColumn = (field) => columns.filter((c) => c.field === field)[0];
13
18
  const result = {
14
19
  selected,
@@ -0,0 +1 @@
1
+ export declare const validDataSource: (dataSourceInfo: any) => boolean;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validDataSource = void 0;
4
+ exports.validDataSource = (dataSourceInfo) => {
5
+ if (!dataSourceInfo || !Array.isArray(dataSourceInfo.columns)) {
6
+ throw `We can't find any columns in your configuration`;
7
+ }
8
+ if (!dataSourceInfo.columns.length) {
9
+ throw 'You should have at least one column';
10
+ }
11
+ const allStringColumns = dataSourceInfo.columns.reduce((acc, col) => {
12
+ if (!col || typeof col !== 'string') {
13
+ return false;
14
+ }
15
+ return acc;
16
+ }, true);
17
+ if (!allStringColumns) {
18
+ throw `Some of your columns are not strings`;
19
+ }
20
+ if (!Array.isArray(dataSourceInfo.data)) {
21
+ throw `We can't find the data array in your configuration`;
22
+ }
23
+ return true;
24
+ };
@@ -0,0 +1,54 @@
1
+ import * as React from 'react';
2
+ import { Reducer, ReactNode } from 'react';
3
+ import { AdaptableOptions } from '../../types';
4
+ import { ConfigurationWizardProps } from './AdaptableConfigurationDialog/ConfigurationWizard';
5
+ export interface AdaptableWizardViewProps {
6
+ adaptableOptions?: Omit<AdaptableOptions, 'primaryKey'> & {
7
+ primaryKey?: string;
8
+ };
9
+ /**
10
+ * Default true.
11
+ */
12
+ ddEnabled?: boolean;
13
+ /**
14
+ * When true the the configuration wizard will be shown.
15
+ * It will use the available information in adaptableOptions & gridOptions.
16
+ * This mode skips over interpreting data to figure-out columns.
17
+ */
18
+ skipToWizard?: boolean;
19
+ onInit: (adaptableOptions: AdaptableOptions) => any;
20
+ fileContentsToJSON?: (str: string) => Promise<any> | any;
21
+ readFile?: (file: File) => Promise<any>;
22
+ fileAccept?: string;
23
+ helpText?: React.ReactNode;
24
+ loadingMessage?: ReactNode;
25
+ defaultActionMessage?: ReactNode;
26
+ dragOverActionMessage?: ReactNode;
27
+ fetchData?: () => Promise<Record<string, any>[]>;
28
+ showFetchDataWizard?: boolean;
29
+ startSections?: ConfigurationWizardProps['startSections'];
30
+ prepareData?: (data: any, file?: File) => {
31
+ columns: string[];
32
+ data: any[];
33
+ primaryKey?: string;
34
+ };
35
+ }
36
+ export declare const initialState: Partial<WizardState>;
37
+ export declare const reducer: Reducer<WizardState, any>;
38
+ interface WizardState {
39
+ dropped: boolean;
40
+ error: any;
41
+ adaptableOptions: AdaptableOptions;
42
+ }
43
+ /**
44
+ * The wizard in a few modes:
45
+ *
46
+ * 1. Based on data:
47
+ * 1.1 Drag and drop a file
48
+ * 1.2 Fetch data from a url
49
+ *
50
+ * 2. Based on configuration:
51
+ * Provide a schema, on how the data looks like.
52
+ */
53
+ export declare const Wizard: (props: AdaptableWizardViewProps) => JSX.Element;
54
+ export {};
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Wizard = exports.reducer = exports.initialState = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_1 = require("react");
7
+ const helper_1 = require("./helper");
8
+ const rebass_1 = require("rebass");
9
+ const AdaptableConfigurationDialog_1 = tslib_1.__importDefault(require("./AdaptableConfigurationDialog"));
10
+ const FileDroppable_1 = tslib_1.__importDefault(require("../../components/FileDroppable"));
11
+ const Utils_1 = require("./Utils");
12
+ exports.initialState = {
13
+ dropped: false,
14
+ };
15
+ exports.reducer = (state, action) => {
16
+ if (action.type === 'DROPPED') {
17
+ return Object.assign(Object.assign({}, state), { adaptableOptions: action.payload, dropped: true, error: null });
18
+ }
19
+ if (action.type === 'ERROR') {
20
+ return Object.assign(Object.assign({}, state), { dropped: false, error: action.payload });
21
+ }
22
+ if (action.type === 'CANCEL') {
23
+ return Object.assign(Object.assign({}, state), { error: null, dropped: false });
24
+ }
25
+ return state;
26
+ };
27
+ /**
28
+ * The wizard in a few modes:
29
+ *
30
+ * 1. Based on data:
31
+ * 1.1 Drag and drop a file
32
+ * 1.2 Fetch data from a url
33
+ *
34
+ * 2. Based on configuration:
35
+ * Provide a schema, on how the data looks like.
36
+ */
37
+ exports.Wizard = (props) => {
38
+ var _a;
39
+ const [state, dispatch] = react_1.useReducer(exports.reducer, Object.assign(Object.assign({}, exports.initialState), { adaptableOptions: props.adaptableOptions }));
40
+ const [droppableKey, setDroppableKey] = react_1.useState(Date.now());
41
+ const [isDataLoading, setIsDataLoading] = react_1.useState(false);
42
+ const handleDataSource = (array, file) => {
43
+ const dataSourceInfo = (props.prepareData || helper_1.prepareDataSource)(array, file);
44
+ try {
45
+ Utils_1.validDataSource(dataSourceInfo);
46
+ }
47
+ catch (err) {
48
+ return dispatch({
49
+ type: 'ERROR',
50
+ payload: `Invalid adaptable configuration - ${err}`,
51
+ });
52
+ }
53
+ const gridOptions = helper_1.prepareGridOptions(dataSourceInfo);
54
+ const adaptableOptions = Object.assign({}, props.adaptableOptions);
55
+ adaptableOptions.adaptableId = adaptableOptions.adaptableId || (file ? file.name : '');
56
+ adaptableOptions.gridOptions = gridOptions;
57
+ if (dataSourceInfo.primaryKey) {
58
+ adaptableOptions.primaryKey = dataSourceInfo.primaryKey;
59
+ }
60
+ const shouldShowWizard = props.fetchData ? Boolean(props.showFetchDataWizard) : true;
61
+ if (shouldShowWizard) {
62
+ dispatch({
63
+ type: 'DROPPED',
64
+ payload: adaptableOptions,
65
+ });
66
+ }
67
+ else {
68
+ props.onInit(adaptableOptions);
69
+ }
70
+ };
71
+ let wizard;
72
+ if (props.skipToWizard || state.dropped) {
73
+ wizard = (React.createElement(AdaptableConfigurationDialog_1.default, { startSections: props.startSections, adaptableOptions: state.adaptableOptions, onCancel: () => {
74
+ // change the file droppable component key
75
+ // so it's remounted and it's in the initial state
76
+ setDroppableKey(Date.now());
77
+ dispatch({
78
+ type: 'CANCEL',
79
+ });
80
+ }, onFinish: (adaptableOptions) => {
81
+ props.onInit(adaptableOptions);
82
+ } }));
83
+ }
84
+ react_1.useEffect(() => {
85
+ if (props.fetchData) {
86
+ setIsDataLoading(true);
87
+ props.fetchData().then((data) => {
88
+ handleDataSource(data);
89
+ setIsDataLoading(false);
90
+ });
91
+ }
92
+ }, []);
93
+ const ddEnabled = (_a = props.ddEnabled) !== null && _a !== void 0 ? _a : !props.fetchData;
94
+ return (React.createElement(React.Fragment, null,
95
+ ddEnabled && (React.createElement(FileDroppable_1.default, { key: droppableKey, className: 'ab-nocode-wizard', toJSON: props.fileContentsToJSON, readFile: props.readFile, fileAccept: props.fileAccept, helpText: props.helpText, message: state.error, defaultText: props.defaultActionMessage, dragOverText: props.dragOverActionMessage, loadingText: props.loadingMessage, onDropSuccess: handleDataSource })),
96
+ isDataLoading && (React.createElement(rebass_1.Flex, { className: 'ab-nocode-wizard', alignItems: "center", justifyContent: "center", flexDirection: "column" }, props.loadingMessage || 'Loading ...')),
97
+ wizard));
98
+ };
@@ -1,25 +1,4 @@
1
1
  import * as React from 'react';
2
- import { ReactNode } from 'react';
3
- import { AdaptableOptions } from '../../AdaptableOptions/AdaptableOptions';
4
- interface AdaptableWizardViewProps {
5
- adaptableOptions?: Omit<AdaptableOptions, 'primaryKey'> & {
6
- primaryKey?: string;
7
- };
8
- onInit: (adaptableOptions: AdaptableOptions) => any;
9
- fileContentsToJSON?: (str: string) => Promise<any> | any;
10
- readFile?: (file: File) => Promise<any>;
11
- fileAccept?: string;
12
- helpText?: React.ReactNode;
13
- loadingMessage?: ReactNode;
14
- defaultActionMessage?: ReactNode;
15
- dragOverActionMessage?: ReactNode;
16
- fetchData?: () => Promise<Record<string, any>[]>;
17
- showFetchDataWizard?: boolean;
18
- prepareData?: (data: any, file?: File) => {
19
- columns: string[];
20
- data: any[];
21
- primaryKey?: string;
22
- };
23
- }
2
+ import { AdaptableWizardViewProps } from './Wizard';
24
3
  declare const AdaptableWizardView: React.FunctionComponent<AdaptableWizardViewProps>;
25
4
  export default AdaptableWizardView;
@@ -3,109 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const React = tslib_1.__importStar(require("react"));
5
5
  const styled_components_1 = require("styled-components");
6
- const react_1 = require("react");
7
6
  const theme_1 = tslib_1.__importDefault(require("../../theme"));
8
- const FileDroppable_1 = tslib_1.__importDefault(require("../../components/FileDroppable"));
9
- const helper_1 = require("./helper");
10
- const rebass_1 = require("rebass");
11
- const AdaptableConfigurationDialog_1 = tslib_1.__importDefault(require("./AdaptableConfigurationDialog"));
7
+ const Wizard_1 = require("./Wizard");
12
8
  const AdaptableWizardView = (props) => (React.createElement(styled_components_1.ThemeProvider, { theme: theme_1.default },
13
- React.createElement(Wizard, Object.assign({}, props))));
14
- const initialState = {
15
- dropped: false,
16
- };
17
- const reducer = (state, action) => {
18
- if (action.type === 'DROPPED') {
19
- return Object.assign(Object.assign({}, state), { adaptableOptions: action.payload, dropped: true, error: null });
20
- }
21
- if (action.type === 'ERROR') {
22
- return Object.assign(Object.assign({}, state), { dropped: false, error: action.payload });
23
- }
24
- if (action.type === 'CANCEL') {
25
- return Object.assign(Object.assign({}, state), { error: null, dropped: false });
26
- }
27
- return state;
28
- };
29
- const validDataSource = (dataSourceInfo) => {
30
- if (!dataSourceInfo || !Array.isArray(dataSourceInfo.columns)) {
31
- throw `We can't find any columns in your configuration`;
32
- }
33
- if (!dataSourceInfo.columns.length) {
34
- throw 'You should have at least one column';
35
- }
36
- const allStringColumns = dataSourceInfo.columns.reduce((acc, col) => {
37
- if (!col || typeof col !== 'string') {
38
- return false;
39
- }
40
- return acc;
41
- }, true);
42
- if (!allStringColumns) {
43
- throw `Some of your columns are not strings`;
44
- }
45
- if (!Array.isArray(dataSourceInfo.data)) {
46
- throw `We can't find the data array in your configuration`;
47
- }
48
- return true;
49
- };
50
- const Wizard = (props) => {
51
- const [state, dispatch] = react_1.useReducer(reducer, Object.assign(Object.assign({}, initialState), { adaptableOptions: props.adaptableOptions }));
52
- const [droppableKey, setDroppableKey] = react_1.useState(Date.now());
53
- const [isDataLoading, setIsDataLoading] = react_1.useState(false);
54
- const handleDataSource = (array, file) => {
55
- const dataSourceInfo = (props.prepareData || helper_1.prepareDataSource)(array, file);
56
- try {
57
- validDataSource(dataSourceInfo);
58
- }
59
- catch (err) {
60
- return dispatch({
61
- type: 'ERROR',
62
- payload: `Invalid adaptable configuration - ${err}`,
63
- });
64
- }
65
- const gridOptions = helper_1.prepareGridOptions(dataSourceInfo);
66
- const adaptableOptions = Object.assign({}, props.adaptableOptions);
67
- adaptableOptions.adaptableId = adaptableOptions.adaptableId || (file ? file.name : '');
68
- adaptableOptions.gridOptions = gridOptions;
69
- if (dataSourceInfo.primaryKey) {
70
- adaptableOptions.primaryKey = dataSourceInfo.primaryKey;
71
- }
72
- const shouldShowWizard = props.fetchData ? Boolean(props.showFetchDataWizard) : true;
73
- if (shouldShowWizard) {
74
- dispatch({
75
- type: 'DROPPED',
76
- payload: adaptableOptions,
77
- });
78
- }
79
- else {
80
- props.onInit(adaptableOptions);
81
- }
82
- };
83
- let wizard;
84
- if (state.dropped) {
85
- wizard = (React.createElement(AdaptableConfigurationDialog_1.default, { adaptableOptions: state.adaptableOptions, onCancel: () => {
86
- // change the file droppable component key
87
- // so it's remounted and it's in the initial state
88
- setDroppableKey(Date.now());
89
- dispatch({
90
- type: 'CANCEL',
91
- });
92
- }, onFinish: (adaptableOptions) => {
93
- props.onInit(adaptableOptions);
94
- } }));
95
- }
96
- react_1.useEffect(() => {
97
- if (props.fetchData) {
98
- setIsDataLoading(true);
99
- props.fetchData().then((data) => {
100
- handleDataSource(data);
101
- setIsDataLoading(false);
102
- });
103
- }
104
- }, []);
105
- const ddEnabled = !props.fetchData;
106
- return (React.createElement(React.Fragment, null,
107
- ddEnabled && (React.createElement(FileDroppable_1.default, { key: droppableKey, className: 'ab-nocode-wizard', toJSON: props.fileContentsToJSON, readFile: props.readFile, fileAccept: props.fileAccept, helpText: props.helpText, message: state.error, defaultText: props.defaultActionMessage, dragOverText: props.dragOverActionMessage, loadingText: props.loadingMessage, onDropSuccess: handleDataSource })),
108
- isDataLoading && (React.createElement(rebass_1.Flex, { className: 'ab-nocode-wizard', alignItems: "center", justifyContent: "center", flexDirection: "column" }, props.loadingMessage || 'Loading ...')),
109
- wizard));
110
- };
9
+ React.createElement(Wizard_1.Wizard, Object.assign({}, props))));
111
10
  exports.default = AdaptableWizardView;
@@ -83,7 +83,7 @@ exports.renderAlertBehaviourSummary = (alert, api, allowWrap = false) => {
83
83
  } }));
84
84
  };
85
85
  exports.AlertBehaviourWizardSection = (props) => {
86
- const { data, api } = OnePageAdaptableWizard_1.useOnePageWizardContext();
86
+ const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
87
87
  const { AlertProperties = {} } = data;
88
88
  const rowAddedAlert = api.internalApi.isAlertDefinitionForAddedRowChangeEvent(data);
89
89
  const rowRemovedAlert = api.internalApi.isAlertDefinitionForRemovedRowChangeEvent(data);
@@ -2,10 +2,10 @@
2
2
  import { AlertButton } from '../../../PredefinedConfig/AlertState';
3
3
  import { AdaptableAlert } from '../../../PredefinedConfig/Common/AdaptableAlert';
4
4
  import { AdaptableApi } from '../../../Api/AdaptableApi';
5
- import { AlertButtonContext } from '../../../types';
5
+ import { AlertFormContext } from '../../../types';
6
6
  declare type AlertButtonsEditorProps = {
7
- AlertButtons: AlertButton<AlertButtonContext>[];
8
- onChange: (buttons: AlertButton<AlertButtonContext>[]) => void;
7
+ AlertButtons: AlertButton<AlertFormContext>[];
8
+ onChange: (buttons: AlertButton<AlertFormContext>[]) => void;
9
9
  api: AdaptableApi;
10
10
  adaptableAlert: AdaptableAlert;
11
11
  };
@@ -22,7 +22,7 @@ const DEFAULT_BUTTONS = [
22
22
  ];
23
23
  exports.renderAlertDisplaySummary = () => {
24
24
  var _a;
25
- const { data, api } = OnePageAdaptableWizard_1.useOnePageWizardContext();
25
+ const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
26
26
  if (!((_a = data.AlertProperties) === null || _a === void 0 ? void 0 : _a.DisplayNotification)) {
27
27
  return (React.createElement(rebass_1.Text, { fontSize: 2 },
28
28
  "Alert type ",
@@ -57,7 +57,7 @@ exports.AlertPreview = (_a) => {
57
57
  };
58
58
  exports.AlertDisplayWizardSection = (props) => {
59
59
  var _a, _b, _c, _d;
60
- const { data, api } = OnePageAdaptableWizard_1.useOnePageWizardContext();
60
+ const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
61
61
  const messageType = data.MessageType;
62
62
  const messageText = api.alertApi.getAlertDescription(data);
63
63
  const adaptableAlert = {
@@ -6,7 +6,7 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
7
7
  const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
8
8
  exports.BaseAlertRulesWizardSection = (props) => {
9
- const { data, api, moduleInfo } = OnePageAdaptableWizard_1.useOnePageWizardContext();
9
+ const { data, api, moduleInfo } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
10
10
  const wholeRowScope = props.wholeRowScope != null ? props.wholeRowScope : api.scopeApi.scopeIsAll(data.Scope);
11
11
  const predicateDefs = api.alertApi.getAlertPredicateDefsForScope(data.Scope);
12
12
  return (React.createElement(EntityRulesEditor_1.EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: "Any", data: data, predicateDefs: predicateDefs, onChange: props.onChange, showAggregation: !wholeRowScope ? false : true, showObservable: !wholeRowScope ? false : true, showBoolean: true, showPredicate: true, descriptions: {
@@ -8,7 +8,7 @@ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
8
8
  const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
9
9
  const ValueSelector_1 = require("../../Components/ValueSelector");
10
10
  exports.BaseAlertScopeWizardSection = (props) => {
11
- const { data, api } = OnePageAdaptableWizard_1.useOnePageWizardContext();
11
+ const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
12
12
  return (React.createElement(rebass_1.Flex, { flexDirection: "column", style: { height: '100%' }, padding: 2 },
13
13
  React.createElement(NewScopeComponent_1.NewScopeComponent, { descriptions: {
14
14
  rowScope: 'Changes anywhere in the row will trigger an alert',
@@ -41,7 +41,7 @@ exports.BaseAlertScopeWizardSection = (props) => {
41
41
  } })));
42
42
  };
43
43
  exports.renderBaseAlertScopeSummary = (data) => {
44
- const { api: { scopeApi }, } = OnePageAdaptableWizard_1.useOnePageWizardContext();
44
+ const { api: { scopeApi }, } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
45
45
  const columnsInScope = scopeApi.getColumnsForScope(data.Scope);
46
46
  return (React.createElement(React.Fragment, null,
47
47
  React.createElement(rebass_1.Box, null,
@@ -6,7 +6,6 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const react_redux_1 = require("react-redux");
7
7
  const BulkUpdateRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/BulkUpdateRedux"));
8
8
  const SystemRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/SystemRedux"));
9
- const Enums_1 = require("../../PredefinedConfig/Common/Enums");
10
9
  const PanelWithImage_1 = require("../Components/Panels/PanelWithImage");
11
10
  const AdaptablePopover_1 = require("../AdaptablePopover");
12
11
  const StringExtensions_1 = require("../../Utilities/Extensions/StringExtensions");
@@ -34,7 +33,7 @@ class BulkUpdatePopupComponent extends React.Component {
34
33
  let dataTypeErrorMessage = '';
35
34
  if (col && StringExtensions_1.StringExtensions.IsNotNullOrEmpty(this.props.BulkUpdateValue)) {
36
35
  // check that the update value is a number for a numeric column. not issue for dates as we dont allow free text
37
- if (col.dataType == Enums_1.DataType.Number) {
36
+ if (col.dataType == 'Number') {
38
37
  if (isNaN(Number(this.props.BulkUpdateValue))) {
39
38
  hasDataTypeError = true;
40
39
  dataTypeErrorMessage = 'This column only accepts numbers';
@@ -50,7 +49,7 @@ class BulkUpdatePopupComponent extends React.Component {
50
49
  return null;
51
50
  }
52
51
  return (React.createElement(PanelWithImage_1.PanelWithImage, { bodyProps: { padding: 2 }, flex: 1, glyphicon: this.props.moduleInfo.Glyph, header: this.props.moduleInfo.FriendlyName, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed(), variant: "primary" },
53
- col.dataType == Enums_1.DataType.Date ? (React.createElement(React.Fragment, null,
52
+ col.dataType == 'Date' ? (React.createElement(React.Fragment, null,
54
53
  React.createElement(HelpBlock_1.default, { marginTop: 2, marginBottom: 2 }, "Enter a date value. Alternatively, tick the checkbox and select from an existing column value."),
55
54
  React.createElement(rebass_1.Box, null,
56
55
  React.createElement(CheckBox_1.CheckBox, { marginLeft: 2, onChange: (checked) => this.onUseColumnValuesSelectorChanged(checked), checked: this.state.useSelector },
@@ -6,7 +6,6 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const react_1 = require("react");
7
7
  const rebass_1 = require("rebass");
8
8
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
9
- const Enums_1 = require("../../../PredefinedConfig/Common/Enums");
10
9
  const ExpressionEditor_1 = require("../../../components/ExpressionEditor");
11
10
  const Tabs_1 = require("../../../components/Tabs");
12
11
  const CodeBlock_1 = require("../../../components/CodeBlock");
@@ -43,7 +42,7 @@ QueryTab.defaultProps = {
43
42
  isTabsTab: true,
44
43
  };
45
44
  exports.CalculatedColumnExpressionWizardSection = (props) => {
46
- const { api, data, moduleInfo } = OnePageAdaptableWizard_1.useOnePageWizardContext();
45
+ const { api, data, moduleInfo } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
47
46
  const initialData = react_1.useMemo(() => api.internalApi.getQueryPreviewData(), []);
48
47
  const type = data.Query.AggregatedScalarExpression != undefined
49
48
  ? 'AggregatedScalarExpression'
@@ -65,8 +64,8 @@ exports.CalculatedColumnExpressionWizardSection = (props) => {
65
64
  const setCalculatedColumnExpression = (calculatedColumnQuery) => {
66
65
  const calculatedColumnExpressionService = api.internalApi.getCalculatedColumnExpressionService();
67
66
  const dataType = calculatedColumnExpressionService.getCalculatedColumnDataType(calculatedColumnQuery);
68
- const Pivotable = dataType == Enums_1.DataType.String;
69
- const Aggregatable = dataType == Enums_1.DataType.Number;
67
+ const Pivotable = dataType == 'String';
68
+ const Aggregatable = dataType == 'Number';
70
69
  props.onChange(Object.assign(Object.assign({}, data), { Query: calculatedColumnQuery, CalculatedColumnSettings: Object.assign(Object.assign({}, data.CalculatedColumnSettings), { DataType: dataType, Pivotable,
71
70
  Aggregatable }) }));
72
71
  };
@@ -4,7 +4,6 @@ exports.CalculatedColumnSettingsWizardSection = exports.isValidCalculatedColumnS
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const rebass_1 = require("rebass");
7
- const Enums_1 = require("../../../PredefinedConfig/Common/Enums");
8
7
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
9
8
  const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
10
9
  const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
@@ -45,7 +44,7 @@ exports.isValidCalculatedColumnSettings = (data, api) => {
45
44
  };
46
45
  exports.CalculatedColumnSettingsWizardSection = (props) => {
47
46
  var _a, _b;
48
- const { data, api } = OnePageAdaptableWizard_1.useOnePageWizardContext();
47
+ const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
49
48
  const calculatedColumnExpressionService = react_1.useMemo(() => api.internalApi.getCalculatedColumnExpressionService(), []);
50
49
  const handleColumnIdChange = (event) => {
51
50
  let e = event.target;
@@ -64,10 +63,10 @@ exports.CalculatedColumnSettingsWizardSection = (props) => {
64
63
  const validCheck = exports.isValidCalculatedColumnSettings(data, api);
65
64
  const ErrorMessage = validCheck === true ? null : validCheck;
66
65
  let options = [
67
- { value: Enums_1.DataType.Number, label: Enums_1.DataType.Number },
68
- { value: Enums_1.DataType.String, label: Enums_1.DataType.String },
69
- { value: Enums_1.DataType.Date, label: Enums_1.DataType.Date },
70
- { value: Enums_1.DataType.Boolean, label: Enums_1.DataType.Boolean },
66
+ { value: 'Number', label: 'Number' },
67
+ { value: 'String', label: 'String' },
68
+ { value: 'Date', label: 'Date' },
69
+ { value: 'Boolean', label: 'Boolean' },
71
70
  ];
72
71
  const [ColumnNameFocused, setColumnNameFocused] = react_1.useState(false);
73
72
  const ColumnName = data.FriendlyName;
@@ -6,8 +6,8 @@ const React = tslib_1.__importStar(require("react"));
6
6
  const EmptyContent_1 = tslib_1.__importDefault(require("../../components/EmptyContent"));
7
7
  const InfiniteTable_1 = require("../../components/InfiniteTable");
8
8
  const columnsMap = new Map([
9
- ['Operation', { field: 'Operation', flex: 1 }],
10
- ['Value', { field: 'Value', flex: 1 }],
9
+ ['Operation', { field: 'Operation', defaultFlex: 1 }],
10
+ ['Value', { field: 'Value', defaultFlex: 1 }],
11
11
  ]);
12
12
  const tableDOMProps = {
13
13
  style: {
@@ -105,7 +105,7 @@ class FilterFormComponent extends React.Component {
105
105
  this._isMounted = false;
106
106
  }
107
107
  componentDidMount() {
108
- if (this.props.currentColumn.dataType != Enums_1.DataType.Boolean) {
108
+ if (this.props.currentColumn.dataType != 'Boolean') {
109
109
  this.loadPermittedValues();
110
110
  }
111
111
  }
@@ -321,7 +321,7 @@ class QuickFilterFormComponent extends React.Component {
321
321
  }
322
322
  clearFilter() {
323
323
  const { filter } = this.state;
324
- this.props.api.layoutApi.clearColumnFilterByColumn(filter.ColumnId);
324
+ this.props.api.filterApi.clearColumnFilterByColumn(filter.ColumnId);
325
325
  }
326
326
  hasValuesPredicate(predicate) {
327
327
  return (predicate === null || predicate === void 0 ? void 0 : predicate.PredicateId) === 'Values' || (predicate === null || predicate === void 0 ? void 0 : predicate.PredicateId) === 'ExcludeValues';