@antscorp/antsomi-ui 1.3.5-beta.285 → 1.3.5-beta.287
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/atoms/Icon/index.d.ts +2 -2
- package/es/components/atoms/Scrollbars/Scrollbars.d.ts +5 -0
- package/es/components/atoms/Scrollbars/Scrollbars.js +32 -0
- package/es/components/atoms/Scrollbars/index.d.ts +2 -0
- package/es/components/atoms/Scrollbars/index.js +1 -0
- package/es/components/atoms/Scrollbars/styled.d.ts +4 -0
- package/es/components/atoms/Scrollbars/styled.js +29 -0
- package/es/components/atoms/index.d.ts +1 -0
- package/es/components/atoms/index.js +1 -0
- package/es/components/molecules/EditableName/styled.js +1 -0
- package/es/components/organism/DataTable/DataTable.d.ts +3 -0
- package/es/components/organism/DataTable/DataTable.js +33 -0
- package/es/components/organism/DataTable/components/AddButton/index.d.ts +5 -0
- package/es/components/organism/DataTable/components/AddButton/index.js +33 -0
- package/es/components/organism/DataTable/components/Filter/AddFilterButton.d.ts +5 -0
- package/es/components/organism/DataTable/components/Filter/AddFilterButton.js +30 -0
- package/es/components/organism/DataTable/components/Filter/SavedFilterAndMetrics.d.ts +6 -0
- package/es/components/organism/DataTable/components/Filter/SavedFilterAndMetrics.js +111 -0
- package/es/components/organism/DataTable/components/Filter/index.d.ts +5 -0
- package/es/components/organism/DataTable/components/Filter/index.js +20 -0
- package/es/components/organism/DataTable/components/Filter/styled.d.ts +4 -0
- package/es/components/organism/DataTable/components/Filter/styled.js +26 -0
- package/es/components/organism/DataTable/components/ModifyColumn/index.d.ts +5 -0
- package/es/components/organism/DataTable/components/ModifyColumn/index.js +17 -0
- package/es/components/organism/DataTable/components/Pagination/index.d.ts +14 -0
- package/es/components/organism/DataTable/components/Pagination/index.js +59 -0
- package/es/components/organism/DataTable/components/Pagination/styled.d.ts +5 -0
- package/es/components/organism/DataTable/components/Pagination/styled.js +34 -0
- package/es/components/organism/DataTable/components/Table/ResizableCell.d.ts +11 -0
- package/es/components/organism/DataTable/components/Table/ResizableCell.js +29 -0
- package/es/components/organism/DataTable/components/Table/index.d.ts +6 -0
- package/es/components/organism/DataTable/components/Table/index.js +70 -0
- package/es/components/organism/DataTable/components/Table/styled.d.ts +11 -0
- package/es/components/organism/DataTable/components/Table/styled.js +67 -0
- package/es/components/organism/DataTable/components/Toolbar/index.d.ts +3 -0
- package/es/components/organism/DataTable/components/Toolbar/index.js +48 -0
- package/es/components/organism/DataTable/components/Toolbar/styled.d.ts +5 -0
- package/es/components/organism/DataTable/components/Toolbar/styled.js +28 -0
- package/es/components/organism/DataTable/components/ToolbarActionButton/index.d.ts +5 -0
- package/es/components/organism/DataTable/components/ToolbarActionButton/index.js +52 -0
- package/es/components/organism/DataTable/components/ToolbarActionButton/styled.d.ts +5 -0
- package/es/components/organism/DataTable/components/ToolbarActionButton/styled.js +26 -0
- package/es/components/organism/DataTable/components/index.d.ts +6 -0
- package/es/components/organism/DataTable/components/index.js +6 -0
- package/es/components/organism/DataTable/constants/common.d.ts +6 -0
- package/es/components/organism/DataTable/constants/common.js +7 -0
- package/es/components/organism/DataTable/constants/index.d.ts +7 -0
- package/es/components/organism/DataTable/constants/index.js +18 -0
- package/es/components/organism/DataTable/constants/pagination.d.ts +6 -0
- package/es/components/organism/DataTable/constants/pagination.js +6 -0
- package/es/components/organism/DataTable/constants/sample.d.ts +242 -0
- package/es/components/organism/DataTable/constants/sample.js +2332 -0
- package/es/components/organism/DataTable/constants/theme.d.ts +2 -0
- package/es/components/organism/DataTable/constants/theme.js +26 -0
- package/es/components/organism/DataTable/constants/toolbar.d.ts +14 -0
- package/es/components/organism/DataTable/constants/toolbar.js +52 -0
- package/es/components/organism/DataTable/contexts/DataTableContext.d.ts +5 -0
- package/es/components/organism/DataTable/contexts/DataTableContext.js +15 -0
- package/es/components/organism/DataTable/contexts/index.d.ts +0 -0
- package/es/components/organism/DataTable/contexts/index.js +1 -0
- package/es/components/organism/DataTable/hooks/index.d.ts +1 -0
- package/es/components/organism/DataTable/hooks/index.js +1 -0
- package/es/components/organism/DataTable/hooks/useDataTable.d.ts +5 -0
- package/es/components/organism/DataTable/hooks/useDataTable.js +40 -0
- package/es/components/organism/DataTable/index.d.ts +3 -0
- package/es/components/organism/DataTable/index.js +3 -0
- package/es/components/organism/DataTable/providers/AntdTableConfigProvider.d.ts +7 -0
- package/es/components/organism/DataTable/providers/AntdTableConfigProvider.js +21 -0
- package/es/components/organism/DataTable/providers/DataTableProvider.d.ts +8 -0
- package/es/components/organism/DataTable/providers/DataTableProvider.js +8 -0
- package/es/components/organism/DataTable/providers/index.d.ts +1 -0
- package/es/components/organism/DataTable/providers/index.js +1 -0
- package/es/components/organism/DataTable/stores/index.d.ts +2 -0
- package/es/components/organism/DataTable/stores/index.js +10 -0
- package/es/components/organism/DataTable/styled/index.d.ts +2 -0
- package/es/components/organism/DataTable/styled/index.js +32 -0
- package/es/components/organism/DataTable/types/filter.d.ts +22 -0
- package/es/components/organism/DataTable/types/filter.js +1 -0
- package/es/components/organism/DataTable/types/index.d.ts +38 -0
- package/es/components/organism/DataTable/types/index.js +3 -0
- package/es/components/organism/DataTable/types/theme.d.ts +9 -0
- package/es/components/organism/DataTable/types/theme.js +1 -0
- package/es/components/organism/DataTable/types/toolbar.d.ts +26 -0
- package/es/components/organism/DataTable/types/toolbar.js +1 -0
- package/es/components/organism/DataTable/utils/filter.d.ts +5 -0
- package/es/components/organism/DataTable/utils/filter.js +12 -0
- package/es/components/organism/DataTable/utils/index.d.ts +1 -0
- package/es/components/organism/DataTable/utils/index.js +1 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/constants/theme.js +27 -24
- package/es/locales/en/translation.json +12 -1
- package/es/locales/i18n.d.ts +26 -0
- package/es/locales/translations.d.ts +11 -0
- package/es/locales/vi/translation.json +15 -0
- package/es/providers/ConfigProvider/GlobalStyle.js +1 -1
- package/es/test.js +4 -0
- package/es/tests/DataTableTest.d.ts +5 -0
- package/es/tests/DataTableTest.js +83 -0
- package/es/tests/index.d.ts +1 -0
- package/es/tests/index.js +1 -0
- package/es/tests/styled.d.ts +1 -0
- package/es/tests/styled.js +4 -0
- package/package.json +5 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { IconProps as OriginIconProps } from '../../icons/type';
|
|
3
|
+
export interface IconProps extends OriginIconProps {
|
|
3
4
|
size?: number;
|
|
4
5
|
width?: number;
|
|
5
6
|
height?: number;
|
|
@@ -7,4 +8,3 @@ interface IconProps {
|
|
|
7
8
|
style?: React.CSSProperties;
|
|
8
9
|
}
|
|
9
10
|
export declare const Icon: import("styled-components").StyledComponent<any, any, IconProps, string | number | symbol>;
|
|
10
|
-
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import { Scrollbars as CustomScrollbars, } from 'react-custom-scrollbars';
|
|
13
|
+
// Libraries
|
|
14
|
+
import React from 'react';
|
|
15
|
+
// Styled
|
|
16
|
+
import { HorizontalTrack, ThumbBar, VerticalTrack } from './styled';
|
|
17
|
+
import { cloneDeep } from 'lodash';
|
|
18
|
+
const THUMB_SIZE = 4;
|
|
19
|
+
export const Scrollbars = props => {
|
|
20
|
+
const { autoHide = true, autoHeightMax = 0 } = props, restProps = __rest(props, ["autoHide", "autoHeightMax"]);
|
|
21
|
+
return (React.createElement(CustomScrollbars, Object.assign({ autoHide: autoHide, autoHeightMax: autoHeightMax, renderThumbVertical: props => React.createElement(ThumbBar, Object.assign({}, props)), renderThumbHorizontal: props => React.createElement(ThumbBar, Object.assign({}, props)), renderTrackVertical: props => React.createElement(VerticalTrack, Object.assign({}, props)), renderTrackHorizontal: props => React.createElement(HorizontalTrack, Object.assign({}, props)), renderView: props => {
|
|
22
|
+
const { style } = props || {};
|
|
23
|
+
const newStyle = cloneDeep(style);
|
|
24
|
+
newStyle.marginBottom = -THUMB_SIZE;
|
|
25
|
+
newStyle.marginRight = -THUMB_SIZE;
|
|
26
|
+
newStyle.minHeight = THUMB_SIZE;
|
|
27
|
+
if (autoHeightMax) {
|
|
28
|
+
newStyle.maxHeight = parseInt(`${autoHeightMax}`) + THUMB_SIZE;
|
|
29
|
+
}
|
|
30
|
+
return React.createElement("div", Object.assign({ className: "scrollbar-view" }, props, { style: newStyle }));
|
|
31
|
+
}, hideTracksWhenNotNeeded: true }, restProps)));
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Scrollbars } from './Scrollbars';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const ScrollbarsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const ThumbBar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const VerticalTrack: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const HorizontalTrack: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
// Constants
|
|
4
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
5
|
+
export const ScrollbarsWrapper = styled.div ``;
|
|
6
|
+
export const ThumbBar = styled.div `
|
|
7
|
+
background: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.gray5};
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
`;
|
|
10
|
+
export const VerticalTrack = styled.div `
|
|
11
|
+
position: absolute;
|
|
12
|
+
width: 4px !important;
|
|
13
|
+
transition: opacity 200ms ease 0s;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
right: 2px;
|
|
16
|
+
bottom: 2px;
|
|
17
|
+
top: 2px;
|
|
18
|
+
border-radius: 4px;
|
|
19
|
+
`;
|
|
20
|
+
export const HorizontalTrack = styled.div `
|
|
21
|
+
position: absolute;
|
|
22
|
+
height: 4px !important;
|
|
23
|
+
transition: opacity 200ms ease 0s;
|
|
24
|
+
opacity: 0;
|
|
25
|
+
right: 2px;
|
|
26
|
+
bottom: 2px;
|
|
27
|
+
left: 2px;
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
`;
|
|
@@ -40,6 +40,7 @@ export * from './MobileFrame';
|
|
|
40
40
|
export * from './MobileFrameV2';
|
|
41
41
|
export * from './SlideBar';
|
|
42
42
|
export * from './ReactIframe';
|
|
43
|
+
export * from './Scrollbars';
|
|
43
44
|
export type { SliderProps } from './Slider';
|
|
44
45
|
export type { PaginationProps } from './Pagination';
|
|
45
46
|
export type { InputDynamicProps } from './InputDynamic';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable react/function-component-definition */
|
|
2
|
+
// Libraries
|
|
3
|
+
import React, { useRef } from 'react';
|
|
4
|
+
// Hooks
|
|
5
|
+
import { useDataTable } from './hooks';
|
|
6
|
+
// Styled
|
|
7
|
+
import { DataTableWrapper } from './styled';
|
|
8
|
+
// Components
|
|
9
|
+
import { Table, Pagination, Toolbar } from './components';
|
|
10
|
+
// Providers
|
|
11
|
+
import { DataTableProvider } from './providers/DataTableProvider';
|
|
12
|
+
import { AntdTableConfigProvider } from './providers';
|
|
13
|
+
// Store
|
|
14
|
+
import { createDataTableStore } from './stores';
|
|
15
|
+
function DataTableComponent(props) {
|
|
16
|
+
// Hooks
|
|
17
|
+
const { pagination, setPagination } = useDataTable(props);
|
|
18
|
+
return (React.createElement(DataTableWrapper, null,
|
|
19
|
+
React.createElement(Toolbar, null),
|
|
20
|
+
React.createElement(Table, null),
|
|
21
|
+
React.createElement(Pagination, { id: "data-table-pagination", page: pagination.page, pageSize: pagination.pageSize, onChange: setPagination })));
|
|
22
|
+
}
|
|
23
|
+
export function DataTable(props) {
|
|
24
|
+
const storeRef = useRef();
|
|
25
|
+
if (!storeRef.current) {
|
|
26
|
+
storeRef.current = createDataTableStore(props);
|
|
27
|
+
}
|
|
28
|
+
if (!storeRef.current)
|
|
29
|
+
return null;
|
|
30
|
+
return (React.createElement(AntdTableConfigProvider, null,
|
|
31
|
+
React.createElement(DataTableProvider, { store: storeRef.current },
|
|
32
|
+
React.createElement(DataTableComponent, Object.assign({}, props)))));
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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, { memo } from 'react';
|
|
14
|
+
import styled from 'styled-components';
|
|
15
|
+
// Components
|
|
16
|
+
import { Flex, Icon } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
17
|
+
// Providers
|
|
18
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
19
|
+
const StyledAddButton = styled(Flex) `
|
|
20
|
+
border-radius: 100%;
|
|
21
|
+
width: 30px;
|
|
22
|
+
height: 30px;
|
|
23
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorPrimary};
|
|
24
|
+
color: #fff;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
`;
|
|
27
|
+
export const AddButton = memo(props => {
|
|
28
|
+
const { show } = props, restProps = __rest(props, ["show"]);
|
|
29
|
+
if (!show)
|
|
30
|
+
return null;
|
|
31
|
+
return (React.createElement(StyledAddButton, Object.assign({ align: "center", justify: "center" }, restProps),
|
|
32
|
+
React.createElement(Icon, { type: "icon-ants-plus-square", size: 14 })));
|
|
33
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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, { memo } from 'react';
|
|
14
|
+
// Components
|
|
15
|
+
import { Flex, Icon, Button } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
16
|
+
// Locales
|
|
17
|
+
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
18
|
+
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
19
|
+
// Styled
|
|
20
|
+
import { FilterButton } from './styled';
|
|
21
|
+
import { SavedFilterAndMetrics } from './SavedFilterAndMetrics';
|
|
22
|
+
export const AddFilterButton = memo(props => {
|
|
23
|
+
const restProps = __rest(props, []);
|
|
24
|
+
const { t } = i18nInstance;
|
|
25
|
+
return (React.createElement(Flex, { align: "center", gap: 7 },
|
|
26
|
+
React.createElement(FilterButton, null,
|
|
27
|
+
React.createElement(Icon, { type: "icon-ants-filter-slim", size: 18 })),
|
|
28
|
+
React.createElement(SavedFilterAndMetrics, null,
|
|
29
|
+
React.createElement(Button, { type: "text" }, t(translations.filter.addFilter).toString()))));
|
|
30
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
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, { useMemo } from 'react';
|
|
14
|
+
import { Scrollbars } from 'react-custom-scrollbars';
|
|
15
|
+
// Components
|
|
16
|
+
import { Input, Popover, Icon, Divider, Flex } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
17
|
+
import { Menu } from '@antscorp/antsomi-ui/es/components/organism';
|
|
18
|
+
// Styled
|
|
19
|
+
import { FilterSelectFieldsContent } from './styled';
|
|
20
|
+
import { IconButton } from '../../styled';
|
|
21
|
+
// Constants
|
|
22
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
23
|
+
// Context
|
|
24
|
+
import { useDataTableContext } from '../../contexts/DataTableContext';
|
|
25
|
+
import { serializeFilterMetricsToMenuItems } from '../../utils';
|
|
26
|
+
import styled from 'styled-components';
|
|
27
|
+
const ScrollWrapper = styled.div `
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
`;
|
|
30
|
+
const TestWrapper = styled.div `
|
|
31
|
+
/* Container styling */
|
|
32
|
+
&.container {
|
|
33
|
+
position: relative;
|
|
34
|
+
height: 400px;
|
|
35
|
+
width: 80%;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Scrollable content styling */
|
|
40
|
+
.scrollable-content {
|
|
41
|
+
height: 100%;
|
|
42
|
+
width: 100%;
|
|
43
|
+
overflow-y: scroll;
|
|
44
|
+
padding-right: 20px; /* Add some space for the custom scrollbar */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Styling the scrollbar for Webkit browsers */
|
|
48
|
+
.scrollable-content::-webkit-scrollbar {
|
|
49
|
+
width: 16px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.scrollable-content::-webkit-scrollbar-track {
|
|
53
|
+
background: #bd4b4b;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.scrollable-content::-webkit-scrollbar-thumb {
|
|
57
|
+
background: #888;
|
|
58
|
+
border-radius: 8px;
|
|
59
|
+
border: 4px solid transparent; /* Creates space around the thumb */
|
|
60
|
+
background-clip: content-box; /* Prevents thumb from extending into the border */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.scrollable-content::-webkit-scrollbar-thumb:hover {
|
|
64
|
+
background: #555;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Ensure scrollbar appears over other elements */
|
|
68
|
+
.scrollable-content::-webkit-scrollbar {
|
|
69
|
+
z-index: 10;
|
|
70
|
+
position: relative;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Styling for other browsers (standard) */
|
|
74
|
+
.scrollable-content {
|
|
75
|
+
scrollbar-color: #888 #f1f1f1; /* thumb and track colors */
|
|
76
|
+
scrollbar-width: thin; /* thin scrollbar */
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Example item styling */
|
|
80
|
+
.item {
|
|
81
|
+
padding: 10px;
|
|
82
|
+
border-bottom: 1px solid #ddd;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
export const SavedFilterAndMetrics = props => {
|
|
86
|
+
const { children } = props, restProps = __rest(props, ["children"]);
|
|
87
|
+
const savedFilter = useDataTableContext(store => store.filter.savedFilter);
|
|
88
|
+
const filterMetrics = useDataTableContext(store => store.filter.filterMetrics);
|
|
89
|
+
// Variables
|
|
90
|
+
const { list, selected } = savedFilter || {};
|
|
91
|
+
// Memos
|
|
92
|
+
const filterMetricItems = useMemo(() => serializeFilterMetricsToMenuItems(filterMetrics || []), [filterMetrics]);
|
|
93
|
+
console.log({ filterMetricItems });
|
|
94
|
+
// Handlers
|
|
95
|
+
const renderSavedFilter = () => (React.createElement(Menu, { selectedKeys: [(selected === null || selected === void 0 ? void 0 : selected.toString()) || ''], items: list === null || list === void 0 ? void 0 : list.map(({ id, name, removable }) => ({
|
|
96
|
+
key: id,
|
|
97
|
+
label: (React.createElement(Flex, { align: "center", justify: "space-between" },
|
|
98
|
+
name,
|
|
99
|
+
!!removable && (React.createElement(IconButton, null,
|
|
100
|
+
React.createElement(Icon, { type: "icon-ants-outline-delete" }))))),
|
|
101
|
+
})) }));
|
|
102
|
+
const renderFilterMetrics = () => React.createElement(Menu, { mode: "inline", items: filterMetricItems });
|
|
103
|
+
const content = (React.createElement(FilterSelectFieldsContent, null,
|
|
104
|
+
React.createElement(Input, { bordered: false, className: "search-input", autoFocus: true, suffix: React.createElement(Icon, { type: "icon-ants-search-2", size: 24 }) }),
|
|
105
|
+
React.createElement(Divider, { style: { borderColor: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw3, margin: '8px 0 2px 0' } }),
|
|
106
|
+
React.createElement(Scrollbars, { autoHeight: true, autoHeightMax: 300, autoHide: true },
|
|
107
|
+
renderSavedFilter(),
|
|
108
|
+
React.createElement(Divider, { style: { borderColor: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw3, margin: '8px 0 2px 0' } }),
|
|
109
|
+
renderFilterMetrics())));
|
|
110
|
+
return (React.createElement(Popover, Object.assign({ content: content, trigger: ['click'], overlayInnerStyle: { width: 300, padding: 0 }, arrow: false, placement: "bottomLeft" }, restProps), children));
|
|
111
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 from 'react';
|
|
14
|
+
import { FilterWrapper } from './styled';
|
|
15
|
+
import { AddFilterButton } from './AddFilterButton';
|
|
16
|
+
export const Filter = props => {
|
|
17
|
+
const restProps = __rest(props, []);
|
|
18
|
+
return (React.createElement(FilterWrapper, { align: "center" },
|
|
19
|
+
React.createElement(AddFilterButton, null)));
|
|
20
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const FilterWrapper: 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>;
|
|
3
|
+
export declare const FilterButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const FilterSelectFieldsContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
// Componets
|
|
4
|
+
import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
5
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
6
|
+
export const FilterWrapper = styled(Flex) ``;
|
|
7
|
+
export const FilterButton = styled.div `
|
|
8
|
+
width: 24px;
|
|
9
|
+
height: 24px;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
`;
|
|
14
|
+
/* Filter Item */
|
|
15
|
+
export const FilterSelectFieldsContent = styled.div `
|
|
16
|
+
.search-input {
|
|
17
|
+
margin-top: 8px;
|
|
18
|
+
input {
|
|
19
|
+
background-color: #fff !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
i {
|
|
23
|
+
color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 from 'react';
|
|
14
|
+
export const ModifyColumn = props => {
|
|
15
|
+
const restProps = __rest(props, []);
|
|
16
|
+
return React.createElement("div", null, "ModifyColumn");
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlexProps } from 'antd/lib';
|
|
3
|
+
type TChangePageSizePayload = {
|
|
4
|
+
pageSize: number;
|
|
5
|
+
page: number;
|
|
6
|
+
};
|
|
7
|
+
interface PaginationProps extends Omit<FlexProps, 'children' | 'onChange'> {
|
|
8
|
+
page?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
total?: number;
|
|
11
|
+
onChange?: (payload: TChangePageSizePayload) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const Pagination: React.FC<PaginationProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
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, { useMemo } from 'react';
|
|
14
|
+
// Components
|
|
15
|
+
import { Select } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
16
|
+
import { Flex, Icon, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
17
|
+
// Instance
|
|
18
|
+
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
19
|
+
// Locales
|
|
20
|
+
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
21
|
+
// Styled
|
|
22
|
+
import { ActionButton, PaginationWrapper } from './styled';
|
|
23
|
+
// Constants
|
|
24
|
+
import { DEFAULT_PAGE, DEFAULT_PAGE_SIZE, PAGE_SIZE_OPTIONS } from '../../constants';
|
|
25
|
+
const { Text } = Typography;
|
|
26
|
+
export const Pagination = props => {
|
|
27
|
+
// Props
|
|
28
|
+
const { pageSize = DEFAULT_PAGE_SIZE, page = DEFAULT_PAGE, total = 70, onChange } = props, restProps = __rest(props, ["pageSize", "page", "total", "onChange"]);
|
|
29
|
+
// Instance
|
|
30
|
+
const { t } = i18nInstance;
|
|
31
|
+
// Memo
|
|
32
|
+
const paginationSizeOptions = useMemo(() => PAGE_SIZE_OPTIONS.map(pageSize => ({ label: pageSize.toString(), value: pageSize })), []);
|
|
33
|
+
// Variables
|
|
34
|
+
const disabledNext = page * pageSize >= total;
|
|
35
|
+
const disabledPrevious = page === 1;
|
|
36
|
+
// Handlers
|
|
37
|
+
const onChangePagination = (payload) => {
|
|
38
|
+
if (onChange) {
|
|
39
|
+
onChange(Object.assign({ page,
|
|
40
|
+
pageSize }, payload));
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (React.createElement(PaginationWrapper, Object.assign({ align: "center", gap: 10 }, restProps),
|
|
44
|
+
React.createElement(Flex, { align: "center", gap: 10 },
|
|
45
|
+
React.createElement(Text, null,
|
|
46
|
+
t(translations.pagination.showRow).toString(),
|
|
47
|
+
":"),
|
|
48
|
+
React.createElement(Select, { defaultValue: DEFAULT_PAGE_SIZE, value: pageSize, className: "show-row-select", options: paginationSizeOptions, popupMatchSelectWidth: 70, onChange: value => onChangePagination({ pageSize: value, page: 1 }) })),
|
|
49
|
+
React.createElement(Text, null, `${page * pageSize - pageSize + 1} - ${Math.min(page * pageSize, total)} of ${total}`),
|
|
50
|
+
React.createElement(Flex, { align: "center", gap: 10 },
|
|
51
|
+
React.createElement(ActionButton, { onClick: () => onChangePagination({ page: 1 }), disabled: disabledPrevious },
|
|
52
|
+
React.createElement(Icon, { type: "icon-ants-first-page", size: 12 })),
|
|
53
|
+
React.createElement(ActionButton, { disabled: disabledPrevious, onClick: () => onChangePagination({ page: page - 1 }) },
|
|
54
|
+
React.createElement(Icon, { type: "icon-ants-angle-left", size: 12 })),
|
|
55
|
+
React.createElement(ActionButton, { disabled: disabledNext, onClick: () => onChangePagination({ page: page + 1 }) },
|
|
56
|
+
React.createElement(Icon, { type: "icon-ants-angle-right", size: 12 })),
|
|
57
|
+
React.createElement(ActionButton, { onClick: () => onChangePagination({ page: Math.ceil(total / pageSize) }), disabled: disabledNext },
|
|
58
|
+
React.createElement(Icon, { type: "icon-ants-last-page", size: 12 })))));
|
|
59
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PaginationWrapper: 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>;
|
|
3
|
+
export declare const ActionButton: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
disabled?: boolean | undefined;
|
|
5
|
+
}, never>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
// Components
|
|
4
|
+
import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
5
|
+
// Constants
|
|
6
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
7
|
+
export const PaginationWrapper = styled(Flex) `
|
|
8
|
+
height: 60px;
|
|
9
|
+
|
|
10
|
+
.show-row-select {
|
|
11
|
+
width: 50px;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
export const ActionButton = styled.div `
|
|
15
|
+
height: 24px;
|
|
16
|
+
width: 24px;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8};
|
|
21
|
+
transition: all 0.3s;
|
|
22
|
+
|
|
23
|
+
${props => props.disabled &&
|
|
24
|
+
css `
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw5};
|
|
27
|
+
`}
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorText};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ResizeCallbackData } from 'react-resizable';
|
|
3
|
+
interface HandleProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
}
|
|
5
|
+
interface ResizableCellProps extends Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'onResize'> {
|
|
6
|
+
onResize?: (e: React.SyntheticEvent<Element, Event>, data: ResizeCallbackData) => void;
|
|
7
|
+
width?: number;
|
|
8
|
+
handleProps?: HandleProps;
|
|
9
|
+
}
|
|
10
|
+
export declare const ResizableCell: React.FC<ResizableCellProps>;
|
|
11
|
+
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 from 'react';
|
|
14
|
+
import { Resizable } from 'react-resizable';
|
|
15
|
+
export const ResizableCell = props => {
|
|
16
|
+
var _a;
|
|
17
|
+
const { width, onResize, handleProps } = props, restProps = __rest(props, ["width", "onResize", "handleProps"]);
|
|
18
|
+
const isRowSelectionCol = (_a = props === null || props === void 0 ? void 0 : props.className) === null || _a === void 0 ? void 0 : _a.includes('antsomi-table-selection-column');
|
|
19
|
+
if (isRowSelectionCol || !width) {
|
|
20
|
+
return React.createElement("th", Object.assign({}, restProps));
|
|
21
|
+
}
|
|
22
|
+
return (React.createElement(Resizable, { width: width || 0, height: 0, handle: React.createElement("div", { className: "resizable-handle-wrapper", onClick: e => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
} },
|
|
25
|
+
React.createElement("span", Object.assign({
|
|
26
|
+
/* react-resizable-handle */
|
|
27
|
+
className: "resizable-handle" }, handleProps))), onResize: (...args) => onResize && onResize(...args), draggableOpts: { enableUserSelectHack: false } },
|
|
28
|
+
React.createElement("th", Object.assign({}, restProps))));
|
|
29
|
+
};
|