@canlooks/can-ui 0.0.164 → 0.0.166
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.style.d.ts +1 -1
- package/dist/cjs/components/actionSheet/actionSheet.style.d.ts +1 -1
- package/dist/cjs/components/alert/alert.style.d.ts +1 -1
- package/dist/cjs/components/anchorList/anchorList.style.d.ts +1 -1
- package/dist/cjs/components/app/app.style.d.ts +2 -2
- package/dist/cjs/components/avatar/avatar.style.d.ts +1 -1
- package/dist/cjs/components/avatar/avatarGroup.style.d.ts +1 -1
- package/dist/cjs/components/backdrop/backdrop.style.d.ts +1 -1
- package/dist/cjs/components/badge/badge.style.d.ts +1 -1
- package/dist/cjs/components/bottomNavigation/bottomNavigation.style.d.ts +1 -1
- package/dist/cjs/components/boundary/errorBoundary.style.d.ts +1 -1
- package/dist/cjs/components/breadcrumb/breadcrumb.style.d.ts +1 -1
- package/dist/cjs/components/bubble/bubble.style.d.ts +1 -1
- package/dist/cjs/components/bubbleConfirm/bubbleConfirm.style.d.ts +1 -1
- package/dist/cjs/components/button/button.style.d.ts +1 -1
- package/dist/cjs/components/calendar/calendar.style.d.ts +1 -1
- package/dist/cjs/components/card/card.style.d.ts +1 -1
- package/dist/cjs/components/cascade/cascade.style.d.ts +2 -2
- package/dist/cjs/components/checkboxBase/checkboxBase.style.d.ts +1 -1
- package/dist/cjs/components/colorPicker/colorPicker.style.d.ts +2 -2
- package/dist/cjs/components/counter/counter.style.d.ts +1 -1
- package/dist/cjs/components/curd/curd.style.d.ts +2 -2
- package/dist/cjs/components/curd/curdColumnConfig.js +27 -15
- package/dist/cjs/components/curd/curdColumnConfig.style.d.ts +1 -1
- package/dist/cjs/components/dataGrid/dataGrid.style.d.ts +1 -1
- package/dist/cjs/components/dataGrid/filterBubbleContent.style.d.ts +1 -1
- package/dist/cjs/components/dateTimePicker/dateTimePicker.style.d.ts +2 -2
- package/dist/cjs/components/dateTimePicker/timer.style.d.ts +1 -1
- package/dist/cjs/components/dateTimeRangePicker/dateTimeRangePicker.style.d.ts +1 -1
- package/dist/cjs/components/descriptions/descriptions.style.d.ts +2 -2
- package/dist/cjs/components/dialog/dialog.style.d.ts +1 -1
- package/dist/cjs/components/divider/divider.style.d.ts +1 -1
- package/dist/cjs/components/drawer/drawer.d.ts +5 -3
- package/dist/cjs/components/drawer/drawer.js +9 -3
- package/dist/cjs/components/drawer/drawer.style.d.ts +1 -1
- package/dist/cjs/components/dropdown/dropdown.style.d.ts +1 -1
- package/dist/cjs/components/flex/flex.style.d.ts +1 -1
- package/dist/cjs/components/form/form.style.d.ts +1 -1
- package/dist/cjs/components/gallery/gallery.style.d.ts +1 -1
- package/dist/cjs/components/grid/grid.style.d.ts +2 -2
- package/dist/cjs/components/image/image.style.d.ts +1 -1
- package/dist/cjs/components/image/image.style.js +2 -0
- package/dist/cjs/components/input/input.style.d.ts +2 -2
- package/dist/cjs/components/inputBase/inputBase.style.d.ts +1 -1
- package/dist/cjs/components/loading/loading.style.d.ts +1 -1
- package/dist/cjs/components/loadingIndicator/loadingIndicator.style.d.ts +1 -1
- package/dist/cjs/components/loadingMask/loadingMask.style.d.ts +1 -1
- package/dist/cjs/components/menu/menu.style.d.ts +1 -1
- package/dist/cjs/components/menuItem/menuItem.style.d.ts +2 -2
- package/dist/cjs/components/modal/modal.style.d.ts +1 -1
- package/dist/cjs/components/optionsBase/optionsBase.style.d.ts +1 -1
- package/dist/cjs/components/overlayBase/overlayBase.style.d.ts +1 -1
- package/dist/cjs/components/pagination/pagination.style.d.ts +1 -1
- package/dist/cjs/components/palette/palette.style.d.ts +1 -1
- package/dist/cjs/components/pickerDialog/pickerDialog.style.d.ts +1 -1
- package/dist/cjs/components/pinchable/pinchable.style.d.ts +1 -1
- package/dist/cjs/components/placeholder/placeholder.style.d.ts +1 -1
- package/dist/cjs/components/popper/popper.style.d.ts +4 -4
- package/dist/cjs/components/progress/progress.style.d.ts +1 -1
- package/dist/cjs/components/rating/rating.style.d.ts +1 -1
- package/dist/cjs/components/resizable/resizable.style.d.ts +1 -1
- package/dist/cjs/components/scrollbar/scrollbar.style.d.ts +1 -1
- package/dist/cjs/components/segmented/segmented.style.d.ts +1 -1
- package/dist/cjs/components/selectBase/selectBase.style.d.ts +1 -1
- package/dist/cjs/components/selectedList/selectedList.style.d.ts +1 -1
- package/dist/cjs/components/serialInput/serialInput.style.d.ts +1 -1
- package/dist/cjs/components/skeleton/skeleton.style.d.ts +3 -3
- package/dist/cjs/components/slidableActions/slidableActions.style.d.ts +1 -1
- package/dist/cjs/components/slider/slider.style.d.ts +2 -2
- package/dist/cjs/components/snackbarBase/snackbarBase.style.d.ts +1 -1
- package/dist/cjs/components/sortableItem/sortableItem.d.ts +3 -2
- package/dist/cjs/components/sortableItem/sortableItem.js +7 -31
- package/dist/cjs/components/sortableItem/sortableItem.style.d.ts +0 -2
- package/dist/cjs/components/sortableItem/sortableItem.style.js +1 -20
- package/dist/cjs/components/status/status.style.d.ts +1 -1
- package/dist/cjs/components/stepper/step.style.d.ts +1 -1
- package/dist/cjs/components/stepper/stepper.style.d.ts +1 -1
- package/dist/cjs/components/switch/switch.style.d.ts +1 -1
- package/dist/cjs/components/table/table.style.d.ts +1 -1
- package/dist/cjs/components/table/tableSticky.style.d.ts +1 -1
- package/dist/cjs/components/tabs/tab.d.ts +3 -1
- package/dist/cjs/components/tabs/tab.js +2 -2
- package/dist/cjs/components/tabs/tabs.d.ts +2 -2
- package/dist/cjs/components/tabs/tabs.js +15 -18
- package/dist/cjs/components/tabs/tabs.style.d.ts +1 -1
- package/dist/cjs/components/tabs/tabsEllipsis.style.d.ts +1 -1
- package/dist/cjs/components/tag/tag.style.d.ts +1 -1
- package/dist/cjs/components/textarea/textarea.style.d.ts +1 -1
- package/dist/cjs/components/timeline/timeline.style.d.ts +2 -2
- package/dist/cjs/components/toggleButton/toggleButton.style.d.ts +1 -1
- package/dist/cjs/components/tooltip/tooltip.style.d.ts +1 -1
- package/dist/cjs/components/touchRipple/touchRipple.style.d.ts +1 -1
- package/dist/cjs/components/transfer/transfer.style.d.ts +1 -1
- package/dist/cjs/components/transitionBase/transitionBase.style.d.ts +5 -5
- package/dist/cjs/components/tree/tree.style.d.ts +1 -1
- package/dist/cjs/components/tree/treeDnd.style.d.ts +2 -2
- package/dist/cjs/components/typography/typography.style.d.ts +2 -2
- package/dist/cjs/components/upload/dropArea.style.d.ts +1 -1
- package/dist/cjs/components/upload/upload.js +13 -14
- package/dist/cjs/components/upload/upload.style.d.ts +2 -2
- package/dist/cjs/components/upload/upload.style.js +4 -10
- package/dist/cjs/components/waterfall/waterfall.style.d.ts +1 -1
- package/dist/cjs/extensions/documentViewer/documentViewer.style.d.ts +2 -2
- package/dist/cjs/extensions/textFormatter/textFormatter.style.d.ts +1 -1
- package/dist/cjs/utils/dnd.d.ts +8 -6
- package/dist/cjs/utils/dnd.js +48 -21
- package/dist/esm/components/accordion/accordion.style.d.ts +1 -1
- package/dist/esm/components/actionSheet/actionSheet.style.d.ts +1 -1
- package/dist/esm/components/alert/alert.style.d.ts +1 -1
- package/dist/esm/components/anchorList/anchorList.style.d.ts +1 -1
- package/dist/esm/components/app/app.style.d.ts +2 -2
- package/dist/esm/components/avatar/avatar.style.d.ts +1 -1
- package/dist/esm/components/avatar/avatarGroup.style.d.ts +1 -1
- package/dist/esm/components/backdrop/backdrop.style.d.ts +1 -1
- package/dist/esm/components/badge/badge.style.d.ts +1 -1
- package/dist/esm/components/bottomNavigation/bottomNavigation.style.d.ts +1 -1
- package/dist/esm/components/boundary/errorBoundary.style.d.ts +1 -1
- package/dist/esm/components/breadcrumb/breadcrumb.style.d.ts +1 -1
- package/dist/esm/components/bubble/bubble.style.d.ts +1 -1
- package/dist/esm/components/bubbleConfirm/bubbleConfirm.style.d.ts +1 -1
- package/dist/esm/components/button/button.style.d.ts +1 -1
- package/dist/esm/components/calendar/calendar.style.d.ts +1 -1
- package/dist/esm/components/card/card.style.d.ts +1 -1
- package/dist/esm/components/cascade/cascade.style.d.ts +2 -2
- package/dist/esm/components/checkboxBase/checkboxBase.style.d.ts +1 -1
- package/dist/esm/components/colorPicker/colorPicker.style.d.ts +2 -2
- package/dist/esm/components/counter/counter.style.d.ts +1 -1
- package/dist/esm/components/curd/curd.style.d.ts +2 -2
- package/dist/esm/components/curd/curdColumnConfig.js +29 -17
- package/dist/esm/components/curd/curdColumnConfig.style.d.ts +1 -1
- package/dist/esm/components/dataGrid/dataGrid.style.d.ts +1 -1
- package/dist/esm/components/dataGrid/filterBubbleContent.style.d.ts +1 -1
- package/dist/esm/components/dateTimePicker/dateTimePicker.style.d.ts +2 -2
- package/dist/esm/components/dateTimePicker/timer.style.d.ts +1 -1
- package/dist/esm/components/dateTimeRangePicker/dateTimeRangePicker.style.d.ts +1 -1
- package/dist/esm/components/descriptions/descriptions.style.d.ts +2 -2
- package/dist/esm/components/dialog/dialog.style.d.ts +1 -1
- package/dist/esm/components/divider/divider.style.d.ts +1 -1
- package/dist/esm/components/drawer/drawer.d.ts +5 -3
- package/dist/esm/components/drawer/drawer.js +10 -4
- package/dist/esm/components/drawer/drawer.style.d.ts +1 -1
- package/dist/esm/components/dropdown/dropdown.style.d.ts +1 -1
- package/dist/esm/components/flex/flex.style.d.ts +1 -1
- package/dist/esm/components/form/form.style.d.ts +1 -1
- package/dist/esm/components/gallery/gallery.style.d.ts +1 -1
- package/dist/esm/components/grid/grid.style.d.ts +2 -2
- package/dist/esm/components/image/image.style.d.ts +1 -1
- package/dist/esm/components/image/image.style.js +2 -0
- package/dist/esm/components/input/input.style.d.ts +2 -2
- package/dist/esm/components/inputBase/inputBase.style.d.ts +1 -1
- package/dist/esm/components/loading/loading.style.d.ts +1 -1
- package/dist/esm/components/loadingIndicator/loadingIndicator.style.d.ts +1 -1
- package/dist/esm/components/loadingMask/loadingMask.style.d.ts +1 -1
- package/dist/esm/components/menu/menu.style.d.ts +1 -1
- package/dist/esm/components/menuItem/menuItem.style.d.ts +2 -2
- package/dist/esm/components/modal/modal.style.d.ts +1 -1
- package/dist/esm/components/optionsBase/optionsBase.style.d.ts +1 -1
- package/dist/esm/components/overlayBase/overlayBase.style.d.ts +1 -1
- package/dist/esm/components/pagination/pagination.style.d.ts +1 -1
- package/dist/esm/components/palette/palette.style.d.ts +1 -1
- package/dist/esm/components/pickerDialog/pickerDialog.style.d.ts +1 -1
- package/dist/esm/components/pinchable/pinchable.style.d.ts +1 -1
- package/dist/esm/components/placeholder/placeholder.style.d.ts +1 -1
- package/dist/esm/components/popper/popper.style.d.ts +4 -4
- package/dist/esm/components/progress/progress.style.d.ts +1 -1
- package/dist/esm/components/rating/rating.style.d.ts +1 -1
- package/dist/esm/components/resizable/resizable.style.d.ts +1 -1
- package/dist/esm/components/scrollbar/scrollbar.style.d.ts +1 -1
- package/dist/esm/components/segmented/segmented.style.d.ts +1 -1
- package/dist/esm/components/selectBase/selectBase.style.d.ts +1 -1
- package/dist/esm/components/selectedList/selectedList.style.d.ts +1 -1
- package/dist/esm/components/serialInput/serialInput.style.d.ts +1 -1
- package/dist/esm/components/skeleton/skeleton.style.d.ts +3 -3
- package/dist/esm/components/slidableActions/slidableActions.style.d.ts +1 -1
- package/dist/esm/components/slider/slider.style.d.ts +2 -2
- package/dist/esm/components/snackbarBase/snackbarBase.style.d.ts +1 -1
- package/dist/esm/components/sortableItem/sortableItem.d.ts +3 -2
- package/dist/esm/components/sortableItem/sortableItem.js +10 -34
- package/dist/esm/components/sortableItem/sortableItem.style.d.ts +0 -2
- package/dist/esm/components/sortableItem/sortableItem.style.js +0 -19
- package/dist/esm/components/status/status.style.d.ts +1 -1
- package/dist/esm/components/stepper/step.style.d.ts +1 -1
- package/dist/esm/components/stepper/stepper.style.d.ts +1 -1
- package/dist/esm/components/switch/switch.style.d.ts +1 -1
- package/dist/esm/components/table/table.style.d.ts +1 -1
- package/dist/esm/components/table/tableSticky.style.d.ts +1 -1
- package/dist/esm/components/tabs/tab.d.ts +3 -1
- package/dist/esm/components/tabs/tab.js +2 -2
- package/dist/esm/components/tabs/tabs.d.ts +2 -2
- package/dist/esm/components/tabs/tabs.js +16 -19
- package/dist/esm/components/tabs/tabs.style.d.ts +1 -1
- package/dist/esm/components/tabs/tabsEllipsis.style.d.ts +1 -1
- package/dist/esm/components/tag/tag.style.d.ts +1 -1
- package/dist/esm/components/textarea/textarea.style.d.ts +1 -1
- package/dist/esm/components/timeline/timeline.style.d.ts +2 -2
- package/dist/esm/components/toggleButton/toggleButton.style.d.ts +1 -1
- package/dist/esm/components/tooltip/tooltip.style.d.ts +1 -1
- package/dist/esm/components/touchRipple/touchRipple.style.d.ts +1 -1
- package/dist/esm/components/transfer/transfer.style.d.ts +1 -1
- package/dist/esm/components/transitionBase/transitionBase.style.d.ts +5 -5
- package/dist/esm/components/tree/tree.style.d.ts +1 -1
- package/dist/esm/components/tree/treeDnd.style.d.ts +2 -2
- package/dist/esm/components/typography/typography.style.d.ts +2 -2
- package/dist/esm/components/upload/dropArea.style.d.ts +1 -1
- package/dist/esm/components/upload/upload.js +14 -15
- package/dist/esm/components/upload/upload.style.d.ts +2 -2
- package/dist/esm/components/upload/upload.style.js +4 -10
- package/dist/esm/components/waterfall/waterfall.style.d.ts +1 -1
- package/dist/esm/extensions/documentViewer/documentViewer.style.d.ts +2 -2
- package/dist/esm/extensions/textFormatter/textFormatter.style.d.ts +1 -1
- package/dist/esm/utils/dnd.d.ts +8 -6
- package/dist/esm/utils/dnd.js +45 -20
- package/package.json +12 -13
|
@@ -18,4 +18,4 @@ export declare const classes: {
|
|
|
18
18
|
root: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const getTransparentBackground: (a: string, b: string) => string;
|
|
21
|
-
export declare const style: () => import("@emotion/
|
|
21
|
+
export declare const style: () => import("@emotion/utils").SerializedStyles;
|
|
@@ -4,15 +4,15 @@ export declare const classes: {
|
|
|
4
4
|
} & {
|
|
5
5
|
root: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const style: () => import("@emotion/
|
|
7
|
+
export declare const style: () => import("@emotion/utils").SerializedStyles[];
|
|
8
8
|
/**
|
|
9
9
|
* 通用弹框箭头样式
|
|
10
10
|
* @param colorValue
|
|
11
11
|
* @param arrowSize
|
|
12
12
|
*/
|
|
13
|
-
export declare const popperArrowStyle: (colorValue: string, arrowSize?: number) => import("@emotion/
|
|
13
|
+
export declare const popperArrowStyle: (colorValue: string, arrowSize?: number) => import("@emotion/utils").SerializedStyles;
|
|
14
14
|
/**
|
|
15
15
|
* 通用弹框样式
|
|
16
16
|
*/
|
|
17
|
-
export declare const popperStyleCallback: ({ background, borderRadius, boxShadow }: Theme) => import("@emotion/
|
|
18
|
-
export declare const popperStyle: () => import("@emotion/
|
|
17
|
+
export declare const popperStyleCallback: ({ background, borderRadius, boxShadow }: Theme) => import("@emotion/utils").SerializedStyles;
|
|
18
|
+
export declare const popperStyle: () => import("@emotion/utils").SerializedStyles;
|
|
@@ -8,4 +8,4 @@ export declare const classes: {
|
|
|
8
8
|
} & {
|
|
9
9
|
root: string;
|
|
10
10
|
};
|
|
11
|
-
export declare function useStyle({ color, variant }: Required<Pick<ProgressProps, 'color' | 'variant'>>): import("@emotion/
|
|
11
|
+
export declare function useStyle({ color, variant }: Required<Pick<ProgressProps, 'color' | 'variant'>>): import("@emotion/utils").SerializedStyles;
|
|
@@ -9,4 +9,4 @@ export declare const classes: {
|
|
|
9
9
|
export declare const handleCursors: {
|
|
10
10
|
[P in Handle]?: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function useStyle({ variant, handleSize, handleColor }: Required<Pick<ResizableProps, 'variant' | 'handleSize' | 'handleColor'>>): import("@emotion/
|
|
12
|
+
export declare function useStyle({ variant, handleSize, handleColor }: Required<Pick<ResizableProps, 'variant' | 'handleSize' | 'handleColor'>>): import("@emotion/utils").SerializedStyles[];
|
|
@@ -7,6 +7,6 @@ export declare const classes: {
|
|
|
7
7
|
} & {
|
|
8
8
|
root: string;
|
|
9
9
|
};
|
|
10
|
-
export declare const style: () => import("@emotion/
|
|
11
|
-
export declare const articalStyle: () => import("@emotion/
|
|
12
|
-
export declare const tableStyle: () => import("@emotion/
|
|
10
|
+
export declare const style: () => import("@emotion/utils").SerializedStyles;
|
|
11
|
+
export declare const articalStyle: () => import("@emotion/utils").SerializedStyles;
|
|
12
|
+
export declare const tableStyle: () => import("@emotion/utils").SerializedStyles;
|
|
@@ -5,13 +5,13 @@ export declare const classes: {
|
|
|
5
5
|
track: string;
|
|
6
6
|
prefix: string;
|
|
7
7
|
suffix: string;
|
|
8
|
+
handle: string;
|
|
8
9
|
rail: string;
|
|
9
10
|
railWrap: string;
|
|
10
11
|
trackCorner: string;
|
|
11
|
-
handle: string;
|
|
12
12
|
} & {
|
|
13
13
|
root: string;
|
|
14
14
|
};
|
|
15
15
|
export declare function useStyle({ color }: {
|
|
16
16
|
color: ColorPropsValue;
|
|
17
|
-
}): import("@emotion/
|
|
17
|
+
}): import("@emotion/utils").SerializedStyles;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ElementType } from 'react';
|
|
2
|
-
import { Arguments } from '@dnd-kit/sortable/dist/hooks/useSortable';
|
|
3
2
|
import { Id, OverridableComponent, OverridableProps } from '../../types.js';
|
|
3
|
+
import { UseSortableInput } from '@dnd-kit/react/sortable';
|
|
4
4
|
export type SortableItemOwnProps = {
|
|
5
5
|
id: Id;
|
|
6
|
+
index: number;
|
|
6
7
|
disabled?: boolean;
|
|
7
|
-
sortableArguments?:
|
|
8
|
+
sortableArguments?: UseSortableInput;
|
|
8
9
|
noStyle?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export type SortableItemProps<C extends ElementType = 'div'> = OverridableProps<SortableItemOwnProps, C>;
|
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { classes, globalGrabbingStyle, style } from './sortableItem.style.js';
|
|
8
|
-
export const SortableItem = (({ component: Component = 'div', id, disabled, sortableArguments, noStyle, ...props }) => {
|
|
9
|
-
const { attributes, isDragging, listeners, setNodeRef, transform, transition } = useSortable({
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { cloneRef, clsx } from '../../utils/index.js';
|
|
3
|
+
import { classes } from './sortableItem.style.js';
|
|
4
|
+
import { useSortable } from '@dnd-kit/react/sortable';
|
|
5
|
+
export const SortableItem = (({ component: Component = 'div', id, index, disabled, sortableArguments, noStyle, ...props }) => {
|
|
6
|
+
const { ref } = useSortable({
|
|
10
7
|
...sortableArguments,
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
id,
|
|
9
|
+
index,
|
|
10
|
+
disabled
|
|
13
11
|
});
|
|
14
|
-
|
|
15
|
-
const removeListener = () => {
|
|
16
|
-
if (preventDefaultCallback.current) {
|
|
17
|
-
removeEventListener('touchmove', preventDefaultCallback.current);
|
|
18
|
-
preventDefaultCallback.current = void 0;
|
|
19
|
-
}
|
|
20
|
-
removeEventListener('pointerup', onPointerUp);
|
|
21
|
-
};
|
|
22
|
-
const onPointerUp = useCallback(removeListener, []);
|
|
23
|
-
const syncOnTouchStart = useSync(props.onTouchStart);
|
|
24
|
-
const onTouchStart = useCallback((e) => {
|
|
25
|
-
syncOnTouchStart.current?.(e);
|
|
26
|
-
addEventListener('touchmove', preventDefaultCallback.current = e => {
|
|
27
|
-
e.cancelable && e.preventDefault();
|
|
28
|
-
}, { passive: false });
|
|
29
|
-
addEventListener('pointerup', onPointerUp);
|
|
30
|
-
}, []);
|
|
31
|
-
useEffect(() => removeListener, []);
|
|
32
|
-
return (_jsxs(_Fragment, { children: [_jsx(Component, { ...attributes, ...listeners, ...props, ref: cloneRef(setNodeRef, props.ref), css: style, className: clsx(classes.root, props.className), style: {
|
|
33
|
-
transform: CSS.Transform.toString(transform),
|
|
34
|
-
transition,
|
|
35
|
-
...props.style
|
|
36
|
-
}, onTouchStart: disabled ? void 0 : onTouchStart, "data-no-style": noStyle, "data-dragging": isDragging, "data-draggable": !disabled }), !noStyle && isDragging && _jsx(Global, { styles: globalGrabbingStyle })] }));
|
|
12
|
+
return (_jsx(Component, { ...props, ref: cloneRef(ref, props.ref), className: clsx(classes.root, props.className), "data-no-style": noStyle, "data-draggable": !disabled }));
|
|
37
13
|
});
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
import { css } from '@emotion/react';
|
|
2
1
|
import { defineInnerClasses } from '../../utils/index.js';
|
|
3
2
|
export const classes = defineInnerClasses('sortable-item');
|
|
4
|
-
export const style = css `
|
|
5
|
-
@layer reset {
|
|
6
|
-
&:not([data-no-style=true]) {
|
|
7
|
-
&[data-draggable=true] {
|
|
8
|
-
cursor: grab;
|
|
9
|
-
|
|
10
|
-
&:active {
|
|
11
|
-
cursor: grabbing;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
export const globalGrabbingStyle = css `
|
|
18
|
-
* {
|
|
19
|
-
cursor: grabbing;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
@@ -9,4 +9,4 @@ export declare const classes: {
|
|
|
9
9
|
} & {
|
|
10
10
|
root: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function useStyle({ color, gap }: Required<Pick<StepProps, 'color' | 'gap'>>): import("@emotion/
|
|
12
|
+
export declare function useStyle({ color, gap }: Required<Pick<StepProps, 'color' | 'gap'>>): import("@emotion/utils").SerializedStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const style: () => import("@emotion/
|
|
1
|
+
export declare const style: () => import("@emotion/utils").SerializedStyles;
|
|
@@ -15,5 +15,7 @@ export interface TabProps extends Omit<DivProps, 'prefix'> {
|
|
|
15
15
|
sortable?: boolean;
|
|
16
16
|
/** @private 内部使用,用于表示改选项卡是否为激活状态 */
|
|
17
17
|
_active?: boolean;
|
|
18
|
+
/** @private */
|
|
19
|
+
_index?: number;
|
|
18
20
|
}
|
|
19
|
-
export declare const Tab: React.MemoExoticComponent<({ prefix, suffix, color, orientation, label, value, disabled, closable, onClose, sortable, _active, ...props }: TabProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
21
|
+
export declare const Tab: React.MemoExoticComponent<({ prefix, suffix, color, orientation, label, value, disabled, closable, onClose, sortable, _active, _index, ...props }: TabProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
@@ -8,7 +8,7 @@ import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark';
|
|
|
8
8
|
import { Icon } from '../icon/index.js';
|
|
9
9
|
import { SortableItem } from '../sortableItem/index.js';
|
|
10
10
|
import { Collapse } from '../transitionBase/index.js';
|
|
11
|
-
export const Tab = memo(({ prefix, suffix, color, orientation, label, value, disabled, closable, onClose, sortable, _active, ...props }) => {
|
|
11
|
+
export const Tab = memo(({ prefix, suffix, color, orientation, label, value, disabled, closable, onClose, sortable, _active, _index, ...props }) => {
|
|
12
12
|
const context = useTabsContext();
|
|
13
13
|
const colorValue = useColor(color ?? context.color);
|
|
14
14
|
const _closable = closable ?? context.closable;
|
|
@@ -17,7 +17,7 @@ export const Tab = memo(({ prefix, suffix, color, orientation, label, value, dis
|
|
|
17
17
|
context.onClose?.(value);
|
|
18
18
|
};
|
|
19
19
|
const _sortable = sortable ?? context.sortable;
|
|
20
|
-
return (_jsx(SortableItem, { ...props, className: clsx(classes.tabWrapper, props.className), component: Collapse, orientation: "horizontal", id: value, disabled: !_sortable, children: _jsxs("div", { className: classes.tab, style: {
|
|
20
|
+
return (_jsx(SortableItem, { ...props, className: clsx(classes.tabWrapper, props.className), component: Collapse, orientation: "horizontal", id: value, index: _index, disabled: !_sortable, children: _jsxs("div", { className: classes.tab, style: {
|
|
21
21
|
borderColor: context.variant === 'line' && !context.animating && _active ? colorValue : void 0,
|
|
22
22
|
color: _active ? colorValue : void 0,
|
|
23
23
|
...props.style
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode, SetStateAction, Dispatch } from 'react';
|
|
2
2
|
import { ColorPropsValue, DivProps, Id, Obj, Size } from '../../types.js';
|
|
3
3
|
import { Tab, TabProps } from './tab.js';
|
|
4
|
-
import {
|
|
4
|
+
import { DragDropEvents } from '@dnd-kit/abstract';
|
|
5
5
|
export type TabType = TabProps & Obj;
|
|
6
6
|
type TabsSharedProps = {
|
|
7
7
|
variant?: 'line' | 'card';
|
|
@@ -32,7 +32,7 @@ export interface TabsProps<T extends TabType = TabType> extends TabsSharedProps,
|
|
|
32
32
|
* @param e
|
|
33
33
|
* @param tabs 仅{@link tabs}模式支持,使用children时,该参数为`undefined`
|
|
34
34
|
*/
|
|
35
|
-
onSort?(e:
|
|
35
|
+
onSort?(e: Parameters<DragDropEvents<any, any, any>['dragend']>[0], tabs?: T[]): void;
|
|
36
36
|
/** 触发change事件的事件,默认为`click` */
|
|
37
37
|
changeEvent?: 'click' | 'pointerDown';
|
|
38
38
|
}
|
|
@@ -2,14 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import { createElement as _createElement } from "@emotion/react";
|
|
3
3
|
import { Children, cloneElement, createContext, isValidElement, memo, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { classes, useStyle } from './tabs.style.js';
|
|
5
|
-
import { clsx, cloneRef, isUnset, useControlled, useDerivedState,
|
|
5
|
+
import { clsx, cloneRef, isUnset, useControlled, useDerivedState, defaultSensors, onDndDragEnd } from '../../utils/index.js';
|
|
6
6
|
import { useTheme } from '../theme/index.js';
|
|
7
7
|
import { Tab } from './tab.js';
|
|
8
8
|
import { TabsEllipsis } from './tabsEllipsis.js';
|
|
9
9
|
import { LineIndicator } from './lineIndicator.js';
|
|
10
|
-
import { DndContext } from '@dnd-kit/core';
|
|
11
|
-
import { SortableContext } from '@dnd-kit/sortable';
|
|
12
10
|
import { TransitionGroup } from 'react-transition-group';
|
|
11
|
+
import { DragDropProvider } from '@dnd-kit/react';
|
|
13
12
|
const TabsContext = createContext({});
|
|
14
13
|
export function useTabsContext() {
|
|
15
14
|
return useContext(TabsContext);
|
|
@@ -45,10 +44,10 @@ export const Tabs = memo(({ tabs, labelKey = 'label', primaryKey = 'value', size
|
|
|
45
44
|
}, value: value, label: p[labelKey], [eventName]: (e) => {
|
|
46
45
|
p[eventName]?.(e);
|
|
47
46
|
setInnerValue(value);
|
|
48
|
-
}, _active: active }));
|
|
47
|
+
}, _active: active, _index: i }));
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
|
-
return Children.map(props.children, c => {
|
|
50
|
+
return Children.map(props.children, (c, _index) => {
|
|
52
51
|
if (isValidElement(c)) {
|
|
53
52
|
const { value } = c.props;
|
|
54
53
|
const active = !isUnset(value) && value === innerValue.current;
|
|
@@ -66,7 +65,8 @@ export const Tabs = memo(({ tabs, labelKey = 'label', primaryKey = 'value', size
|
|
|
66
65
|
!isUnset(value) && setInnerValue(value);
|
|
67
66
|
}
|
|
68
67
|
},
|
|
69
|
-
_active: active
|
|
68
|
+
_active: active,
|
|
69
|
+
_index
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
return c;
|
|
@@ -121,26 +121,23 @@ export const Tabs = memo(({ tabs, labelKey = 'label', primaryKey = 'value', size
|
|
|
121
121
|
* ----------------------------------------------------------------
|
|
122
122
|
* 拖拽
|
|
123
123
|
*/
|
|
124
|
-
const
|
|
125
|
-
? tabs.map(tab => tab[primaryKey])
|
|
126
|
-
: Children.map(props.children, c => isValidElement(c) ? c.props.value : c);
|
|
127
|
-
const dragEndHandler = (e) => {
|
|
124
|
+
const dragEndHandler = e => {
|
|
128
125
|
if (props.onSort) {
|
|
129
126
|
const newTabs = tabs
|
|
130
127
|
? onDndDragEnd(e, tabs, primaryKey)
|
|
131
128
|
: void 0;
|
|
132
|
-
props.onSort(e, newTabs);
|
|
129
|
+
newTabs && props.onSort(e, newTabs);
|
|
133
130
|
}
|
|
134
131
|
};
|
|
135
132
|
return (_jsxs("div", { ...props, css: useStyle({ color, variant }), className: clsx(classes.root, props.className), "data-size": size, "data-position": position, "data-animating": animating.current, "data-full-width": fullWidth, "data-read-only": readOnly, "data-disabled": disabled, children: [_jsx("div", { className: classes.start, "data-show": shadowStart, children: !!prefix &&
|
|
136
|
-
_jsx("div", { className: classes.prefix, children: prefix }) }), _jsx("div", { ref: scrollRef, className: classes.scroll, onScroll: setShadow, children: _jsx("div", { className: classes.scrollWrap, style: { justifyContent }, children:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
_jsx("div", { className: classes.prefix, children: prefix }) }), _jsx("div", { ref: scrollRef, className: classes.scroll, onScroll: setShadow, children: _jsx("div", { className: classes.scrollWrap, style: { justifyContent }, children: _jsxs(TabsContext, { value: useMemo(() => ({
|
|
134
|
+
color, variant, closable, onClose, sortable,
|
|
135
|
+
animating: animating.current, setAnimating
|
|
136
|
+
}), [
|
|
137
|
+
color, variant, closable, onClose, sortable,
|
|
138
|
+
animating.current
|
|
139
|
+
]), children: [_jsx(DragDropProvider, { sensors: defaultSensors, onDragEnd: dragEndHandler, children: _jsx(TransitionGroup, { component: null, children: renderTabs() }) }), variant === 'line' &&
|
|
140
|
+
_jsx(LineIndicator, { value: innerValue.current, position: position, getActiveTab: getActiveTab })] }) }) }), _jsx("div", { className: classes.end, "data-show": shadowEnd, children: !!(suffix || shadowStart || shadowEnd) &&
|
|
144
141
|
_jsxs("div", { className: classes.suffix, children: [(shadowStart || shadowEnd) &&
|
|
145
142
|
_jsx(TabsEllipsis, { tabs: tabs, labelKey: labelKey, primaryKey: primaryKey, value: innerValue.current, onToggleSelected: setValueInEllipsis, children: props.children }), suffix] }) })] }));
|
|
146
143
|
});
|
|
@@ -18,4 +18,4 @@ export declare const classes: {
|
|
|
18
18
|
root: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const indicatorWidth = 2;
|
|
21
|
-
export declare function useStyle({ color, variant }: Required<Pick<TabsProps, 'color' | 'variant'>>): import("@emotion/
|
|
21
|
+
export declare function useStyle({ color, variant }: Required<Pick<TabsProps, 'color' | 'variant'>>): import("@emotion/utils").SerializedStyles[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const tabsEllipsisPopperStyle: () => import("@emotion/
|
|
1
|
+
export declare const tabsEllipsisPopperStyle: () => import("@emotion/utils").SerializedStyles[];
|
|
@@ -7,4 +7,4 @@ export declare const classes: {
|
|
|
7
7
|
} & {
|
|
8
8
|
root: string;
|
|
9
9
|
};
|
|
10
|
-
export declare function useStyle({ color }: Required<Pick<TagProps, 'color'>>): import("@emotion/
|
|
10
|
+
export declare function useStyle({ color }: Required<Pick<TagProps, 'color'>>): import("@emotion/utils").SerializedStyles;
|
|
@@ -8,7 +8,7 @@ export declare const classes: {
|
|
|
8
8
|
} & {
|
|
9
9
|
root: string;
|
|
10
10
|
};
|
|
11
|
-
export declare const style: () => import("@emotion/
|
|
11
|
+
export declare const style: () => import("@emotion/utils").SerializedStyles;
|
|
12
12
|
export declare function useTimelineItemStyle({ color }: {
|
|
13
13
|
color: ColorPropsValue;
|
|
14
|
-
}): import("@emotion/
|
|
14
|
+
}): import("@emotion/utils").SerializedStyles;
|
|
@@ -2,8 +2,8 @@ import { TransitionBaseProps } from './transitionBase.js';
|
|
|
2
2
|
export declare const classes: {
|
|
3
3
|
root: string;
|
|
4
4
|
};
|
|
5
|
-
export declare function useTransitionBaseStyle({ timeout }: Required<Pick<TransitionBaseProps<any>, 'timeout'>>): import("@emotion/
|
|
6
|
-
export declare const fadeStyle: () => import("@emotion/
|
|
7
|
-
export declare const sweepingStyle: () => import("@emotion/
|
|
8
|
-
export declare function useGrowAndCollapseStyle({ orientation, _mode }: Required<Pick<TransitionBaseProps<any>, 'orientation' | '_mode'>>): import("@emotion/
|
|
9
|
-
export declare function useSlideStyle({ direction, offset }: Required<Pick<TransitionBaseProps<any>, 'direction' | 'offset'>>): import("@emotion/
|
|
5
|
+
export declare function useTransitionBaseStyle({ timeout }: Required<Pick<TransitionBaseProps<any>, 'timeout'>>): import("@emotion/utils").SerializedStyles;
|
|
6
|
+
export declare const fadeStyle: () => import("@emotion/utils").SerializedStyles;
|
|
7
|
+
export declare const sweepingStyle: () => import("@emotion/utils").SerializedStyles;
|
|
8
|
+
export declare function useGrowAndCollapseStyle({ orientation, _mode }: Required<Pick<TransitionBaseProps<any>, 'orientation' | '_mode'>>): import("@emotion/utils").SerializedStyles;
|
|
9
|
+
export declare function useSlideStyle({ direction, offset }: Required<Pick<TransitionBaseProps<any>, 'direction' | 'offset'>>): import("@emotion/utils").SerializedStyles;
|
|
@@ -12,5 +12,5 @@ export declare const treeDndClasses: {
|
|
|
12
12
|
};
|
|
13
13
|
export declare function useStyle({ indent }: {
|
|
14
14
|
indent: number;
|
|
15
|
-
}): import("@emotion/
|
|
16
|
-
export declare const globalGrabbingStyle: import("@emotion/
|
|
15
|
+
}): import("@emotion/utils").SerializedStyles;
|
|
16
|
+
export declare const globalGrabbingStyle: import("@emotion/utils").SerializedStyles;
|
|
@@ -10,5 +10,5 @@ export declare const classes: {
|
|
|
10
10
|
} & {
|
|
11
11
|
root: string;
|
|
12
12
|
};
|
|
13
|
-
export declare function useStyle({ color }: Required<Pick<TypographyProps, 'color'>>): import("@emotion/
|
|
14
|
-
export declare const editStyle: import("@emotion/
|
|
13
|
+
export declare function useStyle({ color }: Required<Pick<TypographyProps, 'color'>>): import("@emotion/utils").SerializedStyles;
|
|
14
|
+
export declare const editStyle: import("@emotion/utils").SerializedStyles;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { memo, useImperativeHandle, useRef } from 'react';
|
|
3
3
|
import { classes, style } from './upload.style.js';
|
|
4
|
-
import { clsx, getRandomId, onDndDragEnd, useControlled,
|
|
4
|
+
import { clsx, getRandomId, onDndDragEnd, useControlled, mergeComponentProps, defaultSensors } from '../../utils/index.js';
|
|
5
5
|
import { Button } from '../button/index.js';
|
|
6
6
|
import { FileItem } from './fileItem.js';
|
|
7
7
|
import { TransitionGroup } from 'react-transition-group';
|
|
8
8
|
import { Collapse, Grow } from '../transitionBase/index.js';
|
|
9
9
|
import { ImageItem } from './imageItem.js';
|
|
10
|
-
import { DndContext } from '@dnd-kit/core';
|
|
11
|
-
import { SortableContext } from '@dnd-kit/sortable';
|
|
12
10
|
import { SortableItem } from '../sortableItem/index.js';
|
|
13
11
|
import { DropArea } from './dropArea.js';
|
|
14
12
|
import { Icon } from '../icon/index.js';
|
|
15
13
|
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
|
|
16
14
|
import { faUpload } from '@fortawesome/free-solid-svg-icons/faUpload';
|
|
15
|
+
import { DragDropProvider } from '@dnd-kit/react';
|
|
17
16
|
const markFileId = (files) => {
|
|
18
17
|
if (files) {
|
|
19
18
|
for (const file of files) {
|
|
@@ -87,7 +86,7 @@ export const Upload = memo(({ inputProps, type = 'file', accept = type === 'imag
|
|
|
87
86
|
const removeHandler = (id) => {
|
|
88
87
|
setInnerValue(o => o.filter(f => f.id !== id));
|
|
89
88
|
};
|
|
90
|
-
const dragEndHandler =
|
|
89
|
+
const dragEndHandler = e => {
|
|
91
90
|
const newValue = onDndDragEnd(e, innerValue.current);
|
|
92
91
|
newValue && setInnerValue(newValue);
|
|
93
92
|
};
|
|
@@ -95,19 +94,19 @@ export const Upload = memo(({ inputProps, type = 'file', accept = type === 'imag
|
|
|
95
94
|
ref: innerInputRef,
|
|
96
95
|
className: classes.input,
|
|
97
96
|
onChange: inputChangeHandler
|
|
98
|
-
}), "data-hidden": "true" }), _jsx(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
r
|
|
104
|
-
? itemRefs.current.set(file.id, r)
|
|
105
|
-
: itemRefs.current.delete(file.id);
|
|
106
|
-
}, file: file, onRemove: () => removeHandler(file.id), onUpload: onUpload }) }, file.id)) })] })
|
|
107
|
-
: _jsxs(TransitionGroup, { className: classes.images, children: [_jsx(Grow, { children: _jsx("div", { className: classes.imageWrap, "data-clickable": "true", children: _jsx("div", { className: classes.image, onClick: () => innerInputRef.current.click(), children: _jsx(Icon, { icon: faPlus }) }) }) }), innerValue.current.map(file => _jsx(SortableItem, { component: Collapse, className: classes.sortable, id: file.id, orientation: "horizontal", children: _jsx(ImageItem, { ref: r => {
|
|
97
|
+
}), "data-hidden": "true" }), _jsx(DragDropProvider, { sensors: defaultSensors, onDragEnd: dragEndHandler, children: type === 'file'
|
|
98
|
+
? _jsxs(_Fragment, { children: [droppable
|
|
99
|
+
? _jsx(DropArea, { onClick: () => innerInputRef.current.click(), onDrop: changeFn })
|
|
100
|
+
: showButton &&
|
|
101
|
+
_jsx(Button, { variant: "outlined", prefix: _jsx(Icon, { icon: faUpload }), ...buttonProps, onClick: buttonClick, children: buttonText }), _jsx(TransitionGroup, { className: classes.files, children: innerValue.current.map((file, index) => _jsx(SortableItem, { component: Collapse, className: classes.sortableItem, id: file.id, index: index, disabled: !sortable, children: _jsx(FileItem, { ref: r => {
|
|
108
102
|
r
|
|
109
103
|
? itemRefs.current.set(file.id, r)
|
|
110
104
|
: itemRefs.current.delete(file.id);
|
|
111
|
-
},
|
|
105
|
+
}, file: file, onRemove: () => removeHandler(file.id), onUpload: onUpload }) }, file.id)) })] })
|
|
106
|
+
: _jsxs(TransitionGroup, { className: classes.images, children: [_jsx(Grow, { children: _jsx("div", { className: classes.imageWrap, "data-clickable": "true", children: _jsx("div", { className: classes.image, onClick: () => innerInputRef.current.click(), children: _jsx(Icon, { icon: faPlus }) }) }) }), innerValue.current.map((file, index) => _jsx(SortableItem, { component: Collapse, className: classes.sortableItem, id: file.id, index: index, disabled: !sortable, orientation: "horizontal", children: _jsx(ImageItem, { ref: r => {
|
|
107
|
+
r
|
|
108
|
+
? itemRefs.current.set(file.id, r)
|
|
109
|
+
: itemRefs.current.delete(file.id);
|
|
110
|
+
}, type: type, file: file, onRemove: () => removeHandler(file.id), onUpload: onUpload }, file.id) }, file.id))] }) })] }));
|
|
112
111
|
});
|
|
113
112
|
Upload.DropArea = DropArea;
|