@antscorp/antsomi-ui 1.3.5-beta.695 → 1.3.5-beta.697
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/molecules/MatchAnySelect/MatchesAnySelect.js +24 -18
- package/es/components/molecules/MatchAnySelect/styled.d.ts +17 -1
- package/es/components/molecules/MatchAnySelect/styled.js +2 -1
- package/es/components/molecules/SearchPopover/components/PopoverSelect/PopoverSelect.js +6 -2
- package/es/components/molecules/Tree/Tree.d.ts +3 -13
- package/es/components/molecules/Tree/Tree.js +3 -2
- package/es/components/molecules/Tree/styled.js +19 -6
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +1 -1
- package/es/components/organism/LeftMenu/utils/index.js +5 -8
- package/es/constants/theme.js +16 -14
- package/es/providers/ConfigProvider/GlobalStyle.js +9 -16
- package/es/utils/common.d.ts +11 -0
- package/es/utils/common.js +28 -0
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ import { uniqBy } from 'lodash';
|
|
|
17
17
|
import React, { useEffect, useState } from 'react';
|
|
18
18
|
// Components
|
|
19
19
|
import { EmptyData, PopoverSelect, Select } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
20
|
-
import { Button, Flex, Icon, Input, Popover,
|
|
20
|
+
import { Button, Flex, Icon, Input, Popover, Spin, Typography, Tooltip, } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
21
21
|
import { ExtendValuePopup } from './components/ExtendValuePopup';
|
|
22
22
|
// Styled
|
|
23
23
|
import { MatchesAnyWrapper, ActionButton, StyledTree, TextButton, GroupSelectButton, ExtraValueLabel, } from './styled';
|
|
@@ -30,7 +30,7 @@ import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
|
30
30
|
// Hooks
|
|
31
31
|
import { useDeepCompareEffect, useDeepCompareMemo, useIntersectionObserver, } from '@antscorp/antsomi-ui/es/hooks';
|
|
32
32
|
// Utils
|
|
33
|
-
import { flatTree, recursiveSearchItems } from '@antscorp/antsomi-ui/es/utils';
|
|
33
|
+
import { flatTree, recursiveFindParents, recursiveSearchItems, } from '@antscorp/antsomi-ui/es/utils';
|
|
34
34
|
import { DataIcon, WarningIcon } from '../../icons';
|
|
35
35
|
import clsx from 'clsx';
|
|
36
36
|
const initialState = {
|
|
@@ -40,6 +40,7 @@ const matchesAnyInitialState = {
|
|
|
40
40
|
searchValue: '',
|
|
41
41
|
selectedItems: [],
|
|
42
42
|
isShowLoadMoreEl: false,
|
|
43
|
+
selectedExpandedKeys: [],
|
|
43
44
|
};
|
|
44
45
|
const { t } = i18nInstance;
|
|
45
46
|
const { Text } = Typography;
|
|
@@ -49,7 +50,7 @@ export function MatchesAny(props) {
|
|
|
49
50
|
// State
|
|
50
51
|
const [state, setState] = useState(matchesAnyInitialState);
|
|
51
52
|
// Variables
|
|
52
|
-
const { searchValue, selectedItems, isShowLoadMoreEl } = state;
|
|
53
|
+
const { searchValue, selectedItems, isShowLoadMoreEl, selectedExpandedKeys } = state;
|
|
53
54
|
const _a = listEmptyProps || {}, { icon: listEmptyIcon, description: listEmptyDescription = t(translations.global.noResultsMatchesKeyWord).toString() } = _a, restListEmptyProps = __rest(_a, ["icon", "description"]);
|
|
54
55
|
const _b = selectedListEmptyProps || {}, { description: selectedListEmptyDescription = t(translations.global.selectItemsFromList).toString(), icon: selectedListEmptyIcon = React.createElement(DataIcon, { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw5, size: 48 }) } = _b, restSelectedListEmptyProps = __rest(_b, ["description", "icon"]);
|
|
55
56
|
// Refs
|
|
@@ -92,10 +93,11 @@ export function MatchesAny(props) {
|
|
|
92
93
|
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: [
|
|
93
94
|
...(prev.selectedItems || []),
|
|
94
95
|
...flattenChild === null || flattenChild === void 0 ? void 0 : flattenChild.filter(item => !item.children),
|
|
95
|
-
] })));
|
|
96
|
+
], selectedExpandedKeys: [...(prev.selectedExpandedKeys || []), item.key] })));
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
+
const parentExpandedKeys = recursiveFindParents(items || [], item, 'key', 'children').map(item => item.key);
|
|
100
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: [...(prev.selectedItems || []), item], selectedExpandedKeys: [...(prev.selectedExpandedKeys || []), ...parentExpandedKeys] })));
|
|
99
101
|
};
|
|
100
102
|
/**
|
|
101
103
|
* Removes an item and its descendants from the list of selected items.
|
|
@@ -120,7 +122,9 @@ export function MatchesAny(props) {
|
|
|
120
122
|
const onSelectAll = () => {
|
|
121
123
|
const flattenTreeData = flatTree(items, 'children').filter(item => !item.children &&
|
|
122
124
|
!(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.some(selectedItem => selectedItem.key === item.key || selectedItem.title === item.title)));
|
|
123
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: uniqBy([...(prev.selectedItems || []), ...flattenTreeData], 'key')
|
|
125
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: uniqBy([...(prev.selectedItems || []), ...flattenTreeData], 'key'), selectedExpandedKeys: flatTree(items, 'children')
|
|
126
|
+
.filter(item => !!item.children)
|
|
127
|
+
.map(item => item.key) })));
|
|
124
128
|
};
|
|
125
129
|
const onRemoveAll = () => {
|
|
126
130
|
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: [] })));
|
|
@@ -263,23 +267,25 @@ export function MatchesAny(props) {
|
|
|
263
267
|
React.createElement(Flex, { align: "center", gap: 10 },
|
|
264
268
|
renderExtraValueLabels(),
|
|
265
269
|
React.createElement(TextButton, { disabled: isDisableSelectAll, onClick: onSelectAll }, t(translations.global.selectAll).toString()))),
|
|
266
|
-
React.createElement(Spin, { spinning: loading },
|
|
267
|
-
React.createElement(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
isShowLoadMoreEl && React.createElement("div", { ref: loadMoreRef }))) : (React.createElement(EmptyData, Object.assign({ icon: listEmptyIcon, showIcon: !!listEmptyIcon, description: listEmptyDescription }, restListEmptyProps))))))));
|
|
270
|
+
React.createElement(Spin, { spinning: loading }, (treeData === null || treeData === void 0 ? void 0 : treeData.length) ? (React.createElement(React.Fragment, null,
|
|
271
|
+
React.createElement(StyledTree, { key: searchValue, defaultExpandAll: true, defaultExpandedKeys: matchedParents.map(item => item.key), selectable: false, treeData: treeData, switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
|
|
272
|
+
transform: props.expanded ? 'rotate(0)' : 'rotate(-90deg)',
|
|
273
|
+
transition: 'transform 0.3s ease',
|
|
274
|
+
}, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 })), height: 396 }),
|
|
275
|
+
isShowLoadMoreEl && React.createElement("div", { ref: loadMoreRef }))) : (React.createElement(EmptyData, Object.assign({ icon: listEmptyIcon, showIcon: !!listEmptyIcon, description: listEmptyDescription }, restListEmptyProps)))))));
|
|
273
276
|
};
|
|
274
277
|
const renderSelectedList = () => (React.createElement("div", { className: "matches-any__section" },
|
|
275
278
|
React.createElement(Flex, { className: "matches-any__header", justify: "space-between" },
|
|
276
279
|
React.createElement(Text, { strong: true }, `${t(translations.global.selected)} (${(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) || 0})`),
|
|
277
280
|
React.createElement(TextButton, { disabled: isDisableRemoveAll, onClick: onRemoveAll }, t(translations.global.removeAll).toString())),
|
|
278
|
-
React.createElement("div", { className: "matches-any__body" },
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
React.createElement("div", { className: "matches-any__body" }, !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) ? (React.createElement(EmptyData, Object.assign({ icon: selectedListEmptyIcon, description: selectedListEmptyDescription }, restSelectedListEmptyProps))) : (React.createElement(StyledTree, Object.assign({ selectable: false, treeData: selectedTreeData, height: 420, defaultExpandAll: true }, ((selectedExpandedKeys === null || selectedExpandedKeys === void 0 ? void 0 : selectedExpandedKeys.length) && {
|
|
282
|
+
expandedKeys: selectedExpandedKeys,
|
|
283
|
+
}), { switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
|
|
284
|
+
transform: props.expanded ? 'rotate(0)' : 'rotate(-90deg)',
|
|
285
|
+
transition: 'transform 0.3s ease',
|
|
286
|
+
}, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 })), onExpand: expandedKeys => {
|
|
287
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedExpandedKeys: expandedKeys })));
|
|
288
|
+
} }))))));
|
|
283
289
|
// Handlers
|
|
284
290
|
const onApplyExtendValue = (extendValues) => {
|
|
285
291
|
// Filter out values that are already present in selectedItems
|
|
@@ -7,7 +7,23 @@ export declare const GroupSelectButton: import("styled-components").StyledCompon
|
|
|
7
7
|
Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
|
|
8
8
|
}, any, {}, never>;
|
|
9
9
|
export declare const ActionButton: 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
|
-
export declare const StyledTree: import("styled-components").StyledComponent<import("
|
|
10
|
+
export declare const StyledTree: import("styled-components").StyledComponent<(<T extends import("rc-tree").BasicDataNode | import("rc-tree/lib/interface").DataNode = import("rc-tree/lib/interface").DataNode>(props: import("antd/es/tree/Tree").TreeProps<T> & {
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
} & import("react").RefAttributes<import("rc-tree").default<import("rc-tree/lib/interface").DataNode>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
13
|
+
TreeNode: import("react").FC<import("rc-tree").TreeNodeProps<import("rc-tree/lib/interface").DataNode>>;
|
|
14
|
+
DirectoryTree: (<T_1 extends import("rc-tree").BasicDataNode | import("rc-tree/lib/interface").DataNode = import("rc-tree/lib/interface").DataNode>(props: import("antd/es/tree").DirectoryTreeProps<T_1> & {
|
|
15
|
+
children?: import("react").ReactNode;
|
|
16
|
+
} & import("react").RefAttributes<import("rc-tree").default<import("rc-tree/lib/interface").DataNode>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
17
|
+
displayName?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
} & {
|
|
20
|
+
DirectoryTree: (<T_1 extends import("rc-tree").BasicDataNode | import("rc-tree/lib/interface").DataNode = import("rc-tree/lib/interface").DataNode>(props: import("antd/es/tree").DirectoryTreeProps<T_1> & {
|
|
21
|
+
children?: import("react").ReactNode;
|
|
22
|
+
} & import("react").RefAttributes<import("rc-tree").default<import("rc-tree/lib/interface").DataNode>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
23
|
+
displayName?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
Standard: import("react").FC<import("antd/es/tree/Tree").TreeProps<import("rc-tree/lib/interface").DataNode>>;
|
|
26
|
+
}, any, {}, never>;
|
|
11
27
|
export declare const TextArea: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>, any, {}, never>;
|
|
12
28
|
export declare const ExtraValueLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
29
|
export declare const ItemStatus: 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>;
|
|
@@ -68,13 +68,14 @@ export const MatchesAnyWrapper = styled(Flex) `
|
|
|
68
68
|
|
|
69
69
|
.antsomi-tree {
|
|
70
70
|
.antsomi-tree-list-holder-inner {
|
|
71
|
-
gap: 5px;
|
|
71
|
+
/* gap: 5px; */
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.antsomi-tree-treenode {
|
|
75
75
|
width: 100%;
|
|
76
76
|
padding: 0px;
|
|
77
77
|
transition: all 300ms;
|
|
78
|
+
padding-bottom: 5px;
|
|
78
79
|
|
|
79
80
|
.antsomi-tree-switcher {
|
|
80
81
|
width: 20px;
|
|
@@ -17,6 +17,10 @@ import { searchStringQuery } from '@antscorp/antsomi-ui/es/utils';
|
|
|
17
17
|
import { Button, Checkbox } from '../../../../atoms';
|
|
18
18
|
import { StyledAction, StyledFooter, StyledListFieldsWrapper } from './styled';
|
|
19
19
|
import { List } from 'antd';
|
|
20
|
+
import { EmptyData } from '../../../EmptyData';
|
|
21
|
+
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
22
|
+
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
23
|
+
const { t } = i18nInstance;
|
|
20
24
|
export const PopoverSelect = (props) => {
|
|
21
25
|
var _a, _b;
|
|
22
26
|
const { open: openProp, selected, options: optionsProp = [], onCancel, onApply, inputSearchProps = {}, children, showAllLabel = 'Show all', showSelectedLabel = 'Show selected', selectAllLabel = 'Select all', deselectAllLabel = 'Unselect all', onSearchPredicate } = props, rest = __rest(props, ["open", "selected", "options", "onCancel", "onApply", "inputSearchProps", "children", "showAllLabel", "showSelectedLabel", "selectAllLabel", "deselectAllLabel", "onSearchPredicate"]);
|
|
@@ -122,9 +126,9 @@ export const PopoverSelect = (props) => {
|
|
|
122
126
|
optionsProp.length > 0 && (React.createElement(StyledAction, null,
|
|
123
127
|
React.createElement(Button, { type: "link", size: "small", onClick: () => setShowSelected(current => !current) }, showSelected ? showAllLabel : showSelectedLabel),
|
|
124
128
|
selectedKeys.size === options.length ? (React.createElement(Button, { type: "link", onClick: handleDeselectAll }, deselectAllLabel)) : (React.createElement(Button, { type: "link", onClick: handleSelectAll }, selectAllLabel)))),
|
|
125
|
-
|
|
129
|
+
filteredOptions.length ? (React.createElement(StyledListFieldsWrapper, { autoHeight: true, autoHeightMax: 260 },
|
|
126
130
|
React.createElement(List, { bordered: false, dataSource: filteredOptions, renderItem: option => (React.createElement(List.Item, null,
|
|
127
|
-
React.createElement(Checkbox, { onChange: e => handleToggleField(option, e.target.checked), checked: selectedKeys.has(option.key) }, renderCheckBoxLabel(option)))) }))),
|
|
131
|
+
React.createElement(Checkbox, { onChange: e => handleToggleField(option, e.target.checked), checked: selectedKeys.has(option.key) }, renderCheckBoxLabel(option)))) }))) : (React.createElement(EmptyData, { showIcon: false, description: t(translations.noData).toString() })),
|
|
128
132
|
React.createElement(StyledFooter, null,
|
|
129
133
|
React.createElement(Button, { onClick: handleCancel }, "Cancel"),
|
|
130
134
|
React.createElement(Button, { onClick: handleApply, disabled: applyDisabled, type: "primary" }, "Apply"))), overlayInnerStyle: {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="hoist-non-react-statics" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { Tree as AntdTree } from 'antd';
|
|
4
3
|
import type { TreeProps, TreeDataNode } from 'antd';
|
|
5
4
|
declare const StandardTree: React.FC<TreeProps>;
|
|
6
|
-
export declare const Tree:
|
|
5
|
+
export declare const Tree: (<T extends import("rc-tree").BasicDataNode | TreeDataNode = TreeDataNode>(props: TreeProps<T> & {
|
|
7
6
|
children?: React.ReactNode;
|
|
8
7
|
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
9
8
|
TreeNode: React.FC<import("rc-tree").TreeNodeProps<TreeDataNode>>;
|
|
@@ -12,17 +11,8 @@ export declare const Tree: string & import("styled-components").StyledComponentB
|
|
|
12
11
|
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
13
12
|
displayName?: string | undefined;
|
|
14
13
|
};
|
|
15
|
-
}
|
|
16
|
-
children?: React.ReactNode;
|
|
17
|
-
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
18
|
-
TreeNode: React.FC<import("rc-tree").TreeNodeProps<TreeDataNode>>;
|
|
19
|
-
DirectoryTree: (<T_1 extends import("rc-tree").BasicDataNode | TreeDataNode = TreeDataNode>(props: import("antd/es/tree").DirectoryTreeProps<T_1> & {
|
|
20
|
-
children?: React.ReactNode;
|
|
21
|
-
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
22
|
-
displayName?: string | undefined;
|
|
23
|
-
};
|
|
24
|
-
}, {}> & {
|
|
14
|
+
} & {
|
|
25
15
|
DirectoryTree: typeof AntdTree.DirectoryTree;
|
|
26
|
-
|
|
16
|
+
Standard: typeof StandardTree;
|
|
27
17
|
};
|
|
28
18
|
export type { TreeProps, TreeDataNode };
|
|
@@ -12,12 +12,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { Tree as AntdTree } from 'antd';
|
|
14
14
|
// styled
|
|
15
|
-
import { StyledTreeDirectory } from './styled';
|
|
15
|
+
import { StyledTree, StyledTreeDirectory } from './styled';
|
|
16
16
|
// icon
|
|
17
17
|
import { ExpandMoreIcon } from '../../icons';
|
|
18
18
|
const StandardTree = props => {
|
|
19
19
|
const { switcherIcon = React.createElement(ExpandMoreIcon, { size: 20 }) } = props, restProps = __rest(props, ["switcherIcon"]);
|
|
20
|
-
return React.createElement(
|
|
20
|
+
return React.createElement(StyledTree, Object.assign({ switcherIcon: switcherIcon }, restProps));
|
|
21
21
|
// return <StyledTree switcherIcon={(props) => <ExpandMoreIcon size={20} />} {...restProps} />;
|
|
22
22
|
};
|
|
23
23
|
export const Tree = AntdTree;
|
|
@@ -26,3 +26,4 @@ const DirectoryTree = props => {
|
|
|
26
26
|
return React.createElement(StyledTreeDirectory, Object.assign({ switcherIcon: switcherIcon }, restProps));
|
|
27
27
|
};
|
|
28
28
|
Tree.DirectoryTree = DirectoryTree;
|
|
29
|
+
Tree.Standard = StandardTree;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
1
2
|
import { Tree } from 'antd';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
export const StyledTree = styled(Tree) `
|
|
4
|
-
/* .antsomi-tree-treenode.placement-right { */
|
|
5
5
|
.antsomi-tree-treenode {
|
|
6
6
|
.antsomi-tree-switcher {
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
9
|
justify-content: center;
|
|
10
10
|
order: 10;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.antsomi-tree-iconEle.antsomi-tree-icon__customize {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
`;
|
|
@@ -22,9 +24,20 @@ export const StyledTreeDirectory = styled(Tree.DirectoryTree) `
|
|
|
22
24
|
display: flex;
|
|
23
25
|
align-items: center;
|
|
24
26
|
justify-content: center;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.antsomi-tree-iconEle.antsomi-tree-icon__customize {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
|
|
33
|
+
& svg {
|
|
34
|
+
width: 16px;
|
|
35
|
+
height: 16px;
|
|
27
36
|
}
|
|
28
37
|
}
|
|
38
|
+
|
|
39
|
+
&::before {
|
|
40
|
+
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadius}px;
|
|
41
|
+
}
|
|
29
42
|
}
|
|
30
43
|
`;
|
|
@@ -279,7 +279,7 @@ export function useDataTableListing(props) {
|
|
|
279
279
|
const result = metrics.map(metric => {
|
|
280
280
|
var _a;
|
|
281
281
|
return ({
|
|
282
|
-
id: metric.metricCode
|
|
282
|
+
id: metric.metricCode,
|
|
283
283
|
name: metric.metricName,
|
|
284
284
|
dataType: METRIC_MAP_NUMBER_TYPE[+metric.dataType] || 'string',
|
|
285
285
|
children: serializeFilterMetrics(metric.child || []),
|
|
@@ -10,12 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
// Libraries
|
|
13
|
-
import React from 'react';
|
|
13
|
+
import React, { Suspense } from 'react';
|
|
14
14
|
import { cloneDeep, isArray, isEmpty, isNil, sortBy } from 'lodash';
|
|
15
15
|
// Components
|
|
16
|
-
|
|
16
|
+
import { LazyIcon as Icons } from '@antscorp/antsomi-ui/es/components/icons/LazyIcon';
|
|
17
17
|
/** Use this Icons for test storybook */
|
|
18
|
-
import * as Icons from '@antscorp/antsomi-ui/es/components/icons';
|
|
18
|
+
// import * as Icons from '@antscorp/antsomi-ui/es/components/icons';
|
|
19
19
|
import { Icon } from '@antscorp/antsomi-ui/es/components/atoms/Icon';
|
|
20
20
|
// Constants
|
|
21
21
|
import { APP_KEYS, MARKETING_CHANNEL_KEY, HOME_MENU_ITEMS, MARKETING_ROUTES, MENU_ITEM_TYPE, RENDER_OPTION, HOME_REPORT_ROUTES, SETTING_APP, APP_EXCLUDED_KEYS, MAP_MENU_TO_PARENT_APP_CODE, } from '../constants';
|
|
@@ -522,11 +522,8 @@ export const renderMenuIcon = (iconName) => {
|
|
|
522
522
|
try {
|
|
523
523
|
// const ComponentIcon = iconName && Icons[iconName];
|
|
524
524
|
const ComponentIcon = iconName && Icons[iconName];
|
|
525
|
-
return ComponentIcon ? (
|
|
526
|
-
|
|
527
|
-
React.createElement(ComponentIcon, { className: "menu-item__icon", size: 30 })) : (
|
|
528
|
-
// </Suspense>
|
|
529
|
-
React.createElement(IconWrapper, null, isNil(iconName) ? null : React.createElement(Icon, { type: iconName })));
|
|
525
|
+
return ComponentIcon ? (React.createElement(Suspense, { fallback: null },
|
|
526
|
+
React.createElement(ComponentIcon, { className: "menu-item__icon", size: 30 }))) : (React.createElement(IconWrapper, null, isNil(iconName) ? null : React.createElement(Icon, { type: iconName })));
|
|
530
527
|
}
|
|
531
528
|
catch (error) {
|
|
532
529
|
return React.createElement(IconWrapper, null, isNil(iconName) ? null : React.createElement(Icon, { type: iconName }));
|
package/es/constants/theme.js
CHANGED
|
@@ -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, _5, _6;
|
|
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, _6, _7, _8, _9;
|
|
2
2
|
// Types
|
|
3
3
|
import { theme } from 'antd';
|
|
4
4
|
// Variables
|
|
@@ -177,11 +177,13 @@ THEME.components = {
|
|
|
177
177
|
borderRadiusSM: 5,
|
|
178
178
|
},
|
|
179
179
|
Tree: {
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
// Directory token
|
|
181
|
+
directoryNodeSelectedBg: (_w = THEME.token) === null || _w === void 0 ? void 0 : _w.blue1_1,
|
|
182
|
+
directoryNodeSelectedColor: (_x = THEME.token) === null || _x === void 0 ? void 0 : _x.colorText,
|
|
182
183
|
controlInteractiveSize: 18,
|
|
183
|
-
colorBorder: (
|
|
184
|
-
nodeHoverBg:
|
|
184
|
+
colorBorder: (_y = THEME.token) === null || _y === void 0 ? void 0 : _y.colorPrimary,
|
|
185
|
+
nodeHoverBg: (_z = THEME.token) === null || _z === void 0 ? void 0 : _z.blue,
|
|
186
|
+
nodeSelectedBg: (_0 = THEME.token) === null || _0 === void 0 ? void 0 : _0.blue1_1,
|
|
185
187
|
lineWidth: 2,
|
|
186
188
|
borderRadiusSM: 5,
|
|
187
189
|
// titleHeight: 12,
|
|
@@ -198,7 +200,7 @@ THEME.components = {
|
|
|
198
200
|
paddingMD: 0,
|
|
199
201
|
},
|
|
200
202
|
Tabs: {
|
|
201
|
-
itemColor: (
|
|
203
|
+
itemColor: (_1 = THEME.token) === null || _1 === void 0 ? void 0 : _1.bw8,
|
|
202
204
|
horizontalItemPadding: '17px 30px',
|
|
203
205
|
horizontalItemGutter: 0,
|
|
204
206
|
lineWidthBold: 3,
|
|
@@ -210,7 +212,7 @@ THEME.components = {
|
|
|
210
212
|
lineHeight: 1.143,
|
|
211
213
|
lineHeightLG: 1.143,
|
|
212
214
|
lineHeightSM: 1.143,
|
|
213
|
-
itemHoverColor: (
|
|
215
|
+
itemHoverColor: (_2 = THEME.token) === null || _2 === void 0 ? void 0 : _2.colorPrimary,
|
|
214
216
|
},
|
|
215
217
|
Collapse: {
|
|
216
218
|
headerBg: '#FFF',
|
|
@@ -218,13 +220,13 @@ THEME.components = {
|
|
|
218
220
|
headerPadding: '15px 10px',
|
|
219
221
|
},
|
|
220
222
|
Switch: {
|
|
221
|
-
colorTextQuaternary: (
|
|
222
|
-
colorTextTertiary: (
|
|
223
|
+
colorTextQuaternary: (_3 = THEME.token) === null || _3 === void 0 ? void 0 : _3.bw0,
|
|
224
|
+
colorTextTertiary: (_4 = THEME.token) === null || _4 === void 0 ? void 0 : _4.bw0,
|
|
223
225
|
handleSize: 8,
|
|
224
226
|
handleSizeSM: 7,
|
|
225
227
|
trackMinWidth: 27,
|
|
226
228
|
trackHeight: 16,
|
|
227
|
-
handleBg: (
|
|
229
|
+
handleBg: (_5 = THEME.token) === null || _5 === void 0 ? void 0 : _5.colorPrimary,
|
|
228
230
|
},
|
|
229
231
|
Popover: {
|
|
230
232
|
borderRadiusLG: 10,
|
|
@@ -236,11 +238,11 @@ THEME.components = {
|
|
|
236
238
|
paddingXXS: 8,
|
|
237
239
|
controlItemBgHover: '#F2F9FF',
|
|
238
240
|
controlItemBgActive: '#DEEFFE',
|
|
239
|
-
colorPrimary: (
|
|
241
|
+
colorPrimary: (_6 = THEME.token) === null || _6 === void 0 ? void 0 : _6.colorText,
|
|
240
242
|
controlItemBgActiveHover: '#DEEFFE',
|
|
241
243
|
},
|
|
242
244
|
Tooltip: {
|
|
243
|
-
colorBgSpotlight: (
|
|
245
|
+
colorBgSpotlight: (_7 = THEME.token) === null || _7 === void 0 ? void 0 : _7.bw8,
|
|
244
246
|
fontSize: 11,
|
|
245
247
|
},
|
|
246
248
|
Menu: {
|
|
@@ -250,8 +252,8 @@ THEME.components = {
|
|
|
250
252
|
itemMarginBlock: 5,
|
|
251
253
|
itemBorderRadius: 5,
|
|
252
254
|
subMenuItemBg: 'transparent',
|
|
253
|
-
itemDisabledColor: (
|
|
254
|
-
itemActiveBg: (
|
|
255
|
+
itemDisabledColor: (_8 = THEME.token) === null || _8 === void 0 ? void 0 : _8.colorTextDisabled,
|
|
256
|
+
itemActiveBg: (_9 = THEME.token) === null || _9 === void 0 ? void 0 : _9.blue1_1,
|
|
255
257
|
},
|
|
256
258
|
Form: {
|
|
257
259
|
itemMarginBottom: 15,
|
|
@@ -9,7 +9,7 @@ import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
|
9
9
|
import { far } from '@fortawesome/free-regular-svg-icons';
|
|
10
10
|
import { fab } from '@fortawesome/free-brands-svg-icons';
|
|
11
11
|
library.add(fas, far, fab);
|
|
12
|
-
const {
|
|
12
|
+
const { accent7, gray5, scrollBarSize, bw3, bw4, bw5 } = THEME.token || {};
|
|
13
13
|
export const GlobalStyle = () => {
|
|
14
14
|
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, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41;
|
|
15
15
|
return (React.createElement(Global, { styles: css `
|
|
@@ -245,15 +245,9 @@ export const GlobalStyle = () => {
|
|
|
245
245
|
&:focus {
|
|
246
246
|
background-color: ${(_o = THEME.token) === null || _o === void 0 ? void 0 : _o.bw0};
|
|
247
247
|
}
|
|
248
|
-
|
|
249
|
-
&::placeholder {
|
|
250
|
-
font-style: normal !important;
|
|
251
|
-
font-size: ${fontSize}px !important;
|
|
252
|
-
}
|
|
253
248
|
}
|
|
254
249
|
|
|
255
250
|
.antsomi-input-affix-wrapper {
|
|
256
|
-
overflow: hidden;
|
|
257
251
|
&:hover {
|
|
258
252
|
> input.antsomi-input {
|
|
259
253
|
background-color: ${(_p = THEME.token) === null || _p === void 0 ? void 0 : _p.blue};
|
|
@@ -399,15 +393,6 @@ export const GlobalStyle = () => {
|
|
|
399
393
|
.antsomi-picker {
|
|
400
394
|
border-width: 0 0 1px 0 !important;
|
|
401
395
|
box-shadow: none !important;
|
|
402
|
-
|
|
403
|
-
> .antsomi-picker-input {
|
|
404
|
-
input {
|
|
405
|
-
&::placeholder {
|
|
406
|
-
font-style: normal !important;
|
|
407
|
-
font-size: ${fontSize}px !important;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
396
|
}
|
|
412
397
|
|
|
413
398
|
.antsomi-picker:hover,
|
|
@@ -1072,6 +1057,14 @@ export const GlobalStyle = () => {
|
|
|
1072
1057
|
margin: 3px 0px;
|
|
1073
1058
|
}
|
|
1074
1059
|
}
|
|
1060
|
+
|
|
1061
|
+
> .antsomi-tree-list-scrollbar-vertical {
|
|
1062
|
+
width: ${scrollBarSize} !important;
|
|
1063
|
+
|
|
1064
|
+
> .antsomi-tree-list-scrollbar-thumb {
|
|
1065
|
+
background: ${accent7} !important;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1075
1068
|
}
|
|
1076
1069
|
|
|
1077
1070
|
/* Checkbox */
|
package/es/utils/common.d.ts
CHANGED
|
@@ -147,3 +147,14 @@ export declare function parseJSONFromLocalStorage<T = any>(key: string): T | nul
|
|
|
147
147
|
* @returns {T[]} - The sorted array with each object’s children arrays also sorted recursively.
|
|
148
148
|
*/
|
|
149
149
|
export declare const recursiveSortBy: <T = any>(arr: T[], childrenKey?: keyof T, sortByKeys?: (keyof T)[]) => T[];
|
|
150
|
+
/**
|
|
151
|
+
* Recursively finds all parent items of a given item in a list of objects.
|
|
152
|
+
*
|
|
153
|
+
* @template T - The type of the objects within the list.
|
|
154
|
+
* @param {T[]} list - The list of objects to search through.
|
|
155
|
+
* @param {T} item - The item to find the parents of.
|
|
156
|
+
* @param {keyof T} identifyKey - The key used to identify each object in the list.
|
|
157
|
+
* @param {keyof T} childrenKey - The key used to identify the children array in each object.
|
|
158
|
+
* @returns {T[]} - An array of parent objects that contain the specified item.
|
|
159
|
+
*/
|
|
160
|
+
export declare const recursiveFindParents: <T = any>(list: T[], item: T, identifyKey: keyof T, childrenKey: keyof T) => T[];
|
package/es/utils/common.js
CHANGED
|
@@ -620,3 +620,31 @@ export function parseJSONFromLocalStorage(key) {
|
|
|
620
620
|
export const recursiveSortBy = (arr, childrenKey = 'children', sortByKeys = []) => sortBy(arr, [...sortByKeys]).map(item => (Object.assign(Object.assign({}, item), (item[childrenKey] && {
|
|
621
621
|
[childrenKey]: recursiveSortBy(item[childrenKey], childrenKey, sortByKeys),
|
|
622
622
|
}))));
|
|
623
|
+
/**
|
|
624
|
+
* Recursively finds all parent items of a given item in a list of objects.
|
|
625
|
+
*
|
|
626
|
+
* @template T - The type of the objects within the list.
|
|
627
|
+
* @param {T[]} list - The list of objects to search through.
|
|
628
|
+
* @param {T} item - The item to find the parents of.
|
|
629
|
+
* @param {keyof T} identifyKey - The key used to identify each object in the list.
|
|
630
|
+
* @param {keyof T} childrenKey - The key used to identify the children array in each object.
|
|
631
|
+
* @returns {T[]} - An array of parent objects that contain the specified item.
|
|
632
|
+
*/
|
|
633
|
+
export const recursiveFindParents = (list, item, identifyKey, childrenKey) => {
|
|
634
|
+
const matchedParents = [];
|
|
635
|
+
list.forEach(child => {
|
|
636
|
+
if (child[identifyKey] === item[identifyKey]) {
|
|
637
|
+
// If the current child is the item we're searching for, add it to the matched parents array.
|
|
638
|
+
matchedParents.push(child);
|
|
639
|
+
}
|
|
640
|
+
else if (child[childrenKey] && Array.isArray(child[childrenKey])) {
|
|
641
|
+
// If the current child has children, recursively search through them for the item.
|
|
642
|
+
const matchingSubChildren = recursiveFindParents(child[childrenKey], item, identifyKey, childrenKey);
|
|
643
|
+
// If any matching sub-children were found, add the current child to the matched parents array.
|
|
644
|
+
if (matchingSubChildren.length > 0) {
|
|
645
|
+
matchedParents.push(Object.assign(Object.assign({}, child), { [childrenKey]: matchingSubChildren }));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
return matchedParents;
|
|
650
|
+
};
|
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.697",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"uniqid": "^5.4.0",
|
|
135
135
|
"use-context-selector": "^1.4.4",
|
|
136
136
|
"use-image": "^1.1.1",
|
|
137
|
-
"use-immer": "^0.
|
|
137
|
+
"use-immer": "^0.9.0",
|
|
138
138
|
"zustand": "^4.5.2"
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|