@canlooks/can-ui 0.0.67 → 0.0.69
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/dist/cjs/components/accordion/accordion.js +2 -2
- package/dist/cjs/components/alert/alert.js +4 -3
- package/dist/cjs/components/anchorList/anchorList.js +26 -20
- package/dist/cjs/components/boundary/errorBoundary.js +2 -2
- package/dist/cjs/components/bubbleConfirm/bubbleConfirm.js +2 -2
- package/dist/cjs/components/calendar/panelYear.js +2 -2
- package/dist/cjs/components/cascade/cascade.js +5 -5
- package/dist/cjs/components/cascade/cascadePanel.js +2 -2
- package/dist/cjs/components/checkboxBase/checkboxBase.js +2 -2
- package/dist/cjs/components/counter/counter.js +3 -3
- package/dist/cjs/components/curd/curd.js +5 -5
- package/dist/cjs/components/curd/curd.style.js +5 -0
- package/dist/cjs/components/curd/curdColumnConfig.js +4 -3
- package/dist/cjs/components/curd/curdDialog.js +2 -2
- package/dist/cjs/components/curd/curdFilter.js +3 -3
- package/dist/cjs/components/curd/curdResizable.js +2 -2
- package/dist/cjs/components/dataGrid/dataGrid.js +3 -2
- package/dist/cjs/components/dataGrid/dataGridHead.js +2 -2
- package/dist/cjs/components/dataGrid/dataGridRows.js +3 -3
- package/dist/cjs/components/dateTimePicker/dateTimePicker.js +3 -3
- package/dist/cjs/components/dialog/dialog.js +2 -2
- package/dist/cjs/components/drawer/drawer.js +2 -2
- package/dist/cjs/components/gallery/gallery.js +7 -7
- package/dist/cjs/components/image/image.d.ts +1 -1
- package/dist/cjs/components/image/image.js +5 -4
- package/dist/cjs/components/inputBase/inputBase.js +2 -2
- package/dist/cjs/components/menu/menu.js +2 -2
- package/dist/cjs/components/menuItem/menuItem.js +2 -2
- package/dist/cjs/components/overlayBase/overlayBase.d.ts +3 -1
- package/dist/cjs/components/overlayBase/overlayBase.js +5 -5
- package/dist/cjs/components/pagination/pager.js +3 -3
- package/dist/cjs/components/palette/palette.js +2 -2
- package/dist/cjs/components/pickerDialog/pickerDialog.js +2 -2
- package/dist/cjs/components/pinchable/pinchable.js +7 -0
- package/dist/cjs/components/popper/popper.d.ts +3 -1
- package/dist/cjs/components/popper/popper.js +6 -6
- package/dist/cjs/components/progress/progress.js +7 -5
- package/dist/cjs/components/rating/rating.js +2 -2
- package/dist/cjs/components/select/select.js +3 -3
- package/dist/cjs/components/snackbarBase/snackbarBase.d.ts +3 -2
- package/dist/cjs/components/snackbarBase/snackbarBase.js +6 -6
- package/dist/cjs/components/stepper/step.js +5 -5
- package/dist/cjs/components/tabs/tabsEllipsis.js +2 -2
- package/dist/cjs/components/tag/tag.js +2 -2
- package/dist/cjs/components/theme/themeVariables.d.ts +1 -0
- package/dist/cjs/components/theme/themeVariables.js +1 -0
- package/dist/cjs/components/touchRipple/index.d.ts +1 -0
- package/dist/cjs/components/touchRipple/index.js +1 -0
- package/dist/cjs/components/touchRipple/touchRipple.d.ts +6 -14
- package/dist/cjs/components/touchRipple/touchRipple.js +54 -39
- package/dist/cjs/components/touchRipple/touchRipple.style.js +25 -27
- package/dist/cjs/components/transfer/transfer.js +5 -5
- package/dist/cjs/components/transfer/transferPanel.js +2 -1
- package/dist/cjs/components/tree/tree.js +2 -2
- package/dist/cjs/components/tree/treeNode.js +2 -2
- package/dist/cjs/components/treeSelect/treeSelect.js +2 -2
- package/dist/cjs/components/typography/typography.js +4 -4
- package/dist/cjs/components/upload/dropArea.js +2 -2
- package/dist/cjs/components/upload/fileItem.js +5 -5
- package/dist/cjs/components/upload/imageItem.js +3 -3
- package/dist/cjs/components/upload/upload.js +5 -5
- package/dist/cjs/components/waterfall/waterfallItem.js +1 -1
- package/dist/cjs/extensions/documentViewer/documentViewer.js +4 -3
- package/dist/cjs/extensions/documentViewer/documentViewer.style.js +2 -1
- package/dist/cjs/extensions/documentViewer/svgViewer.d.ts +2 -2
- package/dist/cjs/extensions/documentViewer/svgViewer.js +13 -9
- package/dist/cjs/utils/hooks.d.ts +8 -0
- package/dist/cjs/utils/hooks.js +22 -0
- package/dist/esm/components/accordion/accordion.js +1 -1
- package/dist/esm/components/alert/alert.js +2 -1
- package/dist/esm/components/anchorList/anchorList.js +26 -20
- package/dist/esm/components/boundary/errorBoundary.js +1 -1
- package/dist/esm/components/bubbleConfirm/bubbleConfirm.js +1 -1
- package/dist/esm/components/calendar/panelYear.js +1 -1
- package/dist/esm/components/cascade/cascade.js +3 -3
- package/dist/esm/components/cascade/cascadePanel.js +1 -1
- package/dist/esm/components/checkboxBase/checkboxBase.js +1 -1
- package/dist/esm/components/counter/counter.js +1 -1
- package/dist/esm/components/curd/curd.js +1 -1
- package/dist/esm/components/curd/curd.style.js +5 -0
- package/dist/esm/components/curd/curdColumnConfig.js +3 -2
- package/dist/esm/components/curd/curdDialog.js +1 -1
- package/dist/esm/components/curd/curdFilter.js +1 -1
- package/dist/esm/components/curd/curdResizable.js +1 -1
- package/dist/esm/components/dataGrid/dataGrid.js +3 -2
- package/dist/esm/components/dataGrid/dataGridHead.js +1 -1
- package/dist/esm/components/dataGrid/dataGridRows.js +1 -1
- package/dist/esm/components/dateTimePicker/dateTimePicker.js +1 -1
- package/dist/esm/components/dialog/dialog.js +1 -1
- package/dist/esm/components/drawer/drawer.js +1 -1
- package/dist/esm/components/gallery/gallery.js +3 -3
- package/dist/esm/components/image/image.d.ts +1 -1
- package/dist/esm/components/image/image.js +3 -2
- package/dist/esm/components/inputBase/inputBase.js +1 -1
- package/dist/esm/components/menu/menu.js +2 -2
- package/dist/esm/components/menuItem/menuItem.js +1 -1
- package/dist/esm/components/overlayBase/overlayBase.d.ts +3 -1
- package/dist/esm/components/overlayBase/overlayBase.js +6 -6
- package/dist/esm/components/pagination/pager.js +1 -1
- package/dist/esm/components/palette/palette.js +1 -1
- package/dist/esm/components/pickerDialog/pickerDialog.js +1 -1
- package/dist/esm/components/pinchable/pinchable.js +7 -0
- package/dist/esm/components/popper/popper.d.ts +3 -1
- package/dist/esm/components/popper/popper.js +7 -7
- package/dist/esm/components/progress/progress.js +5 -3
- package/dist/esm/components/rating/rating.js +1 -1
- package/dist/esm/components/select/select.js +1 -1
- package/dist/esm/components/snackbarBase/snackbarBase.d.ts +3 -2
- package/dist/esm/components/snackbarBase/snackbarBase.js +5 -5
- package/dist/esm/components/stepper/step.js +1 -1
- package/dist/esm/components/tabs/tabsEllipsis.js +1 -1
- package/dist/esm/components/tag/tag.js +1 -1
- package/dist/esm/components/theme/themeVariables.d.ts +1 -0
- package/dist/esm/components/theme/themeVariables.js +1 -0
- package/dist/esm/components/touchRipple/index.d.ts +1 -0
- package/dist/esm/components/touchRipple/index.js +1 -0
- package/dist/esm/components/touchRipple/touchRipple.d.ts +6 -14
- package/dist/esm/components/touchRipple/touchRipple.js +54 -39
- package/dist/esm/components/touchRipple/touchRipple.style.js +25 -27
- package/dist/esm/components/transfer/transfer.js +3 -3
- package/dist/esm/components/transfer/transferPanel.js +2 -1
- package/dist/esm/components/tree/tree.js +1 -1
- package/dist/esm/components/tree/treeNode.js +1 -1
- package/dist/esm/components/treeSelect/treeSelect.js +1 -1
- package/dist/esm/components/typography/typography.js +1 -1
- package/dist/esm/components/upload/dropArea.js +1 -1
- package/dist/esm/components/upload/fileItem.js +1 -1
- package/dist/esm/components/upload/imageItem.js +1 -1
- package/dist/esm/components/upload/upload.js +3 -3
- package/dist/esm/components/waterfall/waterfallItem.js +2 -2
- package/dist/esm/extensions/documentViewer/documentViewer.js +2 -1
- package/dist/esm/extensions/documentViewer/documentViewer.style.js +2 -1
- package/dist/esm/extensions/documentViewer/svgViewer.d.ts +2 -2
- package/dist/esm/extensions/documentViewer/svgViewer.js +12 -8
- package/dist/esm/utils/hooks.d.ts +8 -0
- package/dist/esm/utils/hooks.js +21 -0
- package/documentation/dist/assets/{index-GiFWv3kZ.js → index-DvrKS6Tv.js} +2978 -2957
- package/documentation/dist/index.html +1 -1
- package/package.json +1 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RefObject, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { DefineElement } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* 获取渲染前的值
|
|
4
5
|
* @param value
|
|
@@ -48,3 +49,10 @@ export declare function useLoading<A extends any[], R>(fn: (...args: A) => R | P
|
|
|
48
49
|
(...args: A) => Promise<R>,
|
|
49
50
|
Dispatch<SetStateAction<boolean>>
|
|
50
51
|
];
|
|
52
|
+
/**
|
|
53
|
+
* 获取容器元素,通常用于`container`或`effectContainer`属性
|
|
54
|
+
* @param container
|
|
55
|
+
* @param effectContainer
|
|
56
|
+
* @param defaultContainer 默认为`document.body`
|
|
57
|
+
*/
|
|
58
|
+
export declare function useContainer<T extends HTMLElement | null>(container?: DefineElement<T>, effectContainer?: DefineElement<T>, defaultContainer?: T): RefObject<T>;
|
package/dist/cjs/utils/hooks.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.useDerivedState = useDerivedState;
|
|
|
8
8
|
exports.useUnmounted = useUnmounted;
|
|
9
9
|
exports.useControlled = useControlled;
|
|
10
10
|
exports.useLoading = useLoading;
|
|
11
|
+
exports.useContainer = useContainer;
|
|
11
12
|
const react_1 = require("react");
|
|
12
13
|
const utils_1 = require("./utils");
|
|
13
14
|
/**
|
|
@@ -123,3 +124,24 @@ function useLoading(fn, referredLoading = false) {
|
|
|
123
124
|
setLoading
|
|
124
125
|
];
|
|
125
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* 获取容器元素,通常用于`container`或`effectContainer`属性
|
|
129
|
+
* @param container
|
|
130
|
+
* @param effectContainer
|
|
131
|
+
* @param defaultContainer 默认为`document.body`
|
|
132
|
+
*/
|
|
133
|
+
function useContainer(container, effectContainer, defaultContainer = document.body) {
|
|
134
|
+
const [containerEl, setContainerEl] = useDerivedState(prev => {
|
|
135
|
+
if (container) {
|
|
136
|
+
return typeof container === 'function' ? container() : container;
|
|
137
|
+
}
|
|
138
|
+
return prev || defaultContainer;
|
|
139
|
+
}, [container, defaultContainer]);
|
|
140
|
+
(0, react_1.useEffect)(() => {
|
|
141
|
+
if (effectContainer) {
|
|
142
|
+
const el = typeof effectContainer === 'function' ? effectContainer() : effectContainer;
|
|
143
|
+
setContainerEl(el);
|
|
144
|
+
}
|
|
145
|
+
}, []);
|
|
146
|
+
return containerEl;
|
|
147
|
+
}
|
|
@@ -3,7 +3,7 @@ import { classes, style } from './accordion.style';
|
|
|
3
3
|
import { clsx, useControlled } from '../../utils';
|
|
4
4
|
import { useTheme } from '../theme';
|
|
5
5
|
import { Collapse } from '../transitionBase';
|
|
6
|
-
import { Icon } from '
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
7
|
import { faCaretRight } from '@fortawesome/free-solid-svg-icons/faCaretRight';
|
|
8
8
|
export function Accordion({ size, title, prefix, suffix, expandIcon, defaultExpanded = false, expanded, onExpandedChange, readOnly, disabled, ...props }) {
|
|
9
9
|
const theme = useTheme();
|
|
@@ -5,7 +5,8 @@ import { classes, useStyle } from './alert.style';
|
|
|
5
5
|
import { Button } from '../button';
|
|
6
6
|
import { Skeleton } from '../skeleton';
|
|
7
7
|
import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark';
|
|
8
|
-
import { Icon
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
|
+
import { statusMapToIconDefinition } from '../status';
|
|
9
10
|
export const Alert = memo(({ variant = 'standard', status = 'error', color = status, showIcon = true, icon, title, description, prefix, suffix, closable, onClose, loading, ...props }) => {
|
|
10
11
|
return (_jsxs("div", { ...props, css: useStyle({ color: color || 'error' }), className: clsx(classes.root, props.className), "data-variant": variant, children: [showIcon &&
|
|
11
12
|
_jsx("div", { className: classes.icon, children: loading
|
|
@@ -18,10 +18,11 @@ export const AnchorList = memo(({ anchors, renderAnchorItem, indent = 24, scroll
|
|
|
18
18
|
});
|
|
19
19
|
const scrollToId = (id) => {
|
|
20
20
|
const targetEl = document.getElementById(id);
|
|
21
|
-
|
|
21
|
+
const scrollerEl = getScroller();
|
|
22
|
+
if (!targetEl || !scrollerEl) {
|
|
22
23
|
return false;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
scrollerEl.scrollTo({
|
|
25
26
|
top: targetEl.offsetTop - offset,
|
|
26
27
|
// 初始化之前无需平滑滚动
|
|
27
28
|
behavior: initialized.current ? scrollBehavior : 'instant'
|
|
@@ -50,29 +51,34 @@ export const AnchorList = memo(({ anchors, renderAnchorItem, indent = 24, scroll
|
|
|
50
51
|
* 监听滚动设置高亮
|
|
51
52
|
*/
|
|
52
53
|
const getScroller = () => {
|
|
53
|
-
|
|
54
|
+
if (scroller) {
|
|
55
|
+
return typeof scroller === 'function' ? scroller() : scroller;
|
|
56
|
+
}
|
|
57
|
+
return document.documentElement;
|
|
54
58
|
};
|
|
55
59
|
const [activeId, setActiveId] = useSyncState();
|
|
56
60
|
useEffect(() => {
|
|
57
61
|
const scrollerEl = getScroller();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
minDistance
|
|
68
|
-
|
|
62
|
+
if (scrollerEl) {
|
|
63
|
+
const scroll = () => {
|
|
64
|
+
let nearest;
|
|
65
|
+
let minDistance = Infinity;
|
|
66
|
+
const targets = anchors?.map(item => document.getElementById(item.id));
|
|
67
|
+
targets?.forEach(target => {
|
|
68
|
+
const top = target?.getBoundingClientRect().top;
|
|
69
|
+
if (typeof top === 'number') {
|
|
70
|
+
const distance = Math.abs(top - offset);
|
|
71
|
+
if (distance < minDistance) {
|
|
72
|
+
minDistance = distance;
|
|
73
|
+
nearest = target;
|
|
74
|
+
}
|
|
69
75
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
});
|
|
77
|
+
nearest && setActiveId(nearest.id);
|
|
78
|
+
};
|
|
79
|
+
!activeId.current && scroll();
|
|
80
|
+
return listenAllPredecessorsScroll(scrollerEl === document.documentElement ? document : scrollerEl, scroll);
|
|
81
|
+
}
|
|
76
82
|
}, [anchors, scroller, offset]);
|
|
77
83
|
const [animating, setAnimating] = useDerivedState(prev => typeof prev !== 'undefined', [activeId.current]);
|
|
78
84
|
return (_jsxs(Flex, { direction: "column", alignItems: "flex-start", ...props, css: style, className: clsx(classes.root, props.className), "data-animating": animating.current, children: [anchors?.map(item => {
|
|
@@ -4,7 +4,7 @@ import { clsx } from '../../utils';
|
|
|
4
4
|
import { classes, style } from './errorBoundary.style';
|
|
5
5
|
import { Placeholder } from '../placeholder';
|
|
6
6
|
import { Button } from '../button';
|
|
7
|
-
import { Icon } from '
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
8
|
import { faRotateRight } from '@fortawesome/free-solid-svg-icons/faRotateRight';
|
|
9
9
|
const placeholderSlots = {
|
|
10
10
|
description: 'pre'
|
|
@@ -4,7 +4,7 @@ import { classes, style } from './bubbleConfirm.style';
|
|
|
4
4
|
import { clsx, useControlled, useLoading } from '../../utils';
|
|
5
5
|
import { Button } from '../button';
|
|
6
6
|
import { useTheme } from '../theme';
|
|
7
|
-
import { Icon } from '
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
8
|
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons/faCircleQuestion';
|
|
9
9
|
export function BubbleConfirm({ icon = _jsx(Icon, { icon: faCircleQuestion }), title, footer, showArrow = true, offset, loading = false, onConfirm, defaultOpen = false, open, onOpenChange, ...props }) {
|
|
10
10
|
const { spacing } = useTheme();
|
|
@@ -3,7 +3,7 @@ import { memo, useState } from 'react';
|
|
|
3
3
|
import { classes } from './calendar.style';
|
|
4
4
|
import { Button } from '../button';
|
|
5
5
|
import { Tooltip } from '../tooltip';
|
|
6
|
-
import { Icon } from '
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
7
|
import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft';
|
|
8
8
|
import { faAngleRight } from '@fortawesome/free-solid-svg-icons/faAngleRight';
|
|
9
9
|
export const PanelYear = memo(({ innerD, setInnerD, onSelected, min, max }) => {
|
|
@@ -9,14 +9,14 @@ import { classes, cascadePopperStyle, style } from './cascade.style';
|
|
|
9
9
|
import { CascadePanel } from './cascadePanel';
|
|
10
10
|
import { SearchResult } from './searchResult';
|
|
11
11
|
import { useSelection } from '../selectionContext';
|
|
12
|
-
import { Icon } from '
|
|
12
|
+
import { Icon } from '../icon';
|
|
13
13
|
import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons/faMagnifyingGlass';
|
|
14
14
|
import { faCaretDown } from '@fortawesome/free-solid-svg-icons/faCaretDown';
|
|
15
15
|
const CascadeContext = createContext({});
|
|
16
16
|
export function useCascadeContext() {
|
|
17
17
|
return useContext(CascadeContext);
|
|
18
18
|
}
|
|
19
|
-
export const Cascade = memo(({ inputProps, defaultOpen = false, open, onOpenChange, children, loadOptions, multiple = false, showCheckbox = !!multiple, defaultValue
|
|
19
|
+
export const Cascade = memo(({ inputProps, defaultOpen = false, open, onOpenChange, children, loadOptions, multiple = false, showCheckbox = !!multiple, defaultValue, value, onChange, renderBackfill, searchable, defaultSearchValue = '', searchValue, onSearchChange, searchInputProps, popperProps, popperRef, clearable = !!multiple, integration = 'deepest',
|
|
20
20
|
// 共享属性,从OptionsBaseSharedProps继承
|
|
21
21
|
loading, options, labelKey = 'label', primaryKey = 'value', childrenKey = 'children', searchTokenKey = 'searchToken', ...props }) => {
|
|
22
22
|
/**
|
|
@@ -75,7 +75,7 @@ loading, options, labelKey = 'label', primaryKey = 'value', childrenKey = 'child
|
|
|
75
75
|
* --------------------------------------------------------------------
|
|
76
76
|
* 控制选中状态
|
|
77
77
|
*/
|
|
78
|
-
const [pathifiedValue, setPathifiedValue] = useControlled(defaultValue, value, onChange);
|
|
78
|
+
const [pathifiedValue, setPathifiedValue] = useControlled(defaultValue || [], value, onChange);
|
|
79
79
|
// 路径转单一键
|
|
80
80
|
const toStandardValue = (path) => {
|
|
81
81
|
if (!path) {
|
|
@@ -7,7 +7,7 @@ import { classes } from './cascade.style';
|
|
|
7
7
|
import { Collapse } from '../transitionBase';
|
|
8
8
|
import { useCascadeContext } from './cascade';
|
|
9
9
|
import { isUnset } from '../../utils';
|
|
10
|
-
import { Icon } from '
|
|
10
|
+
import { Icon } from '../icon';
|
|
11
11
|
import { faChevronRight } from '@fortawesome/free-solid-svg-icons/faChevronRight';
|
|
12
12
|
export function CascadePanel({ options, index = 0 }) {
|
|
13
13
|
const { innerLoading, loadingOption, multiple, showCheckbox, primaryKey, labelKey, childrenKey, pathifiedValue, selectionStatus, optionsMap, openedPanels, onOptionClick, onCheckboxClick, verticalIndex, setVerticalIndex, horizontalIndex } = useCascadeContext();
|
|
@@ -3,7 +3,7 @@ import { memo, useRef } from 'react';
|
|
|
3
3
|
import { clsx, cloneRef, useControlled, useTouchSpread } from '../../utils';
|
|
4
4
|
import { classes, useStyle } from './checkboxBase.style';
|
|
5
5
|
import { useCheckboxBaseGroupContext } from '../checkboxBaseGroup';
|
|
6
|
-
import { Icon } from '
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
7
|
import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';
|
|
8
8
|
export const CheckboxBase = memo(({ inputProps, _type, size, color, label, value, indeterminate, disabled, readOnly, defaultChecked = false, checked, onChange, ...props }) => {
|
|
9
9
|
const context = useCheckboxBaseGroupContext();
|
|
@@ -5,7 +5,7 @@ import { clsx, useControlled } from '../../utils';
|
|
|
5
5
|
import { Button } from '../button';
|
|
6
6
|
import { Input } from '../input';
|
|
7
7
|
import { Flex } from '../flex';
|
|
8
|
-
import { Icon } from '
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
9
|
import { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';
|
|
10
10
|
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
|
|
11
11
|
export const Counter = memo(({ size, min = -Infinity, max = Infinity, step = 1, precision = 0, defaultValue = 0, value, onChange, decreaseProps, increaseProps, inputProps, ...props }) => {
|
|
@@ -14,7 +14,7 @@ import { CurdDialog } from './curdDialog';
|
|
|
14
14
|
import { useAppContext } from '../app';
|
|
15
15
|
import { BubbleConfirm } from '../bubbleConfirm';
|
|
16
16
|
import { useSelectionContext } from '../selectionContext';
|
|
17
|
-
import { Icon } from '
|
|
17
|
+
import { Icon } from '../icon';
|
|
18
18
|
import { faTrashCan } from '@fortawesome/free-regular-svg-icons/faTrashCan';
|
|
19
19
|
import { faPenToSquare } from '@fortawesome/free-regular-svg-icons/faPenToSquare';
|
|
20
20
|
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { defineInnerClasses, defineCss } from '../../utils';
|
|
3
3
|
import { classes as buttonClasses } from '../button/button.style';
|
|
4
|
+
import { classes as loadingClasses } from '../loading/loading.style';
|
|
4
5
|
export const classes = defineInnerClasses('curd', [
|
|
5
6
|
'filter',
|
|
6
7
|
'filterGridContainer',
|
|
@@ -73,6 +74,10 @@ export const style = defineCss(({ spacing, text, background, borderRadius }) =>
|
|
|
73
74
|
.${classes.card} {
|
|
74
75
|
min-height: 0;
|
|
75
76
|
border-radius: ${borderRadius}px;
|
|
77
|
+
|
|
78
|
+
.${loadingClasses.container} {
|
|
79
|
+
height: 100%;
|
|
80
|
+
}
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
&[data-variant=standard] {
|
|
@@ -9,9 +9,10 @@ import { SortableItem } from '../sortableItem';
|
|
|
9
9
|
import { DndContext } from '@dnd-kit/core';
|
|
10
10
|
import { SortableContext } from '@dnd-kit/sortable';
|
|
11
11
|
import { isUnset, onDndDragEnd, useDndSensors } from '../../utils';
|
|
12
|
-
import { Icon } from '
|
|
12
|
+
import { Icon } from '../icon';
|
|
13
13
|
import { faGear } from '@fortawesome/free-solid-svg-icons/faGear';
|
|
14
|
-
export const CurdColumnConfig = memo(({ columns
|
|
14
|
+
export const CurdColumnConfig = memo(({ columns, innerVisible, setInnerVisible, setInnerOrder, }) => {
|
|
15
|
+
columns ||= [];
|
|
15
16
|
const dragEndHandler = (e) => {
|
|
16
17
|
const newColumns = onDndDragEnd(e, columns, '_key');
|
|
17
18
|
newColumns && setInnerOrder(newColumns.flatMap(col => col._key ?? []));
|
|
@@ -9,7 +9,7 @@ import { Loading } from '../loading';
|
|
|
9
9
|
import { Button } from '../button';
|
|
10
10
|
import { classes, dialogStyle } from './curd.style';
|
|
11
11
|
import { PickerDialog } from '../pickerDialog';
|
|
12
|
-
import { Icon } from '
|
|
12
|
+
import { Icon } from '../icon';
|
|
13
13
|
import { faCopy } from '@fortawesome/free-regular-svg-icons/faCopy';
|
|
14
14
|
export const CurdDialog = memo(({ ref, onFinish, curdProps, ...props }) => {
|
|
15
15
|
const { columns, rowToForm, copyable, titleKey, formProps, formRef, dataName = '', createName = '添加', updateName = '编辑' } = curdProps;
|
|
@@ -8,7 +8,7 @@ import { Grid } from '../grid';
|
|
|
8
8
|
import { Button } from '../button';
|
|
9
9
|
import { Collapse } from '../transitionBase';
|
|
10
10
|
import { useTheme } from '../theme';
|
|
11
|
-
import { Icon } from '
|
|
11
|
+
import { Icon } from '../icon';
|
|
12
12
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown';
|
|
13
13
|
import { faFilter } from '@fortawesome/free-solid-svg-icons/faFilter';
|
|
14
14
|
export const CurdFilter = memo(({ ref, columns, expandable, showButton, renderConditions, buttonProps, onFilter, ...props }) => {
|
|
@@ -4,7 +4,7 @@ import { Tooltip } from '../tooltip';
|
|
|
4
4
|
import { Bubble } from '../bubble';
|
|
5
5
|
import { MenuItem } from '../menuItem';
|
|
6
6
|
import { Button } from '../button';
|
|
7
|
-
import { Icon } from '
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
8
|
import { faArrowsUpDown } from '@fortawesome/free-solid-svg-icons/faArrowsUpDown';
|
|
9
9
|
export const CurdResizable = memo(({ innerSize, setInnerSize }) => {
|
|
10
10
|
return (_jsx(Tooltip, { title: "\u8868\u683C\u5C3A\u5BF8", children: _jsx(Bubble, { placement: "bottom", content: _jsxs(_Fragment, { children: [_jsx(MenuItem, { value: "small", label: "\u5C0F", selected: innerSize === 'small', onClick: () => setInnerSize('small') }), _jsx(MenuItem, { value: "medium", label: "\u4E2D", selected: innerSize === 'medium', onClick: () => setInnerSize('medium') }), _jsx(MenuItem, { value: "large", label: "\u5927", selected: innerSize === 'large', onClick: () => setInnerSize('large') })] }), children: _jsx(Button, { shape: "circular", variant: "text", color: "text.secondary", children: _jsx(Icon, { icon: faArrowsUpDown }) }) }) }));
|
|
@@ -14,7 +14,7 @@ const DataGridContext = createContext({});
|
|
|
14
14
|
export function useDataGridContext() {
|
|
15
15
|
return useContext(DataGridContext);
|
|
16
16
|
}
|
|
17
|
-
export const DataGrid = memo(({ columns, rows, rowProps, primaryKey = 'id', childrenKey = null, defaultOrderColumn, orderColumn, defaultOrderType = 'descend', orderType, onOrderChange, selectable, relation = 'dependent', integration = 'shallowest', allowSelectAll = true, clickRowToSelect = true, selectorProps, indent = 24, renderExpandIcon, defaultExpanded
|
|
17
|
+
export const DataGrid = memo(({ columns, rows, rowProps, primaryKey = 'id', childrenKey = null, defaultOrderColumn, orderColumn, defaultOrderType = 'descend', orderType, onOrderChange, selectable, relation = 'dependent', integration = 'shallowest', allowSelectAll = true, clickRowToSelect = true, selectorProps, indent = 24, renderExpandIcon, defaultExpanded, expanded, onExpandedChange, paginatable = true, paginationProps, renderPagination, loading, emptyPlaceholder, columnResizable = false, size, bordered, striped, tableProps, multiple, defaultValue, value, onChange, ...props }) => {
|
|
18
18
|
/**
|
|
19
19
|
* ---------------------------------------------------------------
|
|
20
20
|
* 选择行
|
|
@@ -61,7 +61,7 @@ export const DataGrid = memo(({ columns, rows, rowProps, primaryKey = 'id', chil
|
|
|
61
61
|
* ---------------------------------------------------------------
|
|
62
62
|
* 展开行
|
|
63
63
|
*/
|
|
64
|
-
const [innerExpanded, setInnerExpanded] = useControlled(defaultExpanded, expanded);
|
|
64
|
+
const [innerExpanded, setInnerExpanded] = useControlled(defaultExpanded || [], expanded);
|
|
65
65
|
const expandedSet = useMemo(() => {
|
|
66
66
|
return new Set(innerExpanded.current);
|
|
67
67
|
}, [innerExpanded.current]);
|
|
@@ -79,6 +79,7 @@ export const DataGrid = memo(({ columns, rows, rowProps, primaryKey = 'id', chil
|
|
|
79
79
|
* ---------------------------------------------------------------
|
|
80
80
|
* 分页
|
|
81
81
|
*/
|
|
82
|
+
paginationProps ||= {};
|
|
82
83
|
const [innerPage, setInnerPage] = useControlled(paginationProps.defaultPage ?? 1, paginationProps.page, paginationProps.onPageChange);
|
|
83
84
|
const [innerPageSize, setInnerPageSize] = useControlled(paginationProps.defaultPageSize ?? 10, paginationProps.pageSize, paginationProps.onPageSizeChange);
|
|
84
85
|
const pageChangeHandler = (page, pageSize) => {
|
|
@@ -6,7 +6,7 @@ import { DataGrid } from './dataGrid';
|
|
|
6
6
|
import { useRenderHead } from './columnResize';
|
|
7
7
|
import { Checkbox } from '../checkbox';
|
|
8
8
|
import { isUnset } from '../../utils';
|
|
9
|
-
import { Icon } from '
|
|
9
|
+
import { Icon } from '../icon';
|
|
10
10
|
import { useSelectionContext } from '../selectionContext';
|
|
11
11
|
import { Tooltip } from '../tooltip';
|
|
12
12
|
import { faCaretDown } from '@fortawesome/free-solid-svg-icons/faCaretDown';
|
|
@@ -9,7 +9,7 @@ import { Radio } from '../radio';
|
|
|
9
9
|
import { TdCell } from '../table';
|
|
10
10
|
import { Button } from '../button';
|
|
11
11
|
import { Collapse } from '../transitionBase';
|
|
12
|
-
import { Icon } from '
|
|
12
|
+
import { Icon } from '../icon';
|
|
13
13
|
import { faMinusSquare } from '@fortawesome/free-regular-svg-icons/faMinusSquare';
|
|
14
14
|
import { faPlusSquare } from '@fortawesome/free-regular-svg-icons/faPlusSquare';
|
|
15
15
|
import { classes } from './dataGrid.style';
|
|
@@ -8,7 +8,7 @@ import dayjs from 'dayjs';
|
|
|
8
8
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
9
9
|
import { Calendar } from '../calendar';
|
|
10
10
|
import { Timer } from './timer';
|
|
11
|
-
import { Icon } from '
|
|
11
|
+
import { Icon } from '../icon';
|
|
12
12
|
import { faCalendar } from '@fortawesome/free-regular-svg-icons/faCalendar';
|
|
13
13
|
import { faClock } from '@fortawesome/free-regular-svg-icons/faClock';
|
|
14
14
|
dayjs.extend(customParseFormat);
|
|
@@ -5,7 +5,7 @@ import { classes, style } from './dialog.style';
|
|
|
5
5
|
import { clsx, cloneRef, useControlled, useEscapeClosable, useLoading } from '../../utils';
|
|
6
6
|
import { Button } from '../button';
|
|
7
7
|
import { Draggable } from '../draggable';
|
|
8
|
-
import { Icon } from '
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
9
|
import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark';
|
|
10
10
|
export function Dialog({ ref, icon, title, footer, prefix, suffix, width = 420, minWidth, maxWidth = '100%', showClose = true, closeProps, showConfirm = true, confirmText = '确 定', confirmProps, onConfirm, confirmLoading = false, showCancel = true, cancelText = '取 消', cancelProps, onCancel, draggable = true, maskClosable = true, escapeClosable = true, defaultOpen = false, open, onClose, ...props }) {
|
|
11
11
|
const [innerOpen, _setInnerOpen] = useControlled(defaultOpen, open);
|
|
@@ -5,7 +5,7 @@ import { clsx, useControlled } from '../../utils';
|
|
|
5
5
|
import { OverlayBase } from '../overlayBase';
|
|
6
6
|
import { Button } from '../button';
|
|
7
7
|
import { Slide } from '../transitionBase';
|
|
8
|
-
import { Icon } from '
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
9
|
import { faAnglesRight } from '@fortawesome/free-solid-svg-icons/faAnglesRight';
|
|
10
10
|
const placementToDirection = {
|
|
11
11
|
left: 'right',
|
|
@@ -5,7 +5,7 @@ import { clsx, cubicBezier, range, toArray, useControlled, useDraggable, useSync
|
|
|
5
5
|
import { classes, style } from './gallery.style';
|
|
6
6
|
import { Button } from '../button';
|
|
7
7
|
import { Tooltip } from '../tooltip';
|
|
8
|
-
import { Icon } from '
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
9
|
import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark';
|
|
10
10
|
import { faExpand } from '@fortawesome/free-solid-svg-icons/faExpand';
|
|
11
11
|
import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft';
|
|
@@ -22,8 +22,8 @@ const commonControlProps = {
|
|
|
22
22
|
color: 'text'
|
|
23
23
|
};
|
|
24
24
|
const bounceBezier = cubicBezier(0, 0, 0, 1);
|
|
25
|
-
export const Gallery = memo(({ src
|
|
26
|
-
const srcArr = useSync(toArray(src));
|
|
25
|
+
export const Gallery = memo(({ src, defaultIndex = 0, index, onIndexChange, defaultOpen = false, open, onOpenChange, showRotation = true, showZoom = true, showClose = true, renderControl, bounceElementTranslate = 24, bounceDragDistance = 240, effectiveSpeed = 450, ...props }) => {
|
|
26
|
+
const srcArr = useSync(toArray(src || []));
|
|
27
27
|
const [innerOpen, setInnerOpen] = useControlled(defaultOpen, open, onOpenChange);
|
|
28
28
|
const close = () => {
|
|
29
29
|
setInnerOpen(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode, JSX, ReactElement } from 'react';
|
|
2
2
|
import { DivProps } from '../../types';
|
|
3
|
-
import { Gallery, ImagePreviewProps } from '../gallery
|
|
3
|
+
import { Gallery, ImagePreviewProps } from '../gallery';
|
|
4
4
|
export interface ImageProps extends DivProps {
|
|
5
5
|
src?: string;
|
|
6
6
|
fallback?: string;
|
|
@@ -2,8 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import { memo, useRef } from 'react';
|
|
3
3
|
import { classes, style } from './image.style';
|
|
4
4
|
import { clsx, cloneRef, useControlled, useDerivedState } from '../../utils';
|
|
5
|
-
import { Gallery } from '../gallery
|
|
6
|
-
import { Icon
|
|
5
|
+
import { Gallery } from '../gallery';
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
import { Skeleton } from '../skeleton';
|
|
7
8
|
import { faEye } from '@fortawesome/free-regular-svg-icons/faEye';
|
|
8
9
|
export const Image = memo(({ src, fallback, onLoad, onError, renderLoading, alt = '', width, height, objectFit = 'cover', objectPosition = 'center', imgProps, actions, previewable = true, previewProps, onPreview, ...props }) => {
|
|
9
10
|
const imgRef = useRef(null);
|
|
@@ -5,7 +5,7 @@ import { clsx, fixInputNumber, useControlled } from '../../utils';
|
|
|
5
5
|
import { useTheme } from '../theme';
|
|
6
6
|
import { Button } from '../button';
|
|
7
7
|
import { LoadingIndicator } from '../loadingIndicator';
|
|
8
|
-
import { Icon } from '
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
9
|
import { faCircleXmark } from '@fortawesome/free-solid-svg-icons/faCircleXmark';
|
|
10
10
|
export const InputBase = (({ variant = 'outlined', size, shape, color = 'primary', children, prefix, suffix, onClear, loading, type, clearable = type !== 'number',
|
|
11
11
|
// 以下属性传递给<input/>
|
|
@@ -12,10 +12,10 @@ export function useMenuContext() {
|
|
|
12
12
|
const { size = theme.size, ellipsis = true, indent = theme.spacing[8], ...context } = useContext(MenuContext);
|
|
13
13
|
return { size, ellipsis, indent, ...context };
|
|
14
14
|
}
|
|
15
|
-
export const Menu = memo(({ items, primaryKey = 'value', labelKey = 'label', childrenKey = 'children', defaultExpanded
|
|
15
|
+
export const Menu = memo(({ items, primaryKey = 'value', labelKey = 'label', childrenKey = 'children', defaultExpanded, expanded, onExpandedChange, multiple, defaultValue, value, onChange,
|
|
16
16
|
// 以下属性传递给<MenuItem/>
|
|
17
17
|
size = 'large', showCheckbox, ellipsis, indent, ...props }) => {
|
|
18
|
-
const [innerExpanded, setInnerExpanded] = useControlled(defaultExpanded, expanded);
|
|
18
|
+
const [innerExpanded, setInnerExpanded] = useControlled(defaultExpanded || [], expanded);
|
|
19
19
|
const expandedSet = useMemo(() => {
|
|
20
20
|
return new Set(innerExpanded.current);
|
|
21
21
|
}, [innerExpanded.current]);
|
|
@@ -6,7 +6,7 @@ import { Checkbox } from '../checkbox';
|
|
|
6
6
|
import { usePopperContext } from '../popper';
|
|
7
7
|
import { useMenuContext } from '../menu';
|
|
8
8
|
import { Collapse } from '../transitionBase';
|
|
9
|
-
import { Icon } from '
|
|
9
|
+
import { Icon } from '../icon';
|
|
10
10
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown';
|
|
11
11
|
export const MenuItem = memo(({ value, size, color = 'primary', emphasized = false, selected, focused = false, disabled = false, showCheckbox, checkboxProps, ellipsis, prefix, label, suffix, searchToken, _level = 0, indent, expandIcon, defaultExpanded = false, expanded, onExpandedChange, ...props }) => {
|
|
12
12
|
const context = useMenuContext();
|
|
@@ -4,6 +4,8 @@ import { TransitionBaseProps } from '../transitionBase';
|
|
|
4
4
|
export interface OverlayBaseProps extends DivProps {
|
|
5
5
|
/** 模态的容器元素,默认为document.body */
|
|
6
6
|
container?: DefineElement<HTMLElement>;
|
|
7
|
+
/** 同{@link container},但会在useEffect后取值,且只会执行一次 */
|
|
8
|
+
effectContainer?: DefineElement<HTMLElement>;
|
|
7
9
|
/**
|
|
8
10
|
* @enum {true} 跟随父组件强制渲染
|
|
9
11
|
* @enum {false} 打开时渲染,关闭后销毁
|
|
@@ -22,4 +24,4 @@ export interface OverlayBaseProps extends DivProps {
|
|
|
22
24
|
removeFocusOnOpen?: boolean;
|
|
23
25
|
}
|
|
24
26
|
export declare const overlayBaseTransitionDuration = 300;
|
|
25
|
-
export declare function OverlayBase({ container, forceRender, open, onMaskClick, singleLayer, onOpened, onClosed, maskProps, removeFocusOnOpen, ...props }: OverlayBaseProps): false | React.ReactPortal;
|
|
27
|
+
export declare function OverlayBase({ container, effectContainer, forceRender, open, onMaskClick, singleLayer, onOpened, onClosed, maskProps, removeFocusOnOpen, ...props }: OverlayBaseProps): false | React.ReactPortal;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { classes, style } from './overlayBase.style';
|
|
4
|
-
import { clsx, useDerivedState } from '../../utils';
|
|
4
|
+
import { clsx, useContainer, useDerivedState } from '../../utils';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
import { Fade } from '../transitionBase';
|
|
7
7
|
export const overlayBaseTransitionDuration = 300;
|
|
8
|
-
export function OverlayBase({ container, forceRender, open, onMaskClick, singleLayer, onOpened, onClosed, maskProps, removeFocusOnOpen = true, ...props }) {
|
|
8
|
+
export function OverlayBase({ container, effectContainer, forceRender, open, onMaskClick, singleLayer, onOpened, onClosed, maskProps, removeFocusOnOpen = true, ...props }) {
|
|
9
9
|
const [shouldRender, setShouldRender] = useDerivedState((prev = false) => {
|
|
10
10
|
if (open) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
return forceRender === true || prev;
|
|
14
14
|
}, [open, forceRender]);
|
|
15
|
-
const containerEl = (
|
|
15
|
+
const containerEl = useContainer(container, effectContainer);
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
if (!open) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
removeFocusOnOpen && document.activeElement?.blur?.();
|
|
21
|
-
containerEl.style.overflow = 'hidden';
|
|
21
|
+
containerEl.current.style.overflow = 'hidden';
|
|
22
22
|
return () => {
|
|
23
|
-
containerEl.style.overflow = '';
|
|
23
|
+
containerEl.current.style.overflow = '';
|
|
24
24
|
};
|
|
25
25
|
}, [open]);
|
|
26
26
|
const clickHandler = (e) => {
|
|
@@ -36,5 +36,5 @@ export function OverlayBase({ container, forceRender, open, onMaskClick, singleL
|
|
|
36
36
|
onClosed?.();
|
|
37
37
|
forceRender === false && setShouldRender(false);
|
|
38
38
|
};
|
|
39
|
-
return shouldRender.current && createPortal(_jsxs("div", { ...props, css: style, className: clsx(classes.root, props.className), "data-open": open, "data-custom-container": containerEl !== document.body, children: [_jsx(Fade, { timeout: overlayBaseTransitionDuration, ...maskProps, in: open, className: clsx(classes.mask, maskProps?.className), onClick: clickHandler, onEntered: onEntered, onExited: onExited }), props.children] }), containerEl);
|
|
39
|
+
return shouldRender.current && createPortal(_jsxs("div", { ...props, css: style, className: clsx(classes.root, props.className), "data-open": open, "data-custom-container": containerEl.current !== document.body, children: [_jsx(Fade, { timeout: overlayBaseTransitionDuration, ...maskProps, in: open, className: clsx(classes.mask, maskProps?.className), onClick: clickHandler, onEntered: onEntered, onExited: onExited }), props.children] }), containerEl.current);
|
|
40
40
|
}
|
|
@@ -5,7 +5,7 @@ import { classes } from './pagination.style';
|
|
|
5
5
|
import { usePaginationContext } from './pagination';
|
|
6
6
|
import { clsx } from '../../utils';
|
|
7
7
|
import { useTheme } from '../theme';
|
|
8
|
-
import { Icon } from '
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
9
|
import { faEllipsis } from '@fortawesome/free-solid-svg-icons/faEllipsis';
|
|
10
10
|
import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft';
|
|
11
11
|
import { faAngleRight } from '@fortawesome/free-solid-svg-icons/faAngleRight';
|
|
@@ -7,7 +7,7 @@ import { Slider } from '../slider';
|
|
|
7
7
|
import Color from 'color';
|
|
8
8
|
import { Button } from '../button';
|
|
9
9
|
import { ColorValueInput } from './colorValueInput';
|
|
10
|
-
import { Icon } from '
|
|
10
|
+
import { Icon } from '../icon';
|
|
11
11
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown';
|
|
12
12
|
const sliderProps = {
|
|
13
13
|
railSize: 9,
|
|
@@ -7,7 +7,7 @@ import { SelectionContext } from '../selectionContext';
|
|
|
7
7
|
import { Divider } from '../divider';
|
|
8
8
|
import { SelectedList } from '../selectedList';
|
|
9
9
|
import { Button } from '../button';
|
|
10
|
-
import { Icon } from '
|
|
10
|
+
import { Icon } from '../icon';
|
|
11
11
|
import { faTrashCan } from '@fortawesome/free-regular-svg-icons/faTrashCan';
|
|
12
12
|
export const PickerDialog = (({ ref, dialogRef, multiple, children, showSelectedList = !!multiple, selectedListPlacement = 'right', selectedListProps, selectedItemProps, onConfirm, rows, nodes,
|
|
13
13
|
// 以下属性从SelectionContextBaseProps继承
|
|
@@ -140,6 +140,12 @@ export const Pinchable = (({ component: Component = 'div', ref, gestureOptions,
|
|
|
140
140
|
resetZoom();
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
+
const wheelHandler = (e) => {
|
|
144
|
+
childrenProps.onMouseWheel?.(e);
|
|
145
|
+
e.deltaY > 0
|
|
146
|
+
? zoomFn(innerScale.current * .8, e.clientX, e.clientY)
|
|
147
|
+
: zoomFn(innerScale.current * 1.2, e.clientX, e.clientY);
|
|
148
|
+
};
|
|
143
149
|
return (_jsx(Component, { ...props, ref: wrapperRef, css: style, className: clsx(classes.root, props.className), ...pinchableHandles, children: cloneElement(children, {
|
|
144
150
|
ref: cloneRef(contentRef, childrenProps.ref),
|
|
145
151
|
className: clsx(classes.content, childrenProps.className),
|
|
@@ -152,6 +158,7 @@ export const Pinchable = (({ component: Component = 'div', ref, gestureOptions,
|
|
|
152
158
|
},
|
|
153
159
|
...draggableHandles,
|
|
154
160
|
onDoubleClick: doubleClickHandler,
|
|
161
|
+
onWheel: wheelHandler,
|
|
155
162
|
onTransitionEnd: e => e.currentTarget.dataset.transition = 'false'
|
|
156
163
|
}) }));
|
|
157
164
|
});
|
|
@@ -7,6 +7,8 @@ export interface PopperProps extends Omit<DivProps, 'content' | 'children'> {
|
|
|
7
7
|
anchorElement?: DefineElement<HTMLElement>;
|
|
8
8
|
/** 弹框渲染的容器元素,默认为{@link document.body} */
|
|
9
9
|
container?: DefineElement<HTMLElement>;
|
|
10
|
+
/** 同{@link container},但会在useEffect后取值,且只会执行一次 */
|
|
11
|
+
effectContainer?: DefineElement<HTMLElement>;
|
|
10
12
|
/** 汽泡里的内容 */
|
|
11
13
|
content?: ReactNode;
|
|
12
14
|
/** 弹框偏离元素的距离 */
|
|
@@ -46,4 +48,4 @@ export interface PopperRef extends HTMLDivElement {
|
|
|
46
48
|
openAnimation?: boolean;
|
|
47
49
|
}, beforeOpen?: () => void): void;
|
|
48
50
|
}
|
|
49
|
-
export declare function Popper({ ref, popperRef, anchorElement, container, content, offset, trigger, placement, variant, sizeAdaptable, mouseEnterDelay, mouseLeaveDelay, defaultOpen, open, onOpenChange, onOpenChangeEnd, disabled, autoClose, forceRender, children, ...props }: PopperProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare function Popper({ ref, popperRef, anchorElement, container, effectContainer, content, offset, trigger, placement, variant, sizeAdaptable, mouseEnterDelay, mouseLeaveDelay, defaultOpen, open, onOpenChange, onOpenChangeEnd, disabled, autoClose, forceRender, children, ...props }: PopperProps): import("@emotion/react/jsx-runtime").JSX.Element;
|