@adaptabletools/adaptable 16.0.7 → 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.
Files changed (38) hide show
  1. package/bundle.cjs.js +103 -103
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableOptions/AdaptablePlugin.d.ts +3 -3
  6. package/src/AdaptableOptions/AdaptablePlugin.js +3 -1
  7. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +1 -1
  8. package/src/Api/ColumnApi.d.ts +5 -0
  9. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  10. package/src/Api/Implementation/ColumnApiImpl.js +4 -1
  11. package/src/PredefinedConfig/Common/AdaptablePredicate.js +4 -4
  12. package/src/PredefinedConfig/Common/CellHighlightInfo.d.ts +2 -1
  13. package/src/Strategy/CellSummaryModule.js +7 -7
  14. package/src/Strategy/StyledColumnModule.js +3 -0
  15. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -1
  16. package/src/Utilities/Helpers/Helper.d.ts +10 -10
  17. package/src/Utilities/Helpers/Helper.js +22 -26
  18. package/src/View/Alert/ActiveAlertsPanelItemLabel.js +2 -2
  19. package/src/View/Alert/AlertsPanel.js +2 -2
  20. package/src/View/Components/Badge/index.d.ts +1 -0
  21. package/src/View/Components/Badge/index.js +1 -1
  22. package/src/View/Components/Panels/PanelWithButton.js +2 -2
  23. package/src/View/Components/Panels/PanelWithImage.js +2 -2
  24. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +0 -1
  25. package/src/View/PlusMinus/PlusMinusSummary.js +1 -1
  26. package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +5 -5
  27. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
  28. package/src/agGrid/Adaptable.d.ts +1 -1
  29. package/src/agGrid/Adaptable.js +13 -12
  30. package/src/agGrid/BadgeRenderer.js +71 -13
  31. package/src/components/Icon/index.js +3 -3
  32. package/src/components/IconSelector/IconSelector.js +5 -5
  33. package/src/components/SimpleButton/index.js +2 -2
  34. package/src/components/icons/index.d.ts +1 -2
  35. package/src/components/icons/index.js +6 -7
  36. package/src/metamodel/adaptable.metamodel.js +1 -1
  37. package/version.d.ts +1 -1
  38. package/version.js +1 -1
@@ -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, _d;
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
- // grouped but do not incluide
38
- (includeGrouped === false && isGrouped) ||
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.unmountReactRoot = api.internalApi.getAdaptableInstance().renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)((0, Badge_1.Badge)({
47
- adaptableStyle: badge.Style,
48
- children: formattedValue,
49
- icon: badge.Icon,
50
- iconPosition: (_d = badge.IconPosition) !== null && _d !== void 0 ? _d : 'start',
51
- }), adaptable), this.eGui);
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 = tslib_1.__importStar(require("../icons"));
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.default) {
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 ((0, exports.isAdaptableSystemIcon)(icon) || (0, exports.isAdaptableCustomIcon)(icon) || (0, exports.isAdaptableElementIcon)(icon));
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 = tslib_1.__importStar(require("../icons"));
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 allIcons = Object.keys(icons_1.default);
18
+ const allIconsNames = Object.keys(icons_1.allIcons);
19
19
  const filteredIcons = query
20
- ? allIcons.filter((iconName) => {
20
+ ? allIconsNames.filter((iconName) => {
21
21
  return iconName.toLowerCase().includes(query.toLowerCase());
22
22
  })
23
- : allIcons;
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.default) {
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 = tslib_1.__importDefault(require("../icons"));
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.default[icon]) {
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
- const allIcons = {
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;