@adaptabletools/adaptable 16.0.6 → 16.0.8-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/base.css.map +1 -1
- package/bundle.cjs.js +140 -140
- package/index.css +1 -1
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/AdaptablePlugin.d.ts +3 -3
- package/src/AdaptableOptions/AdaptablePlugin.js +3 -1
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +6 -0
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/Events/Fdc3MessageInfo.d.ts +3 -3
- package/src/Api/Implementation/CellSummaryApiImpl.js +2 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +4 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +4 -4
- package/src/PredefinedConfig/Common/CellHighlightInfo.d.ts +2 -1
- package/src/PredefinedConfig/Common/CellSummary.d.ts +1 -0
- package/src/PredefinedConfig/Common/Enums.d.ts +1 -0
- package/src/PredefinedConfig/Common/Enums.js +1 -0
- package/src/Strategy/CellSummaryModule.js +10 -7
- package/src/Strategy/StyledColumnModule.js +3 -0
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -1
- package/src/Utilities/Helpers/Helper.d.ts +12 -10
- package/src/Utilities/Helpers/Helper.js +33 -23
- package/src/Utilities/ObjectFactory.js +1 -0
- package/src/View/AdaptableView.js +1 -1
- package/src/View/Alert/ActiveAlertsPanelItemLabel.js +2 -2
- package/src/View/Alert/AlertsPanel.js +2 -2
- package/src/View/Components/Badge/index.d.ts +1 -0
- package/src/View/Components/Badge/index.js +1 -1
- package/src/View/Components/Panels/PanelWithButton.js +2 -2
- package/src/View/Components/Panels/PanelWithImage.js +2 -2
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +0 -1
- package/src/View/PlusMinus/PlusMinusSummary.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +5 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
- package/src/agGrid/Adaptable.d.ts +1 -1
- package/src/agGrid/Adaptable.js +13 -12
- package/src/agGrid/BadgeRenderer.js +71 -13
- package/src/components/Icon/index.js +3 -3
- package/src/components/IconSelector/IconSelector.js +5 -5
- package/src/components/SimpleButton/index.js +2 -2
- package/src/components/icons/index.d.ts +1 -2
- package/src/components/icons/index.js +6 -7
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Helper = exports.clamp = exports.modeNumberArray = exports.medianNumberArray = exports.meanNumberArray = exports.sumNumberArray = exports.
|
|
3
|
+
exports.Helper = exports.clamp = exports.modeNumberArray = exports.medianNumberArray = exports.meanNumberArray = exports.standardDeviationNumberArray = exports.sumNumberArray = exports.roundNumberTo4dp = exports.roundNumber = exports.isInputNotNullOrEmpty = exports.isInputNullOrEmpty = exports.returnItemCount = exports.copyToClipboard = exports.createDownloadedFile = exports.convertArrayToCsv = exports.arrayToKeyMap = exports.cloneObject = exports.getStringRepresentionFromKey = exports.objectNotExists = exports.objectExists = void 0;
|
|
4
4
|
const StringExtensions_1 = require("../Extensions/StringExtensions");
|
|
5
5
|
const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
|
|
6
6
|
function objectExists(item) {
|
|
@@ -114,14 +114,14 @@ function copyToClipboard(text) {
|
|
|
114
114
|
AdaptableLogger_1.AdaptableLogger.consoleWarnBase('Copy not available on this computer.');
|
|
115
115
|
}
|
|
116
116
|
exports.copyToClipboard = copyToClipboard;
|
|
117
|
-
function
|
|
117
|
+
function returnItemCount(items, itemName) {
|
|
118
118
|
if (items.length == 0) {
|
|
119
119
|
return `No ${itemName}s`;
|
|
120
120
|
}
|
|
121
121
|
return items.length == 1 ? `1 ${itemName}` : `${items.length} ${itemName}s`;
|
|
122
122
|
}
|
|
123
|
-
exports.
|
|
124
|
-
function
|
|
123
|
+
exports.returnItemCount = returnItemCount;
|
|
124
|
+
function isInputNullOrEmpty(itemToCheck) {
|
|
125
125
|
if (itemToCheck == 'Invalid Date ') {
|
|
126
126
|
return true;
|
|
127
127
|
}
|
|
@@ -136,12 +136,12 @@ function IsInputNullOrEmpty(itemToCheck) {
|
|
|
136
136
|
}
|
|
137
137
|
return itemToCheck == null;
|
|
138
138
|
}
|
|
139
|
-
exports.
|
|
140
|
-
function
|
|
141
|
-
return !
|
|
139
|
+
exports.isInputNullOrEmpty = isInputNullOrEmpty;
|
|
140
|
+
function isInputNotNullOrEmpty(itemToCheck) {
|
|
141
|
+
return !isInputNullOrEmpty(itemToCheck);
|
|
142
142
|
}
|
|
143
|
-
exports.
|
|
144
|
-
function
|
|
143
|
+
exports.isInputNotNullOrEmpty = isInputNotNullOrEmpty;
|
|
144
|
+
function roundNumber(numberToRound, decimalPlaces) {
|
|
145
145
|
switch (decimalPlaces) {
|
|
146
146
|
case 1:
|
|
147
147
|
return Math.round(numberToRound * 10) / 10;
|
|
@@ -157,23 +157,32 @@ function RoundNumber(numberToRound, decimalPlaces) {
|
|
|
157
157
|
return Math.round(numberToRound * 1000000) / 1000000;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
exports.
|
|
161
|
-
function
|
|
162
|
-
return
|
|
160
|
+
exports.roundNumber = roundNumber;
|
|
161
|
+
function roundNumberTo4dp(numberToRound) {
|
|
162
|
+
return roundNumber(numberToRound, 4);
|
|
163
163
|
}
|
|
164
|
-
exports.
|
|
164
|
+
exports.roundNumberTo4dp = roundNumberTo4dp;
|
|
165
165
|
function sumNumberArray(numericValues) {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
return numericValues.length
|
|
167
|
+
? numericValues.reduce(function (a, b) {
|
|
168
168
|
return a + b;
|
|
169
|
-
})
|
|
170
|
-
|
|
169
|
+
})
|
|
170
|
+
: 0;
|
|
171
|
+
}
|
|
172
|
+
exports.sumNumberArray = sumNumberArray;
|
|
173
|
+
function standardDeviationNumberArray(numericValues) {
|
|
174
|
+
if (numericValues.length) {
|
|
175
|
+
const count = numericValues.length;
|
|
176
|
+
const mean = sumNumberArray(numericValues) / count;
|
|
177
|
+
return Math.sqrt(sumNumberArray(numericValues.map((val) => {
|
|
178
|
+
return Math.pow(val - mean, 2);
|
|
179
|
+
})) / count);
|
|
171
180
|
}
|
|
172
181
|
else {
|
|
173
182
|
return 0;
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
|
-
exports.
|
|
185
|
+
exports.standardDeviationNumberArray = standardDeviationNumberArray;
|
|
177
186
|
function meanNumberArray(numericValues) {
|
|
178
187
|
// dividing by 0 will return Infinity
|
|
179
188
|
// arr must contain at least 1 element to use reduce
|
|
@@ -245,11 +254,12 @@ exports.Helper = {
|
|
|
245
254
|
convertArrayToCsv,
|
|
246
255
|
createDownloadedFile,
|
|
247
256
|
copyToClipboard,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
returnItemCount,
|
|
258
|
+
isInputNullOrEmpty,
|
|
259
|
+
isInputNotNullOrEmpty,
|
|
260
|
+
roundNumber,
|
|
261
|
+
roundNumberTo4dp,
|
|
262
|
+
standardDeviationNumberArray,
|
|
253
263
|
sumNumberArray,
|
|
254
264
|
meanNumberArray,
|
|
255
265
|
medianNumberArray,
|
|
@@ -27,7 +27,7 @@ class AdaptableView extends React.Component {
|
|
|
27
27
|
React.createElement(CommentPopup_1.CommentPopup, null),
|
|
28
28
|
React.createElement(FloatingQuickSearch_1.QuickSearchDrawer, null),
|
|
29
29
|
this.props.AdaptableApi.internalApi.getModuleService().isModuleAvailable('Dashboard') && (React.createElement(Dashboard_1.Dashboard, { api: this.props.AdaptableApi })),
|
|
30
|
-
React.createElement(AdaptableLoadingScreen_1.AdaptableLoadingScreen, { onClose: this.props.onCloseLoadingPopup, showLoadingScreen: this.props.PopupState.LoadingPopup.ShowLoadingPopup }),
|
|
30
|
+
this.props.AdaptableApi.optionsApi.getUserInterfaceOptions().showLoadingScreen && (React.createElement(AdaptableLoadingScreen_1.AdaptableLoadingScreen, { onClose: this.props.onCloseLoadingPopup, showLoadingScreen: this.props.PopupState.LoadingPopup.ShowLoadingPopup })),
|
|
31
31
|
this.props.PopupState.PromptPopup.ShowPromptPopup && (React.createElement(AdaptablePopupPrompt_1.AdaptablePopupPrompt, { message: this.props.PopupState.PromptPopup.Message, header: this.props.PopupState.PromptPopup.Header, onClose: this.props.onClosePromptPopup, onConfirm: this.props.onConfirmPromptPopup, onConfirmActionCreator: this.props.PopupState.PromptPopup.ConfirmActionCreator, defaultValue: this.props.PopupState.PromptPopup.DefaultValue })),
|
|
32
32
|
Boolean(this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup) && (React.createElement(AdaptablePopupConfirmation_1.AdaptablePopupConfirmation, { header: this.props.PopupState.ConfirmationPopup.Header, messsage: this.props.PopupState.ConfirmationPopup.Msg, showPopup: this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup, cancelButtonText: this.props.PopupState.ConfirmationPopup.CancelButtonText, confirmButtonText: this.props.PopupState.ConfirmationPopup.ConfirmButtonText, onCancel: this.props.onCancelConfirmationPopup, onConfirm: this.props.onConfirmConfirmationPopup, showInputBox: this.props.PopupState.ConfirmationPopup.ShowInputBox, messageType: this.props.PopupState.ConfirmationPopup.MessageType, api: this.props.AdaptableApi })),
|
|
33
33
|
Boolean(this.props.PopupState.ScreenPopup.ShowScreenPopup) && (React.createElement(AdaptablePopup_1.AdaptablePopup, { componentName: this.props.PopupState.ScreenPopup.ComponentName, componentModule: this.props.PopupState.ScreenPopup.ComponentModule, onHide: this.props.onCloseScreenPopup, api: this.props.AdaptableApi, onClearParams: () => this.props.onClearPopupParams(), moduleParams: this.props.PopupState.ScreenPopup.Params, moduleProps: this.props.PopupState.ScreenPopup.PopupProps })),
|
|
@@ -4,7 +4,7 @@ exports.ActiveAlertsPanelItemLabel = void 0;
|
|
|
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 icons_1 =
|
|
7
|
+
const icons_1 = require("../../components/icons");
|
|
8
8
|
const UIHelper_1 = tslib_1.__importDefault(require("../UIHelper"));
|
|
9
9
|
const ActiveAlertsPanelItemLabel = (props) => {
|
|
10
10
|
const iconColor = UIHelper_1.default.getColorByMessageType(props.data.alertDefinition.MessageType);
|
|
@@ -13,7 +13,7 @@ const ActiveAlertsPanelItemLabel = (props) => {
|
|
|
13
13
|
fill: iconColor,
|
|
14
14
|
};
|
|
15
15
|
const iconName = UIHelper_1.default.getGlyphByMessageType(props.data.alertDefinition.MessageType);
|
|
16
|
-
const IconCmp = icons_1.
|
|
16
|
+
const IconCmp = icons_1.allIcons[iconName];
|
|
17
17
|
const icon = IconCmp ? React.createElement(IconCmp, null) : null;
|
|
18
18
|
return (React.createElement(rebass_1.Box, null,
|
|
19
19
|
React.createElement(rebass_1.Text, { style: Object.assign({ float: 'left' }, iconStyle) }, icon),
|
|
@@ -8,7 +8,7 @@ const ButtonPreviewDelete_1 = tslib_1.__importDefault(require("../Components/But
|
|
|
8
8
|
const PanelWithButton_1 = require("../Components/Panels/PanelWithButton");
|
|
9
9
|
const StringExtensions_1 = require("../../Utilities/Extensions/StringExtensions");
|
|
10
10
|
const rebass_1 = require("rebass");
|
|
11
|
-
const icons_1 =
|
|
11
|
+
const icons_1 = require("../../components/icons");
|
|
12
12
|
const ListGroupItem_1 = tslib_1.__importDefault(require("../../components/List/ListGroupItem"));
|
|
13
13
|
const ListGroup_1 = tslib_1.__importDefault(require("../../components/List/ListGroup"));
|
|
14
14
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
|
|
@@ -26,7 +26,7 @@ class AlertsPanel extends React.Component {
|
|
|
26
26
|
fill: textColor,
|
|
27
27
|
};
|
|
28
28
|
const iconName = UIHelper_1.UIHelper.getGlyphByMessageType(alert.alertDefinition.MessageType);
|
|
29
|
-
const IconCmp = icons_1.
|
|
29
|
+
const IconCmp = icons_1.allIcons[iconName];
|
|
30
30
|
const icon = IconCmp ? React.createElement(IconCmp, null) : null;
|
|
31
31
|
let alertText = (React.createElement("div", { key: alert.Uuid, style: { maxWidth: '600px', width: '100%' } },
|
|
32
32
|
React.createElement(rebass_1.Flex, { alignItems: "center", width: "100%" },
|
|
@@ -10,7 +10,7 @@ const Badge = (props) => {
|
|
|
10
10
|
const preparedBadgePosition = iconPosition.toLowerCase();
|
|
11
11
|
const icon = iconProps && React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { icon: iconProps });
|
|
12
12
|
const style = (0, StyleHelper_1.toStyle)(props.adaptableStyle);
|
|
13
|
-
return (React.createElement("div", { className: "ab-Badge", style: style },
|
|
13
|
+
return (React.createElement("div", { className: "ab-Badge", style: Object.assign(Object.assign({}, style), { marginRight: props.gap }) },
|
|
14
14
|
preparedBadgePosition === 'start' && icon,
|
|
15
15
|
props.children,
|
|
16
16
|
preparedBadgePosition === 'end' && icon));
|
|
@@ -6,7 +6,7 @@ const React = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
|
|
7
7
|
const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
|
|
8
8
|
const rebass_1 = require("rebass");
|
|
9
|
-
const icons_1 =
|
|
9
|
+
const icons_1 = require("../../../components/icons");
|
|
10
10
|
const ButtonInfo_1 = require("../Buttons/ButtonInfo");
|
|
11
11
|
//We cannot destructure this.props using the react way in typescript which is a real pain as you
|
|
12
12
|
//need to transfer props individually as a consequence
|
|
@@ -14,7 +14,7 @@ const ButtonInfo_1 = require("../Buttons/ButtonInfo");
|
|
|
14
14
|
class PanelWithButton extends React.Component {
|
|
15
15
|
render() {
|
|
16
16
|
let { buttonContent } = this.props;
|
|
17
|
-
const IconCmp = icons_1.
|
|
17
|
+
const IconCmp = icons_1.allIcons[this.props.glyphicon];
|
|
18
18
|
let header = (React.createElement(rebass_1.Flex, { alignItems: "center", width: "100%" },
|
|
19
19
|
React.createElement(rebass_1.Flex, { alignItems: "center" },
|
|
20
20
|
this.props.glyphicon != null && (IconCmp ? React.createElement(IconCmp, null) : null),
|
|
@@ -6,14 +6,14 @@ const React = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const styled_components_1 = require("styled-components");
|
|
7
7
|
const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
|
|
8
8
|
const rebass_1 = require("rebass");
|
|
9
|
-
const icons_1 =
|
|
9
|
+
const icons_1 = require("../../../components/icons");
|
|
10
10
|
const ButtonInfo_1 = require("../Buttons/ButtonInfo");
|
|
11
11
|
//We cannot destructure this.props using the react way in typescript which is a real pain as you
|
|
12
12
|
//need to transfer props individually as a consequence
|
|
13
13
|
//let { buttonContent, ...other } = this.props
|
|
14
14
|
class PanelWithImageCmp extends React.Component {
|
|
15
15
|
render() {
|
|
16
|
-
const IconCmp = icons_1.
|
|
16
|
+
const IconCmp = icons_1.allIcons[(this.props.icon || this.props.glyphicon)];
|
|
17
17
|
const headerStyle = {};
|
|
18
18
|
if (this.props.headerColor) {
|
|
19
19
|
headerStyle.color = this.props.headerColor;
|
|
@@ -107,7 +107,6 @@ const buildAdaptableOptions = (mainAdaptableInstance, gridOptions, adaptableCont
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
const options = {
|
|
110
|
-
_gridOptions: gridOptions,
|
|
111
110
|
primaryKey: 'primaryKey',
|
|
112
111
|
licenseKey: mainAdaptableOptions.licenseKey,
|
|
113
112
|
userName: `${mainAdaptableOptions.userName}`,
|
|
@@ -23,7 +23,7 @@ class PlusMinusSummaryComponent extends React.Component {
|
|
|
23
23
|
render() {
|
|
24
24
|
let moduleSummaries = [];
|
|
25
25
|
// title row
|
|
26
|
-
let titleRow = (React.createElement(ModuleHeader_1.ModuleHeader, { key: this.props.moduleInfo.FriendlyName, moduleInfo: this.props.moduleInfo, moduleSummary: Helper_1.Helper.
|
|
26
|
+
let titleRow = (React.createElement(ModuleHeader_1.ModuleHeader, { key: this.props.moduleInfo.FriendlyName, moduleInfo: this.props.moduleInfo, moduleSummary: Helper_1.Helper.returnItemCount(this.props.PlusMinusNudges.filter((item) => this.props.api.scopeApi.isColumnInScopeColumns(this.props.summarisedColumn, item.Scope)), this.props.moduleInfo.FriendlyName), onNew: () => this.onNew(), newButtonTooltip: 'Plus / Minus Rule', accessLevel: this.props.accessLevel }));
|
|
27
27
|
moduleSummaries.push(titleRow);
|
|
28
28
|
// existing items
|
|
29
29
|
this.props.PlusMinusNudges.map((item, index) => {
|
|
@@ -23,11 +23,10 @@ const BadgeEditor = (props) => {
|
|
|
23
23
|
var _a, _b;
|
|
24
24
|
const { api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
25
25
|
const { badge, columnId, onChange } = props;
|
|
26
|
+
// badges evaluate predicate per value
|
|
26
27
|
const predicateDefs = api.styledColumnApi.internalApi.getBadgePredicateDefsForColumn(columnId);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
previewValue = '12345';
|
|
30
|
-
}
|
|
28
|
+
const dataType = api.columnApi.getColumnDataTypeForColumnId(columnId);
|
|
29
|
+
const previewValue = dataType === 'Number' || dataType == 'NumberArray' ? '12345' : 'Hello world';
|
|
31
30
|
return (React.createElement(rebass_1.Flex, { className: "ab-Badge-Definition-Editor", mb: 15, p: 3 },
|
|
32
31
|
React.createElement(rebass_1.Box, { flex: 1 },
|
|
33
32
|
React.createElement(FormLayout_1.default, null,
|
|
@@ -42,11 +41,12 @@ const BadgeEditor = (props) => {
|
|
|
42
41
|
} }),
|
|
43
42
|
] },
|
|
44
43
|
React.createElement(SimpleButton_1.default, { variant: "raised" }, "Edit Badge Style"))),
|
|
44
|
+
!api.columnApi.hasArrayDataType(columnId) && ( // dont show predicates for arrays
|
|
45
45
|
React.createElement(FormLayout_1.FormRow, { label: 'Predicate' }, columnId ? (React.createElement(React.Fragment, null,
|
|
46
46
|
React.createElement(HelpBlock_1.default, { fontSize: 2, mb: 1, mt: 2 }, "Create (optional) Rule for when the Badge is displayed; if no Rule provided Badge will always display (unless overriden by another Rule)"),
|
|
47
47
|
React.createElement(PredicateEditor_1.PredicateEditor, { columnId: columnId, predicate: badge.Predicate, predicateDefs: predicateDefs, placeholder: "No Predicate Selected", onChange: (predicate) => {
|
|
48
48
|
onChange(Object.assign(Object.assign({}, badge), { Predicate: predicate }));
|
|
49
|
-
}, onClear: () => onChange(Object.assign(Object.assign({}, badge), { Predicate: undefined })) }))) : (React.createElement(ErrorBox_1.default, null, "Select a column first"))),
|
|
49
|
+
}, onClear: () => onChange(Object.assign(Object.assign({}, badge), { Predicate: undefined })) }))) : (React.createElement(ErrorBox_1.default, null, "Select a column first")))),
|
|
50
50
|
React.createElement(FormLayout_1.FormRow, { label: "Icon" },
|
|
51
51
|
React.createElement(HelpBlock_1.default, { fontSize: 2, mb: 1, mt: 2 }, "Select (optional) Icon (and Icon position) to display in the Badge"),
|
|
52
52
|
' ',
|
|
@@ -36,7 +36,7 @@ const StyledColumnWizardColumnSection = (props) => {
|
|
|
36
36
|
sortableColumns = api.columnApi.getNumericArrayColumns();
|
|
37
37
|
}
|
|
38
38
|
else if (data.BadgeStyle) {
|
|
39
|
-
sortableColumns = [...api.columnApi.getNumericColumns(), ...api.columnApi.getStringColumns()];
|
|
39
|
+
sortableColumns = [...api.columnApi.getNumericColumns(), ...api.columnApi.getStringColumns(), ...api.columnApi.getStringArrayColumns(), ...api.columnApi.getNumberArrayColumns()];
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
sortableColumns = api.columnApi.getNumericColumns();
|
|
@@ -453,7 +453,7 @@ export declare class AdaptableNoCodeWizard implements IAdaptableNoCodeWizard {
|
|
|
453
453
|
/**
|
|
454
454
|
* @param adaptableOptions
|
|
455
455
|
*/
|
|
456
|
-
constructor(adaptableOptions: AdaptableOptions, extraOptions?: AdaptableNoCodeWizardOptions);
|
|
456
|
+
constructor(adaptableOptions: AdaptableOptions, extraOptions?: AdaptableNoCodeWizardOptions, agGridOptons?: AgGridConfig);
|
|
457
457
|
render(container?: HTMLElement | null): void;
|
|
458
458
|
}
|
|
459
459
|
export {};
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -299,14 +299,23 @@ class Adaptable {
|
|
|
299
299
|
static async initInternal(adaptableOptions, runtimeConfig) {
|
|
300
300
|
let promise = null;
|
|
301
301
|
if (Array.isArray(adaptableOptions.plugins)) {
|
|
302
|
+
const agGridOptions = {
|
|
303
|
+
gridOptions: runtimeConfig.gridOptions,
|
|
304
|
+
modules: runtimeConfig.modules,
|
|
305
|
+
};
|
|
302
306
|
// do this
|
|
303
307
|
for (let plugin of adaptableOptions.plugins) {
|
|
304
308
|
promise =
|
|
305
309
|
promise && promise.then
|
|
306
310
|
? promise.then(() => {
|
|
307
|
-
return plugin.beforeInit(adaptableOptions,
|
|
311
|
+
return plugin.beforeInit(adaptableOptions, agGridOptions);
|
|
308
312
|
})
|
|
309
|
-
: plugin.beforeInit(adaptableOptions,
|
|
313
|
+
: plugin.beforeInit(adaptableOptions, agGridOptions);
|
|
314
|
+
}
|
|
315
|
+
// if gridOptions changed, we need to update the runtimeConfig
|
|
316
|
+
if (agGridOptions.gridOptions !== runtimeConfig.gridOptions) {
|
|
317
|
+
// This allows plugins to modify
|
|
318
|
+
runtimeConfig.gridOptions = agGridOptions.gridOptions;
|
|
310
319
|
}
|
|
311
320
|
// instead of
|
|
312
321
|
// if (Array.isArray(adaptableOptions.plugins)) {
|
|
@@ -317,11 +326,6 @@ class Adaptable {
|
|
|
317
326
|
// because this await for of introduces too much delay
|
|
318
327
|
}
|
|
319
328
|
const doInit = (ab) => {
|
|
320
|
-
// required for NoCode
|
|
321
|
-
// it should go away with https://github.com/AdaptableTools/adaptable/issues/2278
|
|
322
|
-
if (adaptableOptions._gridOptions) {
|
|
323
|
-
runtimeConfig.gridOptions = adaptableOptions._gridOptions;
|
|
324
|
-
}
|
|
325
329
|
return ab.init(adaptableOptions, runtimeConfig, true).then((api) => {
|
|
326
330
|
if (Array.isArray(adaptableOptions.plugins)) {
|
|
327
331
|
adaptableOptions.plugins.forEach((plugin) => {
|
|
@@ -394,7 +398,6 @@ class Adaptable {
|
|
|
394
398
|
this.gridOptions = this.runtimeConfig.gridOptions;
|
|
395
399
|
// we create AdaptableOptions by merging the values provided by the user with the defaults (where no value has been set)
|
|
396
400
|
this.adaptableOptions = AdaptableHelper_1.default.assignAdaptableOptions(adaptableOptions);
|
|
397
|
-
this.adaptableOptions._gridOptions = this.gridOptions;
|
|
398
401
|
if (this.hasAutogeneratedPrimaryKey()) {
|
|
399
402
|
this.logger
|
|
400
403
|
.warn(`Autogenerated primary key (adaptableOptions.autogeneratedPrimaryKey = TRUE) should be used only as a last resort,
|
|
@@ -5221,15 +5224,14 @@ class AdaptableNoCodeWizard {
|
|
|
5221
5224
|
/**
|
|
5222
5225
|
* @param adaptableOptions
|
|
5223
5226
|
*/
|
|
5224
|
-
constructor(adaptableOptions, extraOptions = {}) {
|
|
5225
|
-
var _a;
|
|
5227
|
+
constructor(adaptableOptions, extraOptions = {}, agGridOptons) {
|
|
5226
5228
|
const defaultInit = async ({ gridOptions, adaptableOptions, agGridModules, }) => {
|
|
5227
5229
|
return await Adaptable.init(adaptableOptions, { gridOptions, modules: agGridModules });
|
|
5228
5230
|
};
|
|
5229
5231
|
this.adaptableOptions = adaptableOptions;
|
|
5230
5232
|
this.init = extraOptions.onInit || defaultInit;
|
|
5231
5233
|
this.extraOptions = extraOptions;
|
|
5232
|
-
this.agGridModules = core_1.ModuleRegistry.__getRegisteredModules(
|
|
5234
|
+
this.agGridModules = core_1.ModuleRegistry.__getRegisteredModules(agGridOptons === null || agGridOptons === void 0 ? void 0 : agGridOptons.gridOptions.gridId);
|
|
5233
5235
|
this.render();
|
|
5234
5236
|
}
|
|
5235
5237
|
render(container) {
|
|
@@ -5256,7 +5258,6 @@ class AdaptableNoCodeWizard {
|
|
|
5256
5258
|
const unmount = (0, renderReactRoot_1.renderReactRoot)(React.createElement(AdaptableWizardView_1.default, Object.assign(Object.assign({ adaptableOptions: this.adaptableOptions }, this.extraOptions), { onInit: (adaptableOptions, gridOptions) => {
|
|
5257
5259
|
container.classList.remove('adaptable--in-wizard');
|
|
5258
5260
|
unmount();
|
|
5259
|
-
adaptableOptions._gridOptions = gridOptions;
|
|
5260
5261
|
this.init({
|
|
5261
5262
|
adaptableOptions,
|
|
5262
5263
|
gridOptions: gridOptions,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBadgeRendererForColumn = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const Badge_1 = require("../View/Components/Badge");
|
|
5
6
|
const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext");
|
|
7
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
8
|
const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
7
9
|
if (!styledColumn.BadgeStyle) {
|
|
8
10
|
return;
|
|
@@ -13,11 +15,58 @@ const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
13
15
|
return adaptable;
|
|
14
16
|
}
|
|
15
17
|
init(params) {
|
|
16
|
-
var _a, _b, _c
|
|
18
|
+
var _a, _b, _c;
|
|
17
19
|
const adaptable = this.getAdaptableInstance(params);
|
|
18
20
|
const adapatableApi = adaptable.api;
|
|
19
21
|
this.eGui = document.createElement('div');
|
|
20
22
|
this.eGui.className = 'ab-Badge__wrapper';
|
|
23
|
+
const includeGrouped = Boolean(styledColumn.IncludeGroupedRows);
|
|
24
|
+
const isGrouped = params.node.group;
|
|
25
|
+
if ((includeGrouped === false && isGrouped)) {
|
|
26
|
+
const formattedValue = (_c = (_b = (_a = params.formatValue) === null || _a === void 0 ? void 0 : _a.call(params, params.value)) !== null && _b !== void 0 ? _b : params.value) !== null && _c !== void 0 ? _c : '';
|
|
27
|
+
this.eGui.innerHTML = formattedValue;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (['NumberArray', 'StringArray'].includes(abColumn.dataType)) {
|
|
31
|
+
this.renderArrayValues(params, adapatableApi);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.renderSingularValues(params, adapatableApi);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
renderArrayValues(params, adapatableApi) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f;
|
|
39
|
+
let badgesConfig = [];
|
|
40
|
+
if (!Array.isArray(params.value) || params.value.length === 0) {
|
|
41
|
+
const formattedValue = (_c = (_b = (_a = params.formatValue) === null || _a === void 0 ? void 0 : _a.call(params, params.value)) !== null && _b !== void 0 ? _b : params.value) !== null && _c !== void 0 ? _c : '';
|
|
42
|
+
this.eGui.innerHTML = formattedValue;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
for (const value of params.value) {
|
|
46
|
+
const formattedValue = (_f = (_e = (_d = params.formatValue) === null || _d === void 0 ? void 0 : _d.call(params, value)) !== null && _e !== void 0 ? _e : value) !== null && _f !== void 0 ? _f : '';
|
|
47
|
+
const predicateDefHandlerContext = {
|
|
48
|
+
value: value,
|
|
49
|
+
oldValue: null,
|
|
50
|
+
displayValue: params.formatValue,
|
|
51
|
+
node: params.node,
|
|
52
|
+
column: abColumn,
|
|
53
|
+
adaptableApi: adapatableApi,
|
|
54
|
+
userName: adapatableApi.optionsApi.getUserName(),
|
|
55
|
+
adaptableId: adapatableApi.optionsApi.getAdaptableId(),
|
|
56
|
+
};
|
|
57
|
+
const badge = api.styledColumnApi.internalApi.getApplicableBadge(styledColumn, predicateDefHandlerContext);
|
|
58
|
+
const isNullValue = formattedValue === '' || formattedValue === null || formattedValue === undefined;
|
|
59
|
+
if (!isNullValue && badge) {
|
|
60
|
+
badgesConfig.push({
|
|
61
|
+
badge: Object.assign({}, badge),
|
|
62
|
+
value: formattedValue,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.renderBadges(badgesConfig, api, params);
|
|
67
|
+
}
|
|
68
|
+
renderSingularValues(params, adapatableApi) {
|
|
69
|
+
var _a, _b, _c;
|
|
21
70
|
const formattedValue = (_c = (_b = (_a = params.formatValue) === null || _a === void 0 ? void 0 : _a.call(params, params.value)) !== null && _b !== void 0 ? _b : params.value) !== null && _c !== void 0 ? _c : '';
|
|
22
71
|
const predicateDefHandlerContext = {
|
|
23
72
|
value: params.value,
|
|
@@ -30,25 +79,34 @@ const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
30
79
|
adaptableId: adapatableApi.optionsApi.getAdaptableId(),
|
|
31
80
|
};
|
|
32
81
|
const badge = api.styledColumnApi.internalApi.getApplicableBadge(styledColumn, predicateDefHandlerContext);
|
|
33
|
-
const isGrouped = params.node.group;
|
|
34
|
-
const includeGrouped = Boolean(styledColumn.IncludeGroupedRows);
|
|
35
82
|
const isNullValue = formattedValue === '' || formattedValue === null || formattedValue === undefined;
|
|
36
83
|
if (
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
// empty values
|
|
40
|
-
isNullValue ||
|
|
84
|
+
// empty values
|
|
85
|
+
isNullValue ||
|
|
41
86
|
// no badge
|
|
42
87
|
!badge) {
|
|
43
88
|
this.eGui.innerHTML = formattedValue;
|
|
44
89
|
return;
|
|
45
90
|
}
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
91
|
+
this.renderBadges([{
|
|
92
|
+
badge,
|
|
93
|
+
value: formattedValue,
|
|
94
|
+
}], api, params);
|
|
95
|
+
}
|
|
96
|
+
renderBadges(config, api, params) {
|
|
97
|
+
const adaptable = this.getAdaptableInstance(params);
|
|
98
|
+
const badges = config.map(({ badge, value }, index) => {
|
|
99
|
+
var _a;
|
|
100
|
+
return React.createElement(Badge_1.Badge, {
|
|
101
|
+
key: index,
|
|
102
|
+
adaptableStyle: badge.Style,
|
|
103
|
+
children: value,
|
|
104
|
+
icon: badge.Icon,
|
|
105
|
+
iconPosition: (_a = badge.IconPosition) !== null && _a !== void 0 ? _a : 'start',
|
|
106
|
+
gap: 5
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
this.unmountReactRoot = api.internalApi.getAdaptableInstance().renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(React.Fragment, { children: badges }), adaptable), this.eGui);
|
|
52
110
|
}
|
|
53
111
|
getGui() {
|
|
54
112
|
return this.eGui;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isAdaptableIcon = exports.isAdaptableElementIcon = exports.isAdaptableCustomIcon = exports.isAdaptableSystemIcon = exports.IconComponent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const icons_1 =
|
|
6
|
+
const icons_1 = require("../icons");
|
|
7
7
|
const join_1 = tslib_1.__importDefault(require("../utils/join"));
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const IconComponent = (props) => {
|
|
@@ -38,7 +38,7 @@ const IconComponent = (props) => {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}, [icon]);
|
|
41
|
-
if ((0, exports.isAdaptableSystemIcon)(icon) && icon.name in icons_1.
|
|
41
|
+
if ((0, exports.isAdaptableSystemIcon)(icon) && icon.name in icons_1.allIcons) {
|
|
42
42
|
return (React.createElement(icons_1.Icon, { name: icon.name, size: icon.size, style: icon.style, className: className }));
|
|
43
43
|
}
|
|
44
44
|
if ((0, exports.isAdaptableCustomIcon)(icon)) {
|
|
@@ -68,6 +68,6 @@ const isAdaptableElementIcon = (icon) => {
|
|
|
68
68
|
};
|
|
69
69
|
exports.isAdaptableElementIcon = isAdaptableElementIcon;
|
|
70
70
|
const isAdaptableIcon = (icon) => {
|
|
71
|
-
return (
|
|
71
|
+
return (0, exports.isAdaptableSystemIcon)(icon) || (0, exports.isAdaptableCustomIcon)(icon) || (0, exports.isAdaptableElementIcon)(icon);
|
|
72
72
|
};
|
|
73
73
|
exports.isAdaptableIcon = isAdaptableIcon;
|
|
@@ -6,7 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const rebass_1 = require("rebass");
|
|
7
7
|
const AdaptableInput_1 = tslib_1.__importDefault(require("../../View/Components/AdaptableInput"));
|
|
8
8
|
const Icon_1 = require("../Icon");
|
|
9
|
-
const icons_1 =
|
|
9
|
+
const icons_1 = require("../icons");
|
|
10
10
|
const OverlayTrigger_1 = tslib_1.__importDefault(require("../OverlayTrigger"));
|
|
11
11
|
const SimpleButton_1 = tslib_1.__importDefault(require("../SimpleButton"));
|
|
12
12
|
const IconButton = (props) => {
|
|
@@ -15,12 +15,12 @@ const IconButton = (props) => {
|
|
|
15
15
|
const IconSelector = (props) => {
|
|
16
16
|
var _a, _b, _c;
|
|
17
17
|
const [query, setQuery] = react_1.default.useState('');
|
|
18
|
-
const
|
|
18
|
+
const allIconsNames = Object.keys(icons_1.allIcons);
|
|
19
19
|
const filteredIcons = query
|
|
20
|
-
?
|
|
20
|
+
? allIconsNames.filter((iconName) => {
|
|
21
21
|
return iconName.toLowerCase().includes(query.toLowerCase());
|
|
22
22
|
})
|
|
23
|
-
:
|
|
23
|
+
: allIconsNames;
|
|
24
24
|
const iconsElements = filteredIcons.map((iconName) => {
|
|
25
25
|
return (react_1.default.createElement(rebass_1.Flex, { key: iconName },
|
|
26
26
|
react_1.default.createElement(IconButton, { onClick: () => props.onChange(iconName), active: iconName === props.value, icon: iconName })));
|
|
@@ -38,7 +38,7 @@ const IconSelector = (props) => {
|
|
|
38
38
|
" ",
|
|
39
39
|
customIconsElements)));
|
|
40
40
|
let value = 'No Icon Selected';
|
|
41
|
-
if (props.value in icons_1.
|
|
41
|
+
if (props.value in icons_1.allIcons) {
|
|
42
42
|
value = (react_1.default.createElement(icons_1.Icon, { style: { display: 'inline-block' }, name: props.value }));
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const rebass_1 = require("rebass");
|
|
7
7
|
const join_1 = tslib_1.__importDefault(require("../utils/join"));
|
|
8
|
-
const icons_1 =
|
|
8
|
+
const icons_1 = require("../icons");
|
|
9
9
|
const Tooltip_1 = tslib_1.__importDefault(require("../Tooltip"));
|
|
10
10
|
const theme_1 = tslib_1.__importDefault(require("../../theme"));
|
|
11
11
|
const Icon_1 = require("../Icon");
|
|
@@ -17,7 +17,7 @@ const SimpleButton = React.forwardRef((props, theRef) => {
|
|
|
17
17
|
if ((0, Icon_1.isAdaptableSystemIcon)(icon)) {
|
|
18
18
|
adaptableSystemIcon = icon;
|
|
19
19
|
}
|
|
20
|
-
if (typeof icon === 'string' && icons_1.
|
|
20
|
+
if (typeof icon === 'string' && icons_1.allIcons[icon]) {
|
|
21
21
|
adaptableSystemIcon = { name: icon };
|
|
22
22
|
}
|
|
23
23
|
if (adaptableSystemIcon) {
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
3
|
import { IconProps } from './DefaultIcon';
|
|
4
4
|
import { AdaptableCustomIcon, AdaptableSystemIcon, AdaptableSystemIconName } from '../../PredefinedConfig/Common/AdaptableIcon';
|
|
5
|
-
declare const allIcons: Record<AdaptableSystemIconName, React.FunctionComponent<IconProps>>;
|
|
5
|
+
export declare const allIcons: Record<AdaptableSystemIconName, React.FunctionComponent<IconProps>>;
|
|
6
6
|
export declare const Icon: ({ name, style, className, tabIndex, ...props }: {
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
8
|
name: AdaptableSystemIconName;
|
|
@@ -12,4 +12,3 @@ export declare const Icon: ({ name, style, className, tabIndex, ...props }: {
|
|
|
12
12
|
props?: React.SVGProps<SVGElement>;
|
|
13
13
|
}) => JSX.Element;
|
|
14
14
|
export declare const iconToString: (icon: AdaptableSystemIcon | AdaptableCustomIcon, style?: CSSProperties) => string;
|
|
15
|
-
export default allIcons;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.iconToString = exports.Icon = void 0;
|
|
3
|
+
exports.iconToString = exports.Icon = exports.allIcons = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const ReactDOMServer = tslib_1.__importStar(require("react-dom/server"));
|
|
@@ -155,7 +155,7 @@ const order_1 = tslib_1.__importDefault(require("./order"));
|
|
|
155
155
|
const contact_1 = tslib_1.__importDefault(require("./contact"));
|
|
156
156
|
const Icon_1 = require("../Icon");
|
|
157
157
|
const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
|
|
158
|
-
|
|
158
|
+
exports.allIcons = {
|
|
159
159
|
search: query_1.default,
|
|
160
160
|
grid: layout_1.default,
|
|
161
161
|
cells: cell_summary_1.default,
|
|
@@ -307,13 +307,13 @@ const allIcons = {
|
|
|
307
307
|
order: order_1.default,
|
|
308
308
|
contact: contact_1.default,
|
|
309
309
|
};
|
|
310
|
-
Object.keys(allIcons).forEach((name) => {
|
|
311
|
-
const ReactCmp = allIcons[name];
|
|
312
|
-
allIcons[name] = (props) => React.createElement(ReactCmp, Object.assign({}, props, { name: name }));
|
|
310
|
+
Object.keys(exports.allIcons).forEach((name) => {
|
|
311
|
+
const ReactCmp = exports.allIcons[name];
|
|
312
|
+
exports.allIcons[name] = (props) => React.createElement(ReactCmp, Object.assign({}, props, { name: name }));
|
|
313
313
|
});
|
|
314
314
|
const Icon = (_a) => {
|
|
315
315
|
var { name, style, className, tabIndex } = _a, props = tslib_1.__rest(_a, ["name", "style", "className", "tabIndex"]);
|
|
316
|
-
const IconCmp = (allIcons[name] || null);
|
|
316
|
+
const IconCmp = (exports.allIcons[name] || null);
|
|
317
317
|
if (!IconCmp) {
|
|
318
318
|
AdaptableLogger_1.AdaptableLogger.consoleWarnBase('NO icon found for ' + name);
|
|
319
319
|
return React.createElement("svg", { height: "17", width: "17" });
|
|
@@ -328,4 +328,3 @@ const iconToString = (icon, style) => {
|
|
|
328
328
|
return ReactDOMServer.renderToString(React.createElement(Icon_1.IconComponent, { icon: Object.assign(Object.assign({}, icon), { style: Object.assign(Object.assign({}, icon.style), style) }) }));
|
|
329
329
|
};
|
|
330
330
|
exports.iconToString = iconToString;
|
|
331
|
-
exports.default = allIcons;
|