@antscorp/antsomi-ui 1.3.5-beta.284 → 1.3.5-beta.286

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/es/components/atoms/Icon/index.d.ts +2 -2
  2. package/es/components/atoms/Scrollbars/Scrollbars.d.ts +5 -0
  3. package/es/components/atoms/Scrollbars/Scrollbars.js +31 -0
  4. package/es/components/atoms/Scrollbars/index.d.ts +2 -0
  5. package/es/components/atoms/Scrollbars/index.js +1 -0
  6. package/es/components/atoms/Scrollbars/styled.d.ts +4 -0
  7. package/es/components/atoms/Scrollbars/styled.js +29 -0
  8. package/es/components/atoms/index.d.ts +1 -0
  9. package/es/components/atoms/index.js +1 -0
  10. package/es/components/molecules/DrawerDetail/DrawerDetail.js +32 -7
  11. package/es/components/molecules/DrawerDetail/constants.d.ts +2 -1
  12. package/es/components/molecules/DrawerDetail/constants.js +2 -1
  13. package/es/components/molecules/DrawerDetail/styled.d.ts +2 -0
  14. package/es/components/molecules/DrawerDetail/styled.js +17 -2
  15. package/es/components/molecules/DrawerDetail/types.d.ts +8 -2
  16. package/es/components/molecules/EditableName/styled.js +1 -0
  17. package/es/components/organism/DataTable/DataTable.d.ts +3 -0
  18. package/es/components/organism/DataTable/DataTable.js +33 -0
  19. package/es/components/organism/DataTable/components/AddButton/index.d.ts +5 -0
  20. package/es/components/organism/DataTable/components/AddButton/index.js +33 -0
  21. package/es/components/organism/DataTable/components/Filter/AddFilterButton.d.ts +5 -0
  22. package/es/components/organism/DataTable/components/Filter/AddFilterButton.js +30 -0
  23. package/es/components/organism/DataTable/components/Filter/SavedFilterAndMetrics.d.ts +6 -0
  24. package/es/components/organism/DataTable/components/Filter/SavedFilterAndMetrics.js +111 -0
  25. package/es/components/organism/DataTable/components/Filter/index.d.ts +5 -0
  26. package/es/components/organism/DataTable/components/Filter/index.js +20 -0
  27. package/es/components/organism/DataTable/components/Filter/styled.d.ts +4 -0
  28. package/es/components/organism/DataTable/components/Filter/styled.js +26 -0
  29. package/es/components/organism/DataTable/components/ModifyColumn/index.d.ts +5 -0
  30. package/es/components/organism/DataTable/components/ModifyColumn/index.js +17 -0
  31. package/es/components/organism/DataTable/components/Pagination/index.d.ts +14 -0
  32. package/es/components/organism/DataTable/components/Pagination/index.js +59 -0
  33. package/es/components/organism/DataTable/components/Pagination/styled.d.ts +5 -0
  34. package/es/components/organism/DataTable/components/Pagination/styled.js +34 -0
  35. package/es/components/organism/DataTable/components/Table/ResizableCell.d.ts +11 -0
  36. package/es/components/organism/DataTable/components/Table/ResizableCell.js +29 -0
  37. package/es/components/organism/DataTable/components/Table/index.d.ts +6 -0
  38. package/es/components/organism/DataTable/components/Table/index.js +70 -0
  39. package/es/components/organism/DataTable/components/Table/styled.d.ts +11 -0
  40. package/es/components/organism/DataTable/components/Table/styled.js +67 -0
  41. package/es/components/organism/DataTable/components/Toolbar/index.d.ts +3 -0
  42. package/es/components/organism/DataTable/components/Toolbar/index.js +48 -0
  43. package/es/components/organism/DataTable/components/Toolbar/styled.d.ts +5 -0
  44. package/es/components/organism/DataTable/components/Toolbar/styled.js +28 -0
  45. package/es/components/organism/DataTable/components/ToolbarActionButton/index.d.ts +5 -0
  46. package/es/components/organism/DataTable/components/ToolbarActionButton/index.js +52 -0
  47. package/es/components/organism/DataTable/components/ToolbarActionButton/styled.d.ts +5 -0
  48. package/es/components/organism/DataTable/components/ToolbarActionButton/styled.js +26 -0
  49. package/es/components/organism/DataTable/components/index.d.ts +6 -0
  50. package/es/components/organism/DataTable/components/index.js +6 -0
  51. package/es/components/organism/DataTable/constants/common.d.ts +6 -0
  52. package/es/components/organism/DataTable/constants/common.js +7 -0
  53. package/es/components/organism/DataTable/constants/index.d.ts +7 -0
  54. package/es/components/organism/DataTable/constants/index.js +18 -0
  55. package/es/components/organism/DataTable/constants/pagination.d.ts +6 -0
  56. package/es/components/organism/DataTable/constants/pagination.js +6 -0
  57. package/es/components/organism/DataTable/constants/sample.d.ts +242 -0
  58. package/es/components/organism/DataTable/constants/sample.js +2332 -0
  59. package/es/components/organism/DataTable/constants/theme.d.ts +2 -0
  60. package/es/components/organism/DataTable/constants/theme.js +26 -0
  61. package/es/components/organism/DataTable/constants/toolbar.d.ts +14 -0
  62. package/es/components/organism/DataTable/constants/toolbar.js +52 -0
  63. package/es/components/organism/DataTable/contexts/DataTableContext.d.ts +5 -0
  64. package/es/components/organism/DataTable/contexts/DataTableContext.js +15 -0
  65. package/es/components/organism/DataTable/contexts/index.d.ts +0 -0
  66. package/es/components/organism/DataTable/contexts/index.js +1 -0
  67. package/es/components/organism/DataTable/hooks/index.d.ts +1 -0
  68. package/es/components/organism/DataTable/hooks/index.js +1 -0
  69. package/es/components/organism/DataTable/hooks/useDataTable.d.ts +5 -0
  70. package/es/components/organism/DataTable/hooks/useDataTable.js +40 -0
  71. package/es/components/organism/DataTable/index.d.ts +3 -0
  72. package/es/components/organism/DataTable/index.js +3 -0
  73. package/es/components/organism/DataTable/providers/AntdTableConfigProvider.d.ts +7 -0
  74. package/es/components/organism/DataTable/providers/AntdTableConfigProvider.js +21 -0
  75. package/es/components/organism/DataTable/providers/DataTableProvider.d.ts +8 -0
  76. package/es/components/organism/DataTable/providers/DataTableProvider.js +8 -0
  77. package/es/components/organism/DataTable/providers/index.d.ts +1 -0
  78. package/es/components/organism/DataTable/providers/index.js +1 -0
  79. package/es/components/organism/DataTable/stores/index.d.ts +2 -0
  80. package/es/components/organism/DataTable/stores/index.js +10 -0
  81. package/es/components/organism/DataTable/styled/index.d.ts +2 -0
  82. package/es/components/organism/DataTable/styled/index.js +32 -0
  83. package/es/components/organism/DataTable/types/filter.d.ts +22 -0
  84. package/es/components/organism/DataTable/types/filter.js +1 -0
  85. package/es/components/organism/DataTable/types/index.d.ts +38 -0
  86. package/es/components/organism/DataTable/types/index.js +3 -0
  87. package/es/components/organism/DataTable/types/theme.d.ts +9 -0
  88. package/es/components/organism/DataTable/types/theme.js +1 -0
  89. package/es/components/organism/DataTable/types/toolbar.d.ts +26 -0
  90. package/es/components/organism/DataTable/types/toolbar.js +1 -0
  91. package/es/components/organism/DataTable/utils/filter.d.ts +5 -0
  92. package/es/components/organism/DataTable/utils/filter.js +12 -0
  93. package/es/components/organism/DataTable/utils/index.d.ts +1 -0
  94. package/es/components/organism/DataTable/utils/index.js +1 -0
  95. package/es/components/organism/index.d.ts +1 -0
  96. package/es/components/organism/index.js +1 -0
  97. package/es/constants/theme.js +27 -23
  98. package/es/locales/en/translation.json +12 -1
  99. package/es/locales/i18n.d.ts +26 -0
  100. package/es/locales/translations.d.ts +11 -0
  101. package/es/locales/vi/translation.json +15 -0
  102. package/es/providers/ConfigProvider/GlobalStyle.js +1 -1
  103. package/es/test.js +4 -0
  104. package/es/tests/DataTableTest.d.ts +5 -0
  105. package/es/tests/DataTableTest.js +83 -0
  106. package/es/tests/index.d.ts +1 -0
  107. package/es/tests/index.js +1 -0
  108. package/es/tests/styled.d.ts +1 -0
  109. package/es/tests/styled.js +4 -0
  110. package/es/utils/common.d.ts +1 -0
  111. package/es/utils/common.js +10 -0
  112. package/package.json +5 -2
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- interface IconProps {
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,5 @@
1
+ import { ScrollbarProps as CustomScrollbarProps } from 'react-custom-scrollbars';
2
+ import React from 'react';
3
+ export interface ScrollbarsProps extends CustomScrollbarProps {
4
+ }
5
+ export declare const Scrollbars: React.FC<ScrollbarsProps>;
@@ -0,0 +1,31 @@
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, ScrollbarsWrapper, ThumbBar, VerticalTrack } from './styled';
17
+ import { cloneDeep } from 'lodash';
18
+ const THUMB_SIZE = 4;
19
+ export const Scrollbars = props => {
20
+ const { autoHide = true, autoHeight = true, autoHeightMax = 500 } = props, restProps = __rest(props, ["autoHide", "autoHeight", "autoHeightMax"]);
21
+ return (React.createElement(ScrollbarsWrapper, null,
22
+ React.createElement(CustomScrollbars, Object.assign({ autoHide: autoHide, autoHeight: autoHeight, 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 => {
23
+ const { style } = props || {};
24
+ const newStyle = cloneDeep(style);
25
+ newStyle.marginBottom = -THUMB_SIZE;
26
+ newStyle.marginRight = -THUMB_SIZE;
27
+ newStyle.minHeight = THUMB_SIZE;
28
+ newStyle.maxHeight = parseInt(`${autoHeightMax}`) + THUMB_SIZE;
29
+ return React.createElement("div", Object.assign({ className: "scrollbar-view" }, props, { style: newStyle }));
30
+ }, hideTracksWhenNotNeeded: true }, restProps))));
31
+ };
@@ -0,0 +1,2 @@
1
+ export { Scrollbars } from './Scrollbars';
2
+ export type { ScrollbarsProps } from './Scrollbars';
@@ -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';
@@ -40,3 +40,4 @@ export * from './MobileFrame';
40
40
  export * from './MobileFrameV2';
41
41
  export * from './SlideBar';
42
42
  export * from './ReactIframe';
43
+ export * from './Scrollbars';
@@ -10,23 +10,27 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  // Libraries
13
+ import { ConfigProvider } from 'antd';
14
+ import { isNil } from 'lodash';
13
15
  import React, { useEffect, useMemo } from 'react';
14
16
  // Components
15
17
  import { Flex, Icon, Tooltip } from '../../atoms';
16
18
  // Styled
17
- import { CloseBtn, Content, LeftMenu, MenuFooter, MenuItem, StyledDrawer } from './styled';
19
+ import { CloseBtn, Content, DrawerHeader, LeftMenu, MenuFooter, MenuItem, StyledDrawer, } from './styled';
18
20
  // Constants
19
- import { BREAK_POINT, DRAWER_LARGE_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, } from './constants';
21
+ import { BREAK_POINT, DRAWER_DETAIL_LOCAL_STORAGE_KEY, DRAWER_LARGE_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, } from './constants';
20
22
  import { ToggleDrawerSizeButton } from './components';
21
23
  // Hooks
22
24
  import { useMediaQuery, useToggle } from '@antscorp/antsomi-ui/es/hooks';
23
- import { ConfigProvider } from 'antd';
25
+ // Utils
26
+ import { safeParseJson } from '@antscorp/antsomi-ui/es/utils';
24
27
  export const DrawerDetail = props => {
25
28
  // Props
26
- const { width, fullScreen, children, menuProps, closeIconProps, maxWidth, minWidth, defaultSize = 'max' } = props, restProps = __rest(props, ["width", "fullScreen", "children", "menuProps", "closeIconProps", "maxWidth", "minWidth", "defaultSize"]);
29
+ const { width, fullScreen, children, menuProps, closeIconProps, maxWidth, minWidth, defaultSize = 'max', headerProps, name } = props, restProps = __rest(props, ["width", "fullScreen", "children", "menuProps", "closeIconProps", "maxWidth", "minWidth", "defaultSize", "headerProps", "name"]);
27
30
  const { show: showMenu = true, showExpandButton = true, showClose = true, items, selectedKeys, footer, onClick = () => { }, } = menuProps || {};
31
+ const _a = headerProps || {}, { children: headerChildren } = _a, restOfHeaderProps = __rest(_a, ["children"]);
28
32
  const { onClose = () => { } } = props;
29
- const _a = closeIconProps || {}, { show: showCloseIcon, onClick: onCloseIconClick = () => { } } = _a, restOfCloseIcon = __rest(_a, ["show", "onClick"]);
33
+ const _b = closeIconProps || {}, { show: showCloseIcon, onClick: onCloseIconClick = () => { } } = _b, restOfCloseIcon = __rest(_b, ["show", "onClick"]);
30
34
  // Hooks
31
35
  const matchesSmallScreen = useMediaQuery(`(max-width: ${BREAK_POINT})`);
32
36
  // State
@@ -46,6 +50,14 @@ export const DrawerDetail = props => {
46
50
  break;
47
51
  }
48
52
  }, [matchesSmallScreen, defaultSize, toggleCollapseDrawer]);
53
+ // Get cache collapse from local storage
54
+ useEffect(() => {
55
+ const localStorageValues = safeParseJson(localStorage.getItem(DRAWER_DETAIL_LOCAL_STORAGE_KEY), {});
56
+ const cachedCollapse = localStorageValues[name || ''];
57
+ if (!isNil(cachedCollapse)) {
58
+ toggleCollapseDrawer(cachedCollapse);
59
+ }
60
+ }, [name, toggleCollapseDrawer]);
49
61
  // Memo
50
62
  const drawerWidth = useMemo(() => {
51
63
  if (fullScreen)
@@ -75,6 +87,17 @@ export const DrawerDetail = props => {
75
87
  }
76
88
  }
77
89
  }, [collapseDrawer, fullScreen, matchesSmallScreen, maxWidth, minWidth, width]);
90
+ // Handlers
91
+ const handleToggleDrawerSize = () => {
92
+ const localStorageValues = safeParseJson(localStorage.getItem(DRAWER_DETAIL_LOCAL_STORAGE_KEY), {});
93
+ toggleCollapseDrawer(!collapseDrawer);
94
+ /**
95
+ * Set local storage last collapsed
96
+ */
97
+ if (name) {
98
+ localStorage.setItem(DRAWER_DETAIL_LOCAL_STORAGE_KEY, JSON.stringify(Object.assign(Object.assign({}, localStorageValues), { [name || '']: !collapseDrawer })));
99
+ }
100
+ };
78
101
  return (React.createElement(ConfigProvider, { theme: { components: { Drawer: { motionDurationSlow: '0ms' } } } },
79
102
  React.createElement(StyledDrawer, Object.assign({}, restProps, { push: false, closable: false, width: drawerWidth, classNames: {
80
103
  body: 'drawer-detail-body',
@@ -84,7 +107,7 @@ export const DrawerDetail = props => {
84
107
  onClose(e);
85
108
  } }),
86
109
  React.createElement(Icon, { type: "icon-ants-remove-slim", size: 14 }))),
87
- showExpandButton && !fullScreen && (React.createElement(ToggleDrawerSizeButton, { style: Object.assign({}, (!showMenu && { background: '#ffffff' })), onClick: () => toggleCollapseDrawer(), collapse: collapseDrawer })),
110
+ showExpandButton && !fullScreen && (React.createElement(ToggleDrawerSizeButton, { style: Object.assign({}, (!showMenu && { background: '#ffffff' })), onClick: () => handleToggleDrawerSize(), collapse: collapseDrawer })),
88
111
  showMenu && (React.createElement(LeftMenu, { className: "animate__animated animate__fadeIn" },
89
112
  React.createElement("div", null,
90
113
  showClose && (React.createElement(CloseBtn, { onClick: onClose },
@@ -92,6 +115,8 @@ export const DrawerDetail = props => {
92
115
  React.createElement(Flex, { vertical: true, gap: 10, align: "center", justify: "center" }, items === null || items === void 0 ? void 0 : items.map((item) => (React.createElement(Tooltip, { key: item === null || item === void 0 ? void 0 : item.key, title: item === null || item === void 0 ? void 0 : item.label, mouseEnterDelay: 0.3 },
93
116
  React.createElement(MenuItem, { key: item === null || item === void 0 ? void 0 : item.key, className: (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.includes(item.key)) ? 'active' : '', onClick: () => onClick && onClick(item) }, item.icon)))))),
94
117
  React.createElement(MenuFooter, null, footer))),
95
- React.createElement(Content, null, children))));
118
+ React.createElement(Content, null,
119
+ (headerProps === null || headerProps === void 0 ? void 0 : headerProps.children) && (React.createElement(DrawerHeader, Object.assign({ align: "center" }, restOfHeaderProps), headerChildren)),
120
+ children))));
96
121
  };
97
122
  DrawerDetail.defaultProps = {};
@@ -4,10 +4,11 @@ declare const DRAWER_LARGE_MAX_WIDTH = "calc(100vw - 70px)";
4
4
  declare const DRAWER_SMALL_MAX_WIDTH = "calc(100vw - 70px)";
5
5
  declare const DRAWER_SMALL_MIN_WIDTH = "calc(100vw - 310px)";
6
6
  declare const BREAK_POINT = "1440px";
7
+ declare const DRAWER_DETAIL_LOCAL_STORAGE_KEY = "drawer-detail-collapses";
7
8
  declare const DRAWER_DETAIL_DIMENSION: {
8
9
  LAYER_2: {
9
10
  minWidth: string;
10
11
  maxWidth: string;
11
12
  };
12
13
  };
13
- export { DRAWER_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_LARGE_MAX_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, BREAK_POINT, DRAWER_DETAIL_DIMENSION, };
14
+ export { DRAWER_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_LARGE_MAX_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, BREAK_POINT, DRAWER_DETAIL_DIMENSION, DRAWER_DETAIL_LOCAL_STORAGE_KEY, };
@@ -4,6 +4,7 @@ const DRAWER_LARGE_MAX_WIDTH = 'calc(100vw - 70px)';
4
4
  const DRAWER_SMALL_MAX_WIDTH = 'calc(100vw - 70px)';
5
5
  const DRAWER_SMALL_MIN_WIDTH = 'calc(100vw - 310px)';
6
6
  const BREAK_POINT = '1440px';
7
+ const DRAWER_DETAIL_LOCAL_STORAGE_KEY = 'drawer-detail-collapses';
7
8
  const LAYER_2_MIN_WIDTH = '740px';
8
9
  const LAYER_2_MAX_WIDTH = 'calc(100vw - 46px)';
9
10
  const DRAWER_DETAIL_DIMENSION = {
@@ -12,4 +13,4 @@ const DRAWER_DETAIL_DIMENSION = {
12
13
  maxWidth: LAYER_2_MAX_WIDTH,
13
14
  },
14
15
  };
15
- export { DRAWER_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_LARGE_MAX_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, BREAK_POINT, DRAWER_DETAIL_DIMENSION, };
16
+ export { DRAWER_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_LARGE_MAX_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, BREAK_POINT, DRAWER_DETAIL_DIMENSION, DRAWER_DETAIL_LOCAL_STORAGE_KEY, };
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { DrawerHeaderProps } from './types';
2
3
  export declare const StyledDrawer: import("styled-components").StyledComponent<import("react").FC<import("@antscorp/antsomi-ui/es/components/molecules/Drawer/Drawer").DrawerProps>, any, {}, never>;
3
4
  export declare const Content: import("styled-components").StyledComponent<"div", any, {}, never>;
4
5
  export declare const LeftMenu: import("styled-components").StyledComponent<"div", any, {}, never>;
5
6
  export declare const CloseBtn: import("styled-components").StyledComponent<"div", any, {}, never>;
6
7
  export declare const MenuItem: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const DrawerHeader: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, DrawerHeaderProps, never>;
7
9
  export declare const MenuFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,5 +1,7 @@
1
1
  // Libraries
2
2
  import styled from 'styled-components';
3
+ // Components
4
+ import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
3
5
  // Drawer
4
6
  import { Drawer } from '../Drawer';
5
7
  import { globalToken } from '@antscorp/antsomi-ui/es/constants';
@@ -16,8 +18,8 @@ export const StyledDrawer = styled(Drawer) `
16
18
 
17
19
  .close-btn {
18
20
  position: absolute;
19
- top: 24.5px;
20
- right: 25px;
21
+ top: 20px;
22
+ right: 20px;
21
23
  width: 24px;
22
24
  height: 24px;
23
25
  display: flex;
@@ -103,4 +105,17 @@ export const MenuItem = styled.div `
103
105
  }
104
106
  }
105
107
  `;
108
+ export const DrawerHeader = styled(Flex) `
109
+ position: sticky;
110
+ top: 0px;
111
+ height: 64px;
112
+ padding: 0px 20px;
113
+ box-sizing: border-box;
114
+ background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw0};
115
+ z-index: 20;
116
+
117
+ ${props => props.height &&
118
+ `height: ${typeof props.height === 'string' ? props.height : `${props.height}px`};`}
119
+ ${props => props.showBorderBottom && `border-bottom: 1px solid ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw4};`}
120
+ `;
106
121
  export const MenuFooter = styled.div ``;
@@ -1,18 +1,24 @@
1
1
  import React, { ReactNode } from 'react';
2
- import type { DrawerProps, MenuProps as AntdProps } from 'antd';
2
+ import type { DrawerProps, MenuProps as AntdProps, FlexProps } from 'antd';
3
3
  import { ItemType } from 'antd/es/menu/hooks/useItems';
4
4
  export type TDefaultSize = 'max' | 'min';
5
- export interface DrawerDetailProps extends Omit<DrawerProps, 'closeIcon'> {
5
+ export interface DrawerDetailProps extends Omit<DrawerProps, 'closeIcon' | 'title'> {
6
+ name?: string;
6
7
  fullScreen?: boolean;
7
8
  maxWidth?: string | number;
8
9
  minWidth?: string | number;
9
10
  defaultSize?: TDefaultSize;
11
+ headerProps?: DrawerHeaderProps;
10
12
  menuProps?: DrawerDetailMenuProps;
11
13
  closeIconProps?: DrawerDetailCloseIconProps;
12
14
  }
13
15
  export interface DrawerDetailCloseIconProps extends React.HtmlHTMLAttributes<HTMLDivElement> {
14
16
  show?: boolean;
15
17
  }
18
+ export interface DrawerHeaderProps extends FlexProps {
19
+ height?: React.CSSProperties['height'];
20
+ showBorderBottom?: boolean;
21
+ }
16
22
  export interface DrawerDetailMenuProps extends Omit<AntdProps, 'onClick'> {
17
23
  show?: boolean;
18
24
  showExpandButton?: boolean;
@@ -7,6 +7,7 @@ export const InputWrapperStyled = styled.div `
7
7
  background-color: #fff;
8
8
  border-bottom: 1px solid transparent;
9
9
  max-width: 100%;
10
+ overflow: hidden;
10
11
 
11
12
  display: inline-flex;
12
13
  align-items: baseline;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { DataTableProps } from './types';
3
+ export declare function DataTable<TTableDataType>(props: DataTableProps<TTableDataType>): React.JSX.Element | null;
@@ -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,5 @@
1
+ import React from 'react';
2
+ export interface AddButtonProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ show?: boolean;
4
+ }
5
+ export declare const AddButton: React.FC<AddButtonProps>;
@@ -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,5 @@
1
+ import React from 'react';
2
+ interface AddFilterButtonProps {
3
+ }
4
+ export declare const AddFilterButton: React.FC<AddFilterButtonProps>;
5
+ export {};
@@ -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,6 @@
1
+ import React from 'react';
2
+ import { PopoverProps } from 'antd';
3
+ interface FilterSelectFieldsProps extends PopoverProps {
4
+ }
5
+ export declare const SavedFilterAndMetrics: React.FC<React.PropsWithChildren<FilterSelectFieldsProps>>;
6
+ export {};
@@ -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,5 @@
1
+ import React from 'react';
2
+ interface FilterProps {
3
+ }
4
+ export declare const Filter: React.FC<FilterProps>;
5
+ export {};
@@ -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,5 @@
1
+ import React from 'react';
2
+ interface ModifyColumnProps {
3
+ }
4
+ export declare const ModifyColumn: React.FC<ModifyColumnProps>;
5
+ export {};
@@ -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
+ };