@adaptabletools/adaptable 12.0.0 → 12.0.1-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base.css +1 -1
- package/bundle.cjs.js +118 -118
- package/index.css +1 -1
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/ActionOptions.d.ts +1 -1
- package/src/Api/Implementation/InternalApiImpl.d.ts +4 -1
- package/src/Api/Implementation/InternalApiImpl.js +16 -3
- package/src/Api/InternalApi.d.ts +4 -1
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +24 -6
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +2 -2
- package/src/PredefinedConfig/Selection/GridCellRange.d.ts +19 -0
- package/src/PredefinedConfig/StatusBarState.d.ts +1 -1
- package/src/Strategy/AdaptableModuleBase.d.ts +6 -5
- package/src/Strategy/AlertModule.d.ts +2 -8
- package/src/Strategy/AlertModule.js +3 -0
- package/src/Strategy/Interface/IModule.d.ts +5 -3
- package/src/Utilities/MenuItem.d.ts +4 -4
- package/src/View/Alert/ActiveAlertsPanelItemLabel.d.ts +5 -0
- package/src/View/Alert/ActiveAlertsPanelItemLabel.js +22 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +2 -2
- package/src/View/ColorPicker.d.ts +1 -1
- package/src/View/Components/AdaptableDateInput/index.d.ts +1 -1
- package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +8 -4
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +6 -1
- package/src/View/Components/Buttons/ButtonPause.js +11 -1
- package/src/View/Components/FilterForm/QuickFilterForm.js +1 -1
- package/src/View/Components/Panels/PanelWithButton.d.ts +2 -1
- package/src/View/Components/Panels/PanelWithImage.d.ts +3 -2
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -11
- package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -11
- package/src/View/Dashboard/CustomDashboardButton.js +2 -15
- package/src/View/Dashboard/CustomToolbarWrapper.js +2 -11
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +6 -0
- package/src/View/GridInfo/GridInfoPopup.js +1 -1
- package/src/View/UIHelper.d.ts +2 -2
- package/src/agGrid/ActionColumnRenderer.js +5 -11
- package/src/agGrid/Adaptable.d.ts +2 -26
- package/src/agGrid/Adaptable.js +51 -51
- package/src/agGrid/agGridMenuHelper.d.ts +1 -0
- package/src/agGrid/agGridMenuHelper.js +15 -4
- package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +6 -12
- package/src/components/AdaptableIconComponent/index.d.ts +2 -1
- package/src/components/AdaptableIconComponent/index.js +36 -3
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/Input/index.d.ts +1 -1
- package/src/components/List/ListGroupItem/index.d.ts +1 -1
- package/src/components/PopupWithFooter.d.ts +1 -1
- package/src/components/SimpleButton/index.js +1 -1
- package/src/components/Textarea/index.d.ts +1 -1
- package/src/components/icons/{color-drop.d.ts → ends-with.d.ts} +0 -0
- package/src/components/icons/{format-letter-ends-with.js → ends-with.js} +0 -0
- package/src/components/icons/{filter-outline.d.ts → filter.d.ts} +0 -0
- package/src/components/icons/{filter-outline.js → filter.js} +0 -0
- package/src/components/icons/index.d.ts +5 -7
- package/src/components/icons/index.js +7 -17
- package/src/components/icons/{format-letter-ends-with.d.ts → starts-with.d.ts} +0 -0
- package/src/components/icons/{format-letter-starts-with.js → starts-with.js} +0 -0
- package/src/metamodel/adaptable.metamodel.d.ts +70 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/agGrid/rowEditIcons.d.ts +0 -5
- package/src/agGrid/rowEditIcons.js +0 -10
- package/src/components/icons/color-drop.js +0 -7
- package/src/components/icons/format-letter-starts-with.d.ts +0 -3
- package/src/components/icons/pause-red.d.ts +0 -3
- package/src/components/icons/pause-red.js +0 -7
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PanelProps } from '../../../components/Panel';
|
|
3
3
|
import { BoxProps } from 'rebass';
|
|
4
|
+
import { AdaptableInternalIconName } from '../../../PredefinedConfig/Common/AdaptableIcon';
|
|
4
5
|
export interface PanelWithImageProps extends PanelProps {
|
|
5
|
-
glyphicon?:
|
|
6
|
-
icon?:
|
|
6
|
+
glyphicon?: AdaptableInternalIconName;
|
|
7
|
+
icon?: AdaptableInternalIconName;
|
|
7
8
|
infoLink?: string;
|
|
8
9
|
infoLinkDisabled?: boolean;
|
|
9
10
|
borderRadius?: string;
|
|
@@ -148,19 +148,11 @@ const AdaptableToolPanelComponent = (props) => {
|
|
|
148
148
|
return props.api.toolPanelApi.getCustomToolPanelButtons().map((button) => {
|
|
149
149
|
// TODO: variants of this mapping are present in several places (just search for api.internalApi.getStyleForButton() usages)
|
|
150
150
|
// with the next opportunity we should abstract it
|
|
151
|
-
// the default size of AdapTable SVG ModuleButtons
|
|
152
|
-
const defaultIconProps = {
|
|
153
|
-
style: {
|
|
154
|
-
height: 'var(--ab-cmp-simple-button__height)',
|
|
155
|
-
width: 'var(--ab-cmp-simple-button__width)',
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
151
|
const toolPanelContext = {
|
|
159
152
|
adaptableApi: props.api,
|
|
160
153
|
toolPanelState: props.api.toolPanelApi.getToolPanelState(),
|
|
161
154
|
};
|
|
162
155
|
const buttonIcon = props.api.internalApi.getIconForButton(button, toolPanelContext);
|
|
163
|
-
const iconProps = buttonIcon && Object.assign({}, defaultIconProps, buttonIcon);
|
|
164
156
|
let buttonStyle = props.api.internalApi.getStyleForButton(button, toolPanelContext);
|
|
165
157
|
let buttonLabel = props.api.internalApi.getLabelForButton(button, toolPanelContext);
|
|
166
158
|
let buttonTooltip = props.api.internalApi.getTooltipForButton(button, toolPanelContext);
|
|
@@ -171,9 +163,7 @@ const AdaptableToolPanelComponent = (props) => {
|
|
|
171
163
|
const buttonVariant = buttonStyle && buttonStyle.variant ? buttonStyle.variant : 'text';
|
|
172
164
|
const buttonTone = buttonStyle && buttonStyle.tone ? buttonStyle.tone : 'none';
|
|
173
165
|
const uniqueKey = buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : uuid_1.createUuid();
|
|
174
|
-
return (React.createElement(SimpleButton_1.default, { key: uniqueKey, variant: buttonVariant, tone: buttonTone, className: `ab-ToolPanel__Home__${kebabCase_1.default(buttonLabel)} ${(buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className) || ''}`, tooltip: buttonTooltip, disabled: disabled, onClick: () => button.onClick(button, toolPanelContext), accessLevel: 'Full' },
|
|
175
|
-
buttonIcon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
176
|
-
buttonLabel));
|
|
166
|
+
return (React.createElement(SimpleButton_1.default, { key: uniqueKey, variant: buttonVariant, tone: buttonTone, className: `ab-ToolPanel__Home__${kebabCase_1.default(buttonLabel)} ${(buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className) || ''}`, tooltip: buttonTooltip, icon: buttonIcon, disabled: disabled, onClick: () => button.onClick(button, toolPanelContext), accessLevel: 'Full' }, buttonLabel));
|
|
177
167
|
});
|
|
178
168
|
};
|
|
179
169
|
const onSetColumnVisibility = (name) => {
|
|
@@ -44,20 +44,12 @@ const CustomToolPanelContent = (props) => {
|
|
|
44
44
|
((_a = customToolPanel.buttons) === null || _a === void 0 ? void 0 : _a.length) && (React.createElement("div", { id: buttonsDivId, className: `ab-ToolPanel__custom-content__buttons ${buttonsDivId}` }, customToolPanel.buttons.map((button) => {
|
|
45
45
|
// TODO: variants of this mapping are present in several places (just search for api.internalApi.getStyleForButton() usages)
|
|
46
46
|
// with the next opportunity we should abstract it
|
|
47
|
-
// the default size of AdapTable SVG ModuleButtons
|
|
48
|
-
const defaultIconProps = {
|
|
49
|
-
style: {
|
|
50
|
-
height: 'var(--ab-cmp-simple-button__height)',
|
|
51
|
-
width: 'var(--ab-cmp-simple-button__width)',
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
47
|
const toolPanelContext = {
|
|
55
48
|
adaptableApi: api,
|
|
56
49
|
toolPanelState: api.toolPanelApi.getToolPanelState(),
|
|
57
50
|
customToolPanel: customToolPanel,
|
|
58
51
|
};
|
|
59
52
|
const buttonIcon = api.internalApi.getIconForButton(button, toolPanelContext);
|
|
60
|
-
const iconProps = buttonIcon && Object.assign({}, defaultIconProps, buttonIcon);
|
|
61
53
|
let buttonStyle = api.internalApi.getStyleForButton(button, toolPanelContext);
|
|
62
54
|
let buttonLabel = api.internalApi.getLabelForButton(button, toolPanelContext);
|
|
63
55
|
let buttonTooltip = api.internalApi.getTooltipForButton(button, toolPanelContext);
|
|
@@ -68,9 +60,7 @@ const CustomToolPanelContent = (props) => {
|
|
|
68
60
|
const buttonVariant = buttonStyle && buttonStyle.variant ? buttonStyle.variant : 'text';
|
|
69
61
|
const buttonTone = buttonStyle && buttonStyle.tone ? buttonStyle.tone : 'none';
|
|
70
62
|
const uniqueKey = buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : uuid_1.createUuid();
|
|
71
|
-
return (React.createElement(SimpleButton_1.default, { key: uniqueKey, variant: buttonVariant, tone: buttonTone, className: `ab-ToolPanel__Home__${kebabCase_1.default(buttonLabel)} ${(buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className) || ''}`, tooltip: buttonTooltip, disabled: disabled, onClick: () => button.onClick(button, toolPanelContext), accessLevel: 'Full' },
|
|
72
|
-
buttonIcon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
73
|
-
buttonLabel));
|
|
63
|
+
return (React.createElement(SimpleButton_1.default, { key: uniqueKey, variant: buttonVariant, tone: buttonTone, className: `ab-ToolPanel__Home__${kebabCase_1.default(buttonLabel)} ${(buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className) || ''}`, tooltip: buttonTooltip, icon: buttonIcon, disabled: disabled, onClick: () => button.onClick(button, toolPanelContext), accessLevel: 'Full' }, buttonLabel));
|
|
74
64
|
})))));
|
|
75
65
|
};
|
|
76
66
|
exports.CustomToolPanelContent = CustomToolPanelContent;
|
|
@@ -15,18 +15,7 @@ const CustomDashboardButton = (props) => {
|
|
|
15
15
|
adaptableApi: props.api,
|
|
16
16
|
dashboardState: props.api.dashboardApi.getDashboardState(),
|
|
17
17
|
};
|
|
18
|
-
const defaultIconProps = {
|
|
19
|
-
style: {
|
|
20
|
-
height: 'var(--ab-cmp-simple-button__height)',
|
|
21
|
-
width: 'var(--ab-cmp-simple-button__width)',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
18
|
const buttonIcon = props.api.internalApi.getIconForButton(button, dashboardContext);
|
|
25
|
-
const iconProps = buttonIcon && Object.assign({}, defaultIconProps, buttonIcon);
|
|
26
|
-
// const iconProps: any = button.icon ? { ...button.icon } : null;
|
|
27
|
-
// if (iconProps) {
|
|
28
|
-
// delete iconProps.Uuid;
|
|
29
|
-
// }
|
|
30
19
|
let buttonStyle = props.api.internalApi.getStyleForButton(button, dashboardContext);
|
|
31
20
|
let buttonLabel = props.api.internalApi.getLabelForButton(button, dashboardContext);
|
|
32
21
|
let buttonTooltip = props.api.internalApi.getTooltipForButton(button, dashboardContext);
|
|
@@ -34,15 +23,13 @@ const CustomDashboardButton = (props) => {
|
|
|
34
23
|
return null;
|
|
35
24
|
}
|
|
36
25
|
const disabled = button.disabled && button.disabled(button, dashboardContext);
|
|
37
|
-
return (React.createElement(SimpleButton_1.default, { key: buttonLabel, variant: buttonStyle && buttonStyle.variant ? buttonStyle.variant : 'text', tone: buttonStyle && buttonStyle.tone ? buttonStyle.tone : 'none', className: `ab-DashboardToolbar__Home__${kebabCase_1.default(buttonLabel)} ${(buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className) || ''}`, tooltip: buttonTooltip, disabled: disabled || props.accessLevel == 'ReadOnly', onClick: () => {
|
|
26
|
+
return (React.createElement(SimpleButton_1.default, { key: buttonLabel, variant: buttonStyle && buttonStyle.variant ? buttonStyle.variant : 'text', tone: buttonStyle && buttonStyle.tone ? buttonStyle.tone : 'none', className: `ab-DashboardToolbar__Home__${kebabCase_1.default(buttonLabel)} ${(buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className) || ''}`, tooltip: buttonTooltip, icon: buttonIcon, disabled: disabled || props.accessLevel == 'ReadOnly', onClick: () => {
|
|
38
27
|
var _a;
|
|
39
28
|
(_a = button.onClick) === null || _a === void 0 ? void 0 : _a.call(button, button, dashboardContext);
|
|
40
29
|
setTimeout(() => {
|
|
41
30
|
// mutate state to force a re-rendering
|
|
42
31
|
setComponentRevision(componentRevision + 1);
|
|
43
32
|
}, 16);
|
|
44
|
-
}, accessLevel: 'Full' },
|
|
45
|
-
buttonIcon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
46
|
-
buttonLabel));
|
|
33
|
+
}, accessLevel: 'Full' }, buttonLabel));
|
|
47
34
|
};
|
|
48
35
|
exports.CustomDashboardButton = CustomDashboardButton;
|
|
@@ -69,14 +69,7 @@ const CustomToolbarWrapper = (props) => {
|
|
|
69
69
|
adaptableApi: api,
|
|
70
70
|
dashboardState: api.dashboardApi.getDashboardState(),
|
|
71
71
|
};
|
|
72
|
-
const defaultIconProps = {
|
|
73
|
-
style: {
|
|
74
|
-
height: 'var(--ab-cmp-simple-button__height)',
|
|
75
|
-
width: 'var(--ab-cmp-simple-button__width)',
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
72
|
const buttonIcon = api.internalApi.getIconForButton(button, dashboardContext);
|
|
79
|
-
const iconProps = buttonIcon && Object.assign({}, defaultIconProps, buttonIcon);
|
|
80
73
|
let buttonStyle = api.internalApi.getStyleForButton(button, dashboardContext);
|
|
81
74
|
let buttonLabel = api.internalApi.getLabelForButton(button, dashboardContext);
|
|
82
75
|
let buttonTooltip = api.internalApi.getTooltipForButton(button, dashboardContext);
|
|
@@ -86,15 +79,13 @@ const CustomToolbarWrapper = (props) => {
|
|
|
86
79
|
const disabled = button.disabled && button.disabled(button, dashboardContext);
|
|
87
80
|
let buttonVariant = buttonStyle && buttonStyle.variant ? buttonStyle.variant : 'outlined';
|
|
88
81
|
let buttonTone = buttonStyle && buttonStyle.tone ? buttonStyle.tone : 'neutral';
|
|
89
|
-
return (React.createElement(SimpleButton_1.default, { style: { marginLeft: index ? 'var(--ab-space-1)' : 0 }, key: index, disabled: disabled, tooltip: buttonTooltip, variant: buttonVariant, tone: buttonTone, onClick: () => {
|
|
82
|
+
return (React.createElement(SimpleButton_1.default, { style: { marginLeft: index ? 'var(--ab-space-1)' : 0 }, key: index, disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, variant: buttonVariant, tone: buttonTone, onClick: () => {
|
|
90
83
|
button.onClick ? button.onClick(button, dashboardContext) : null;
|
|
91
84
|
setTimeout(() => {
|
|
92
85
|
// mutate state to force a re-rendering
|
|
93
86
|
setComponentRevision(componentRevision + 1);
|
|
94
87
|
}, 16);
|
|
95
|
-
} },
|
|
96
|
-
buttonIcon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
97
|
-
buttonLabel));
|
|
88
|
+
} }, buttonLabel));
|
|
98
89
|
}))));
|
|
99
90
|
};
|
|
100
91
|
exports.CustomToolbarWrapper = CustomToolbarWrapper;
|
|
@@ -60,6 +60,7 @@ const isValidFreeTextColumn = (data, api) => {
|
|
|
60
60
|
};
|
|
61
61
|
exports.isValidFreeTextColumn = isValidFreeTextColumn;
|
|
62
62
|
const FreeTextColumnSettingsWizardSection = (props) => {
|
|
63
|
+
var _a;
|
|
63
64
|
const { data, api } = OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext();
|
|
64
65
|
const Pattern = api.internalApi.getAdaptableOptions().userInterfaceOptions.dateInputOptions.dateFormat;
|
|
65
66
|
const [ColumnNameFocused, setColumnNameFocused] = react_1.useState(false);
|
|
@@ -128,6 +129,11 @@ const FreeTextColumnSettingsWizardSection = (props) => {
|
|
|
128
129
|
} })) : (React.createElement(AdaptableInput_1.default, { value: data.DataType === 'Date' && data.DefaultValue
|
|
129
130
|
? DateHelper_1.parseToISO(data.DefaultValue, Pattern) || ''
|
|
130
131
|
: data.DefaultValue || '', style: { width: '100%', maxWidth: 500 }, type: data.DataType === 'Number' ? 'number' : data.DataType === 'Date' ? 'date' : 'text', placeholder: "Default Column Value (not required)", onChange: (e) => handleDefaultValueChange(e) }))),
|
|
132
|
+
React.createElement(FormLayout_1.FormRow, { label: "Header Tooltip" },
|
|
133
|
+
React.createElement(Input_1.default, { "data-name": "header-tooltip", type: "text", style: { width: '100%', maxWidth: 500 }, value: ((_a = data.FreeTextColumnSettings) === null || _a === void 0 ? void 0 : _a.HeaderToolTip) || '', onChange: (e) => handleSpecialColumnSettingsChange({
|
|
134
|
+
HeaderToolTip: e.target.value,
|
|
135
|
+
}) })),
|
|
136
|
+
' ',
|
|
131
137
|
data.DataType == 'String' && (React.createElement(FormLayout_1.FormRow, { label: "Editor Type" },
|
|
132
138
|
React.createElement(Radio_1.default, { value: "Inline", checked: data.TextEditor == 'Inline', onChange: (_, e) => onDynamicSelectChanged(e), marginRight: 2 }, "Inline Editor"),
|
|
133
139
|
React.createElement(Radio_1.default, { value: "Large", checked: data.TextEditor == 'Large', onChange: (_, e) => onDynamicSelectChanged(e) }, "Large Editor")))),
|
|
@@ -102,7 +102,7 @@ const GridInfoPopup = (props) => {
|
|
|
102
102
|
return React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { key: index, colItems: x });
|
|
103
103
|
});
|
|
104
104
|
const showRadioButtons = [showGridSummary, showAdaptableOptions, showColumnInfo, showAdaptableObjects].filter((item) => item).length > 1;
|
|
105
|
-
return (React.createElement(PopupPanel_1.PopupPanel, { headerText: 'Grid Info', glyphicon: 'info
|
|
105
|
+
return (React.createElement(PopupPanel_1.PopupPanel, { headerText: 'Grid Info', glyphicon: 'info' },
|
|
106
106
|
React.createElement(rebass_1.Flex, { marginBottom: 2, padding: 3 }, showRadioButtons && (React.createElement(React.Fragment, null,
|
|
107
107
|
showGridSummary && (React.createElement(Radio_1.default, { "data-name": "radioButton-GridSummary", marginRight: 3, value: "GridSummary", checked: state.ActiveTab == 'GridSummary', onChange: (_, e) => onShowGridSummaryChanged('GridSummary') }, "Summary")),
|
|
108
108
|
showAdaptableOptions && (React.createElement(Radio_1.default, { "data-name": "radioButton-AdaptableOptions", marginRight: 3, value: "AdaptableOptions", checked: state.ActiveTab == 'AdaptableOptions', onChange: (_, e) => onShowGridSummaryChanged('AdaptableOptions') }, "Options")),
|
package/src/View/UIHelper.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EditableConfigEntityState } from './Components/SharedProps/EditableConf
|
|
|
3
3
|
import { StatusColour } from '../PredefinedConfig/Common/Enums';
|
|
4
4
|
import { AdaptableStyle } from '../PredefinedConfig/Common/AdaptableStyle';
|
|
5
5
|
import { Schedule, Weekday } from '../PredefinedConfig/Common/Schedule';
|
|
6
|
-
import { AdaptableColumnDataType, AdaptableOptions } from '../types';
|
|
6
|
+
import { AdaptableColumnDataType, AdaptableInternalIconName, AdaptableOptions } from '../types';
|
|
7
7
|
import { AdaptableAlert } from '../PredefinedConfig/Common/AdaptableAlert';
|
|
8
8
|
import { AdaptableMessageType } from '../PredefinedConfig/Common/AdaptableMessageType';
|
|
9
9
|
export declare const BLACK: string;
|
|
@@ -36,7 +36,7 @@ export declare function IsEmptyStyle(style: AdaptableStyle): boolean;
|
|
|
36
36
|
export declare function IsNotEmptyStyle(style: AdaptableStyle): boolean;
|
|
37
37
|
export declare function getMessageTypeByStatusColour(statusColour: StatusColour): AdaptableMessageType;
|
|
38
38
|
export declare function getButtonToneByMessageType(messageType: AdaptableMessageType): 'success' | 'error' | 'neutral' | 'none' | 'warning' | 'info' | 'accent';
|
|
39
|
-
export declare function getGlyphByMessageType(messageType: AdaptableMessageType):
|
|
39
|
+
export declare function getGlyphByMessageType(messageType: AdaptableMessageType): AdaptableInternalIconName;
|
|
40
40
|
export declare function getColorByMessageType(messageType: AdaptableMessageType): string;
|
|
41
41
|
export declare function getStyleForStatusColour(statusColour: StatusColour): CSSProperties;
|
|
42
42
|
export declare function getStyleForMessageType(messageType: AdaptableMessageType): CSSProperties;
|
|
@@ -45,14 +45,10 @@ class ActionColumnRenderer {
|
|
|
45
45
|
if (button.hidden && button.hidden(button, context)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
const buttonIcon = adaptableApi.internalApi.getIconForButton(button, context);
|
|
55
|
-
const iconProps = buttonIcon && Object.assign({}, defaultIconProps, buttonIcon);
|
|
48
|
+
const buttonIcon = adaptableApi.internalApi.getIconForButton(button, context, {
|
|
49
|
+
height: 15,
|
|
50
|
+
width: 15,
|
|
51
|
+
});
|
|
56
52
|
const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
|
|
57
53
|
const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
|
|
58
54
|
const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
|
|
@@ -66,9 +62,7 @@ class ActionColumnRenderer {
|
|
|
66
62
|
}, 16);
|
|
67
63
|
};
|
|
68
64
|
const disabled = button.disabled && button.disabled(button, context);
|
|
69
|
-
return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' },
|
|
70
|
-
buttonIcon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
71
|
-
buttonLabel));
|
|
65
|
+
return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
|
|
72
66
|
})));
|
|
73
67
|
};
|
|
74
68
|
const eGui = this.eGui;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColDef, ColGroupDef, Column, ExcelStyle, GridOptions, Module, RowNode
|
|
1
|
+
import { ColDef, ColGroupDef, Column, ExcelStyle, GridOptions, Module, RowNode } from '@ag-grid-community/all-modules';
|
|
2
2
|
import { AdaptableNoCodeWizardOptions, IAdaptableNoCodeWizard } from '../AdaptableInterfaces/AdaptableNoCodeWizard';
|
|
3
3
|
import { IAdaptable } from '../AdaptableInterfaces/IAdaptable';
|
|
4
4
|
import { AdaptableOptions } from '../AdaptableOptions/AdaptableOptions';
|
|
@@ -18,7 +18,6 @@ import { SelectedRowInfo } from '../PredefinedConfig/Selection/SelectedRowInfo';
|
|
|
18
18
|
import { AdaptableTheme } from '../PredefinedConfig/ThemeState';
|
|
19
19
|
import { IAdaptableStore } from '../Redux/Store/Interface/IAdaptableStore';
|
|
20
20
|
import { IModuleCollection } from '../Strategy/Interface/IModule';
|
|
21
|
-
import { AdaptableColumnType } from '../types';
|
|
22
21
|
import { EmitterCallback } from '../Utilities/Emitter';
|
|
23
22
|
import { IPPStyle } from '../Utilities/Interface/IPPStyle';
|
|
24
23
|
import { LicenseService } from '../Utilities/Services/LicenseService';
|
|
@@ -31,8 +30,6 @@ import { IModuleService } from '../Utilities/Services/Interface/IModuleService';
|
|
|
31
30
|
import { IEntitlementService } from '../Utilities/Services/Interface/IEntitlementService';
|
|
32
31
|
import { IQueryLanguageService } from '../Utilities/Services/Interface/IQueryLanguageService';
|
|
33
32
|
import { IAlertService } from '../Utilities/Services/Interface/IAlertService';
|
|
34
|
-
import { AdaptableNumberEditor } from './editors/AdaptableNumberEditor';
|
|
35
|
-
import { AdaptableDateEditor } from './editors/AdaptableDateEditor';
|
|
36
33
|
import { ColumnSetupInfo } from './ColumnSetupInfo';
|
|
37
34
|
import { CustomSort } from '../PredefinedConfig/CustomSortState';
|
|
38
35
|
import { ColumnValuesComparer } from '../AdaptableOptions/GeneralOptions';
|
|
@@ -224,28 +221,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
224
221
|
*/
|
|
225
222
|
private mapColumnDefs;
|
|
226
223
|
private getColDefsForSpecialColumns;
|
|
227
|
-
getColDefsForFreeTextColumns():
|
|
228
|
-
headerName: string;
|
|
229
|
-
colId: string;
|
|
230
|
-
editable: boolean;
|
|
231
|
-
hide: boolean;
|
|
232
|
-
width: number;
|
|
233
|
-
enableValue: boolean;
|
|
234
|
-
filter: boolean;
|
|
235
|
-
floatingFilter: boolean;
|
|
236
|
-
resizable: boolean;
|
|
237
|
-
enableRowGroup: boolean;
|
|
238
|
-
sortable: boolean;
|
|
239
|
-
enablePivot: boolean;
|
|
240
|
-
suppressMenu: boolean;
|
|
241
|
-
suppressMovable: boolean;
|
|
242
|
-
headerTooltip: string;
|
|
243
|
-
cellEditor: string | typeof AdaptableNumberEditor | typeof AdaptableDateEditor;
|
|
244
|
-
type: AdaptableColumnType[];
|
|
245
|
-
valueSetter: (params: ValueSetterParams) => any;
|
|
246
|
-
cellRenderer: import("@ag-grid-community/all-modules").ICellRendererFunc;
|
|
247
|
-
valueGetter: (params: ValueGetterParams) => any;
|
|
248
|
-
}[];
|
|
224
|
+
getColDefsForFreeTextColumns(): ColDef[];
|
|
249
225
|
setupColumnValueGetter({ col }: ColumnSetupInfo): void;
|
|
250
226
|
setupColumnAggFunc({ col }: ColumnSetupInfo): void;
|
|
251
227
|
private getColDefsForRowEditColumns;
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -62,7 +62,6 @@ const StatusBarState_1 = require("../PredefinedConfig/StatusBarState");
|
|
|
62
62
|
const createAgStatusPanelComponent_1 = require("./createAgStatusPanelComponent");
|
|
63
63
|
const AdaptableStatusBar_1 = require("../View/StatusBar/AdaptableStatusBar");
|
|
64
64
|
const RowEditService_1 = require("../Utilities/Services/RowEditService");
|
|
65
|
-
const rowEditIcons_1 = require("./rowEditIcons");
|
|
66
65
|
const tinycolor = require('tinycolor2');
|
|
67
66
|
all_modules_1.ModuleRegistry.registerModules(all_modules_1.AllCommunityModules);
|
|
68
67
|
const GROUP_PATH_SEPARATOR = '/';
|
|
@@ -2132,7 +2131,6 @@ class Adaptable {
|
|
|
2132
2131
|
: freeTextColumn.DataType === 'Date'
|
|
2133
2132
|
? AdaptableDateEditor_1.AdaptableDateEditor
|
|
2134
2133
|
: null;
|
|
2135
|
-
LoggingHelper_1.LogAdaptableInfo('Setting up FreeText Column: ' + freeTextColumn.ColumnId);
|
|
2136
2134
|
const columnTypes = [
|
|
2137
2135
|
GeneralConstants_1.AB_SPECIAL_COLUMN,
|
|
2138
2136
|
this.agGridHelper.getAgGridDataType(freeTextColumn.DataType),
|
|
@@ -2140,7 +2138,7 @@ class Adaptable {
|
|
|
2140
2138
|
if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty((_a = freeTextColumn === null || freeTextColumn === void 0 ? void 0 : freeTextColumn.FreeTextColumnSettings) === null || _a === void 0 ? void 0 : _a.ColumnTypes)) {
|
|
2141
2139
|
columnTypes.push(...freeTextColumn.FreeTextColumnSettings.ColumnTypes);
|
|
2142
2140
|
}
|
|
2143
|
-
|
|
2141
|
+
const newColDef = {
|
|
2144
2142
|
headerName: freeTextColumn.FriendlyName || freeTextColumn.ColumnId,
|
|
2145
2143
|
colId: freeTextColumn.ColumnId,
|
|
2146
2144
|
editable: true,
|
|
@@ -2155,7 +2153,6 @@ class Adaptable {
|
|
|
2155
2153
|
enablePivot: freeTextColumnSettings.Pivotable,
|
|
2156
2154
|
suppressMenu: freeTextColumnSettings.SuppressMenu,
|
|
2157
2155
|
suppressMovable: freeTextColumnSettings.SuppressMovable,
|
|
2158
|
-
headerTooltip: freeTextColumnSettings.HeaderToolTip,
|
|
2159
2156
|
cellEditor: dataTypeEditor !== null && dataTypeEditor !== void 0 ? dataTypeEditor : (freeTextColumn.TextEditor && freeTextColumn.TextEditor == 'Large'
|
|
2160
2157
|
? 'agLargeTextCellEditor'
|
|
2161
2158
|
: 'agTextCellEditor'),
|
|
@@ -2168,6 +2165,11 @@ class Adaptable {
|
|
|
2168
2165
|
: undefined,
|
|
2169
2166
|
valueGetter: (params) => this.api.freeTextColumnApi.getFreeTextColumnValueFromRowNode(freeTextColumn, params.node),
|
|
2170
2167
|
};
|
|
2168
|
+
if (freeTextColumnSettings.HeaderToolTip) {
|
|
2169
|
+
newColDef.headerTooltip = freeTextColumnSettings.HeaderToolTip;
|
|
2170
|
+
}
|
|
2171
|
+
LoggingHelper_1.LogAdaptableInfo('Setting up FreeText Column: ' + freeTextColumn.ColumnId);
|
|
2172
|
+
return newColDef;
|
|
2171
2173
|
});
|
|
2172
2174
|
}
|
|
2173
2175
|
setupColumnValueGetter({ col }) {
|
|
@@ -2193,57 +2195,55 @@ class Adaptable {
|
|
|
2193
2195
|
}
|
|
2194
2196
|
const editButtons = actionRowButtons
|
|
2195
2197
|
.map((buttonName) => {
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2198
|
+
const button = buttonName === 'create'
|
|
2199
|
+
? {
|
|
2200
|
+
icon: {
|
|
2201
|
+
name: 'add-row',
|
|
2202
|
+
},
|
|
2201
2203
|
tooltip: 'Create',
|
|
2202
2204
|
onClick: () => {
|
|
2203
2205
|
this.api.actionApi.displayCreateActionRow();
|
|
2204
2206
|
},
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
};
|
|
2246
|
-
}
|
|
2207
|
+
}
|
|
2208
|
+
: buttonName === 'edit'
|
|
2209
|
+
? {
|
|
2210
|
+
icon: {
|
|
2211
|
+
name: 'edit',
|
|
2212
|
+
},
|
|
2213
|
+
tooltip: 'Edit',
|
|
2214
|
+
onClick: (button, context) => {
|
|
2215
|
+
this.api.actionApi.displayEditActionRow(context.primaryKeyValue);
|
|
2216
|
+
},
|
|
2217
|
+
}
|
|
2218
|
+
: buttonName === 'clone'
|
|
2219
|
+
? {
|
|
2220
|
+
icon: {
|
|
2221
|
+
name: 'clone',
|
|
2222
|
+
},
|
|
2223
|
+
tooltip: 'Clone',
|
|
2224
|
+
onClick: (button, context) => {
|
|
2225
|
+
this.api.actionApi.displayCloneActionRow(context.primaryKeyValue);
|
|
2226
|
+
},
|
|
2227
|
+
}
|
|
2228
|
+
: buttonName === 'delete'
|
|
2229
|
+
? {
|
|
2230
|
+
icon: {
|
|
2231
|
+
name: 'delete',
|
|
2232
|
+
},
|
|
2233
|
+
tooltip: 'Delete',
|
|
2234
|
+
onClick: (button, context) => {
|
|
2235
|
+
var _a, _b;
|
|
2236
|
+
const eventInfo = {
|
|
2237
|
+
type: 'rowDeleted',
|
|
2238
|
+
rowNode: context.rowNode,
|
|
2239
|
+
adaptableApi: context.adaptableApi,
|
|
2240
|
+
};
|
|
2241
|
+
this.api.eventApi.emit('ActionRowSubmitted', eventInfo);
|
|
2242
|
+
(_b = (_a = this.adaptableOptions.actionOptions.actionRowFormOptions).onFormSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, eventInfo);
|
|
2243
|
+
},
|
|
2244
|
+
}
|
|
2245
|
+
: undefined;
|
|
2246
|
+
return button;
|
|
2247
2247
|
})
|
|
2248
2248
|
.filter(Boolean);
|
|
2249
2249
|
if (!editButtons.length) {
|
|
@@ -12,6 +12,7 @@ export declare class agGridMenuHelper {
|
|
|
12
12
|
createAgGridMenuDefFromAdaptableMenu(adaptableMenuItem: AdaptableMenuItem): MenuItemDef;
|
|
13
13
|
createAgGridColumnMenuDefFromUserMenu(menuItem: UserMenuItem<ColumnMenuContext>, menuContext: ColumnMenuContext): MenuItemDef;
|
|
14
14
|
createAgGridContextMenuDefFromUserMenu(menuItem: UserMenuItem<ContextMenuContext>, menuContext: ContextMenuContext): MenuItemDef;
|
|
15
|
+
private mapAdaptableIconToAgGridIcon;
|
|
15
16
|
createAdaptableColumnMenuItemFromUserMenu(menuItem: UserMenuItem<ColumnMenuContext>, menuContext: ColumnMenuContext): AdaptableMenuItem;
|
|
16
17
|
createAgGridColumnMenuItems(originalgetMainMenuItems: GetMainMenuItems, params: GetMainMenuItemsParams): (string | MenuItemDef)[] | undefined;
|
|
17
18
|
createGroupedColumnMenuItem(): MenuItemDef | undefined;
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const ArrayExtensions_1 = require("../Utilities/Extensions/ArrayExtensions");
|
|
6
6
|
const icons_1 = require("../components/icons");
|
|
7
7
|
const flatten_1 = tslib_1.__importDefault(require("lodash/flatten"));
|
|
8
|
+
const AdaptableIconComponent_1 = require("../components/AdaptableIconComponent");
|
|
8
9
|
// tslint:disable-next-line: class-name
|
|
9
10
|
class agGridMenuHelper {
|
|
10
11
|
constructor(adaptable, gridOptions) {
|
|
@@ -106,7 +107,7 @@ class agGridMenuHelper {
|
|
|
106
107
|
action: x.onClick
|
|
107
108
|
? x.onClick
|
|
108
109
|
: () => this.adaptable.api.internalApi.dispatchReduxAction(x.reduxAction),
|
|
109
|
-
icon:
|
|
110
|
+
icon: this.mapAdaptableIconToAgGridIcon(x.icon, {
|
|
110
111
|
fill: 'var(--ab-color-text-on-primary)',
|
|
111
112
|
}),
|
|
112
113
|
};
|
|
@@ -124,7 +125,7 @@ class agGridMenuHelper {
|
|
|
124
125
|
: adaptableMenuItem.reduxAction
|
|
125
126
|
? () => this.adaptable.api.internalApi.dispatchReduxAction(adaptableMenuItem.reduxAction)
|
|
126
127
|
: undefined,
|
|
127
|
-
icon:
|
|
128
|
+
icon: this.mapAdaptableIconToAgGridIcon(adaptableMenuItem.icon, {
|
|
128
129
|
fill: 'var(--ab-color-text-on-primary)',
|
|
129
130
|
}),
|
|
130
131
|
subMenu: subMenuItems,
|
|
@@ -136,7 +137,7 @@ class agGridMenuHelper {
|
|
|
136
137
|
return {
|
|
137
138
|
name: this.getLabelFromUserColumnMenuItem(menuItem, menuContext),
|
|
138
139
|
action: () => (fn ? fn(menuContext) : null),
|
|
139
|
-
icon:
|
|
140
|
+
icon: this.mapAdaptableIconToAgGridIcon(menuItem.icon, {
|
|
140
141
|
fill: 'var(--ab-color-text-on-primary)',
|
|
141
142
|
}),
|
|
142
143
|
disabled: disabled,
|
|
@@ -153,7 +154,7 @@ class agGridMenuHelper {
|
|
|
153
154
|
return {
|
|
154
155
|
name: this.getLabelFromUserContextMenuItem(menuItem, menuContext),
|
|
155
156
|
action: () => (fn ? fn(menuContext) : null),
|
|
156
|
-
icon:
|
|
157
|
+
icon: this.mapAdaptableIconToAgGridIcon(menuItem.icon, {
|
|
157
158
|
fill: 'var(--ab-color-text-on-primary)',
|
|
158
159
|
}),
|
|
159
160
|
disabled: disabled,
|
|
@@ -164,6 +165,16 @@ class agGridMenuHelper {
|
|
|
164
165
|
}),
|
|
165
166
|
};
|
|
166
167
|
}
|
|
168
|
+
mapAdaptableIconToAgGridIcon(adaptableIcon, style) {
|
|
169
|
+
if (AdaptableIconComponent_1.isAdaptableElementIcon(adaptableIcon)) {
|
|
170
|
+
return adaptableIcon.element;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return icons_1.iconToString(adaptableIcon, {
|
|
174
|
+
fill: 'var(--ab-color-text-on-primary)',
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
167
178
|
createAdaptableColumnMenuItemFromUserMenu(menuItem, menuContext) {
|
|
168
179
|
const fn = menuItem.onClick;
|
|
169
180
|
let adaptableMenuItem = {
|
|
@@ -13,22 +13,16 @@ const react_1 = require("react");
|
|
|
13
13
|
function AdaptableFormComponentButtons({ formDef, onClick, defaultTone, disabledButtons, api, context, focusFirstButton = true, }) {
|
|
14
14
|
return (React.createElement(React.Fragment, null, formDef.buttons.map((button, index) => {
|
|
15
15
|
var _a;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
const buttonIcon = api.internalApi.getIconForButton(button, context);
|
|
23
|
-
const iconProps = buttonIcon && Object.assign({}, defaultIconProps, buttonIcon);
|
|
16
|
+
const buttonIcon = api.internalApi.getIconForButton(button, context, {
|
|
17
|
+
height: 15,
|
|
18
|
+
width: 15,
|
|
19
|
+
});
|
|
24
20
|
let buttonStyle = api.internalApi.getStyleForButton(button, context ? context : { adaptableApi: api });
|
|
25
21
|
let buttonLabel = api.internalApi.getLabelForButton(button, context ? context : { adaptableApi: api });
|
|
26
22
|
let buttonTooltip = api.internalApi.getTooltipForButton(button, context ? context : { adaptableApi: api });
|
|
27
|
-
return (React.createElement(SimpleButton_1.default, { autoFocus: focusFirstButton && index === 0, disabled: disabledButtons[index], key: index, tooltip: buttonTooltip, tone: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _a !== void 0 ? _a : defaultTone, variant: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant, "data-text": buttonLabel, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, marginLeft: index ? 2 : 0, onClick: () => {
|
|
23
|
+
return (React.createElement(SimpleButton_1.default, { autoFocus: focusFirstButton && index === 0, disabled: disabledButtons[index], key: index, tooltip: buttonTooltip, icon: buttonIcon, tone: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _a !== void 0 ? _a : defaultTone, variant: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant, "data-text": buttonLabel, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, marginLeft: index ? 2 : 0, onClick: () => {
|
|
28
24
|
onClick(button);
|
|
29
|
-
} },
|
|
30
|
-
buttonIcon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
31
|
-
buttonLabel));
|
|
25
|
+
} }, buttonLabel));
|
|
32
26
|
})));
|
|
33
27
|
}
|
|
34
28
|
exports.AdaptableFormComponentButtons = AdaptableFormComponentButtons;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AdaptableExternalIcon, AdaptableIcon, AdaptableInternalIcon } from '../../PredefinedConfig/Common/AdaptableIcon';
|
|
2
|
+
import { AdaptableElementIcon, AdaptableExternalIcon, AdaptableIcon, AdaptableInternalIcon } from '../../PredefinedConfig/Common/AdaptableIcon';
|
|
3
3
|
export interface AdaptableIconComponentProps {
|
|
4
4
|
icon: AdaptableIcon;
|
|
5
5
|
iconClassName?: string;
|
|
@@ -7,4 +7,5 @@ export interface AdaptableIconComponentProps {
|
|
|
7
7
|
export declare const AdaptableIconComponent: (props: AdaptableIconComponentProps) => JSX.Element;
|
|
8
8
|
export declare const isAdaptableInternalIcon: (icon: unknown) => icon is AdaptableInternalIcon;
|
|
9
9
|
export declare const isAdaptableExternalIcon: (icon: unknown) => icon is AdaptableExternalIcon;
|
|
10
|
+
export declare const isAdaptableElementIcon: (icon: unknown) => icon is AdaptableElementIcon;
|
|
10
11
|
export declare const isAdaptableIcon: (icon: unknown) => icon is AdaptableIcon;
|
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAdaptableIcon = exports.isAdaptableExternalIcon = exports.isAdaptableInternalIcon = exports.AdaptableIconComponent = void 0;
|
|
3
|
+
exports.isAdaptableIcon = exports.isAdaptableElementIcon = exports.isAdaptableExternalIcon = exports.isAdaptableInternalIcon = exports.AdaptableIconComponent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const icons_1 = require("../icons");
|
|
7
7
|
const join_1 = tslib_1.__importDefault(require("../utils/join"));
|
|
8
|
+
const react_1 = require("react");
|
|
8
9
|
const AdaptableIconComponent = (props) => {
|
|
9
10
|
var _a, _b, _c, _d, _e;
|
|
10
11
|
const { icon, iconClassName } = props;
|
|
11
12
|
if (!icon) {
|
|
12
13
|
return null;
|
|
13
14
|
}
|
|
14
|
-
const className =
|
|
15
|
+
const className = !exports.isAdaptableElementIcon(icon)
|
|
16
|
+
? join_1.default(icon.className, iconClassName)
|
|
17
|
+
: iconClassName;
|
|
18
|
+
const divRef = react_1.useRef(null);
|
|
19
|
+
react_1.useEffect(() => {
|
|
20
|
+
let htmlElement;
|
|
21
|
+
if (exports.isAdaptableElementIcon(icon)) {
|
|
22
|
+
if (typeof icon.element === 'string') {
|
|
23
|
+
const domParser = new DOMParser();
|
|
24
|
+
htmlElement = domParser.parseFromString(icon.element, 'text/html').body
|
|
25
|
+
.firstChild;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
htmlElement = icon.element;
|
|
29
|
+
}
|
|
30
|
+
divRef.current.insertAdjacentElement('afterend', htmlElement);
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
if (exports.isAdaptableElementIcon(icon)) {
|
|
34
|
+
htmlElement === null || htmlElement === void 0 ? void 0 : htmlElement.remove();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, [icon]);
|
|
15
38
|
if (exports.isAdaptableInternalIcon(icon)) {
|
|
16
39
|
return React.createElement(icons_1.Icon, { name: icon.name, size: icon.size, style: icon.style, className: className });
|
|
17
40
|
}
|
|
@@ -21,6 +44,9 @@ const AdaptableIconComponent = (props) => {
|
|
|
21
44
|
const iconStyle = (_e = icon.style) !== null && _e !== void 0 ? _e : {};
|
|
22
45
|
return React.createElement("img", { src: icon.src, className: className, style: Object.assign({ height, width }, iconStyle) });
|
|
23
46
|
}
|
|
47
|
+
if (exports.isAdaptableElementIcon(icon)) {
|
|
48
|
+
return (React.createElement("span", { ref: divRef, style: { display: 'none' }, "data-name": "adaptable-icon-placeholder" }));
|
|
49
|
+
}
|
|
24
50
|
return null;
|
|
25
51
|
};
|
|
26
52
|
exports.AdaptableIconComponent = AdaptableIconComponent;
|
|
@@ -34,7 +60,14 @@ const isAdaptableExternalIcon = (icon) => {
|
|
|
34
60
|
return typeof ((_a = icon) === null || _a === void 0 ? void 0 : _a.src) === 'string';
|
|
35
61
|
};
|
|
36
62
|
exports.isAdaptableExternalIcon = isAdaptableExternalIcon;
|
|
63
|
+
const isAdaptableElementIcon = (icon) => {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
return ((typeof HTMLElement === 'function' &&
|
|
66
|
+
((_a = icon) === null || _a === void 0 ? void 0 : _a.element) instanceof HTMLElement) ||
|
|
67
|
+
typeof ((_b = icon) === null || _b === void 0 ? void 0 : _b.element) === 'string');
|
|
68
|
+
};
|
|
69
|
+
exports.isAdaptableElementIcon = isAdaptableElementIcon;
|
|
37
70
|
const isAdaptableIcon = (icon) => {
|
|
38
|
-
return exports.isAdaptableInternalIcon(icon) || exports.isAdaptableExternalIcon(icon);
|
|
71
|
+
return (exports.isAdaptableInternalIcon(icon) || exports.isAdaptableExternalIcon(icon) || exports.isAdaptableElementIcon(icon));
|
|
39
72
|
};
|
|
40
73
|
exports.isAdaptableIcon = isAdaptableIcon;
|