@antscorp/antsomi-ui 1.3.5-beta.253 → 1.3.5-beta.255
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/ModalSelect/Card.d.ts +6 -0
- package/es/components/molecules/ModalSelect/Card.js +41 -0
- package/es/components/molecules/ModalSelect/ModalSelect.d.ts +3 -0
- package/es/components/molecules/ModalSelect/ModalSelect.js +55 -0
- package/es/components/molecules/ModalSelect/index.d.ts +8 -0
- package/es/components/molecules/ModalSelect/index.js +8 -0
- package/es/components/molecules/ModalSelect/styled.d.ts +11 -0
- package/es/components/molecules/ModalSelect/styled.js +154 -0
- package/es/components/molecules/ModalSelect/types.d.ts +26 -0
- package/es/components/molecules/ModalSelect/types.js +1 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +3 -2
- package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +3 -0
- package/es/components/molecules/index.d.ts +2 -0
- package/es/components/molecules/index.js +1 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/index.js +2 -3
- package/es/constants/theme.js +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CardProps } from 'antd';
|
|
3
|
+
import { CardDefinationProps, CardRecommendedProps } from './types';
|
|
4
|
+
export declare const Card: (props: CardProps) => React.JSX.Element;
|
|
5
|
+
export declare const CardDefination: (props: CardDefinationProps) => React.JSX.Element;
|
|
6
|
+
export declare const CardRecommended: (props: CardRecommendedProps) => React.JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 React from 'react';
|
|
13
|
+
import { CardDefinationContainer, CardRecommendedContainer, RecommendItem, StyledCard, } from './styled';
|
|
14
|
+
import { Typography } from 'antd';
|
|
15
|
+
import clsx from 'clsx';
|
|
16
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
17
|
+
const { Text, Paragraph } = Typography;
|
|
18
|
+
export const Card = (props) => {
|
|
19
|
+
const { children, bordered = false } = props, rest = __rest(props, ["children", "bordered"]);
|
|
20
|
+
return (React.createElement(StyledCard, Object.assign({ bordered: bordered }, rest), children));
|
|
21
|
+
};
|
|
22
|
+
export const CardDefination = (props) => {
|
|
23
|
+
const { title, description, descriptionEllipsis = {
|
|
24
|
+
rows: 3,
|
|
25
|
+
symbol: 'Learn more',
|
|
26
|
+
expandable: true,
|
|
27
|
+
tooltip: true,
|
|
28
|
+
}, } = props;
|
|
29
|
+
return (React.createElement(CardDefinationContainer, null,
|
|
30
|
+
title && React.createElement(Text, { className: "title" }, title),
|
|
31
|
+
description && (React.createElement(Paragraph, { ellipsis: descriptionEllipsis, className: "description" }, description))));
|
|
32
|
+
};
|
|
33
|
+
export const CardRecommended = (props) => {
|
|
34
|
+
const { title, recomendations = [] } = props;
|
|
35
|
+
return (React.createElement(CardRecommendedContainer, null,
|
|
36
|
+
title && React.createElement(Text, { className: "title" }, title),
|
|
37
|
+
React.createElement("div", { className: "recomendations" }, recomendations.map(i => {
|
|
38
|
+
const { className, color = globalToken === null || globalToken === void 0 ? void 0 : globalToken.blue2, bordered = false } = i;
|
|
39
|
+
return (React.createElement(RecommendItem, Object.assign({}, i, { key: i.key, color: color, bordered: bordered, className: clsx('item', className) })));
|
|
40
|
+
}))));
|
|
41
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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 React, { useCallback, useEffect, useState } from 'react';
|
|
13
|
+
import { Menu } from 'antd';
|
|
14
|
+
import { StyledModal } from './styled';
|
|
15
|
+
import { isFunction } from 'lodash';
|
|
16
|
+
export const ModalSelect = (props) => {
|
|
17
|
+
const { value, content, options = [], okButtonProps = {}, cancelButtonProps = {}, title, open: openProp, menuRef: menuRefProp, onChange, onOk } = props, rest = __rest(props, ["value", "content", "options", "okButtonProps", "cancelButtonProps", "title", "open", "menuRef", "onChange", "onOk"]);
|
|
18
|
+
const [selected, setSelected] = useState(null);
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const handleSetMenuRef = useCallback((ref) => {
|
|
21
|
+
var _a;
|
|
22
|
+
if (!((_a = ref === null || ref === void 0 ? void 0 : ref.menu) === null || _a === void 0 ? void 0 : _a.list))
|
|
23
|
+
return;
|
|
24
|
+
if (menuRefProp) {
|
|
25
|
+
menuRefProp(ref.menu.list);
|
|
26
|
+
}
|
|
27
|
+
}, [menuRefProp]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (value === undefined)
|
|
30
|
+
return;
|
|
31
|
+
setSelected(value);
|
|
32
|
+
}, [value]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (openProp === undefined)
|
|
35
|
+
return;
|
|
36
|
+
setOpen(openProp);
|
|
37
|
+
}, [openProp]);
|
|
38
|
+
const renderContent = () => {
|
|
39
|
+
if (!isFunction(content))
|
|
40
|
+
return null;
|
|
41
|
+
return content(selected || null);
|
|
42
|
+
};
|
|
43
|
+
const handleClickItem = (key) => {
|
|
44
|
+
setSelected(key);
|
|
45
|
+
if (onChange)
|
|
46
|
+
onChange(key);
|
|
47
|
+
};
|
|
48
|
+
const handleOk = (e) => {
|
|
49
|
+
if (onOk)
|
|
50
|
+
onOk(e, selected);
|
|
51
|
+
};
|
|
52
|
+
return (React.createElement(StyledModal, Object.assign({}, rest, { open: open, onOk: handleOk, okButtonProps: Object.assign(Object.assign({}, okButtonProps), { className: `${okButtonProps.className} ok-btn` }), cancelButtonProps: Object.assign(Object.assign({}, cancelButtonProps), { className: `${cancelButtonProps.className} cancel-btn` }), title: title || 'Select' }),
|
|
53
|
+
React.createElement(Menu, { ref: handleSetMenuRef, items: options, selectedKeys: [selected || ''], onClick: info => handleClickItem(info.key) }),
|
|
54
|
+
React.createElement("div", { className: "content" }, renderContent())));
|
|
55
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ModalSelect: {
|
|
3
|
+
Modal: (props: import("./types").ModalSelectProps) => import("react").JSX.Element;
|
|
4
|
+
Card: (props: import("antd").CardProps) => import("react").JSX.Element;
|
|
5
|
+
CardRecommended: (props: import("./types").CardRecommendedProps) => import("react").JSX.Element;
|
|
6
|
+
CardDefination: (props: import("./types").CardDefinationProps) => import("react").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export type { ModalSelectProps } from './types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledModal: import("styled-components").StyledComponent<import("react").FC<import("antd").ModalProps> & import("antd/es/modal/confirm").ModalStaticFunctions & {
|
|
3
|
+
useModal: typeof import("antd/es/modal/useModal").default;
|
|
4
|
+
destroyAll: () => void;
|
|
5
|
+
config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
|
|
6
|
+
_InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/modal/PurePanel").PurePanelProps) => import("react").JSX.Element;
|
|
7
|
+
}, any, {}, never>;
|
|
8
|
+
export declare const StyledCard: import("styled-components").StyledComponent<import("antd/es/card").CardInterface, any, {}, never>;
|
|
9
|
+
export declare const CardDefinationContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
export declare const CardRecommendedContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const RecommendItem: import("styled-components").StyledComponent<import("antd").TagType, any, {}, never>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Modal, Card, Tag } from 'antd';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { get } from 'lodash';
|
|
4
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
5
|
+
export const StyledModal = styled(Modal) `
|
|
6
|
+
--modal-padding: 20px;
|
|
7
|
+
|
|
8
|
+
&.antsomi-modal {
|
|
9
|
+
.antsomi-modal-content {
|
|
10
|
+
max-height: 70vh;
|
|
11
|
+
overflow: auto;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.antsomi-modal-close {
|
|
17
|
+
&:hover {
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.antsomi-modal-close-x {
|
|
22
|
+
padding: 10px;
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.antsomi-modal-header {
|
|
28
|
+
padding-inline: var(--modal-padding);
|
|
29
|
+
padding-top: var(--modal-padding);
|
|
30
|
+
margin-bottom: calc(var(--modal-padding) - 5px);
|
|
31
|
+
|
|
32
|
+
.antsomi-modal-title {
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
font-size: 14px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.antsomi-modal-body {
|
|
39
|
+
flex: 1;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
|
|
42
|
+
&:hover {
|
|
43
|
+
overflow: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
padding-inline: var(--modal-padding);
|
|
47
|
+
padding-bottom: var(--modal-padding);
|
|
48
|
+
margin-bottom: 10px;
|
|
49
|
+
display: flex;
|
|
50
|
+
|
|
51
|
+
> .antsomi-menu {
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
overflow-y: auto;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.antsomi-menu-item {
|
|
60
|
+
width: 200px;
|
|
61
|
+
padding-inline: 10px;
|
|
62
|
+
font-weight: bold;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
> .content {
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
margin-left: 80px;
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
overflow: auto;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.antsomi-modal-footer {
|
|
77
|
+
padding: var(--modal-padding) !important;
|
|
78
|
+
margin-top: 0;
|
|
79
|
+
text-align: start;
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: start;
|
|
82
|
+
gap: 10px;
|
|
83
|
+
flex-direction: row-reverse;
|
|
84
|
+
|
|
85
|
+
.antsomi-btn + .antsomi-btn {
|
|
86
|
+
margin: 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
export const StyledCard = styled(Card) `
|
|
92
|
+
font-size: 12px;
|
|
93
|
+
|
|
94
|
+
&.antsomi-card {
|
|
95
|
+
padding: 15px;
|
|
96
|
+
background-color: ${get(globalToken, 'blue1_3')};
|
|
97
|
+
|
|
98
|
+
> .antsomi-card-cover {
|
|
99
|
+
padding: 20px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
> .antsomi-card-body {
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
gap: 15px;
|
|
106
|
+
background-color: transparent;
|
|
107
|
+
padding: 0px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
export const CardDefinationContainer = styled.div `
|
|
112
|
+
> .title {
|
|
113
|
+
font-size: 16px;
|
|
114
|
+
font-weight: normal;
|
|
115
|
+
margin-bottom: 8px;
|
|
116
|
+
display: block;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
> .description.antsomi-typography {
|
|
120
|
+
margin-bottom: 0;
|
|
121
|
+
color: ${get(globalToken, 'bw8')};
|
|
122
|
+
|
|
123
|
+
.antsomi-typography-expand {
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
export const CardRecommendedContainer = styled.div `
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
|
|
132
|
+
> .title {
|
|
133
|
+
margin-bottom: 8px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
> .recomendations {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-wrap: wrap;
|
|
139
|
+
row-gap: 8px;
|
|
140
|
+
|
|
141
|
+
> .item {
|
|
142
|
+
color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorText};
|
|
143
|
+
line-height: 14px;
|
|
144
|
+
font-size: 12px;
|
|
145
|
+
padding: 5px 10px;
|
|
146
|
+
border-radius: 24px;
|
|
147
|
+
|
|
148
|
+
&.antsomi-tag-borderless {
|
|
149
|
+
border-width: 0;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
export const RecommendItem = styled(Tag) ``;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { RefCallback } from 'react';
|
|
2
|
+
import { MenuProps, ModalProps, TagProps } from 'antd';
|
|
3
|
+
import { EllipsisConfig } from 'antd/es/typography/Base';
|
|
4
|
+
export type ModalSelectProps = {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
value?: string;
|
|
7
|
+
options?: MenuProps['items'];
|
|
8
|
+
content?: (active: string | null) => React.ReactNode;
|
|
9
|
+
onChange?: (active: string) => void;
|
|
10
|
+
menuRef?: RefCallback<HTMLUListElement>;
|
|
11
|
+
onOk?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>, active: string | null) => void;
|
|
12
|
+
} & Omit<ModalProps, 'onOk'>;
|
|
13
|
+
export type CardProps = {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export type CardDefinationProps = {
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
descriptionEllipsis?: EllipsisConfig;
|
|
20
|
+
};
|
|
21
|
+
export type CardRecommendedProps = {
|
|
22
|
+
title?: string;
|
|
23
|
+
recomendations?: (TagProps & {
|
|
24
|
+
key?: React.Key;
|
|
25
|
+
})[];
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _a;
|
|
1
|
+
var _a, _b;
|
|
2
2
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
export const StyledGeneralAccessRoot = styled.div `
|
|
@@ -14,6 +14,7 @@ export const StyledGeneralAccessRoot = styled.div `
|
|
|
14
14
|
display: flex;
|
|
15
15
|
justify-content: space-between;
|
|
16
16
|
border: 1px solid #e6e6e6;
|
|
17
|
+
border-radius: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadius}px;
|
|
17
18
|
padding: 8px;
|
|
18
19
|
|
|
19
20
|
.icon-angle {
|
|
@@ -24,7 +25,7 @@ export const StyledGeneralAccessRoot = styled.div `
|
|
|
24
25
|
|
|
25
26
|
.accessable-icon {
|
|
26
27
|
font-size: 28px;
|
|
27
|
-
color: ${(
|
|
28
|
+
color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.colorPrimary};
|
|
28
29
|
display: flex;
|
|
29
30
|
align-items: center;
|
|
30
31
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
1
3
|
import styled from 'styled-components';
|
|
2
4
|
export const StyledPeopleAccessRoot = styled.div `
|
|
3
5
|
display: flex;
|
|
@@ -9,6 +11,7 @@ export const StyledPeopleAccessRoot = styled.div `
|
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
.antsomi-list {
|
|
14
|
+
border-radius: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadius}px;
|
|
12
15
|
border: 1px solid #e6e6e6;
|
|
13
16
|
|
|
14
17
|
.antsomi-list-items {
|
|
@@ -45,6 +45,7 @@ export * from './SelectMulti';
|
|
|
45
45
|
export * from './SelectEventAttribute';
|
|
46
46
|
export * from './DatePickerV2';
|
|
47
47
|
export { EmptyTemplate, EmptyTemplateProps } from './EmptyTemplate';
|
|
48
|
+
export { ModalSelect } from './ModalSelect';
|
|
48
49
|
export * from './PreviewModal';
|
|
49
50
|
export * from './Drawer';
|
|
50
51
|
export * from './DrawerDetail';
|
|
@@ -60,3 +61,4 @@ export type { ThumbnailCardProps } from './ThumbnailCard';
|
|
|
60
61
|
export type { TemplateValueOptions } from './TemplateSaveAs';
|
|
61
62
|
export type { SelectProps as SelectV2Props } from './SelectV2';
|
|
62
63
|
export type { InputNumberProps as InputNumberWithLabelProps } from './InputNumber';
|
|
64
|
+
export type { ModalSelectProps } from './ModalSelect';
|
|
@@ -45,6 +45,7 @@ export * from './SelectMulti';
|
|
|
45
45
|
export * from './SelectEventAttribute';
|
|
46
46
|
export * from './DatePickerV2';
|
|
47
47
|
export { EmptyTemplate } from './EmptyTemplate';
|
|
48
|
+
export { ModalSelect } from './ModalSelect';
|
|
48
49
|
export * from './PreviewModal';
|
|
49
50
|
export * from './Drawer';
|
|
50
51
|
export * from './DrawerDetail';
|
|
@@ -36,8 +36,7 @@ export const Banner = memo(props => {
|
|
|
36
36
|
React.createElement("div", { className: classNames({
|
|
37
37
|
'content-wrapper': true,
|
|
38
38
|
'animate__animated animate__fadeIn': shouldAnimate,
|
|
39
|
-
}) }, isMobile ? React.createElement(MobileFrameV2, { id:
|
|
39
|
+
}) }, isMobile ? (React.createElement(MobileFrameV2, { id: "banner-mobile" }, children || null)) : (children || null)),
|
|
40
40
|
showSkeleton && (React.createElement(React.Fragment, null,
|
|
41
|
-
React.createElement("div", { className: "skeleton" })
|
|
42
|
-
React.createElement("div", { className: "backdrop" }))))));
|
|
41
|
+
React.createElement("div", { className: "skeleton" }))))));
|
|
43
42
|
});
|
package/es/constants/theme.js
CHANGED
|
@@ -107,7 +107,7 @@ THEME.components = {
|
|
|
107
107
|
},
|
|
108
108
|
Select: {
|
|
109
109
|
borderRadius: 0,
|
|
110
|
-
borderRadiusLG:
|
|
110
|
+
borderRadiusLG: 10,
|
|
111
111
|
borderRadiusSM: 0,
|
|
112
112
|
borderRadiusOuter: 0,
|
|
113
113
|
borderRadiusXS: 0,
|
|
@@ -207,6 +207,9 @@ THEME.components = {
|
|
|
207
207
|
Menu: {
|
|
208
208
|
itemHoverBg: '#F2F9FF',
|
|
209
209
|
activeBarBorderWidth: 0,
|
|
210
|
+
itemMarginInline: 0,
|
|
211
|
+
itemMarginBlock: 0,
|
|
212
|
+
itemBorderRadius: 5,
|
|
210
213
|
},
|
|
211
214
|
Form: {},
|
|
212
215
|
};
|