@antscorp/antsomi-ui 1.3.5-beta.679 → 1.3.5-beta.680
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/EmptyData/styled.js +2 -1
- package/es/components/molecules/MatchAnySelect/MatchesAnySelect.js +7 -5
- package/es/components/molecules/MatchAnySelect/types.d.ts +6 -2
- package/package.json +1 -1
|
@@ -204,6 +204,7 @@ export declare const LazyIcon: {
|
|
|
204
204
|
backgroundColor?: string | undefined;
|
|
205
205
|
} & import("react").RefAttributes<SVGSVGElement>>>;
|
|
206
206
|
LocalMallIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
207
|
+
LongerIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
207
208
|
MapIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
208
209
|
MarkAsReadIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
209
210
|
MarketingHub30Icon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
@@ -208,6 +208,7 @@ export const LazyIcon = {
|
|
|
208
208
|
ListIcon: lazy(() => import('../ListIcon').then(m => ({ default: m.ListIcon }))),
|
|
209
209
|
LoadingIcon: lazy(() => import('../LoadingIcon').then(m => ({ default: m.LoadingIcon }))),
|
|
210
210
|
LocalMallIcon: lazy(() => import('../LocalMallIcon').then(m => ({ default: m.LocalMallIcon }))),
|
|
211
|
+
LongerIcon: lazy(() => import('../LongerIcon').then(m => ({ default: m.LongerIcon }))),
|
|
211
212
|
MapIcon: lazy(() => import('../MapIcon').then(m => ({ default: m.MapIcon }))),
|
|
212
213
|
MarkAsReadIcon: lazy(() => import('../MarkAsReadIcon').then(m => ({ default: m.MarkAsReadIcon }))),
|
|
213
214
|
MarketingHub30Icon: lazy(() => import('../MarketingHub30Icon').then(m => ({ default: m.MarketingHub30Icon }))),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { useIcon } from './hooks/useIcon';
|
|
3
|
+
export const LongerIcon = forwardRef((props, ref) => {
|
|
4
|
+
const { width, height } = useIcon(props);
|
|
5
|
+
return (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { ref: ref, width: width, height: height }),
|
|
6
|
+
React.createElement("path", { d: "M14.0156 17.0156V18.9844H3.98438V17.0156H14.0156ZM20.0156 9V11.0156H3.98438V9H20.0156ZM3.98438 15V12.9844H20.0156V15H3.98438ZM3.98438 5.01562H20.0156V6.98438H3.98438V5.01562Z", fill: "currentColor" })));
|
|
7
|
+
});
|
|
@@ -200,6 +200,7 @@ export { LinkManagementIcon } from './LinkManagementIcon';
|
|
|
200
200
|
export { ListIcon } from './ListIcon';
|
|
201
201
|
export { LoadingIcon } from './LoadingIcon';
|
|
202
202
|
export { LocalMallIcon } from './LocalMallIcon';
|
|
203
|
+
export { LongerIcon } from './LongerIcon';
|
|
203
204
|
export { MapIcon } from './MapIcon';
|
|
204
205
|
export { MarkAsReadIcon } from './MarkAsReadIcon';
|
|
205
206
|
export { MarketingHub30Icon } from './MarketingHub30Icon';
|
|
@@ -200,6 +200,7 @@ export { LinkManagementIcon } from './LinkManagementIcon';
|
|
|
200
200
|
export { ListIcon } from './ListIcon';
|
|
201
201
|
export { LoadingIcon } from './LoadingIcon';
|
|
202
202
|
export { LocalMallIcon } from './LocalMallIcon';
|
|
203
|
+
export { LongerIcon } from './LongerIcon';
|
|
203
204
|
export { MapIcon } from './MapIcon';
|
|
204
205
|
export { MarkAsReadIcon } from './MarkAsReadIcon';
|
|
205
206
|
export { MarketingHub30Icon } from './MarketingHub30Icon';
|
|
@@ -45,11 +45,13 @@ const { t } = i18nInstance;
|
|
|
45
45
|
const { Text } = Typography;
|
|
46
46
|
export function MatchesAny(props) {
|
|
47
47
|
// Props
|
|
48
|
-
const { objectName, loading = false, showExtendValue = true, items, groupSelectProps, renderExtraValues, customItemRenders, onApply = () => { }, onCancel = () => { }, onLoadMore = () => { }, onChangeSearch } = props, restOfProps = __rest(props, ["objectName", "loading", "showExtendValue", "items", "groupSelectProps", "renderExtraValues", "customItemRenders", "onApply", "onCancel", "onLoadMore", "onChangeSearch"]);
|
|
48
|
+
const { objectName, loading = false, showExtendValue = true, items, groupSelectProps, renderExtraValues, customItemRenders, listEmptyProps, selectedListEmptyProps, onApply = () => { }, onCancel = () => { }, onLoadMore = () => { }, onChangeSearch } = props, restOfProps = __rest(props, ["objectName", "loading", "showExtendValue", "items", "groupSelectProps", "renderExtraValues", "customItemRenders", "listEmptyProps", "selectedListEmptyProps", "onApply", "onCancel", "onLoadMore", "onChangeSearch"]);
|
|
49
49
|
// State
|
|
50
50
|
const [state, setState] = useState(matchesAnyInitialState);
|
|
51
51
|
// Variables
|
|
52
52
|
const { searchValue, selectedItems, isShowLoadMoreEl } = state;
|
|
53
|
+
const _a = listEmptyProps || {}, { icon: listEmptyIcon, description: listEmptyDescription = t(translations.global.noResultsMatchesKeyWord).toString() } = _a, restListEmptyProps = __rest(_a, ["icon", "description"]);
|
|
54
|
+
const _b = selectedListEmptyProps || {}, { description: selectedListEmptyDescription = t(translations.global.selectItemsFromList).toString(), icon: selectedListEmptyIcon = React.createElement(DataIcon, { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw5, size: 48 }) } = _b, restSelectedListEmptyProps = __rest(_b, ["description", "icon"]);
|
|
53
55
|
// Refs
|
|
54
56
|
const { ref: loadMoreRef } = useIntersectionObserver({
|
|
55
57
|
threshold: 0,
|
|
@@ -267,14 +269,14 @@ export function MatchesAny(props) {
|
|
|
267
269
|
transform: props.expanded ? 'rotate(0)' : 'rotate(-90deg)',
|
|
268
270
|
transition: 'transform 0.3s ease',
|
|
269
271
|
}, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 })) }),
|
|
270
|
-
isShowLoadMoreEl && React.createElement("div", { ref: loadMoreRef }))) : (React.createElement(EmptyData, { showIcon:
|
|
272
|
+
isShowLoadMoreEl && React.createElement("div", { ref: loadMoreRef }))) : (React.createElement(EmptyData, Object.assign({ icon: listEmptyIcon, showIcon: !!listEmptyIcon, description: listEmptyDescription }, restListEmptyProps))))))));
|
|
271
273
|
};
|
|
272
274
|
const renderSelectedList = () => (React.createElement("div", { className: "matches-any__section" },
|
|
273
275
|
React.createElement(Flex, { className: "matches-any__header", justify: "space-between" },
|
|
274
276
|
React.createElement(Text, { strong: true }, `${t(translations.global.selected)} (${(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) || 0})`),
|
|
275
277
|
React.createElement(TextButton, { disabled: isDisableRemoveAll, onClick: onRemoveAll }, t(translations.global.removeAll).toString())),
|
|
276
278
|
React.createElement("div", { className: "matches-any__body" },
|
|
277
|
-
React.createElement(Scrollbars, { style: { height: '100%' } }, !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) ? (React.createElement(EmptyData,
|
|
279
|
+
React.createElement(Scrollbars, { style: { height: '100%' } }, !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) ? (React.createElement(EmptyData, Object.assign({ icon: selectedListEmptyIcon, description: selectedListEmptyDescription }, restSelectedListEmptyProps))) : (React.createElement(StyledTree, { selectable: false, treeData: selectedTreeData, switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
|
|
278
280
|
transform: props.expanded ? 'rotate(0)' : 'rotate(-90deg)',
|
|
279
281
|
transition: 'transform 0.3s ease',
|
|
280
282
|
}, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 })) }))))));
|
|
@@ -307,7 +309,7 @@ export function MatchesAny(props) {
|
|
|
307
309
|
}
|
|
308
310
|
export function MatchesAnySelect(props) {
|
|
309
311
|
var _a, _b, _c;
|
|
310
|
-
const { placeholder = 'Select an item', dropdownStyle, objectName, selectedItems, items, loading, popupClassName, groupSelectProps, renderExtraValues, customItemRenders, popoverProps, onChangeSearch, onChange = () => { }, onLoadMore } = props, restProps = __rest(props, ["placeholder", "dropdownStyle", "objectName", "selectedItems", "items", "loading", "popupClassName", "groupSelectProps", "renderExtraValues", "customItemRenders", "popoverProps", "onChangeSearch", "onChange", "onLoadMore"]);
|
|
312
|
+
const { placeholder = 'Select an item', dropdownStyle, objectName, selectedItems, items, loading, popupClassName, groupSelectProps, renderExtraValues, customItemRenders, popoverProps, listEmptyProps, selectedListEmptyProps, onChangeSearch, onChange = () => { }, onLoadMore } = props, restProps = __rest(props, ["placeholder", "dropdownStyle", "objectName", "selectedItems", "items", "loading", "popupClassName", "groupSelectProps", "renderExtraValues", "customItemRenders", "popoverProps", "listEmptyProps", "selectedListEmptyProps", "onChangeSearch", "onChange", "onLoadMore"]);
|
|
311
313
|
// State
|
|
312
314
|
const [state, setState] = useState(initialState);
|
|
313
315
|
// Variables
|
|
@@ -320,7 +322,7 @@ export function MatchesAnySelect(props) {
|
|
|
320
322
|
onChange(selectedItems);
|
|
321
323
|
setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false })));
|
|
322
324
|
};
|
|
323
|
-
return (React.createElement(Popover, Object.assign({ open: isOpenPopover, arrow: false, placement: "bottomLeft", content: React.createElement(MatchesAny, { className: popupClassName, items: items, selectedItems: selectedItems, loading: loading, objectName: objectName, groupSelectProps: groupSelectProps, renderExtraValues: renderExtraValues, customItemRenders: customItemRenders, onChangeSearch: onChangeSearch, onApply: onApplyMatchesAny, onCancel: () => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false }))), onLoadMore: onLoadMore }), align: {
|
|
325
|
+
return (React.createElement(Popover, Object.assign({ open: isOpenPopover, arrow: false, placement: "bottomLeft", content: React.createElement(MatchesAny, { className: popupClassName, items: items, selectedItems: selectedItems, loading: loading, objectName: objectName, groupSelectProps: groupSelectProps, renderExtraValues: renderExtraValues, customItemRenders: customItemRenders, listEmptyProps: listEmptyProps, selectedListEmptyProps: selectedListEmptyProps, onChangeSearch: onChangeSearch, onApply: onApplyMatchesAny, onCancel: () => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false }))), onLoadMore: onLoadMore }), align: {
|
|
324
326
|
overflow: {
|
|
325
327
|
shiftY: 0,
|
|
326
328
|
shiftX: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TreeDataNode } from 'antd';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import type { SelectProps } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
3
|
+
import type { EmptyDataProps, SelectProps } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
4
4
|
import type { FlexProps, PopoverProps } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
5
5
|
import { PopoverSelectProps } from '../SearchPopover/types';
|
|
6
6
|
export type MatchesAnyItem<TItem = Record<string, any>> = TreeDataNode & {
|
|
@@ -44,6 +44,10 @@ export interface MatchesAnySelectProps<TItem = Record<string, any>> extends Sele
|
|
|
44
44
|
customItemRenders?: CustomItemRenders<TItem>;
|
|
45
45
|
/** Popover Props */
|
|
46
46
|
popoverProps?: Partial<PopoverProps>;
|
|
47
|
+
/** Empty UI for list items */
|
|
48
|
+
listEmptyProps?: EmptyDataProps;
|
|
49
|
+
/** Empty UI for selected list items */
|
|
50
|
+
selectedListEmptyProps?: EmptyDataProps;
|
|
47
51
|
/** Callback function that is called when the selected items change. */
|
|
48
52
|
onChange?: (selectedItems: MatchesAnyItem<TItem>[]) => void;
|
|
49
53
|
/** Callback function that is called when the search value changes */
|
|
@@ -51,7 +55,7 @@ export interface MatchesAnySelectProps<TItem = Record<string, any>> extends Sele
|
|
|
51
55
|
/** Callback function that is called when the user scroll */
|
|
52
56
|
onLoadMore?: () => void;
|
|
53
57
|
}
|
|
54
|
-
export interface MatchesAnyProps<TItem = Record<string, any>> extends Omit<FlexProps, 'children'>, Pick<MatchesAnySelectProps<TItem>, 'objectName' | 'loading' | 'showExtendValue' | 'items' | 'selectedItems' | 'onLoadMore' | 'groupSelectProps' | 'onChangeSearch' | 'renderExtraValues' | 'customItemRenders'> {
|
|
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'> {
|
|
55
59
|
/**
|
|
56
60
|
* Callback function that is called when the apply action is triggered.
|
|
57
61
|
*
|