@antscorp/antsomi-ui 2.0.1 → 2.0.3
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/icons/LazyIcon/LazyIcon.d.ts +1 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +1 -0
- package/es/components/icons/LongerIcon.d.ts +3 -0
- package/es/components/icons/LongerIcon.js +7 -0
- package/es/components/icons/index.d.ts +1 -0
- package/es/components/icons/index.js +1 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +12 -2
- package/es/components/molecules/EditorTab/EditorTab.js +16 -6
- package/es/components/molecules/EditorTab/styled.js +4 -2
- package/es/components/molecules/EmptyData/styled.js +2 -1
- package/es/components/molecules/MatchAnySelect/MatchesAnySelect.d.ts +2 -2
- package/es/components/molecules/MatchAnySelect/MatchesAnySelect.js +78 -31
- package/es/components/molecules/MatchAnySelect/constants.d.ts +19 -0
- package/es/components/molecules/MatchAnySelect/constants.js +81 -0
- package/es/components/molecules/MatchAnySelect/styled.d.ts +6 -10
- package/es/components/molecules/MatchAnySelect/styled.js +62 -4
- package/es/components/molecules/MatchAnySelect/types.d.ts +42 -22
- package/es/components/molecules/SearchPopover/SearchPopover.js +1 -1
- package/es/components/molecules/SearchPopover/components/PopoverAddField/PopoverAddField.js +10 -7
- package/es/components/molecules/SearchPopover/components/PopoverSelect/PopoverSelect.js +17 -17
- package/es/components/molecules/SearchPopover/components/PopoverSelect/styled.d.ts +2 -2
- package/es/components/molecules/SearchPopover/components/PopoverSelect/styled.js +2 -3
- package/es/components/molecules/SearchPopover/types.d.ts +1 -1
- package/es/components/molecules/Tabs/index.d.ts +1 -0
- package/es/components/molecules/Tree/Tree.d.ts +26 -2
- package/es/components/molecules/Tree/Tree.js +26 -1
- package/es/components/molecules/Tree/index.d.ts +1 -0
- package/es/components/molecules/Tree/index.js +1 -0
- package/es/components/molecules/Tree/styled.d.ts +16 -0
- package/es/components/molecules/Tree/styled.js +24 -0
- package/es/components/molecules/Tree/utils.d.ts +10 -0
- package/es/components/molecules/Tree/utils.js +17 -0
- package/es/components/molecules/UploadImage/index.js +1 -1
- package/es/components/molecules/index.d.ts +1 -1
- package/es/components/molecules/index.js +1 -1
- package/es/components/organism/AlgorithmsSetting/styled.d.ts +1 -1
- package/es/components/organism/Help/Help.js +27 -33
- package/es/components/organism/Help/styled.d.ts +0 -5
- package/es/components/organism/Help/styled.js +27 -38
- package/es/components/organism/Login/Login.js +2 -2
- package/es/components/organism/Login/components/ForgotPassword/ForgotPassword.js +3 -3
- package/es/components/organism/Login/components/LoginSelectPortal/Item/styled.js +2 -2
- package/es/components/organism/Login/components/LoginSelectPortal/LoginSelectPortal.js +2 -1
- package/es/components/organism/Login/components/LoginStep2/LoginStep2.js +9 -8
- package/es/components/organism/Login/components/SetupGGAuthenticator/SetupGGAuthenticator.js +1 -1
- package/es/components/organism/Login/components/SignIn/SignIn.js +1 -1
- package/es/components/organism/Login/styled.js +31 -5
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +3 -3
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.js +4 -2
- package/es/components/template/TemplateListing/index.js +5 -3
- package/es/constants/theme.js +13 -10
- package/es/index.d.ts +2 -0
- package/es/index.js +1 -0
- package/es/providers/ConfigProvider/GlobalStyle.js +10 -2
- package/es/test.js +5 -6
- package/es/tests/MatchesAnySelect.js +70 -4
- package/es/utils/common.js +1 -1
- package/package.json +2 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
// Components
|
|
4
|
-
import { Flex, Input, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
4
|
+
import { Button, Flex, Input, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
5
5
|
import { Tree } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
6
6
|
// Constants
|
|
7
7
|
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
8
|
-
|
|
8
|
+
import { EXTRA_VALUE_SHIFT_WIDTH, EXTRA_VALUE_WIDTH } from './constants';
|
|
9
|
+
const { borderRadius, bw3, bw6, blue, blue1, colorPrimary, colorError } = globalToken || {};
|
|
9
10
|
export const MatchesAnyWrapper = styled(Flex) `
|
|
10
11
|
width: 100%;
|
|
11
12
|
height: 550px;
|
|
12
13
|
|
|
13
14
|
.matches-any {
|
|
14
|
-
background-color: red;
|
|
15
15
|
&__header {
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
@@ -19,6 +19,7 @@ export const MatchesAnyWrapper = styled(Flex) `
|
|
|
19
19
|
box-sizing: border-box;
|
|
20
20
|
padding: 0px 15px;
|
|
21
21
|
border-bottom: 1px solid ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw3};
|
|
22
|
+
gap: 10px;
|
|
22
23
|
|
|
23
24
|
.antsomi-search-input {
|
|
24
25
|
padding-left: 0px;
|
|
@@ -66,6 +67,10 @@ export const MatchesAnyWrapper = styled(Flex) `
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
.antsomi-tree {
|
|
70
|
+
.antsomi-tree-list-holder-inner {
|
|
71
|
+
gap: 5px;
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
.antsomi-tree-treenode {
|
|
70
75
|
width: 100%;
|
|
71
76
|
padding: 0px;
|
|
@@ -94,14 +99,32 @@ export const MatchesAnyWrapper = styled(Flex) `
|
|
|
94
99
|
.title-content {
|
|
95
100
|
padding: 5px 0px;
|
|
96
101
|
display: flex;
|
|
97
|
-
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: space-between;
|
|
104
|
+
gap: 10px;
|
|
98
105
|
width: 100%;
|
|
99
106
|
height: 100%;
|
|
100
107
|
overflow: auto;
|
|
101
108
|
|
|
109
|
+
> .left-content {
|
|
110
|
+
width: 100%;
|
|
111
|
+
overflow: auto;
|
|
112
|
+
}
|
|
113
|
+
|
|
102
114
|
.sub-title {
|
|
103
115
|
font-size: 11px;
|
|
104
116
|
}
|
|
117
|
+
|
|
118
|
+
.extra-value-content {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
width: ${EXTRA_VALUE_WIDTH}px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.extra-value {
|
|
126
|
+
width: calc(100% - ${EXTRA_VALUE_SHIFT_WIDTH}px);
|
|
127
|
+
}
|
|
105
128
|
}
|
|
106
129
|
}
|
|
107
130
|
}
|
|
@@ -158,6 +181,27 @@ export const MatchesAnyWrapper = styled(Flex) `
|
|
|
158
181
|
}
|
|
159
182
|
}
|
|
160
183
|
}
|
|
184
|
+
|
|
185
|
+
&.error-node {
|
|
186
|
+
.antsomi-tree-node-content-wrapper {
|
|
187
|
+
border-color: ${colorError};
|
|
188
|
+
border-width: 1px;
|
|
189
|
+
border-style: solid;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&:not(:has(span.antsomi-tree-switcher-noop)) {
|
|
193
|
+
.antsomi-tree-node-content-wrapper {
|
|
194
|
+
border-left-width: 0px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.antsomi-tree-switcher {
|
|
198
|
+
border-color: ${colorError};
|
|
199
|
+
border-width: 1px;
|
|
200
|
+
border-right-width: 0;
|
|
201
|
+
border-style: solid;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
161
205
|
}
|
|
162
206
|
}
|
|
163
207
|
|
|
@@ -169,6 +213,7 @@ export const MatchesAnyWrapper = styled(Flex) `
|
|
|
169
213
|
`;
|
|
170
214
|
export const TextButton = styled(Typography.Text) `
|
|
171
215
|
color: ${colorPrimary} !important;
|
|
216
|
+
font-weight: 500;
|
|
172
217
|
cursor: pointer;
|
|
173
218
|
|
|
174
219
|
${props => props.disabled &&
|
|
@@ -177,6 +222,12 @@ export const TextButton = styled(Typography.Text) `
|
|
|
177
222
|
pointer-events: none;
|
|
178
223
|
`}
|
|
179
224
|
`;
|
|
225
|
+
export const GroupSelectButton = styled(Button) `
|
|
226
|
+
gap: 4px !important;
|
|
227
|
+
.group-name {
|
|
228
|
+
font-weight: normal !important;
|
|
229
|
+
}
|
|
230
|
+
`;
|
|
180
231
|
export const ActionButton = styled(Flex) `
|
|
181
232
|
height: 16px;
|
|
182
233
|
width: 16px;
|
|
@@ -195,3 +246,10 @@ export const TextArea = styled(Input.TextArea) `
|
|
|
195
246
|
border-radius: ${borderRadius}px;
|
|
196
247
|
}
|
|
197
248
|
`;
|
|
249
|
+
export const ExtraValueLabel = styled.div `
|
|
250
|
+
width: ${EXTRA_VALUE_WIDTH}px;
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
justify-content: center;
|
|
254
|
+
`;
|
|
255
|
+
export const ItemStatus = styled(Flex) ``;
|
|
@@ -1,47 +1,67 @@
|
|
|
1
1
|
import { TreeDataNode } from 'antd';
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import type { EmptyDataProps, SelectProps } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
4
|
+
import type { FlexProps, PopoverProps } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
5
|
+
import { PopoverSelectProps } from '../SearchPopover/types';
|
|
6
|
+
export type MatchesAnyItem<TItem = Record<string, any>> = TreeDataNode & {
|
|
5
7
|
/** Addition title of the item. */
|
|
6
8
|
subTitle?: string;
|
|
7
9
|
/** Indicates whether the item is extended */
|
|
8
10
|
isExtendValue?: boolean;
|
|
9
11
|
/** An array of children items. */
|
|
10
|
-
children?: MatchesAnyItem[];
|
|
12
|
+
children?: MatchesAnyItem<TItem>[];
|
|
13
|
+
/** An error message */
|
|
14
|
+
error?: string;
|
|
15
|
+
} & TItem;
|
|
16
|
+
export type GroupSelectProps = PopoverSelectProps & {
|
|
17
|
+
/** Name of the group select to be displayed */
|
|
18
|
+
name?: string;
|
|
11
19
|
};
|
|
12
|
-
export
|
|
20
|
+
export type RenderExtraValue<TItem = Record<string, any>> = {
|
|
21
|
+
key: keyof MatchesAnyItem<TItem>;
|
|
22
|
+
label: string;
|
|
23
|
+
render?: (item: MatchesAnyItem<TItem>) => ReactNode | ReactNode;
|
|
24
|
+
};
|
|
25
|
+
export type CustomItemRenders<TItem> = {
|
|
26
|
+
title?: (item: MatchesAnyItem<TItem>) => ReactNode;
|
|
27
|
+
subTitle?: (item: MatchesAnyItem<TItem>) => ReactNode;
|
|
28
|
+
error?: (item: MatchesAnyItem<TItem>) => ReactNode;
|
|
29
|
+
};
|
|
30
|
+
export interface MatchesAnySelectProps<TItem = Record<string, any>> extends SelectProps {
|
|
13
31
|
/** The name of object to be displayed in Popover */
|
|
14
32
|
objectName?: string;
|
|
15
33
|
/** Indicates whether show the extend value button */
|
|
16
34
|
showExtendValue?: boolean;
|
|
17
35
|
/** An array of items. */
|
|
18
|
-
items?: MatchesAnyItem[];
|
|
36
|
+
items?: MatchesAnyItem<TItem>[];
|
|
19
37
|
/** An array of selected items. */
|
|
20
|
-
selectedItems?: MatchesAnyItem[];
|
|
38
|
+
selectedItems?: MatchesAnyItem<TItem>[];
|
|
39
|
+
/** The properties of the group select */
|
|
40
|
+
groupSelectProps?: GroupSelectProps;
|
|
41
|
+
/** An array of render extra values */
|
|
42
|
+
renderExtraValues?: RenderExtraValue<TItem>[];
|
|
43
|
+
/** Custom item renders */
|
|
44
|
+
customItemRenders?: CustomItemRenders<TItem>;
|
|
45
|
+
/** Popover Props */
|
|
46
|
+
popoverProps?: Partial<PopoverProps>;
|
|
47
|
+
/** Empty UI for list items */
|
|
48
|
+
listEmptyProps?: EmptyDataProps;
|
|
49
|
+
/** Empty UI for selected list items */
|
|
50
|
+
selectedListEmptyProps?: EmptyDataProps;
|
|
21
51
|
/** Callback function that is called when the selected items change. */
|
|
22
|
-
onChange?: (selectedItems: MatchesAnyItem[]) => void;
|
|
52
|
+
onChange?: (selectedItems: MatchesAnyItem<TItem>[]) => void;
|
|
53
|
+
/** Callback function that is called when the search value changes */
|
|
54
|
+
onChangeSearch?: (searchValue: string) => void;
|
|
23
55
|
/** Callback function that is called when the user scroll */
|
|
24
56
|
onLoadMore?: () => void;
|
|
25
57
|
}
|
|
26
|
-
export interface MatchesAnyProps extends Omit<FlexProps, 'children'> {
|
|
27
|
-
/** The name of the object, corresponding to the `objectName` property in `MatchesAnySelectProps`. */
|
|
28
|
-
objectName?: MatchesAnySelectProps['objectName'];
|
|
29
|
-
/** Indicates whether the component is in a loading state, corresponding to the `isLoading` property in `MatchesAnySelectProps`. */
|
|
30
|
-
loading?: MatchesAnySelectProps['loading'];
|
|
31
|
-
/** Determines whether to show the extended value, corresponding to the `showExtendValue` property in `MatchesAnySelectProps`. */
|
|
32
|
-
showExtendValue?: MatchesAnySelectProps['showExtendValue'];
|
|
33
|
-
/** An array of items. */
|
|
34
|
-
items?: MatchesAnySelectProps['items'];
|
|
35
|
-
/** An array of selected items. */
|
|
36
|
-
selectedItems?: MatchesAnySelectProps['selectedItems'];
|
|
58
|
+
export interface MatchesAnyProps<TItem = Record<string, any>> extends Omit<FlexProps, 'children'>, Pick<MatchesAnySelectProps<TItem>, 'objectName' | 'loading' | 'showExtendValue' | 'items' | 'selectedItems' | 'onLoadMore' | 'groupSelectProps' | 'onChangeSearch' | 'renderExtraValues' | 'customItemRenders' | 'listEmptyProps' | 'selectedListEmptyProps'> {
|
|
37
59
|
/**
|
|
38
60
|
* Callback function that is called when the apply action is triggered.
|
|
39
61
|
*
|
|
40
62
|
* @param selectedItems - The array of selected items.
|
|
41
63
|
*/
|
|
42
|
-
onApply?: (selectedItems: MatchesAnyItem[]) => void;
|
|
64
|
+
onApply?: (selectedItems: MatchesAnyItem<TItem>[]) => void;
|
|
43
65
|
/** Callback function that is called when the cancel action is triggered. */
|
|
44
66
|
onCancel?: () => void;
|
|
45
|
-
/** Callback function that is called when the user scroll */
|
|
46
|
-
onLoadMore?: MatchesAnySelectProps['onLoadMore'];
|
|
47
67
|
}
|
|
@@ -18,7 +18,7 @@ import { StyledInput } from './styled';
|
|
|
18
18
|
export const SearchPopover = (props) => {
|
|
19
19
|
const { inputSearchProps = {} } = props, popoverProps = __rest(props, ["inputSearchProps"]);
|
|
20
20
|
const { overlayClassName, arrow = false, children, content, trigger = ['click'] } = popoverProps, restPopoverProps = __rest(popoverProps, ["overlayClassName", "arrow", "children", "content", "trigger"]);
|
|
21
|
-
return (React.createElement(Popover, Object.assign({ trigger: trigger, arrow: arrow }, restPopoverProps, { overlayClassName: clsx('search-popover-overlay', overlayClassName), overlay: true, content: React.createElement(React.Fragment, null,
|
|
21
|
+
return (React.createElement(Popover, Object.assign({ trigger: trigger, arrow: arrow, destroyTooltipOnHide: true }, restPopoverProps, { overlayClassName: clsx('search-popover-overlay', overlayClassName), overlay: true, content: React.createElement(React.Fragment, null,
|
|
22
22
|
React.createElement(StyledInput, Object.assign({ placeholder: (inputSearchProps === null || inputSearchProps === void 0 ? void 0 : inputSearchProps.placeholder) || 'Search...', bordered: false }, inputSearchProps, { addonAfter: React.createElement(Icon, { type: "icon-ants-search-2" }), withWrapper: false })),
|
|
23
23
|
content) }), children));
|
|
24
24
|
};
|
|
@@ -11,21 +11,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React, { useCallback, useMemo } from 'react';
|
|
13
13
|
import clsx from 'clsx';
|
|
14
|
+
import { Button, Icon } from '../../../../atoms';
|
|
14
15
|
import { renderIconField } from '../../utils';
|
|
15
16
|
import { PopoverSelect } from '../PopoverSelect';
|
|
16
17
|
import { Typography } from 'antd';
|
|
17
18
|
export const PopoverAddField = (props) => {
|
|
18
|
-
const { fields, onSearchPredicate, className } = props, rest = __rest(props, ["fields", "onSearchPredicate", "className"]);
|
|
19
|
+
const { fields, onSearchPredicate, className, children } = props, rest = __rest(props, ["fields", "onSearchPredicate", "className", "children"]);
|
|
19
20
|
const originalFieldByKey = useMemo(() => new Map(fields.map(field => [field.key, field])), [fields]);
|
|
20
|
-
const handleOnSearchPredicate = (
|
|
21
|
-
const originalField = originalFieldByKey.get(
|
|
21
|
+
const handleOnSearchPredicate = useCallback((option) => {
|
|
22
|
+
const originalField = originalFieldByKey.get(option.key);
|
|
22
23
|
if (!originalField)
|
|
23
|
-
return
|
|
24
|
+
return false;
|
|
24
25
|
if (onSearchPredicate && originalField) {
|
|
25
26
|
return onSearchPredicate(originalField);
|
|
26
27
|
}
|
|
27
|
-
return
|
|
28
|
-
};
|
|
28
|
+
return false;
|
|
29
|
+
}, [onSearchPredicate, originalFieldByKey]);
|
|
29
30
|
const options = useCallback((params) => fields.map(field => (Object.assign(Object.assign({}, field), { label: (React.createElement(React.Fragment, null,
|
|
30
31
|
field.dataType && renderIconField(field.dataType),
|
|
31
32
|
typeof field.label === 'string' && (React.createElement(Typography.Text, { ellipsis: {
|
|
@@ -35,5 +36,7 @@ export const PopoverAddField = (props) => {
|
|
|
35
36
|
field.label({
|
|
36
37
|
selected: params.selected.includes(field.key),
|
|
37
38
|
}))) }))), [fields]);
|
|
38
|
-
return (React.createElement(PopoverSelect, Object.assign({}, rest, { options: options, onSearchPredicate: handleOnSearchPredicate, className: clsx(className, 'ants-popover-add-fields') })
|
|
39
|
+
return (React.createElement(PopoverSelect, Object.assign({}, rest, { options: options, onSearchPredicate: handleOnSearchPredicate, className: clsx(className, 'ants-popover-add-fields') }), children || (React.createElement(Button, { type: "text" },
|
|
40
|
+
React.createElement(Icon, { type: "icon-ants-plus-slim", size: 14 }),
|
|
41
|
+
"Add fields"))));
|
|
39
42
|
};
|
|
@@ -14,7 +14,7 @@ import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
|
14
14
|
import { SearchPopover } from '../../SearchPopover';
|
|
15
15
|
import './styles.scss';
|
|
16
16
|
import { searchStringQuery } from '@antscorp/antsomi-ui/es/utils';
|
|
17
|
-
import { Button, Checkbox
|
|
17
|
+
import { Button, Checkbox } from '../../../../atoms';
|
|
18
18
|
import { StyledAction, StyledFooter, StyledListFieldsWrapper } from './styled';
|
|
19
19
|
import { List } from 'antd';
|
|
20
20
|
export const PopoverSelect = (props) => {
|
|
@@ -48,18 +48,20 @@ export const PopoverSelect = (props) => {
|
|
|
48
48
|
setSelectedKeys(new Set(selected));
|
|
49
49
|
}
|
|
50
50
|
}, [selected]);
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
if (refOnSearchPredicate.current) {
|
|
54
|
-
const isFilteredOption = refOnSearchPredicate.current(field);
|
|
55
|
-
return isFilteredOption;
|
|
56
|
-
}
|
|
51
|
+
const filteredOptions = useMemo(() => {
|
|
52
|
+
const defaultFilter = (opt) => {
|
|
57
53
|
let labelIncluded = false;
|
|
58
|
-
if (typeof
|
|
59
|
-
labelIncluded = searchStringQuery(
|
|
54
|
+
if (typeof opt.label === 'string') {
|
|
55
|
+
labelIncluded = searchStringQuery(opt.label, search);
|
|
60
56
|
}
|
|
61
|
-
const keyIncluded = searchStringQuery(
|
|
57
|
+
const keyIncluded = searchStringQuery(opt.key, search);
|
|
62
58
|
return keyIncluded || labelIncluded;
|
|
59
|
+
};
|
|
60
|
+
let result = options.filter(field => {
|
|
61
|
+
if (!refOnSearchPredicate.current) {
|
|
62
|
+
return defaultFilter(field);
|
|
63
|
+
}
|
|
64
|
+
return refOnSearchPredicate.current(field) || defaultFilter(field);
|
|
63
65
|
});
|
|
64
66
|
if (showSelected) {
|
|
65
67
|
result = result.filter(field => selectedKeys.has(field.key));
|
|
@@ -117,17 +119,15 @@ export const PopoverSelect = (props) => {
|
|
|
117
119
|
return option.label;
|
|
118
120
|
};
|
|
119
121
|
return (React.createElement(SearchPopover, Object.assign({}, rest, { content: React.createElement(React.Fragment, null,
|
|
120
|
-
|
|
122
|
+
optionsProp.length > 0 && (React.createElement(StyledAction, null,
|
|
121
123
|
React.createElement(Button, { type: "link", size: "small", onClick: () => setShowSelected(current => !current) }, showSelected ? showAllLabel : showSelectedLabel),
|
|
122
|
-
selectedKeys.size ===
|
|
123
|
-
!!
|
|
124
|
-
React.createElement(List, { bordered: false, dataSource:
|
|
124
|
+
selectedKeys.size === options.length ? (React.createElement(Button, { type: "link", onClick: handleDeselectAll }, deselectAllLabel)) : (React.createElement(Button, { type: "link", onClick: handleSelectAll }, selectAllLabel)))),
|
|
125
|
+
!!filteredOptions.length && (React.createElement(StyledListFieldsWrapper, { autoHeight: true, autoHeightMax: 260 },
|
|
126
|
+
React.createElement(List, { bordered: false, dataSource: filteredOptions, renderItem: option => (React.createElement(List.Item, null,
|
|
125
127
|
React.createElement(Checkbox, { onChange: e => handleToggleField(option, e.target.checked), checked: selectedKeys.has(option.key) }, renderCheckBoxLabel(option)))) }))),
|
|
126
128
|
React.createElement(StyledFooter, null,
|
|
127
129
|
React.createElement(Button, { onClick: handleCancel }, "Cancel"),
|
|
128
130
|
React.createElement(Button, { onClick: handleApply, disabled: applyDisabled, type: "primary" }, "Apply"))), overlayInnerStyle: {
|
|
129
131
|
'--item-padding': `${((_b = (_a = THEME.components) === null || _a === void 0 ? void 0 : _a.Menu) === null || _b === void 0 ? void 0 : _b.itemPaddingInline) || 10}px`,
|
|
130
|
-
}, trigger: ['click'], placement: "bottomLeft", open: open, inputSearchProps: Object.assign(Object.assign({}, restInputSearchProps), { value: search, onAfterChange: handleOnSearch }), afterOpenChange: handleAfterOpenChange, onOpenChange: handleOpenChange }), children ||
|
|
131
|
-
React.createElement(Icon, { type: "icon-ants-plus-slim", size: 14 }),
|
|
132
|
-
"Add fields"))));
|
|
132
|
+
}, trigger: ['click'], placement: "bottomLeft", open: open, inputSearchProps: Object.assign(Object.assign({}, restInputSearchProps), { value: search, onAfterChange: handleOnSearch }), afterOpenChange: handleAfterOpenChange, onOpenChange: handleOpenChange }), children || React.createElement(Button, null, "Select")));
|
|
133
133
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export declare const StyledFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const StyledAction: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const StyledListFieldsWrapper: import("styled-components").StyledComponent<
|
|
4
|
+
export declare const StyledListFieldsWrapper: import("styled-components").StyledComponent<import("react").FC<import("@antscorp/antsomi-ui/es/components/atoms").ScrollbarsProps>, any, {}, never>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a, _b;
|
|
2
|
+
import { Scrollbars } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
2
3
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
3
|
-
import Scrollbars from 'react-custom-scrollbars';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
export const StyledFooter = styled.div `
|
|
6
6
|
gap: 10px;
|
|
@@ -8,6 +8,7 @@ export const StyledFooter = styled.div `
|
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
justify-content: flex-end;
|
|
11
|
+
border-top: 1px solid var(--divider-1);
|
|
11
12
|
`;
|
|
12
13
|
export const StyledAction = styled.div `
|
|
13
14
|
display: flex;
|
|
@@ -23,8 +24,6 @@ export const StyledAction = styled.div `
|
|
|
23
24
|
`;
|
|
24
25
|
export const StyledListFieldsWrapper = styled(Scrollbars) `
|
|
25
26
|
.antsomi-list-items {
|
|
26
|
-
border-bottom: 1px solid var(--divider-1);
|
|
27
|
-
|
|
28
27
|
> .antsomi-list-item {
|
|
29
28
|
padding: 0;
|
|
30
29
|
border-bottom: 0;
|
|
@@ -25,7 +25,7 @@ export type PopoverSelectProps<TOption extends Option = Option> = SearchPopoverP
|
|
|
25
25
|
showSelectedLabel: string;
|
|
26
26
|
deselectAllLabel: string;
|
|
27
27
|
selectAllLabel: string;
|
|
28
|
-
onSearchPredicate: (option:
|
|
28
|
+
onSearchPredicate: (option: Option) => boolean;
|
|
29
29
|
}>;
|
|
30
30
|
export type PopoverAddFieldProps = Omit<PopoverSelectProps, 'options'> & {
|
|
31
31
|
fields: Field[];
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="hoist-non-react-statics" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Tree as AntdTree } from 'antd';
|
|
4
|
+
import type { TreeProps, TreeDataNode } from 'antd';
|
|
5
|
+
export declare const Tree: string & import("styled-components").StyledComponentBase<(<T extends import("rc-tree").BasicDataNode | TreeDataNode = TreeDataNode>(props: TreeProps<T> & {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
8
|
+
TreeNode: React.FC<import("rc-tree").TreeNodeProps<TreeDataNode>>;
|
|
9
|
+
DirectoryTree: (<T_1 extends import("rc-tree").BasicDataNode | TreeDataNode = TreeDataNode>(props: import("antd/es/tree").DirectoryTreeProps<T_1> & {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
12
|
+
displayName?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
}, any, any, never> & import("hoist-non-react-statics").NonReactStatics<(<T extends import("rc-tree").BasicDataNode | TreeDataNode = TreeDataNode>(props: TreeProps<T> & {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
17
|
+
TreeNode: React.FC<import("rc-tree").TreeNodeProps<TreeDataNode>>;
|
|
18
|
+
DirectoryTree: (<T_1 extends import("rc-tree").BasicDataNode | TreeDataNode = TreeDataNode>(props: import("antd/es/tree").DirectoryTreeProps<T_1> & {
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
} & React.RefAttributes<import("rc-tree").default<TreeDataNode>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
21
|
+
displayName?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
}, {}> & {
|
|
24
|
+
DirectoryTree: typeof AntdTree.DirectoryTree;
|
|
25
|
+
};
|
|
26
|
+
export type { TreeProps, TreeDataNode };
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
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
|
+
// styled
|
|
14
|
+
import { StyledTree, StyledTreeDirectory } from './styled';
|
|
15
|
+
// icon
|
|
16
|
+
import { ExpandMoreIcon } from '../../icons';
|
|
17
|
+
const StandardTree = props => {
|
|
18
|
+
const { switcherIcon = React.createElement(ExpandMoreIcon, null) } = props, restProps = __rest(props, ["switcherIcon"]);
|
|
19
|
+
return React.createElement(StyledTree, Object.assign({ switcherIcon: switcherIcon }, restProps));
|
|
20
|
+
};
|
|
21
|
+
export const Tree = StandardTree;
|
|
22
|
+
const DirectoryTree = props => {
|
|
23
|
+
const { switcherIcon = React.createElement(ExpandMoreIcon, null) } = props, restProps = __rest(props, ["switcherIcon"]);
|
|
24
|
+
return React.createElement(StyledTreeDirectory, Object.assign({ switcherIcon: switcherIcon }, restProps));
|
|
25
|
+
};
|
|
26
|
+
Tree.DirectoryTree = DirectoryTree;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledTree: import("styled-components").StyledComponent<(<T extends import("rc-tree").BasicDataNode | import("antd").TreeDataNode = import("antd").TreeDataNode>(props: import("antd").TreeProps<T> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
} & import("react").RefAttributes<import("rc-tree").default<import("antd").TreeDataNode>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
5
|
+
TreeNode: import("react").FC<import("rc-tree").TreeNodeProps<import("antd").TreeDataNode>>;
|
|
6
|
+
DirectoryTree: (<T_1 extends import("rc-tree").BasicDataNode | import("antd").TreeDataNode = import("antd").TreeDataNode>(props: import("antd/es/tree").DirectoryTreeProps<T_1> & {
|
|
7
|
+
children?: import("react").ReactNode;
|
|
8
|
+
} & import("react").RefAttributes<import("rc-tree").default<import("antd").TreeDataNode>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
9
|
+
displayName?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
}, any, any, never>;
|
|
12
|
+
export declare const StyledTreeDirectory: import("styled-components").StyledComponent<(<T extends import("rc-tree").BasicDataNode | import("antd").TreeDataNode = import("antd").TreeDataNode>(props: import("antd/es/tree").DirectoryTreeProps<T> & {
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
} & import("react").RefAttributes<import("rc-tree").default<import("antd").TreeDataNode>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
15
|
+
displayName?: string | undefined;
|
|
16
|
+
}, any, any, never>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Tree } from 'antd';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const StyledTree = styled(Tree) `
|
|
4
|
+
.antsomi-tree-treenode {
|
|
5
|
+
.antsomi-tree-switcher {
|
|
6
|
+
display: flex;
|
|
7
|
+
order: 10;
|
|
8
|
+
&_close {
|
|
9
|
+
transform: rotate(-90deg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
export const StyledTreeDirectory = styled(Tree.DirectoryTree) `
|
|
15
|
+
.antsomi-tree-treenode {
|
|
16
|
+
.antsomi-tree-switcher {
|
|
17
|
+
display: flex;
|
|
18
|
+
order: 10;
|
|
19
|
+
&_close {
|
|
20
|
+
transform: rotate(-90deg);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TreeDataNode } from 'antd';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively updates the tree data by replacing the children of a node with a given key.
|
|
4
|
+
*
|
|
5
|
+
* @param {TreeDataNode[]} list - The list of tree nodes to update.
|
|
6
|
+
* @param {React.Key} key - The key of the node to update.
|
|
7
|
+
* @param {TreeDataNode[]} children - The new children to assign to the node.
|
|
8
|
+
* @return {TreeDataNode[]} The updated list of tree nodes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const updateTreeData: (list: TreeDataNode[], key: React.Key, children: TreeDataNode[]) => TreeDataNode[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively updates the tree data by replacing the children of a node with a given key.
|
|
3
|
+
*
|
|
4
|
+
* @param {TreeDataNode[]} list - The list of tree nodes to update.
|
|
5
|
+
* @param {React.Key} key - The key of the node to update.
|
|
6
|
+
* @param {TreeDataNode[]} children - The new children to assign to the node.
|
|
7
|
+
* @return {TreeDataNode[]} The updated list of tree nodes.
|
|
8
|
+
*/
|
|
9
|
+
export const updateTreeData = (list, key, children) => list.map(node => {
|
|
10
|
+
if (node.key === key) {
|
|
11
|
+
return Object.assign(Object.assign({}, node), { children });
|
|
12
|
+
}
|
|
13
|
+
if (node.children) {
|
|
14
|
+
return Object.assign(Object.assign({}, node), { children: updateTreeData(node.children, key, children) });
|
|
15
|
+
}
|
|
16
|
+
return node;
|
|
17
|
+
});
|
|
@@ -311,7 +311,7 @@ export const UploadImage = props => {
|
|
|
311
311
|
React.createElement(Input, { label: mode === 'video' ? 'Video URL' : 'Image URL', required: required, placeholder: placeholder, value: selectedMedia.url ? selectedMedia.url : '', focused: focused, onAfterChange: value => handleSelectMedia({
|
|
312
312
|
url: value,
|
|
313
313
|
}) }))))),
|
|
314
|
-
React.createElement(Modal, { title: labelModalDelete,
|
|
314
|
+
React.createElement(Modal, { title: labelModalDelete, open: isOpenConfirmDelete, onOk: () => handleRemoveUploadedMedia(deleteMediaRef.current, false), onCancel: () => setOpenConfirmDelete(prev => !prev), okText: "OK", cancelText: "Cancel", destroyOnClose: true },
|
|
315
315
|
React.createElement("p", null,
|
|
316
316
|
"Are you sure you want to delete ", (_d = deleteMediaRef.current) === null || _d === void 0 ? void 0 :
|
|
317
317
|
_d.name,
|
|
@@ -7,7 +7,6 @@ export { SelectV2 } from './SelectV2';
|
|
|
7
7
|
export { DatePicker } from './DatePicker';
|
|
8
8
|
export { ChatBox, ChatBoxInsight } from './ChatBox';
|
|
9
9
|
export { PopupDraggable } from './PopupDraggable';
|
|
10
|
-
export { Tabs } from './Tabs';
|
|
11
10
|
export { CaptureScreen } from './CaptureScreen';
|
|
12
11
|
export { SettingWrapper } from './SettingWrapper';
|
|
13
12
|
export { ColorPicker } from './ColorPicker';
|
|
@@ -60,6 +59,7 @@ export * from './Tree';
|
|
|
60
59
|
export * from './MatchAnySelect';
|
|
61
60
|
export * from './ApplyPopupContent';
|
|
62
61
|
export * from './AccessDenied';
|
|
62
|
+
export * from './Tabs';
|
|
63
63
|
export { EditorScript } from './EditorScript';
|
|
64
64
|
export { EditorTab } from './EditorTab';
|
|
65
65
|
export { SelectAccount } from './SelectAccount';
|
|
@@ -7,7 +7,6 @@ export { SelectV2 } from './SelectV2';
|
|
|
7
7
|
export { DatePicker } from './DatePicker';
|
|
8
8
|
export { ChatBox, ChatBoxInsight } from './ChatBox';
|
|
9
9
|
export { PopupDraggable } from './PopupDraggable';
|
|
10
|
-
export { Tabs } from './Tabs';
|
|
11
10
|
export { CaptureScreen } from './CaptureScreen';
|
|
12
11
|
export { SettingWrapper } from './SettingWrapper';
|
|
13
12
|
export { ColorPicker } from './ColorPicker';
|
|
@@ -60,6 +59,7 @@ export * from './Tree';
|
|
|
60
59
|
export * from './MatchAnySelect';
|
|
61
60
|
export * from './ApplyPopupContent';
|
|
62
61
|
export * from './AccessDenied';
|
|
62
|
+
export * from './Tabs';
|
|
63
63
|
export { EditorScript } from './EditorScript';
|
|
64
64
|
export { EditorTab } from './EditorTab';
|
|
65
65
|
export { SelectAccount } from './SelectAccount';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ContentSourceModeView } from '../ContentSources/types';
|
|
3
3
|
export declare const AlgorithmsSettingWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const StyledTabs: import("styled-components").StyledComponent<import("react").FC<import("antd").TabsProps> & {
|
|
4
|
+
export declare const StyledTabs: import("styled-components").StyledComponent<import("react").FC<import("antd/es/tabs").TabsProps> & {
|
|
5
5
|
TabPane: import("react").FC<import("antd").TabPaneProps>;
|
|
6
6
|
}, any, {
|
|
7
7
|
shadow?: boolean | undefined;
|