@antscorp/antsomi-ui 1.3.5-beta.334 → 1.3.5-beta.335

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.
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  import { InputDropdownProps } from './types';
3
+ import './style.scss';
3
4
  export { Dropdown } from 'antd';
4
5
  export declare const InputDropdown: (props: InputDropdownProps) => React.JSX.Element;
@@ -14,9 +14,11 @@ import { Space, Typography } from 'antd';
14
14
  import Icon from '@antscorp/icons';
15
15
  import { StyledInputDropdownRoot } from './styled';
16
16
  import clsx from 'clsx';
17
+ import './style.scss';
17
18
  export { Dropdown } from 'antd';
19
+ const DefaultExpandIcon = React.createElement(Icon, { type: "icon-ants-expand-more" });
18
20
  export const InputDropdown = (props) => {
19
- const { children, disabled = false, className, trigger = ['click'], menu = { items: [] }, width = '100%', onOpenChange = () => { } } = props, rest = __rest(props, ["children", "disabled", "className", "trigger", "menu", "width", "onOpenChange"]);
21
+ const { children, disabled = false, className, trigger = ['click'], menu = { items: [] }, width = '100%', expandIcon = DefaultExpandIcon, onOpenChange = () => { } } = props, rest = __rest(props, ["children", "disabled", "className", "trigger", "menu", "width", "expandIcon", "onOpenChange"]);
20
22
  const [enableTooltip, setEnableTooltip] = useState(true);
21
23
  const renderChildren = useCallback(() => {
22
24
  if (typeof children === 'string') {
@@ -35,8 +37,8 @@ export const InputDropdown = (props) => {
35
37
  setEnableTooltip(!open);
36
38
  onOpenChange(...args);
37
39
  };
38
- return (React.createElement(StyledInputDropdownRoot, Object.assign({ menu: menu, trigger: trigger, disabled: disabled }, rest, { className: clsx({ disabled }, className), onOpenChange: handleOpen }),
40
+ return (React.createElement(StyledInputDropdownRoot, Object.assign({ menu: menu, trigger: trigger, disabled: disabled }, rest, { className: clsx({ disabled }, className, 'antsomi-input-dropdown'), onOpenChange: handleOpen }),
39
41
  React.createElement(Space, { style: { width } },
40
42
  renderChildren(),
41
- React.createElement(Icon, { type: "icon-ants-expand-more" }))));
43
+ expandIcon)));
42
44
  };
@@ -0,0 +1,7 @@
1
+ .antsomi-dropdown-menu {
2
+ overflow: hidden;
3
+
4
+ &:hover {
5
+ overflow: auto;
6
+ }
7
+ }
@@ -1,4 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { DropdownProps } from 'antd';
2
3
  export type InputDropdownProps = DropdownProps & {
3
4
  width?: number;
5
+ expandIcon?: React.ReactNode;
4
6
  };
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import React, { memo, useMemo, useState } from 'react';
12
+ import React, { memo, useLayoutEffect, useMemo, useState } from 'react';
13
13
  import { Link, useLocation } from 'react-router-dom';
14
14
  // Hooks
15
15
  // Styled
@@ -26,7 +26,7 @@ import { useCustomRouter } from '@antscorp/antsomi-ui/es/hooks';
26
26
  const { DATAFLOWS, APP_ANTALYSER } = APP_CODES;
27
27
  // const DOUBLE_RIGHT_POINTING = '&raquo;'
28
28
  export const HeaderV2 = memo(props => {
29
- var _a, _b;
29
+ var _a;
30
30
  const { auth, env: envContext, languageCode = 'en', appCode: contextAppCode, urlLogout: urlLogoutProvider = '', menuCode: contextMenuCode, } = useContextSelector(AppConfigContext, state => state);
31
31
  const { search } = useLocation();
32
32
  // const history = useHistory();
@@ -37,8 +37,12 @@ export const HeaderV2 = memo(props => {
37
37
  const { env = envContext, language = languageCode, userId = isNaN(Number(auth === null || auth === void 0 ? void 0 : auth.userId)) ? 0 : Number(auth === null || auth === void 0 ? void 0 : auth.userId), portalId = auth === null || auth === void 0 ? void 0 : auth.portalId, token = auth === null || auth === void 0 ? void 0 : auth.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
38
38
  const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
39
39
  const urlParams = useMemo(() => new URLSearchParams(search), [search]);
40
- const oidParam = (_a = urlParams.get('oid')) !== null && _a !== void 0 ? _a : 'all';
41
- const [selectedAccount, setSelectedAccount] = useState(`${useURLParam ? oidParam : `${(_b = currentAccount !== null && currentAccount !== void 0 ? currentAccount : userId) !== null && _b !== void 0 ? _b : 'all'}`}`);
40
+ const oidParam = urlParams.get('oid') || 'all';
41
+ const [selectedAccount, setSelectedAccount] = useState(`${useURLParam ? oidParam : `${(_a = currentAccount !== null && currentAccount !== void 0 ? currentAccount : userId) !== null && _a !== void 0 ? _a : 'all'}`}`);
42
+ useLayoutEffect(() => {
43
+ if (useURLParam)
44
+ setSelectedAccount(oidParam);
45
+ }, [oidParam, useURLParam]);
42
46
  // Memo
43
47
  const accountSelectionDomain = useMemo(() => {
44
48
  var _a;
@@ -96,7 +100,6 @@ export const HeaderV2 = memo(props => {
96
100
  else {
97
101
  urlParams.set('oid', userId);
98
102
  }
99
- // history.replace({ search: urlParams.toString() });
100
103
  replace({ search: urlParams.toString() });
101
104
  }
102
105
  onSelectAccount === null || onSelectAccount === void 0 ? void 0 : onSelectAccount(userId);
@@ -3,7 +3,6 @@ import React, { memo } from 'react';
3
3
  // Components
4
4
  import { ChildMenu } from '../common';
5
5
  import { Flex } from '../../../../atoms';
6
- import { Modal } from '../../../../molecules';
7
6
  // Constants
8
7
  import Icon from '@antscorp/icons';
9
8
  // Styled
@@ -56,5 +55,5 @@ export const HomeMenu = memo(() => {
56
55
  React.createElement("span", null, "Create"))),
57
56
  React.createElement("div", { className: "menu-list" },
58
57
  React.createElement(ChildMenu, { items: children, onMenuClick: onMenuClick }))),
59
- React.createElement(Modal, { open: !!removedDashboardId, centered: true, onCancel: () => setRemovedDashboardId(''), title: "Remove this dashboard", okText: "Confirm", cancelText: "Cancel", closable: false, okButtonProps: { loading: isDashboardRemoving }, modalRender: node => React.createElement(ModalWrapper, null, node), onOk: onRemoveDashboard }, "Removing this dashboard will delete it permanently. Are you sure you want to perform this action?")));
58
+ React.createElement(ModalWrapper, { open: !!removedDashboardId, centered: true, onCancel: () => setRemovedDashboardId(''), title: "Remove this dashboard", okText: "Confirm", cancelText: "Cancel", closable: false, okButtonProps: { loading: isDashboardRemoving }, onOk: onRemoveDashboard }, "Removing this dashboard will delete it permanently. Are you sure you want to perform this action?")));
60
59
  });
@@ -3,4 +3,4 @@ export declare const HomeMenuWrapper: import("styled-components").StyledComponen
3
3
  export declare const CreateButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").ButtonProps & import("react").RefAttributes<HTMLElement>> & {
4
4
  Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
5
5
  }, any, {}, never>;
6
- export declare const ModalWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const ModalWrapper: import("styled-components").StyledComponent<import("react").ComponentType<any> | keyof import("react").JSX.IntrinsicElements, any, any, any>;
@@ -3,6 +3,7 @@ var _a;
3
3
  import styled from 'styled-components';
4
4
  // Components
5
5
  import { Button, Flex } from '../../../../atoms';
6
+ import { Modal } from '../../../../molecules';
6
7
  // Constants
7
8
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
8
9
  export const HomeMenuWrapper = styled(Flex) `
@@ -35,13 +36,15 @@ export const CreateButton = styled(Button) `
35
36
  font-size: 14px !important;
36
37
  flex-shrink: 0;
37
38
  `;
38
- export const ModalWrapper = styled.div `
39
- width: 379px;
39
+ export const ModalWrapper = styled(Modal) `
40
+ &.antsomi-modal {
41
+ width: 379px !important;
40
42
 
41
- & > .antsomi-modal-content {
42
- & > .antsomi-modal-header,
43
- & > .antsomi-modal-footer {
44
- margin: 0px;
43
+ & .antsomi-modal-content {
44
+ & > .antsomi-modal-header,
45
+ & > .antsomi-modal-footer {
46
+ margin: 0px;
47
+ }
45
48
  }
46
49
  }
47
50
  `;
@@ -915,5 +915,12 @@ export const GlobalStyle = () => {
915
915
  }
916
916
  }
917
917
  }
918
+
919
+ .antsomi-typography {
920
+ &.antsomi-typography-danger,
921
+ &.antsomi-typography-warning {
922
+ fontsize: 11px;
923
+ }
924
+ }
918
925
  ` }));
919
926
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.334",
3
+ "version": "1.3.5-beta.335",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",