@antscorp/antsomi-ui 1.3.5-beta.574 → 1.3.5-beta.576
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/es/components/icons/AddRadiusIcon.d.ts +3 -0
- package/es/components/icons/AddRadiusIcon.js +7 -0
- package/es/components/icons/PivotTableChartIcon.d.ts +3 -0
- package/es/components/icons/PivotTableChartIcon.js +11 -0
- package/es/components/icons/SubtractRadiusIcon.d.ts +3 -0
- package/es/components/icons/SubtractRadiusIcon.js +7 -0
- package/es/components/icons/index.d.ts +7 -4
- package/es/components/icons/index.js +7 -4
- package/es/components/molecules/HeaderV2/HeaderV2.d.ts +1 -0
- package/es/components/molecules/HeaderV2/HeaderV2.js +2 -2
- package/es/components/molecules/HeaderV2/styled.d.ts +3 -1
- package/es/components/molecules/HeaderV2/styled.js +2 -0
- package/es/components/organism/DataTable/components/Toolbar/GroupByPopover.d.ts +10 -0
- package/es/components/organism/DataTable/components/Toolbar/GroupByPopover.js +29 -0
- package/es/components/organism/DataTable/components/Toolbar/ToolbarActionButtons.js +5 -0
- package/es/components/organism/DataTable/components/Toolbar/index.js +4 -2
- package/es/components/organism/DataTable/constants/common.d.ts +1 -1
- package/es/components/organism/DataTable/constants/common.js +1 -1
- package/es/components/organism/DataTable/constants/toolbar.d.ts +1 -0
- package/es/components/organism/DataTable/constants/toolbar.js +8 -2
- package/es/components/organism/DataTable/hooks/useDataTableListing/types.d.ts +8 -0
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.d.ts +6 -1
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +116 -11
- package/es/components/organism/DataTable/styled/index.d.ts +1 -0
- package/es/components/organism/DataTable/styled/index.js +6 -0
- package/es/components/organism/DataTable/types/toolbar.d.ts +9 -1
- package/es/components/organism/LeftMenu/LeftMenu.js +2 -2
- package/es/components/organism/LeftMenu/styled.d.ts +1 -0
- package/es/components/organism/LeftMenu/styled.js +8 -2
- package/es/components/template/Layout/Layout.d.ts +1 -0
- package/es/components/template/Layout/Layout.js +13 -4
- package/es/components/template/Layout/stores/index.d.ts +2 -0
- package/es/components/template/Layout/stores/index.js +1 -0
- package/es/components/template/Layout/styled.d.ts +1 -0
- package/es/components/template/Layout/styled.js +11 -1
- package/es/locales/en/translation.json +2 -1
- package/es/locales/i18n.d.ts +2 -0
- package/es/locales/translations.d.ts +1 -0
- package/es/locales/vi/translation.json +2 -1
- package/package.json +2 -2
|
@@ -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,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,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';
|
|
@@ -32,7 +32,7 @@ export const HeaderV2 = memo(props => {
|
|
|
32
32
|
const { search } = useLocation();
|
|
33
33
|
const { replace } = useCustomRouter();
|
|
34
34
|
// * Prefer to use Header in AppConfigContext
|
|
35
|
-
const { className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
|
|
35
|
+
const { show = true, className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
|
|
36
36
|
/** General config for children component */
|
|
37
37
|
const { env = envContext, language = languageCode, userId = isNaN(Number(auth === null || auth === void 0 ? void 0 : auth.userId)) ? 0 : Number(auth === null || auth === void 0 ? void 0 : auth.userId), portalId = auth === null || auth === void 0 ? void 0 : auth.portalId, token = auth === null || auth === void 0 ? void 0 : auth.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
|
|
38
38
|
const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
|
|
@@ -108,7 +108,7 @@ export const HeaderV2 = memo(props => {
|
|
|
108
108
|
onSelectAccount === null || onSelectAccount === void 0 ? void 0 : onSelectAccount(userId);
|
|
109
109
|
};
|
|
110
110
|
const QUOTE_ENTITY = React.createElement(React.Fragment, null, "\u00BB");
|
|
111
|
-
return (React.createElement(HeaderV2Styled, { className: className || '', style: style },
|
|
111
|
+
return (React.createElement(HeaderV2Styled, { "$show": show, className: className || '', style: style },
|
|
112
112
|
React.createElement("div", { className: "left-side" },
|
|
113
113
|
showLogo && (React.createElement(LogoWrapper, { className: "logo-wrapper" },
|
|
114
114
|
React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" }))),
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare const LogoWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const HeaderV2Styled: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
export declare const HeaderV2Styled: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
$show: boolean;
|
|
4
|
+
}, never>;
|
|
@@ -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
|
-
}, [
|
|
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>;
|
|
@@ -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
|
|
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
|
}
|
|
@@ -16,7 +16,7 @@ import { useLeftMenu } from './hooks';
|
|
|
16
16
|
import { useLeftMenuContext } from './contexts';
|
|
17
17
|
const SubLogoAntsomi = 'https://st-media-template.antsomi.com/icons/antsomi/antsomi.png';
|
|
18
18
|
export const LeftMenuComponent = memo(props => {
|
|
19
|
-
const { style, className, customization, showLogo = true } = props;
|
|
19
|
+
const { show = true, style, className, customization, showLogo = true } = props;
|
|
20
20
|
const { isExpandable = true, isCustomized, isRecommendation, items = [], onMenuItemClick, } = customization || {};
|
|
21
21
|
const appHoverMenuChildren = useLeftMenuContext(store => store.appHoverMenuChildren);
|
|
22
22
|
const { state, activeAppCode, permissionMenu, customActiveAppKey, onToggleChildMenu, onMouseEnter, onMouseLeave, onHoverMenuBar, onShowPopover, onClickFeatureMenuItem, } = useLeftMenu(props);
|
|
@@ -95,7 +95,7 @@ export const LeftMenuComponent = memo(props => {
|
|
|
95
95
|
}
|
|
96
96
|
return null;
|
|
97
97
|
};
|
|
98
|
-
return (React.createElement(LeftMenuNavWrapper, { style: style, "$isExpandMenu": state.isExpandMenu && isExpandable, className: className },
|
|
98
|
+
return (React.createElement(LeftMenuNavWrapper, { "$show": show, style: style, "$isExpandMenu": state.isExpandMenu && isExpandable, className: className },
|
|
99
99
|
React.createElement(LeftMenuNav, { className: "left-menu-nav" },
|
|
100
100
|
React.createElement(FeatureMenuWrapper, { vertical: true, onMouseEnter: () => onShowPopover(), onMouseLeave: onMouseLeave },
|
|
101
101
|
showLogo && (React.createElement(NavLogoWrapper, { align: "center", justify: "center", onMouseEnter: onHoverMenuBar },
|
|
@@ -8,6 +8,7 @@ export declare const FeatureMenuWrapper: import("styled-components").StyledCompo
|
|
|
8
8
|
export declare const ExpandWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
9
|
export declare const LeftMenuNavWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
10
10
|
$isExpandMenu?: boolean | undefined;
|
|
11
|
+
$show?: boolean | undefined;
|
|
11
12
|
}, never>;
|
|
12
13
|
export declare const NavLogoWrapper: 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>;
|
|
13
14
|
export declare const LeftMenuNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
|
|
@@ -44,7 +44,9 @@ export const PopoverWrapper = styled.div `
|
|
|
44
44
|
bottom: 15px;
|
|
45
45
|
box-shadow: 0px 3px 20px 0px #002e5933;
|
|
46
46
|
height: ${({ hasMarginTop }) => hasMarginTop ? `calc(100% - ${HEADER_HEIGHT + 15}px)` : `calc(100% - 15px)`};
|
|
47
|
-
transition:
|
|
47
|
+
transition:
|
|
48
|
+
visibility 0s,
|
|
49
|
+
opacity 0.2s ease-out;
|
|
48
50
|
z-index: 10;
|
|
49
51
|
padding: 10px;
|
|
50
52
|
box-sizing: border-box;
|
|
@@ -67,6 +69,8 @@ export const LeftMenuNavWrapper = styled.div `
|
|
|
67
69
|
display: flex;
|
|
68
70
|
transition: all 0.2s ease-out;
|
|
69
71
|
|
|
72
|
+
${p => !p.$show && 'display: none;'}
|
|
73
|
+
|
|
70
74
|
${p => (p.$isExpandMenu ? `gap: 10px;` : `gap: 15px;`)}
|
|
71
75
|
`;
|
|
72
76
|
export const NavLogoWrapper = styled(Flex) `
|
|
@@ -206,7 +210,9 @@ export const ChildMenuWrapper = styled.div `
|
|
|
206
210
|
margin-top: ${({ isMarginTop }) => (isMarginTop ? `${HEADER_HEIGHT}px` : '0px')};
|
|
207
211
|
width: ${({ isExpand }) => (isExpand ? '210px' : '0px')};
|
|
208
212
|
padding: ${({ isExpand }) => (isExpand ? '10px' : '10px 0')};
|
|
209
|
-
transition:
|
|
213
|
+
transition:
|
|
214
|
+
width 0.2s,
|
|
215
|
+
padding 0.2s ease;
|
|
210
216
|
padding-left: 0px;
|
|
211
217
|
box-sizing: border-box;
|
|
212
218
|
z-index: 1;
|
|
@@ -5,6 +5,7 @@ import '@antscorp/processing-notification/dist/index.css';
|
|
|
5
5
|
import { ProcessingNotificationProps } from '@antscorp/antsomi-ui/es/types';
|
|
6
6
|
import { ContentWrapperProps, WorkspaceProps } from './types';
|
|
7
7
|
export interface LayoutProps {
|
|
8
|
+
onlyContent?: boolean;
|
|
8
9
|
headerProps?: Partial<Omit<HeaderV2Props, 'helpConfig'> & {
|
|
9
10
|
helpConfig: Partial<HeaderV2Props['helpConfig']>;
|
|
10
11
|
}>;
|
|
@@ -63,6 +63,7 @@ export const Layout = memo(props => {
|
|
|
63
63
|
const header = useLayoutStore(store => store.state.header);
|
|
64
64
|
const contentWrapper = useLayoutStore(store => store.state.contentWrapper);
|
|
65
65
|
const workspace = useLayoutStore(store => store.state.workspace);
|
|
66
|
+
const onlyContent = useLayoutStore(store => store.state.onlyContent);
|
|
66
67
|
const [, , removeCookie] = useCookies();
|
|
67
68
|
const params = useParams();
|
|
68
69
|
const location = useLocation();
|
|
@@ -88,6 +89,8 @@ export const Layout = memo(props => {
|
|
|
88
89
|
attributeOldValue: true,
|
|
89
90
|
characterDataOldValue: true,
|
|
90
91
|
});
|
|
92
|
+
// Memo
|
|
93
|
+
const showOnlyContent = useDeepCompareMemo(() => { var _a; return (_a = props.onlyContent) !== null && _a !== void 0 ? _a : onlyContent; }, [onlyContent, props.onlyContent]);
|
|
91
94
|
const permissionDomain = useDeepCompareMemo(() => {
|
|
92
95
|
var _a;
|
|
93
96
|
/**
|
|
@@ -193,6 +196,12 @@ export const Layout = memo(props => {
|
|
|
193
196
|
setLoadingLayout(false);
|
|
194
197
|
}
|
|
195
198
|
}, [mergeLeftMenuProps.customization]);
|
|
199
|
+
/** Timeout for set layout loading off in case left menu no callback onActiveMenuCodeChange */
|
|
200
|
+
useDeepCompareEffect(() => {
|
|
201
|
+
setTimeout(() => {
|
|
202
|
+
setLoadingLayout(false);
|
|
203
|
+
}, 5000);
|
|
204
|
+
}, []);
|
|
196
205
|
// Handle access denied
|
|
197
206
|
const onClickSwitchAccount = useCallback(() => {
|
|
198
207
|
// Remove cookie when switch account
|
|
@@ -276,12 +285,12 @@ export const Layout = memo(props => {
|
|
|
276
285
|
? header === null || header === void 0 ? void 0 : header.pageTitle
|
|
277
286
|
: ''
|
|
278
287
|
: activePageTitle))),
|
|
279
|
-
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { showLogo: !showLeftMenu })),
|
|
288
|
+
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { show: !showOnlyContent, showLogo: !showLeftMenu })),
|
|
280
289
|
React.createElement(Flex, { className: "layout-body" },
|
|
281
|
-
|
|
290
|
+
React.createElement(LeftMenu, Object.assign({ show: showLeftMenu && !showOnlyContent, className: `layout-body__menu ${leftMenuClassName}` }, mergeLeftMenuProps, { customization: Object.assign(Object.assign({}, mergeLeftMenuProps.customization), {
|
|
282
291
|
// If user has access denied, disable expandable
|
|
283
|
-
isExpandable: !isAccessDenied && ((_a = mergeLeftMenuProps.customization) === null || _a === void 0 ? void 0 : _a.isExpandable) }), appConfig: leftMenuAppConfig, onActiveMenuCodeChange: onActiveMenuCodeChange }))
|
|
284
|
-
React.createElement(ContentWrapper, Object.assign({ "$noPadding": noPadding, "$noSpaceTopContent": noSpaceTopContent }, mergeContentWrapperProps), (activeMenu === null || activeMenu === void 0 ? void 0 : activeMenu.menu_item_code) === HOME_MENU_ITEMS.RECOMMENDATION ? (React.createElement("div", { className: "layout-body__content" },
|
|
292
|
+
isExpandable: !isAccessDenied && ((_a = mergeLeftMenuProps.customization) === null || _a === void 0 ? void 0 : _a.isExpandable) }), appConfig: leftMenuAppConfig, onActiveMenuCodeChange: onActiveMenuCodeChange })),
|
|
293
|
+
React.createElement(ContentWrapper, Object.assign({ "$noPadding": noPadding, "$noSpaceTopContent": noSpaceTopContent, "$showOnlyContent": showOnlyContent }, mergeContentWrapperProps), (activeMenu === null || activeMenu === void 0 ? void 0 : activeMenu.menu_item_code) === HOME_MENU_ITEMS.RECOMMENDATION ? (React.createElement("div", { className: "layout-body__content" },
|
|
285
294
|
React.createElement(RecommendationWorkspace, null))) : (React.createElement("div", Object.assign({ className: `layout-body__content ${(workspaceProps === null || workspaceProps === void 0 ? void 0 : workspaceProps.className) || ''}` }, mergeWorkSpaceProps), isLoadingLayout ? (React.createElement(LayoutLoading, { spinning: true })) : (React.createElement(React.Fragment, null,
|
|
286
295
|
React.createElement(NotificationWrapper, { className: "process-notification", ref: notificationWrapperRef }, showNotification && (React.createElement(AntsProcessingNotification, Object.assign({}, antsProcessingNotificationConfig, { callback: handleCallbackNotify })))),
|
|
287
296
|
React.createElement(ChildrenWrapper, Object.assign({}, workspaceContentProps), isAccessDenied ? (React.createElement(AccessDenied, { onClickRequestAccess: onClickRequestAccess, onClickSwitchAccount: onClickSwitchAccount })) : (React.createElement("div", null, children)))))))))));
|
|
@@ -5,6 +5,7 @@ export declare const LayoutWrapper: import("styled-components").StyledComponent<
|
|
|
5
5
|
export declare const ContentWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
6
6
|
$noPadding?: boolean | undefined;
|
|
7
7
|
$noSpaceTopContent?: boolean | undefined;
|
|
8
|
+
$showOnlyContent?: boolean | undefined;
|
|
8
9
|
}, never>;
|
|
9
10
|
export declare const NotificationWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
11
|
export declare const ChildrenWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a, _b;
|
|
2
2
|
// Libraries
|
|
3
|
-
import styled from 'styled-components';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
4
|
// Components
|
|
5
5
|
import { Flex, Spin } from '../../atoms';
|
|
6
6
|
// Constants
|
|
@@ -57,6 +57,16 @@ export const ContentWrapper = styled.div `
|
|
|
57
57
|
.layout-body__content {
|
|
58
58
|
${({ $noSpaceTopContent }) => $noSpaceTopContent && 'padding-top: 0;'}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
${({ $showOnlyContent }) => $showOnlyContent &&
|
|
62
|
+
css `
|
|
63
|
+
padding: 0px;
|
|
64
|
+
|
|
65
|
+
.layout-body__content {
|
|
66
|
+
padding: 0px;
|
|
67
|
+
border-radius: 0px;
|
|
68
|
+
}
|
|
69
|
+
`}
|
|
60
70
|
`;
|
|
61
71
|
export const NotificationWrapper = styled.div `
|
|
62
72
|
flex-shrink: 0;
|
package/es/locales/i18n.d.ts
CHANGED
|
@@ -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: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.576",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"not op_mini all"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@antscorp/icons": "0.27.
|
|
65
|
+
"@antscorp/icons": "0.27.52",
|
|
66
66
|
"@antscorp/image-editor": "1.0.2",
|
|
67
67
|
"@antscorp/processing-notification": "^1.0.3",
|
|
68
68
|
"@dnd-kit/core": "^6.1.0",
|