@antscorp/antsomi-ui 1.3.5-beta.573 → 1.3.5-beta.575

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 (32) hide show
  1. package/es/components/icons/AddRadiusIcon.d.ts +3 -0
  2. package/es/components/icons/AddRadiusIcon.js +7 -0
  3. package/es/components/icons/PivotTableChartIcon.d.ts +3 -0
  4. package/es/components/icons/PivotTableChartIcon.js +11 -0
  5. package/es/components/icons/SubtractRadiusIcon.d.ts +3 -0
  6. package/es/components/icons/SubtractRadiusIcon.js +7 -0
  7. package/es/components/icons/index.d.ts +7 -4
  8. package/es/components/icons/index.js +7 -4
  9. package/es/components/molecules/Dropdown/Dropdown.d.ts +0 -1
  10. package/es/components/molecules/Dropdown/Dropdown.js +3 -3
  11. package/es/components/molecules/Dropdown/style.scss +6 -4
  12. package/es/components/organism/DataTable/components/Toolbar/GroupByPopover.d.ts +10 -0
  13. package/es/components/organism/DataTable/components/Toolbar/GroupByPopover.js +29 -0
  14. package/es/components/organism/DataTable/components/Toolbar/ToolbarActionButtons.js +5 -0
  15. package/es/components/organism/DataTable/components/Toolbar/index.js +4 -2
  16. package/es/components/organism/DataTable/constants/common.d.ts +1 -1
  17. package/es/components/organism/DataTable/constants/common.js +1 -1
  18. package/es/components/organism/DataTable/constants/toolbar.d.ts +1 -0
  19. package/es/components/organism/DataTable/constants/toolbar.js +8 -2
  20. package/es/components/organism/DataTable/hooks/useDataTableListing/types.d.ts +8 -0
  21. package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.d.ts +6 -1
  22. package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +116 -11
  23. package/es/components/organism/DataTable/styled/index.d.ts +1 -0
  24. package/es/components/organism/DataTable/styled/index.js +6 -0
  25. package/es/components/organism/DataTable/types/toolbar.d.ts +9 -1
  26. package/es/constants/theme.js +9 -5
  27. package/es/locales/en/translation.json +2 -1
  28. package/es/locales/i18n.d.ts +2 -0
  29. package/es/locales/translations.d.ts +1 -0
  30. package/es/locales/vi/translation.json +2 -1
  31. package/es/providers/ConfigProvider/GlobalStyle.js +8 -1
  32. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const AddRadiusIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,7 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useIcon } from './hooks/useIcon';
3
+ export const AddRadiusIcon = forwardRef((props, ref) => {
4
+ const { width, height } = useIcon(props);
5
+ return (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { ref: ref, width: width, height: height }),
6
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8 3C5.23858 3 3 5.23858 3 8V16C3 18.7614 5.23858 21 8 21H16C18.7614 21 21 18.7614 21 16V8C21 5.23858 18.7614 3 16 3H8ZM13.2 10.8H16.8C17.1183 10.8 17.4235 10.9264 17.6486 11.1515C17.8736 11.3765 18 11.6817 18 12C18 12.3183 17.8736 12.6235 17.6486 12.8485C17.4235 13.0736 17.1183 13.2 16.8 13.2H13.2V16.8C13.2 17.1183 13.0736 17.4235 12.8486 17.6485C12.6235 17.8736 12.3183 18 12 18C11.6817 18 11.3765 17.8736 11.1514 17.6485C10.9264 17.4235 10.8 17.1183 10.8 16.8V13.2H7.2C6.88174 13.2 6.57646 13.0736 6.35142 12.8485C6.12637 12.6235 6 12.3183 6 12C6 11.6817 6.12637 11.3765 6.35142 11.1515C6.57646 10.9264 6.88174 10.8 7.2 10.8H10.8V7.2C10.8 6.88174 10.9264 6.57653 11.1514 6.35149C11.3765 6.12645 11.6817 6 12 6C12.3183 6 12.6235 6.12645 12.8486 6.35149C13.0736 6.57653 13.2 6.88174 13.2 7.2V10.8Z", fill: "currentColor" })));
7
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const PivotTableChartIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,11 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useIcon } from './hooks/useIcon';
3
+ export const PivotTableChartIcon = forwardRef((props, ref) => {
4
+ // search tag: group by, pivot table
5
+ const { width, height } = useIcon(props);
6
+ return (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", enableBackground: "new 0 0 24 24", viewBox: "0 0 24 24", fill: "currentColor" }, props, { ref: ref, width: width, height: height }),
7
+ React.createElement("g", null,
8
+ React.createElement("path", { d: "M0,0h24v24H0V0z", fill: "none" })),
9
+ React.createElement("g", null,
10
+ React.createElement("path", { d: "M21,5c0-1.1-0.9-2-2-2h-9v5h11V5z M3,19c0,1.1,0.9,2,2,2h3V10H3V19z M3,5v3h5V3H5C3.9,3,3,3.9,3,5z M18,8.99L14,13 l1.41,1.41l1.59-1.6V15c0,1.1-0.9,2-2,2h-2.17l1.59-1.59L13,14l-4,4l4,4l1.41-1.41L12.83,19H15c2.21,0,4-1.79,4-4v-2.18l1.59,1.6 L22,13L18,8.99z" }))));
11
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const SubtractRadiusIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,7 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useIcon } from './hooks/useIcon';
3
+ export const SubtractRadiusIcon = forwardRef((props, ref) => {
4
+ const { width, height } = useIcon(props);
5
+ return (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg" }, props, { ref: ref, width: width, height: height }),
6
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8 3C5.23858 3 3 5.23858 3 8V16C3 18.7614 5.23858 21 8 21H16C18.7614 21 21 18.7614 21 16V8C21 5.23858 18.7614 3 16 3H8ZM17 11H7V13H17V11Z", fill: "currentColor" })));
7
+ });
@@ -2,6 +2,7 @@ export { AccountCircleIcon } from './AccountCircleIcon';
2
2
  export { AddChartIcon } from './AddChartIcon';
3
3
  export { AddFolderIcon } from './AddFolderIcon';
4
4
  export { AddIcon } from './AddIcon';
5
+ export { AddRadiusIcon } from './AddRadiusIcon';
5
6
  export { AddShoppingCartIcon } from './AddShoppingCartIcon';
6
7
  export { AdjustIcon } from './AdjustIcon';
7
8
  export { AllDevicesIcon } from './AllDevicesIcon';
@@ -32,13 +33,13 @@ export { ChatBubbleOutlineIcon } from './ChatBubbleOutlineIcon';
32
33
  export { ChatConversationCommentAddCommentIcon } from './ChatConversationCommentAddCommentIcon';
33
34
  export { ChatMentionIcon } from './ChatMentionIcon';
34
35
  export { ChatUnreadIcon } from './ChatUnreadIcon';
36
+ export { CheckSlimIcon } from './CheckSlimIcon';
35
37
  export { CheckboxChecked5RadiusIcon } from './CheckboxChecked5RadiusIcon';
36
38
  export { CheckboxCheckedIcon } from './CheckboxCheckedIcon';
37
39
  export { CheckboxIndeterminate5RadiusIcon } from './CheckboxIndeterminate5RadiusIcon';
38
40
  export { CheckboxIndeterminateIcon } from './CheckboxIndeterminateIcon';
39
41
  export { CheckboxUnchecked5RadiusIcon } from './CheckboxUnchecked5RadiusIcon';
40
42
  export { CheckboxUncheckedIcon } from './CheckboxUncheckedIcon';
41
- export { CheckSlimIcon } from './CheckSlimIcon';
42
43
  export { CircleAddElementIcon } from './CircleAddElementIcon';
43
44
  export { CircleNotificationsIcon } from './CircleNotificationsIcon';
44
45
  export { CloseIcon } from './CloseIcon';
@@ -100,9 +101,9 @@ export { ForecastIcon } from './ForecastIcon';
100
101
  export { ForwardIcon } from './ForwardIcon';
101
102
  export { FreeDrawIcon } from './FreeDrawIcon';
102
103
  export { FullReviewIcon } from './FullReviewIcon';
104
+ export { GPTIcon } from './GPTIcon';
103
105
  export { GenerateAutoWizardIcon } from './GenerateAutoWizardIcon';
104
106
  export { GetInsightIcon } from './GetInsightIcon';
105
- export { GPTIcon } from './GPTIcon';
106
107
  export { GridViewIcon } from './GridViewIcon';
107
108
  export { GroupIcon } from './GroupIcon';
108
109
  export { GroupLayerIcon } from './GroupLayerIcon';
@@ -145,8 +146,8 @@ export { MoveToIcon } from './MoveToIcon';
145
146
  export { MuteIcon } from './MuteIcon';
146
147
  export { NodeViewIcon } from './NodeViewIcon';
147
148
  export { NotificationIcon } from './NotificationIcon';
148
- export { NotificationsActiveIcon } from './NotificationsActiveIcon';
149
149
  export { NotificationSettingIcon } from './NotificationSettingIcon';
150
+ export { NotificationsActiveIcon } from './NotificationsActiveIcon';
150
151
  export { OpenNewTabIcon } from './OpenNewTabIcon';
151
152
  export { OpenUrlIcon } from './OpenUrlIcon';
152
153
  export { PageArticleIcon } from './PageArticleIcon';
@@ -156,6 +157,7 @@ export { PenDrawingIcon } from './PenDrawingIcon';
156
157
  export { PersonAddDisabledIcon } from './PersonAddDisabledIcon';
157
158
  export { PersonUserAccountIcon } from './PersonUserAccountIcon';
158
159
  export { PhoneCallbackIcon } from './PhoneCallbackIcon';
160
+ export { PivotTableChartIcon } from './PivotTableChartIcon';
159
161
  export { PlaneIcon } from './PlaneIcon';
160
162
  export { PreviewIcon } from './PreviewIcon';
161
163
  export { PreviewVisibilityEyeIcon } from './PreviewVisibilityEyeIcon';
@@ -206,6 +208,7 @@ export { StatisticIcon } from './StatisticIcon';
206
208
  export { StickerIcon } from './StickerIcon';
207
209
  export { StopRecordIcon } from './StopRecordIcon';
208
210
  export { StoreIcon } from './StoreIcon';
211
+ export { SubtractRadiusIcon } from './SubtractRadiusIcon';
209
212
  export { SupportAssistantIcon } from './SupportAssistantIcon';
210
213
  export { SurveyDirectorProfileIcon } from './SurveyDirectorProfileIcon';
211
214
  export { SystemRunningIcon } from './SystemRunningIcon';
@@ -231,7 +234,7 @@ export { ViewDetailsInformationIcon } from './ViewDetailsInformationIcon';
231
234
  export { VisibilityOffEyeIcon } from './VisibilityOffEyeIcon';
232
235
  export { WarningIcon } from './WarningIcon';
233
236
  export { WebAssetIcon } from './WebAssetIcon';
234
- export { WebhookIcon } from './WebhookIcon';
235
237
  export { WebIcon } from './WebIcon';
238
+ export { WebhookIcon } from './WebhookIcon';
236
239
  export { WidgetIcon } from './WidgetIcon';
237
240
  export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
@@ -2,6 +2,7 @@ export { AccountCircleIcon } from './AccountCircleIcon';
2
2
  export { AddChartIcon } from './AddChartIcon';
3
3
  export { AddFolderIcon } from './AddFolderIcon';
4
4
  export { AddIcon } from './AddIcon';
5
+ export { AddRadiusIcon } from './AddRadiusIcon';
5
6
  export { AddShoppingCartIcon } from './AddShoppingCartIcon';
6
7
  export { AdjustIcon } from './AdjustIcon';
7
8
  export { AllDevicesIcon } from './AllDevicesIcon';
@@ -32,13 +33,13 @@ export { ChatBubbleOutlineIcon } from './ChatBubbleOutlineIcon';
32
33
  export { ChatConversationCommentAddCommentIcon } from './ChatConversationCommentAddCommentIcon';
33
34
  export { ChatMentionIcon } from './ChatMentionIcon';
34
35
  export { ChatUnreadIcon } from './ChatUnreadIcon';
36
+ export { CheckSlimIcon } from './CheckSlimIcon';
35
37
  export { CheckboxChecked5RadiusIcon } from './CheckboxChecked5RadiusIcon';
36
38
  export { CheckboxCheckedIcon } from './CheckboxCheckedIcon';
37
39
  export { CheckboxIndeterminate5RadiusIcon } from './CheckboxIndeterminate5RadiusIcon';
38
40
  export { CheckboxIndeterminateIcon } from './CheckboxIndeterminateIcon';
39
41
  export { CheckboxUnchecked5RadiusIcon } from './CheckboxUnchecked5RadiusIcon';
40
42
  export { CheckboxUncheckedIcon } from './CheckboxUncheckedIcon';
41
- export { CheckSlimIcon } from './CheckSlimIcon';
42
43
  export { CircleAddElementIcon } from './CircleAddElementIcon';
43
44
  export { CircleNotificationsIcon } from './CircleNotificationsIcon';
44
45
  export { CloseIcon } from './CloseIcon';
@@ -100,9 +101,9 @@ export { ForecastIcon } from './ForecastIcon';
100
101
  export { ForwardIcon } from './ForwardIcon';
101
102
  export { FreeDrawIcon } from './FreeDrawIcon';
102
103
  export { FullReviewIcon } from './FullReviewIcon';
104
+ export { GPTIcon } from './GPTIcon';
103
105
  export { GenerateAutoWizardIcon } from './GenerateAutoWizardIcon';
104
106
  export { GetInsightIcon } from './GetInsightIcon';
105
- export { GPTIcon } from './GPTIcon';
106
107
  export { GridViewIcon } from './GridViewIcon';
107
108
  export { GroupIcon } from './GroupIcon';
108
109
  export { GroupLayerIcon } from './GroupLayerIcon';
@@ -145,8 +146,8 @@ export { MoveToIcon } from './MoveToIcon';
145
146
  export { MuteIcon } from './MuteIcon';
146
147
  export { NodeViewIcon } from './NodeViewIcon';
147
148
  export { NotificationIcon } from './NotificationIcon';
148
- export { NotificationsActiveIcon } from './NotificationsActiveIcon';
149
149
  export { NotificationSettingIcon } from './NotificationSettingIcon';
150
+ export { NotificationsActiveIcon } from './NotificationsActiveIcon';
150
151
  export { OpenNewTabIcon } from './OpenNewTabIcon';
151
152
  export { OpenUrlIcon } from './OpenUrlIcon';
152
153
  export { PageArticleIcon } from './PageArticleIcon';
@@ -156,6 +157,7 @@ export { PenDrawingIcon } from './PenDrawingIcon';
156
157
  export { PersonAddDisabledIcon } from './PersonAddDisabledIcon';
157
158
  export { PersonUserAccountIcon } from './PersonUserAccountIcon';
158
159
  export { PhoneCallbackIcon } from './PhoneCallbackIcon';
160
+ export { PivotTableChartIcon } from './PivotTableChartIcon';
159
161
  export { PlaneIcon } from './PlaneIcon';
160
162
  export { PreviewIcon } from './PreviewIcon';
161
163
  export { PreviewVisibilityEyeIcon } from './PreviewVisibilityEyeIcon';
@@ -206,6 +208,7 @@ export { StatisticIcon } from './StatisticIcon';
206
208
  export { StickerIcon } from './StickerIcon';
207
209
  export { StopRecordIcon } from './StopRecordIcon';
208
210
  export { StoreIcon } from './StoreIcon';
211
+ export { SubtractRadiusIcon } from './SubtractRadiusIcon';
209
212
  export { SupportAssistantIcon } from './SupportAssistantIcon';
210
213
  export { SurveyDirectorProfileIcon } from './SurveyDirectorProfileIcon';
211
214
  export { SystemRunningIcon } from './SystemRunningIcon';
@@ -231,7 +234,7 @@ export { ViewDetailsInformationIcon } from './ViewDetailsInformationIcon';
231
234
  export { VisibilityOffEyeIcon } from './VisibilityOffEyeIcon';
232
235
  export { WarningIcon } from './WarningIcon';
233
236
  export { WebAssetIcon } from './WebAssetIcon';
234
- export { WebhookIcon } from './WebhookIcon';
235
237
  export { WebIcon } from './WebIcon';
238
+ export { WebhookIcon } from './WebhookIcon';
236
239
  export { WidgetIcon } from './WidgetIcon';
237
240
  export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
2
  import { InputDropdownProps } from './types';
3
- import './style.scss';
4
3
  export { Dropdown } from 'antd';
5
4
  export declare const InputDropdown: (props: InputDropdownProps) => React.JSX.Element;
@@ -14,11 +14,11 @@ import { Space, Typography } from 'antd';
14
14
  import Icon from '@antscorp/icons';
15
15
  import { StyledInputDropdownRoot } from './styled';
16
16
  import clsx from 'clsx';
17
- import './style.scss';
17
+ // import './style.scss';
18
18
  export { Dropdown } from 'antd';
19
19
  const DefaultExpandIcon = React.createElement(Icon, { type: "icon-ants-expand-more" });
20
20
  export const InputDropdown = (props) => {
21
- const { children, disabled = false, className, trigger = ['click'], menu = { items: [] }, width = '100%', expandIcon = DefaultExpandIcon, onOpenChange = () => { } } = props, rest = __rest(props, ["children", "disabled", "className", "trigger", "menu", "width", "expandIcon", "onOpenChange"]);
21
+ const { children, disabled = false, className, trigger = ['click'], menu = { items: [] }, width = '100%', expandIcon = DefaultExpandIcon, onOpenChange = () => { }, overlayClassName } = props, rest = __rest(props, ["children", "disabled", "className", "trigger", "menu", "width", "expandIcon", "onOpenChange", "overlayClassName"]);
22
22
  const [enableTooltip, setEnableTooltip] = useState(true);
23
23
  const renderChildren = useCallback(() => {
24
24
  if (typeof children === 'string') {
@@ -37,7 +37,7 @@ export const InputDropdown = (props) => {
37
37
  setEnableTooltip(!open);
38
38
  onOpenChange(...args);
39
39
  };
40
- return (React.createElement(StyledInputDropdownRoot, Object.assign({ menu: menu, trigger: trigger, disabled: disabled }, rest, { className: clsx({ disabled }, className, 'antsomi-input-dropdown'), onOpenChange: handleOpen }),
40
+ return (React.createElement(StyledInputDropdownRoot, Object.assign({ menu: menu, trigger: trigger, disabled: disabled }, rest, { className: clsx({ disabled }, className, 'antsomi-input-dropdown'), overlayClassName: clsx(overlayClassName, 'antsomi-input-dropdown-overlay'), onOpenChange: handleOpen }),
41
41
  React.createElement(Space, { style: { width } },
42
42
  renderChildren(),
43
43
  expandIcon)));
@@ -1,7 +1,9 @@
1
- .antsomi-dropdown-menu {
2
- overflow: hidden;
1
+ .antsomi-input-dropdown-overlay {
2
+ .antsomi-dropdown-menu {
3
+ overflow: hidden;
3
4
 
4
- &:hover {
5
- overflow: auto;
5
+ &:hover {
6
+ overflow: auto;
7
+ }
6
8
  }
7
9
  }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ItemType } from 'antd/es/menu/hooks/useItems';
3
+ import { PopoverProps } from '@antscorp/antsomi-ui/es/components/atoms';
4
+ interface GroupByPopoverProps extends PopoverProps {
5
+ selectedKey?: string;
6
+ options?: ItemType[];
7
+ onChange?: (key: string) => void;
8
+ }
9
+ export declare const GroupByPopover: React.FC<GroupByPopoverProps>;
10
+ export {};
@@ -0,0 +1,29 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ // Libraries
13
+ import React, { useState } from 'react';
14
+ // Components
15
+ import { Popover } from '@antscorp/antsomi-ui/es/components/atoms';
16
+ import { Menu } from '@antscorp/antsomi-ui/es/components/organism';
17
+ const initialState = {
18
+ isOpenPopover: false,
19
+ };
20
+ export const GroupByPopover = props => {
21
+ const { options, selectedKey, onChange = () => { } } = props, restProps = __rest(props, ["options", "selectedKey", "onChange"]);
22
+ const [state, setState] = useState(initialState);
23
+ const { isOpenPopover } = state;
24
+ const popoverContent = (React.createElement(Menu, { selectedKeys: [selectedKey || ''], items: options, onSelect: info => {
25
+ setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false })));
26
+ onChange(info.key);
27
+ } }));
28
+ return (React.createElement(Popover, Object.assign({}, restProps, { open: isOpenPopover, content: popoverContent, trigger: ['click'], arrow: false, overlayInnerStyle: { padding: 0, width: 200 }, placement: "bottomRight", onOpenChange: open => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: open }))) })));
29
+ };
@@ -28,6 +28,7 @@ import { Icon } from '@antscorp/antsomi-ui/es/components/atoms';
28
28
  import { renderActionButtons } from '@antscorp/antsomi-ui/es/utils';
29
29
  import { flatFilterMetrics } from '../../utils';
30
30
  import { GridViewIcon, TableIcon } from '@antscorp/antsomi-ui/es/components/icons';
31
+ import { GroupByPopover } from './GroupByPopover';
31
32
  export const ToolbarActionButtons = memo(() => {
32
33
  // Store
33
34
  const actionButtons = useDataTableContext(useShallow(store => store.toolbar.actionButtons));
@@ -87,6 +88,10 @@ export const ToolbarActionButtons = memo(() => {
87
88
  label: mode === 'TABLE' ? 'Grid view' : 'Table',
88
89
  })));
89
90
  }
91
+ case 'GROUP_BY': {
92
+ const { selectedKey, options, onChange } = action;
93
+ return (React.createElement(GroupByPopover, { selectedKey: selectedKey, options: options, onChange: onChange }, actionButton()));
94
+ }
90
95
  default:
91
96
  return actionButton();
92
97
  }
@@ -7,11 +7,12 @@ import { Filter } from '../Filter';
7
7
  import { ToolbarActionButtons } from './ToolbarActionButtons';
8
8
  import { Divider, Flex, Icon } from '@antscorp/antsomi-ui/es/components/atoms';
9
9
  import { FilterActionButton } from '../Filter/FilterActionButton';
10
+ import { RowSelectedControl } from './RowSelectedControl';
10
11
  // Hooks
11
12
  import { useDataTableContext } from '../../contexts/DataTableContext';
12
13
  import { useOutsideClick } from '@antscorp/antsomi-ui/es/hooks/useOutsideClick';
14
+ // Constants
13
15
  import { EXCEPTION_OFF_FILTER_CLASS } from '../../constants/filter';
14
- import { RowSelectedControl } from './RowSelectedControl';
15
16
  export const Toolbar = memo(() => {
16
17
  // Store
17
18
  const toolbarProps = useDataTableContext(store => store.toolbar);
@@ -23,7 +24,7 @@ export const Toolbar = memo(() => {
23
24
  isFilterActive: false,
24
25
  }), [`.${EXCEPTION_OFF_FILTER_CLASS}`]);
25
26
  // Variables
26
- const { addButton, collapse } = toolbarProps;
27
+ const { addButton, collapse, rightContent } = toolbarProps;
27
28
  const { collapsed, onCollapse } = collapse || {};
28
29
  // Handlers
29
30
  const renderAddButton = () => {
@@ -52,6 +53,7 @@ export const Toolbar = memo(() => {
52
53
  !isFilterActive && renderAddButton(),
53
54
  React.createElement(Filter, null)),
54
55
  !isFilterActive ? (React.createElement(Flex, { align: "center" },
56
+ rightContent,
55
57
  React.createElement(ToolbarActionButtons, null),
56
58
  !!collapse && (React.createElement(Flex, { align: "center" },
57
59
  React.createElement(Divider, { dashed: true, type: "vertical", style: {
@@ -5,7 +5,7 @@ declare const MIN_COLUMN_WIDTH = 55;
5
5
  declare const DEFAULT_ROW_SELECTION_WIDTH = 47;
6
6
  declare const DEFAULT_TOGGLE_WIDTH = 55;
7
7
  declare const DEFAULT_COLUMN_WIDTHS: number[];
8
- declare const DEFAULT_CELL_EMPTY = "--";
8
+ declare const DEFAULT_CELL_EMPTY = "";
9
9
  declare const SORT_MAP: {
10
10
  ascend: string;
11
11
  descend: string;
@@ -6,7 +6,7 @@ const DEFAULT_FIRST_COLUMN_WIDTH = 200;
6
6
  const DEFAULT_ROW_SELECTION_WIDTH = 47;
7
7
  const DEFAULT_TOGGLE_WIDTH = 55;
8
8
  const DEFAULT_COLUMN_WIDTHS = [DEFAULT_FIRST_COLUMN_WIDTH].concat(Array.from({ length: 20 }, () => DEFAULT_COLUMN_WIDTH));
9
- const DEFAULT_CELL_EMPTY = '--';
9
+ const DEFAULT_CELL_EMPTY = '';
10
10
  const SORT_MAP = {
11
11
  ascend: 'asc',
12
12
  descend: 'desc',
@@ -10,6 +10,7 @@ export declare const TOOLBAR_ACTION_KEYS: {
10
10
  readonly NODE_VIEW: "NODE_VIEW";
11
11
  readonly GRID_VIEW: "GRID_VIEW";
12
12
  readonly MORE: "MORE";
13
+ readonly GROUP_BY: "GROUP_BY";
13
14
  };
14
15
  export declare const TOOLBAR_ACTION_OPTIONS: TActionOptions;
15
16
  export declare const GRID_VIEW_KEYS: {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
3
3
  // Icons
4
- import { SearchIcon, TableIcon, ViewColumnIcon } from '@antscorp/antsomi-ui/es/components/icons';
4
+ import { PivotTableChartIcon, SearchIcon, TableIcon, ViewColumnIcon, } from '@antscorp/antsomi-ui/es/components/icons';
5
5
  // Types
6
6
  import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
7
7
  export const TOOLBAR_ACTION_KEYS = {
@@ -15,8 +15,9 @@ export const TOOLBAR_ACTION_KEYS = {
15
15
  NODE_VIEW: 'NODE_VIEW',
16
16
  GRID_VIEW: 'GRID_VIEW',
17
17
  MORE: 'MORE',
18
+ GROUP_BY: 'GROUP_BY',
18
19
  };
19
- const { SEARCH, COLUMN, EXPLORE, EXPORT, CALENDAR, TABLE, COMPARE, GRID_VIEW } = TOOLBAR_ACTION_KEYS;
20
+ const { SEARCH, COLUMN, EXPLORE, EXPORT, CALENDAR, TABLE, COMPARE, GRID_VIEW, GROUP_BY } = TOOLBAR_ACTION_KEYS;
20
21
  export const TOOLBAR_ACTION_OPTIONS = {
21
22
  [SEARCH]: {
22
23
  key: SEARCH,
@@ -58,6 +59,11 @@ export const TOOLBAR_ACTION_OPTIONS = {
58
59
  label: 'Grid View',
59
60
  icon: React.createElement(TableIcon, null),
60
61
  },
62
+ [GROUP_BY]: {
63
+ key: GROUP_BY,
64
+ label: 'Group By',
65
+ icon: React.createElement(PivotTableChartIcon, null),
66
+ },
61
67
  };
62
68
  export const GRID_VIEW_KEYS = {
63
69
  TABLE: 'TABLE',
@@ -72,6 +72,10 @@ type TGridViewProps<TTableType> = {
72
72
  };
73
73
  };
74
74
  };
75
+ type TGroupByProps<TTableType> = {
76
+ columnKeys?: (keyof TTableType)[];
77
+ defaultSelectedKey?: keyof TTableType;
78
+ };
75
79
  export type TFormatFilterValue = Partial<Record<TOperatorKey, (value: any) => unknown>>;
76
80
  export interface UseDataTableListingProps<TTableType = any, TSearchType = any> {
77
81
  name?: string;
@@ -111,6 +115,7 @@ export interface UseDataTableListingProps<TTableType = any, TSearchType = any> {
111
115
  formatFilterValue?: TFormatFilterValue;
112
116
  };
113
117
  gridView?: TGridViewProps<TTableType>;
118
+ groupBy?: TGroupByProps<TTableType>;
114
119
  }
115
120
  export interface DataTableLocalStorage<TTableType = any> {
116
121
  filter?: {
@@ -120,5 +125,8 @@ export interface DataTableLocalStorage<TTableType = any> {
120
125
  table?: TableProps<TTableType>;
121
126
  pagination?: PaginationProps;
122
127
  sorter?: SorterResult<TTableType>;
128
+ groupBy?: {
129
+ selectedKey?: string;
130
+ };
123
131
  }
124
132
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useGetColumnMetrics, useGetFilterMetricList, useGetModifyColumnList, useGetSavedFilterList, useGetSearchListing, useGetTableListing } from '@antscorp/antsomi-ui/es/queries';
3
3
  import { UseDataTableListingProps } from './types';
4
- import { FilterItem, FilterProps, TColumnActionButton, TGridViewActionButton, TSearchActionButton, TableProps, TGridViewKeys } from '../../types';
4
+ import { FilterItem, FilterProps, TColumnActionButton, TGridViewActionButton, TSearchActionButton, TableProps, TGridViewKeys, TGroupByActionButton } from '../../types';
5
5
  import { PaginationProps } from '../../components';
6
6
  import { SorterResult } from 'antd/es/table/interface';
7
7
  interface TUseDataTableListing<TTableType = any> {
@@ -11,6 +11,7 @@ interface TUseDataTableListing<TTableType = any> {
11
11
  table: TableProps<TTableType>;
12
12
  search: TSearchActionButton;
13
13
  gridView: TGridViewActionButton;
14
+ groupBy: TGroupByActionButton;
14
15
  /**
15
16
  * This selectedRowKeys is deprecated. Use selectedRow.keys instead.
16
17
  * @deprecated
@@ -41,6 +42,10 @@ type TState<TTableType = any> = {
41
42
  selectedFilterId?: string | number;
42
43
  pagination: PaginationProps;
43
44
  table: TableProps<TTableType>;
45
+ groupBy: {
46
+ selectedKey?: string;
47
+ expandedKeys?: Record<any, boolean>;
48
+ };
44
49
  selectedRowKeys: React.Key[];
45
50
  selectedRow: {
46
51
  keys: React.Key[];
@@ -19,9 +19,9 @@ var __rest = (this && this.__rest) || function (s, e) {
19
19
  return t;
20
20
  };
21
21
  // Libraries
22
- import React, { useCallback, useMemo, useState } from 'react';
22
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
23
23
  import { Link } from 'react-router-dom';
24
- import { flatMap, isEmpty, pick, xor } from 'lodash';
24
+ import { flatMap, isEmpty, pick, xor, groupBy as lodashGroupBy } from 'lodash';
25
25
  import { useQueryClient } from '@tanstack/react-query';
26
26
  // Types
27
27
  import { useAppConfigContext } from '@antscorp/antsomi-ui/es/providers';
@@ -35,10 +35,11 @@ import { DEFAULT_CELL_EMPTY, DEFAULT_PAGE_SIZE, DEFAULT_TOGGLE_WIDTH, SORT_MAP,
35
35
  import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
36
36
  import { useCreateModifyColumn, useDeleteModifyColumn, useDeleteSavedFilter, useGetColumnMetrics, useGetFilterMetricList, useGetInfiniteMatchesAnyList, useGetModifyColumnList, useGetSavedFilterList, useGetSearchListing, useGetTableListing, useSaveFilter, useUpdateFilter, useUpdateModifyColumn, } from '@antscorp/antsomi-ui/es/queries';
37
37
  // Utils
38
- import { flatTree, mapResponseSearchToGeneral, parseJSONFromLocalStorage, } from '@antscorp/antsomi-ui/es/utils';
38
+ import { flatTree, mapResponseSearchToGeneral, parseJSONFromLocalStorage, reorder, } from '@antscorp/antsomi-ui/es/utils';
39
39
  import { METRIC_MAP_NUMBER_TYPE } from '../../constants/filter';
40
40
  import { mapFiltersToApiFilters, mapFiltersToRules, mapRulesToFilters } from '../../utils';
41
- import { ExpandLessIcon } from '@antscorp/antsomi-ui/es/components/icons';
41
+ import { AddRadiusIcon, ExpandLessIcon, SubtractRadiusIcon, } from '@antscorp/antsomi-ui/es/components/icons';
42
+ import { GroupByExpandButton } from '../../styled';
42
43
  const { Text } = Typography;
43
44
  const { MATCHES, MATCHES_ANY, NOT_MATCHES } = OPERATORS_CODE;
44
45
  const initialState = {
@@ -63,11 +64,14 @@ const initialState = {
63
64
  selectedFilterItem: undefined,
64
65
  expandedRowKeys: [],
65
66
  modeView: 'TABLE',
67
+ groupBy: {
68
+ selectedKey: undefined,
69
+ },
66
70
  };
67
71
  export function useDataTableListing(props) {
68
72
  var _a, _b, _c;
69
73
  // Props
70
- const { config, name = 'default', table: tableProps, search: searchProps, filter: filterProps, gridView: gridViewProps, queryOptions, } = props || {};
74
+ const { config, name = 'default', table: tableProps, search: searchProps, filter: filterProps, gridView: gridViewProps, groupBy: groupByProps, queryOptions, } = props || {};
71
75
  // Hooks
72
76
  const queryClient = useQueryClient();
73
77
  const { appConfig } = useAppConfigContext();
@@ -80,10 +84,11 @@ export function useDataTableListing(props) {
80
84
  const _e = apiFilter || {}, { url: filterUrl = `${COLUMN_DOMAIN[env || 'development']}/api/filter`, enabled: enabledApiFilter = true } = _e, restOfApiFilterRequest = __rest(_e, ["url", "enabled"]);
81
85
  const _f = apiListing || {}, { url: listingUrl = '', enabled: enabledApiListing = true } = _f, restOfApiListingRequest = __rest(_f, ["url", "enabled"]);
82
86
  const _g = apiSearch || {}, { url: searchUrl = '', enabled: enabledApiSearch = true } = _g, restOfApiSearchRequest = __rest(_g, ["url", "enabled"]);
83
- const { filters, selectedFilterId, pagination, selectedRowKeys, searchValue, table, sorter, selectedRow, selectedFilterItem, expandedRowKeys, modeView, } = state;
87
+ const { filters, selectedFilterId, pagination, selectedRowKeys, searchValue, table, sorter, selectedRow, selectedFilterItem, expandedRowKeys, groupBy, modeView, } = state;
84
88
  const { externalFilters, includeDataType = false, matchesAny, formatFilterValue, } = filterProps || {};
85
89
  const { sortDirectionKey = 'az', mainColumnKey, expandColumnKey, expandable } = tableProps || {};
86
90
  const { itemProps: gridViewItemProps } = gridViewProps || {};
91
+ const { columnKeys: groupByColumnKeys, defaultSelectedKey: groupByDefaultSelectedKey } = groupByProps || {};
87
92
  const modifyColumnAuth = Object.assign(Object.assign({}, auth), { url: columnUrl });
88
93
  const filterAuth = Object.assign(Object.assign({}, auth), { url: filterUrl });
89
94
  const listingAuth = Object.assign(Object.assign({}, auth), { url: listingUrl });
@@ -317,6 +322,12 @@ export function useDataTableListing(props) {
317
322
  }
318
323
  return children;
319
324
  }, [expandColumnKey, expandable, expandedRowKeys, mainColumnKey]);
325
+ const handleUpdateGroupBy = useCallback((groupBy) => {
326
+ const localStorageValues = parseJSONFromLocalStorage(localStorageKey) || {};
327
+ setState(prev => (Object.assign(Object.assign({}, prev), { groupBy: Object.assign(Object.assign({}, prev.groupBy), groupBy) })));
328
+ // Set Local Storage
329
+ localStorage.setItem(localStorageKey, JSON.stringify(Object.assign(Object.assign({}, localStorageValues), { groupBy: Object.assign(Object.assign({}, localStorageValues.groupBy), groupBy) })));
330
+ }, [localStorageKey]);
320
331
  const tableColumns = useDeepCompareMemo(() => {
321
332
  let data = [];
322
333
  const { columns } = tableProps || {};
@@ -358,11 +369,73 @@ export function useDataTableListing(props) {
358
369
  return renderColumnWithExpandIcon(RenderComponent, headerCol, record);
359
370
  } });
360
371
  })) || []);
372
+ // Handle Group by
373
+ if (groupBy.selectedKey) {
374
+ data.unshift({
375
+ key: 'groupBy',
376
+ fixed: 'left',
377
+ align: 'center',
378
+ dataIndex: 'groupBy',
379
+ title: '',
380
+ width: 50,
381
+ render(value, record) {
382
+ var _a, _b;
383
+ const { groupTotal = 0 } = record || {};
384
+ const groupKey = record === null || record === void 0 ? void 0 : record[groupBy.selectedKey || ''];
385
+ const isExpanded = typeof ((_a = groupBy.expandedKeys) === null || _a === void 0 ? void 0 : _a[groupKey]) === 'boolean'
386
+ ? (_b = groupBy.expandedKeys) === null || _b === void 0 ? void 0 : _b[groupKey]
387
+ : true;
388
+ return (groupKey &&
389
+ groupTotal > 1 && (React.createElement(GroupByExpandButton, { onClick: () => handleUpdateGroupBy({
390
+ expandedKeys: Object.assign(Object.assign({}, groupBy.expandedKeys), { [groupKey]: !isExpanded }),
391
+ }) }, isExpanded ? (React.createElement(SubtractRadiusIcon, { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorPrimary })) : (React.createElement(AddRadiusIcon, { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorPrimary })))));
392
+ },
393
+ });
394
+ const groupByColumnIndex = data.findIndex(col => col.key === groupBy.selectedKey);
395
+ // Reorder group by column next to expand icon
396
+ if (groupByColumnIndex !== -1) {
397
+ data[groupByColumnIndex].fixed = 'left';
398
+ data = reorder(data, groupByColumnIndex, 1);
399
+ }
400
+ }
401
+ return data;
402
+ }, [
403
+ tableProps,
404
+ tableHeader,
405
+ groupBy.selectedKey,
406
+ groupBy.expandedKeys,
407
+ sorter === null || sorter === void 0 ? void 0 : sorter.columnKey,
408
+ sorter === null || sorter === void 0 ? void 0 : sorter.order,
409
+ renderColumnWithExpandIcon,
410
+ handleUpdateGroupBy,
411
+ ]);
412
+ const tableData = useDeepCompareMemo(() => {
413
+ let data = ((Array === null || Array === void 0 ? void 0 : Array.isArray(tableBody)) &&
414
+ (tableBody === null || tableBody === void 0 ? void 0 : tableBody.map((row) => (Object.assign(Object.assign({}, row), { key: row === null || row === void 0 ? void 0 : row[tableProps === null || tableProps === void 0 ? void 0 : tableProps.mainColumnKey] }))))) ||
415
+ [];
416
+ // Handle group by
417
+ if (groupBy.selectedKey) {
418
+ const groupByData = lodashGroupBy(data, groupBy.selectedKey) || [];
419
+ data =
420
+ Object.entries(groupByData)
421
+ .map(([groupByKey, rows]) => Array.isArray(rows) &&
422
+ rows
423
+ .filter((_, index) => {
424
+ var _a, _b;
425
+ // First row always show
426
+ if (!index) {
427
+ return true;
428
+ }
429
+ const isExpanded = typeof ((_a = groupBy.expandedKeys) === null || _a === void 0 ? void 0 : _a[groupByKey]) === 'boolean'
430
+ ? (_b = groupBy.expandedKeys) === null || _b === void 0 ? void 0 : _b[groupByKey]
431
+ : true;
432
+ return isExpanded;
433
+ })
434
+ .map((row, index) => (Object.assign(Object.assign(Object.assign(Object.assign({}, row), { key: row === null || row === void 0 ? void 0 : row[tableProps === null || tableProps === void 0 ? void 0 : tableProps.mainColumnKey] }), (index !== 0 && { [groupBy.selectedKey || '']: '' })), { groupTotal: rows.length }))))
435
+ .flat() || [];
436
+ }
361
437
  return data;
362
- }, [tableProps, tableHeader, sorter === null || sorter === void 0 ? void 0 : sorter.columnKey, sorter === null || sorter === void 0 ? void 0 : sorter.order, renderColumnWithExpandIcon]);
363
- const tableData = useDeepCompareMemo(() => ((Array === null || Array === void 0 ? void 0 : Array.isArray(tableBody)) &&
364
- (tableBody === null || tableBody === void 0 ? void 0 : tableBody.map((row) => (Object.assign(Object.assign({}, row), { key: row === null || row === void 0 ? void 0 : row[tableProps === null || tableProps === void 0 ? void 0 : tableProps.mainColumnKey] }))))) ||
365
- [], [tableBody]);
438
+ }, [groupBy.expandedKeys, groupBy.selectedKey, tableBody, tableProps === null || tableProps === void 0 ? void 0 : tableProps.mainColumnKey]);
366
439
  const searchList = useDeepCompareMemo(() => {
367
440
  const { itemMapKeys, icon, link } = searchProps || {};
368
441
  return ((searchListingBody === null || searchListingBody === void 0 ? void 0 : searchListingBody.map(searchItem => (Object.assign(Object.assign({}, Object.entries(itemMapKeys || {}).reduce((acc, [key, value]) => (Object.assign(Object.assign({}, acc), { [key]: searchItem[value] })), {})), { icon: typeof icon === 'function' ? icon(searchItem) : icon, link: typeof link === 'function' ? link(searchItem) : link })))) || []);
@@ -386,12 +459,22 @@ export function useDataTableListing(props) {
386
459
  }
387
460
  return [];
388
461
  }, [gridViewProps, tableData]);
462
+ const groupByOptions = useDeepCompareMemo(() => ((groupByColumnKeys === null || groupByColumnKeys === void 0 ? void 0 : groupByColumnKeys.map(key => {
463
+ const column = tableColumns.find(column => column.key === key);
464
+ if (column) {
465
+ return {
466
+ key,
467
+ label: column.title,
468
+ };
469
+ }
470
+ return null;
471
+ }).filter(Boolean)) || []), [groupByColumnKeys, tableColumns]);
389
472
  // Effects
390
473
  /**
391
474
  * Update values from local storage to state
392
475
  */
393
476
  useDeepCompareEffect(() => {
394
- const { filter, pagination, table, sorter } = localStorageValues || {};
477
+ const { filter, pagination, table, sorter, groupBy } = localStorageValues || {};
395
478
  if (!isEmpty(filter)) {
396
479
  const { filters, selectedFilterId } = filter || {};
397
480
  setState(prev => (Object.assign(Object.assign({}, prev), { selectedFilterId,
@@ -406,7 +489,19 @@ export function useDataTableListing(props) {
406
489
  if (!isEmpty(sorter)) {
407
490
  setState(prev => (Object.assign(Object.assign({}, prev), { sorter })));
408
491
  }
492
+ if (!isEmpty(groupBy)) {
493
+ setState(prev => (Object.assign(Object.assign({}, prev), { groupBy })));
494
+ }
409
495
  }, [localStorageValues]);
496
+ /**
497
+ * Set default groupBy column
498
+ */
499
+ useEffect(() => {
500
+ const { groupBy } = localStorageValues || {};
501
+ if (groupByDefaultSelectedKey && !(groupBy === null || groupBy === void 0 ? void 0 : groupBy.selectedKey)) {
502
+ setState(prev => (Object.assign(Object.assign({}, prev), { groupBy: Object.assign(Object.assign({}, prev.groupBy), { selectedKey: groupByDefaultSelectedKey }) })));
503
+ }
504
+ }, [localStorageValues, groupByDefaultSelectedKey]);
410
505
  // /** Update filters from external filters */
411
506
  // useDeepCompareEffect(() => {
412
507
  // if (externalFilters) {
@@ -664,6 +759,16 @@ export function useDataTableListing(props) {
664
759
  },
665
760
  },
666
761
  },
762
+ /** Group by */
763
+ groupBy: {
764
+ options: groupByOptions || [],
765
+ selectedKey: groupBy.selectedKey,
766
+ onChange(selectedKey) {
767
+ handleUpdateGroupBy({
768
+ selectedKey,
769
+ });
770
+ },
771
+ },
667
772
  /* Selected row */
668
773
  selectedRowKeys,
669
774
  selectedRow,
@@ -9,3 +9,4 @@ export declare const ActionButton: import("styled-components").StyledComponent<i
9
9
  export declare const FilterMetricLabel: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
10
10
  export declare const DataTableContent: import("styled-components").StyledComponent<"div", any, {}, never>;
11
11
  export declare const FilterButton: import("styled-components").StyledComponent<"div", any, {}, never>;
12
+ export declare const GroupByExpandButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
@@ -90,3 +90,9 @@ export const FilterButton = styled.div `
90
90
  justify-content: center;
91
91
  flex-shrink: 0;
92
92
  `;
93
+ /* Group by */
94
+ export const GroupByExpandButton = styled(Flex) `
95
+ align-items: center;
96
+ justify-content: center;
97
+ cursor: pointer;
98
+ `;
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { DropdownProps } from 'antd';
3
+ import { ItemType } from 'antd/es/menu/hooks/useItems';
3
4
  import { GRID_VIEW_KEYS, TOOLBAR_ACTION_KEYS } from '../constants';
4
5
  import { AddButtonProps } from '../components/AddButton';
5
6
  import { TActionButton, TConfirmResponse } from '@antscorp/antsomi-ui/es/types';
@@ -63,7 +64,12 @@ export type TGridViewActionButton = TActionButton & {
63
64
  /** The callback function to change the mode of the grid view. */
64
65
  onChangeMode?: (mode: TGridViewKeys) => void;
65
66
  };
66
- export type TToolbarActionButton<TActionKey extends string[] = [], ActionKey extends TActionToolbarButtonKey<TActionKey> = TActionToolbarButtonKey<TActionKey>> = ActionKey extends 'SEARCH' ? TSearchActionButton : ActionKey extends 'COLUMN' ? TColumnActionButton : ActionKey extends 'GRID_VIEW' ? TGridViewActionButton : TActionButton;
67
+ export type TGroupByActionButton = TActionButton & {
68
+ selectedKey?: string;
69
+ options: ItemType[];
70
+ onChange: (key: string) => void;
71
+ };
72
+ export type TToolbarActionButton<TActionKey extends string[] = [], ActionKey extends TActionToolbarButtonKey<TActionKey> = TActionToolbarButtonKey<TActionKey>> = ActionKey extends 'SEARCH' ? TSearchActionButton : ActionKey extends 'COLUMN' ? TColumnActionButton : ActionKey extends 'GRID_VIEW' ? TGridViewActionButton : ActionKey extends 'GROUP_BY' ? TGroupByActionButton : TActionButton;
67
73
  export type TCollapse = {
68
74
  collapsed?: boolean;
69
75
  onCollapse?: (collapsed: boolean) => void;
@@ -76,4 +82,6 @@ export interface ToolbarProps<TActionKey extends string[] = []> {
76
82
  };
77
83
  selectedRowButtons?: Record<string, TSelectedRowButton>;
78
84
  collapse?: TCollapse;
85
+ /** The right content of the toolbar. */
86
+ rightContent?: ReactNode;
79
87
  }
@@ -1,4 +1,4 @@
1
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
1
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
2
2
  // Types
3
3
  import { theme } from 'antd';
4
4
  // Variables
@@ -226,12 +226,16 @@ THEME.components = {
226
226
  // borderRadius: THEME.token?.borderRadiusLG,
227
227
  },
228
228
  Dropdown: {
229
- borderRadiusLG: 10,
229
+ borderRadiusSM: 0,
230
230
  // borderRadius: THEME.token?.borderRadiusLG,
231
+ paddingXXS: 8,
231
232
  controlItemBgHover: '#F2F9FF',
233
+ controlItemBgActive: '#DEEFFE',
234
+ colorPrimary: (_2 = THEME.token) === null || _2 === void 0 ? void 0 : _2.colorText,
235
+ controlItemBgActiveHover: '#DEEFFE',
232
236
  },
233
237
  Tooltip: {
234
- colorBgSpotlight: (_2 = THEME.token) === null || _2 === void 0 ? void 0 : _2.bw8,
238
+ colorBgSpotlight: (_3 = THEME.token) === null || _3 === void 0 ? void 0 : _3.bw8,
235
239
  fontSize: 11,
236
240
  },
237
241
  Menu: {
@@ -241,8 +245,8 @@ THEME.components = {
241
245
  itemMarginBlock: 5,
242
246
  itemBorderRadius: 5,
243
247
  subMenuItemBg: 'transparent',
244
- itemDisabledColor: (_3 = THEME.token) === null || _3 === void 0 ? void 0 : _3.colorTextDisabled,
245
- itemActiveBg: (_4 = THEME.token) === null || _4 === void 0 ? void 0 : _4.blue1_1,
248
+ itemDisabledColor: (_4 = THEME.token) === null || _4 === void 0 ? void 0 : _4.colorTextDisabled,
249
+ itemActiveBg: (_5 = THEME.token) === null || _5 === void 0 ? void 0 : _5.blue1_1,
246
250
  },
247
251
  Form: {
248
252
  itemMarginBottom: 15,
@@ -555,7 +555,8 @@
555
555
  "toolbarActions": {
556
556
  "search": "Search",
557
557
  "column": "Column",
558
- "explore": "Explore"
558
+ "explore": "Explore",
559
+ "groupBy": "Group by"
559
560
  }
560
561
  },
561
562
  "dataTableFilter": {
@@ -558,6 +558,7 @@ export declare const translationsJson: {
558
558
  search: string;
559
559
  column: string;
560
560
  explore: string;
561
+ groupBy: string;
561
562
  };
562
563
  };
563
564
  dataTableFilter: {
@@ -781,6 +782,7 @@ export declare const translationsJson: {
781
782
  search: string;
782
783
  column: string;
783
784
  explore: string;
785
+ groupBy: string;
784
786
  };
785
787
  };
786
788
  dataTableFilter: {
@@ -558,6 +558,7 @@ export declare const convertLanguageJsonToObject: (json: any, objToConvertTo?: C
558
558
  search: string;
559
559
  column: string;
560
560
  explore: string;
561
+ groupBy: string;
561
562
  };
562
563
  };
563
564
  dataTableFilter: {
@@ -98,7 +98,8 @@
98
98
  "toolbarActions": {
99
99
  "search": "Tìm",
100
100
  "column": "Cột",
101
- "explore": "Khám phá"
101
+ "explore": "Khám phá",
102
+ "groupBy": "Gom theo"
102
103
  }
103
104
  },
104
105
  "dataTableFilter": {
@@ -310,6 +310,11 @@ export const GlobalStyle = () => {
310
310
  gap: 5px;
311
311
  }
312
312
 
313
+ // Dropdown
314
+ .antsomi-dropdown-menu {
315
+ padding: 8px 0 !important;
316
+ }
317
+
313
318
  // Input Number
314
319
  .antsomi-input-number,
315
320
  .antsomi-input-number-affix-wrapper {
@@ -666,7 +671,9 @@ export const GlobalStyle = () => {
666
671
  border-radius: 50%;
667
672
  box-shadow: rgba(0, 0, 0, 0.3) 0px 2px 2px 0px;
668
673
  cursor: pointer;
669
- transition: border-color 0.3s, box-shadow 0.6s,
674
+ transition:
675
+ border-color 0.3s,
676
+ box-shadow 0.6s,
670
677
  transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) !important;
671
678
  }
672
679
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.573",
3
+ "version": "1.3.5-beta.575",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",