@ioca/react 1.3.83 → 1.3.85
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/lib/cjs/components/image/image.js +4 -3
- package/lib/cjs/components/image/image.js.map +1 -1
- package/lib/cjs/components/input/input.js +3 -2
- package/lib/cjs/components/input/input.js.map +1 -1
- package/lib/cjs/components/input/number.js +3 -2
- package/lib/cjs/components/input/number.js.map +1 -1
- package/lib/cjs/components/modal/content.js +37 -0
- package/lib/cjs/components/modal/content.js.map +1 -0
- package/lib/cjs/components/modal/modal.js +3 -29
- package/lib/cjs/components/modal/modal.js.map +1 -1
- package/lib/cjs/components/popconfirm/popconfirm.js +2 -2
- package/lib/cjs/components/popconfirm/popconfirm.js.map +1 -1
- package/lib/cjs/components/upload/upload.js +5 -2
- package/lib/cjs/components/upload/upload.js.map +1 -1
- package/lib/css/index.css +1 -1
- package/lib/css/index.css.map +1 -1
- package/lib/es/components/image/image.js +4 -3
- package/lib/es/components/image/image.js.map +1 -1
- package/lib/es/components/input/input.js +3 -2
- package/lib/es/components/input/input.js.map +1 -1
- package/lib/es/components/input/number.js +3 -2
- package/lib/es/components/input/number.js.map +1 -1
- package/lib/es/components/modal/content.js +33 -0
- package/lib/es/components/modal/content.js.map +1 -0
- package/lib/es/components/modal/modal.js +5 -31
- package/lib/es/components/modal/modal.js.map +1 -1
- package/lib/es/components/popconfirm/popconfirm.js +2 -2
- package/lib/es/components/popconfirm/popconfirm.js.map +1 -1
- package/lib/es/components/upload/upload.js +7 -4
- package/lib/es/components/upload/upload.js.map +1 -1
- package/lib/index.js +48 -41
- package/lib/types/components/image/type.d.ts +2 -2
- package/lib/types/components/upload/type.d.ts +2 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { debounce, uid, throttle, pick, title } from 'radash';
|
|
4
4
|
import { useMemo, Children, cloneElement, useEffect, createElement, isValidElement, useState, useRef, Fragment as Fragment$1, useLayoutEffect, useImperativeHandle, createContext, useContext } from 'react';
|
|
5
|
-
import { SkipPreviousRound, CloseRound, MinusRound, PlusRound, InboxTwotone, FormatBoldRound, FormatItalicRound, FormatUnderlinedRound, StrikethroughSRound, RedoRound, UndoRound, ClearAllRound, PauseRound, PlayArrowRound, StopRound, VolumeOffRound, VolumeDownRound, FullscreenExitRound, FullscreenRound, FeedOutlined, AspectRatioRound, OpenInNewRound, FileDownloadOutlined, RotateRightRound, RotateLeftRound, KeyboardArrowLeftRound, KeyboardArrowRightRound, HideImageTwotone, SyncAltRound, VisibilityRound, VisibilityOffRound, MoreHorizRound, SearchRound, CheckRound, UnfoldMoreRound, CalendarMonthTwotone, AccessTimeRound, InfoOutlined, KeyboardArrowDownRound, ListAltRound, PlusSharp } from '@ricons/material';
|
|
5
|
+
import { SkipPreviousRound, CloseRound, MinusRound, PlusRound, InboxTwotone, FormatBoldRound, FormatItalicRound, FormatUnderlinedRound, StrikethroughSRound, RedoRound, UndoRound, ClearAllRound, PauseRound, PlayArrowRound, StopRound, VolumeOffRound, VolumeDownRound, FullscreenExitRound, FullscreenRound, FeedOutlined, AspectRatioRound, OpenInNewRound, FileDownloadOutlined, RotateRightRound, RotateLeftRound, KeyboardArrowLeftRound, KeyboardArrowRightRound, HideImageTwotone, SyncAltRound, VisibilityRound, VisibilityOffRound, MoreHorizRound, SearchRound, CheckRound, UnfoldMoreRound, CalendarMonthTwotone, AccessTimeRound, InfoOutlined, KeyboardArrowDownRound, ListAltRound, DriveFolderUploadOutlined, PlusSharp } from '@ricons/material';
|
|
6
6
|
import { useReactive, useCreation, useSize } from 'ahooks';
|
|
7
7
|
import { createRoot } from 'react-dom/client';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
@@ -1122,7 +1122,7 @@ const List$1 = (props) => {
|
|
|
1122
1122
|
};
|
|
1123
1123
|
List$1.Item = Item$4;
|
|
1124
1124
|
|
|
1125
|
-
const Content$
|
|
1125
|
+
const Content$2 = (props) => {
|
|
1126
1126
|
const { ref, getContainer = (trigger) => {
|
|
1127
1127
|
if (typeof document === "undefined")
|
|
1128
1128
|
return null;
|
|
@@ -1366,7 +1366,7 @@ function Popup(props) {
|
|
|
1366
1366
|
...restProps,
|
|
1367
1367
|
...eventMaps[trigger],
|
|
1368
1368
|
});
|
|
1369
|
-
}), state.show && (jsx(Content$
|
|
1369
|
+
}), state.show && (jsx(Content$2, { ref: contentRef, arrow: arrow && trigger !== "contextmenu", style: { ...style, ...state.style }, arrowProps: state.arrowProps, className: className, ...contentTouch, trigger: triggerRef.current, getContainer: getContainer, children: content }))] }));
|
|
1370
1370
|
}
|
|
1371
1371
|
|
|
1372
1372
|
const { Item: ListItem } = List$1;
|
|
@@ -1816,6 +1816,32 @@ Form.useForm = useForm;
|
|
|
1816
1816
|
Form.Field = Field;
|
|
1817
1817
|
Form.useConfig = useConfig;
|
|
1818
1818
|
|
|
1819
|
+
function Content$1(props) {
|
|
1820
|
+
const { title, footer, hideCloseButton, footerLeft, okButtonProps, cancelButtonProps, children, onOk, onClose, } = props;
|
|
1821
|
+
const showHeader = title || !hideCloseButton;
|
|
1822
|
+
const handleOk = async () => {
|
|
1823
|
+
const ret = await onOk?.();
|
|
1824
|
+
if (ret === false)
|
|
1825
|
+
return;
|
|
1826
|
+
onClose?.();
|
|
1827
|
+
};
|
|
1828
|
+
const renderFooter = useMemo(() => {
|
|
1829
|
+
if (footer || footer === null)
|
|
1830
|
+
return footer;
|
|
1831
|
+
const propsOk = Object.assign({
|
|
1832
|
+
children: "确定",
|
|
1833
|
+
onClick: handleOk,
|
|
1834
|
+
}, okButtonProps);
|
|
1835
|
+
const propsCancel = Object.assign({
|
|
1836
|
+
secondary: true,
|
|
1837
|
+
children: "关闭",
|
|
1838
|
+
onClick: onClose,
|
|
1839
|
+
}, cancelButtonProps);
|
|
1840
|
+
return (jsxs(Fragment, { children: [footerLeft, jsx(Button, { ...propsOk }), jsx(Button, { ...propsCancel })] }));
|
|
1841
|
+
}, [footer, okButtonProps, cancelButtonProps]);
|
|
1842
|
+
return (jsxs(Fragment, { children: [showHeader && (jsxs("header", { className: 'i-modal-header', children: [title && jsx("b", { children: title }), jsx(Helpericon, { active: !hideCloseButton, className: 'i-modal-close', onClick: onClose })] })), jsx("div", { className: 'i-modal-content', children: children }), jsx("footer", { className: 'i-modal-footer', children: renderFooter })] }));
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1819
1845
|
function useModal() {
|
|
1820
1846
|
const ref = useRef(null);
|
|
1821
1847
|
const handleOpen = (props) => {
|
|
@@ -1843,38 +1869,13 @@ function useModal() {
|
|
|
1843
1869
|
};
|
|
1844
1870
|
}
|
|
1845
1871
|
|
|
1846
|
-
function DefaultContent(props) {
|
|
1847
|
-
const { title, footer, hideCloseButton, footerLeft, okButtonProps, cancelButtonProps, children, onOk, onClose, } = props;
|
|
1848
|
-
const showHeader = title || !hideCloseButton;
|
|
1849
|
-
const handleOk = async () => {
|
|
1850
|
-
const ret = await onOk?.();
|
|
1851
|
-
if (ret === false)
|
|
1852
|
-
return;
|
|
1853
|
-
onClose?.();
|
|
1854
|
-
};
|
|
1855
|
-
const renderFooter = useMemo(() => {
|
|
1856
|
-
if (footer || footer === null)
|
|
1857
|
-
return footer;
|
|
1858
|
-
const propsOk = Object.assign({
|
|
1859
|
-
children: "确定",
|
|
1860
|
-
onClick: handleOk,
|
|
1861
|
-
}, okButtonProps);
|
|
1862
|
-
const propsCancel = Object.assign({
|
|
1863
|
-
secondary: true,
|
|
1864
|
-
children: "关闭",
|
|
1865
|
-
onClick: onClose,
|
|
1866
|
-
}, cancelButtonProps);
|
|
1867
|
-
return (jsxs(Fragment, { children: [footerLeft, jsx(Button, { ...propsOk }), jsx(Button, { ...propsCancel })] }));
|
|
1868
|
-
}, [footer, okButtonProps, cancelButtonProps]);
|
|
1869
|
-
return (jsxs(Fragment, { children: [showHeader && (jsxs("header", { className: 'i-modal-header', children: [title && jsx("b", { children: title }), jsx(Helpericon, { active: !hideCloseButton, className: 'i-modal-close', onClick: onClose })] })), jsx("div", { className: 'i-modal-content', children: children }), jsx("footer", { className: 'i-modal-footer', children: renderFooter })] }));
|
|
1870
|
-
}
|
|
1871
1872
|
function Modal(props) {
|
|
1872
1873
|
const { visible, title, footer, okButtonProps, cancelButtonProps, closable = true, hideBackdrop, backdropClosable = true, hideCloseButton, disableEsc, width, height, customized, fixed, hideShadow, children, style, className, keepDOM, footerLeft, onClick, onVisibleChange, onClose, onOk, ...restProps } = props;
|
|
1873
1874
|
const [show, setShow] = useState(visible);
|
|
1874
1875
|
const [active, setActive] = useState(false);
|
|
1875
1876
|
const [bounced, setBounced] = useState(false);
|
|
1876
1877
|
const toggable = useRef(true);
|
|
1877
|
-
const handleShow = () => {
|
|
1878
|
+
const handleShow = async () => {
|
|
1878
1879
|
if (!toggable.current)
|
|
1879
1880
|
return;
|
|
1880
1881
|
(!keepDOM || !show) && setShow(true);
|
|
@@ -1938,7 +1939,7 @@ function Modal(props) {
|
|
|
1938
1939
|
e.stopPropagation();
|
|
1939
1940
|
handleClick();
|
|
1940
1941
|
onClick?.(e);
|
|
1941
|
-
}, ...restProps, children: [customized && children, !customized && (jsx(
|
|
1942
|
+
}, ...restProps, children: [customized && children, !customized && (jsx(Content$1, { title: title, hideCloseButton: hideCloseButton, footer: footer, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps, children: children, footerLeft: footerLeft, onOk: onOk, onClose: handleHide }))] }) }), document?.body ?? null);
|
|
1942
1943
|
}
|
|
1943
1944
|
Modal.useModal = useModal;
|
|
1944
1945
|
|
|
@@ -2495,7 +2496,6 @@ const Image = (props) => {
|
|
|
2495
2496
|
status: "loading",
|
|
2496
2497
|
});
|
|
2497
2498
|
const ref = useRef(null);
|
|
2498
|
-
const wh = fit ? "100%" : undefined;
|
|
2499
2499
|
const { observe, unobserve } = useIntersectionObserver();
|
|
2500
2500
|
const preview = usePreview();
|
|
2501
2501
|
const handleError = (err) => {
|
|
@@ -2510,7 +2510,9 @@ const Image = (props) => {
|
|
|
2510
2510
|
onClick?.(e);
|
|
2511
2511
|
if (!previewable || !src)
|
|
2512
2512
|
return;
|
|
2513
|
+
const previewConfigs = typeof previewable === "boolean" ? {} : previewable;
|
|
2513
2514
|
preview({
|
|
2515
|
+
...previewConfigs,
|
|
2514
2516
|
items: [
|
|
2515
2517
|
{
|
|
2516
2518
|
src,
|
|
@@ -2520,7 +2522,7 @@ const Image = (props) => {
|
|
|
2520
2522
|
});
|
|
2521
2523
|
};
|
|
2522
2524
|
useEffect(() => {
|
|
2523
|
-
if (!src)
|
|
2525
|
+
if (!src || typeof window === "undefined")
|
|
2524
2526
|
return;
|
|
2525
2527
|
if (!ref.current?.complete && observe && lazyload) {
|
|
2526
2528
|
state.status = "loading";
|
|
@@ -2547,7 +2549,7 @@ const Image = (props) => {
|
|
|
2547
2549
|
}, className: classNames("i-image", className, {
|
|
2548
2550
|
rounded: round,
|
|
2549
2551
|
[`i-image-${state.status}`]: state.status,
|
|
2550
|
-
}), children: state.status === "error" ? (fallback) : (jsxs(Fragment, { children: [src && (jsx("img", { ref: ref, style: { objectFit: fit
|
|
2552
|
+
}), children: state.status === "error" ? (fallback) : (jsxs(Fragment, { children: [src && (jsx("img", { ref: ref, style: { objectFit: fit }, ...restProps, onLoad: handleLoad, onError: handleError, onClick: handleClick })), src && state.status === "loading" && jsx(Loading, { absolute: true }), cover && (jsx("div", { className: classNames("i-image-cover", coverClass), onClick: handleClick, children: cover }))] })) }));
|
|
2551
2553
|
};
|
|
2552
2554
|
Image.List = List;
|
|
2553
2555
|
|
|
@@ -2561,7 +2563,7 @@ function InputContainer(props) {
|
|
|
2561
2563
|
}
|
|
2562
2564
|
|
|
2563
2565
|
const Number = (props) => {
|
|
2564
|
-
const { ref, label, name, value = props.initValue ?? "", initValue, labelInline, step = 1, min = -Infinity, max = Infinity, thousand, precision, type, className, width, status = "normal", append, border, prepend, message, tip, hideControl, style, onChange, onEnter, onInput, onBlur, ...restProps } = props;
|
|
2566
|
+
const { ref, label, name, value = props.initValue ?? "", initValue, labelInline, step = 1, min = -Infinity, max = Infinity, thousand, precision, type, className, width, status = "normal", append, border, prepend, disabled, message, tip, hideControl, style, onChange, onEnter, onInput, onBlur, ...restProps } = props;
|
|
2565
2567
|
const state = useReactive({
|
|
2566
2568
|
value,
|
|
2567
2569
|
});
|
|
@@ -2592,6 +2594,7 @@ const Number = (props) => {
|
|
|
2592
2594
|
const inputProps = {
|
|
2593
2595
|
ref,
|
|
2594
2596
|
name,
|
|
2597
|
+
disabled,
|
|
2595
2598
|
value: state.value,
|
|
2596
2599
|
className: "i-input i-input-number",
|
|
2597
2600
|
onChange: handleChange,
|
|
@@ -2600,7 +2603,7 @@ const Number = (props) => {
|
|
|
2600
2603
|
return (jsx(InputContainer, { label: label, labelInline: labelInline, className: className, style: { width, ...style }, tip: message ?? tip, status: status, children: jsxs("div", { className: classNames("i-input-item", {
|
|
2601
2604
|
[`i-input-${status}`]: status !== "normal",
|
|
2602
2605
|
"i-input-borderless": !border,
|
|
2603
|
-
}), children: [prepend && jsx("div", { className: 'i-input-prepend', children: prepend }), !hideControl && (jsx(Helpericon, { active: true, icon: jsx(MinusRound, {}), onClick: () => handleOperate(-step) })), jsx("input", { ...inputProps }), !hideControl && (jsx(Helpericon, { active: true, icon: jsx(PlusRound, {}), onClick: () => handleOperate(step) })), append && jsx("div", { className: 'i-input-append', children: append })] }) }));
|
|
2606
|
+
}), children: [prepend && jsx("div", { className: 'i-input-prepend', children: prepend }), !hideControl && !disabled && (jsx(Helpericon, { active: true, icon: jsx(MinusRound, {}), onClick: () => handleOperate(-step) })), jsx("input", { ...inputProps }), !hideControl && !disabled && (jsx(Helpericon, { active: true, icon: jsx(PlusRound, {}), onClick: () => handleOperate(step) })), append && jsx("div", { className: 'i-input-append', children: append })] }) }));
|
|
2604
2607
|
};
|
|
2605
2608
|
|
|
2606
2609
|
const Range = (props) => {
|
|
@@ -2709,7 +2712,7 @@ const Textarea = (props) => {
|
|
|
2709
2712
|
};
|
|
2710
2713
|
|
|
2711
2714
|
const Input = ((props) => {
|
|
2712
|
-
const { ref, type = "text", label, name, value = props.initValue ?? "", initValue = "", prepend, append, labelInline, className, status = "normal", message, tip, clear, width, hideVisible, border, required, onChange, onEnter, style, ...restProps } = props;
|
|
2715
|
+
const { ref, type = "text", label, name, value = props.initValue ?? "", initValue = "", prepend, append, labelInline, className, status = "normal", message, tip, clear, width, hideVisible, border, required, maxLength, onChange, onEnter, style, ...restProps } = props;
|
|
2713
2716
|
const state = useReactive({
|
|
2714
2717
|
value,
|
|
2715
2718
|
type,
|
|
@@ -2748,6 +2751,7 @@ const Input = ((props) => {
|
|
|
2748
2751
|
type: state.type,
|
|
2749
2752
|
name,
|
|
2750
2753
|
value: state.value,
|
|
2754
|
+
maxLength,
|
|
2751
2755
|
className: classNames("i-input", `i-input-${type}`),
|
|
2752
2756
|
onChange: handleChange,
|
|
2753
2757
|
onKeyDown: handleKeydown,
|
|
@@ -2758,7 +2762,7 @@ const Input = ((props) => {
|
|
|
2758
2762
|
return (jsx(InputContainer, { label: label, labelInline: labelInline, className: className, style: { width, ...style }, tip: message ?? tip, status: status, required: required, children: jsxs("div", { className: classNames("i-input-item", {
|
|
2759
2763
|
[`i-input-${status}`]: status !== "normal",
|
|
2760
2764
|
"i-input-borderless": !border,
|
|
2761
|
-
}), children: [prepend && jsx("div", { className: 'i-input-prepend', children: prepend }), jsx("input", { ...inputProps }), jsx(Helpericon, { active: !!clearable || showHelper, icon: HelperIcon, onClick: handleHelperClick }), append && jsx("div", { className: 'i-input-append', children: append })] }) }));
|
|
2765
|
+
}), children: [prepend && jsx("div", { className: 'i-input-prepend', children: prepend }), jsx("input", { ...inputProps }), maxLength && state.value?.length > 0 && (jsxs("span", { className: 'color-8 pr-4 font-sm', children: [state.value.length, " / ", maxLength] })), jsx(Helpericon, { active: !!clearable || showHelper, icon: HelperIcon, onClick: handleHelperClick }), append && jsx("div", { className: 'i-input-append', children: append })] }) }));
|
|
2762
2766
|
});
|
|
2763
2767
|
Input.Textarea = Textarea;
|
|
2764
2768
|
Input.Number = Number;
|
|
@@ -3477,7 +3481,7 @@ const defaultCancel = {
|
|
|
3477
3481
|
secondary: true,
|
|
3478
3482
|
};
|
|
3479
3483
|
const Popconfirm = (props) => {
|
|
3480
|
-
const { trigger = "click", visible, icon = jsx(Icon, { icon: jsx(InfoOutlined, {}), className: 'error' }), content, okButtonProps, cancelButtonProps, children, align = "end", position = "top", offset = 12, extra, onOk, onClose, ...restProps } = props;
|
|
3484
|
+
const { trigger = "click", visible, icon = jsx(Icon, { icon: jsx(InfoOutlined, {}), className: 'error', size: '1.2em' }), content, okButtonProps, cancelButtonProps, children, align = "end", position = "top", offset = 12, extra, onOk, onClose, ...restProps } = props;
|
|
3481
3485
|
const state = useReactive({
|
|
3482
3486
|
loading: false,
|
|
3483
3487
|
visible,
|
|
@@ -3508,7 +3512,7 @@ const Popconfirm = (props) => {
|
|
|
3508
3512
|
await onClose?.();
|
|
3509
3513
|
state.visible = false;
|
|
3510
3514
|
};
|
|
3511
|
-
const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap:
|
|
3515
|
+
const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap: '.5em', children: [icon, jsx("div", { className: 'i-popconfirm-content', children: content })] }), jsxs(Flex, { gap: 12, justify: 'flex-end', className: 'mt-8 i-popconfirm-footer', children: [cancelButtonProps !== null && (jsx(Button, { ...cancel, onClick: handleCancel })), extra, okButtonProps !== null && (jsx(Button, { loading: state.loading, ...ok, onClick: handleOk }))] })] }));
|
|
3512
3516
|
return (jsx(Popup, { content: popconfirmContent, ...restProps, trigger: trigger, visible: state.visible, align: align, offset: offset, position: position, onVisibleChange: handleVisibleChange, children: children }));
|
|
3513
3517
|
};
|
|
3514
3518
|
|
|
@@ -4329,7 +4333,7 @@ const FileListItem = (props) => {
|
|
|
4329
4333
|
};
|
|
4330
4334
|
|
|
4331
4335
|
const Upload = (props) => {
|
|
4332
|
-
const { ref, label, labelInline, value, files = [], initialFiles, placeholder, status = "normal", message, className, style, children,
|
|
4336
|
+
const { ref, label, labelInline, value, files = [], initialFiles, placeholder, status = "normal", message, className, style, children, defaultButtonProps, mode = "default", cardSize = "4em", disabled, sortable, limit = props.multiple ? Infinity : 1, multiple, renderItem, shouldUpload = () => true, uploader, onChange, onFilesChange, onUpload, ...restProps } = props;
|
|
4333
4337
|
const state = useReactive({
|
|
4334
4338
|
files,
|
|
4335
4339
|
value,
|
|
@@ -4338,6 +4342,9 @@ const Upload = (props) => {
|
|
|
4338
4342
|
});
|
|
4339
4343
|
const inputRef = useRef(null);
|
|
4340
4344
|
const preview = usePreview();
|
|
4345
|
+
const defBtnProps = Object.assign({
|
|
4346
|
+
children: (jsxs(Fragment, { children: [jsx(Icon, { icon: jsx(DriveFolderUploadOutlined, {}) }), " \u4E0A\u4F20"] })),
|
|
4347
|
+
}, defaultButtonProps);
|
|
4341
4348
|
const trigger = useMemo(() => {
|
|
4342
4349
|
if (children)
|
|
4343
4350
|
return children;
|
|
@@ -4345,7 +4352,7 @@ const Upload = (props) => {
|
|
|
4345
4352
|
case "card":
|
|
4346
4353
|
return (jsx(Button, { className: 'i-upload-card-btn color-5', square: true, flat: true, outline: true, disabled: disabled, children: jsx(Icon, { icon: jsx(PlusSharp, {}) }) }));
|
|
4347
4354
|
default:
|
|
4348
|
-
return (jsx(Button, { className:
|
|
4355
|
+
return (jsx(Button, { ...defBtnProps, className: classNames("i-upload-btn", defBtnProps.className), disabled: disabled }));
|
|
4349
4356
|
}
|
|
4350
4357
|
}, [mode, children]);
|
|
4351
4358
|
const handleChange = (e) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { IPreview } from '../../js/usePreview/type.js';
|
|
3
3
|
import List from './list.js';
|
|
4
4
|
|
|
5
5
|
interface IImage extends HTMLAttributes<HTMLImageElement> {
|
|
@@ -17,7 +17,7 @@ interface IImage extends HTMLAttributes<HTMLImageElement> {
|
|
|
17
17
|
ratio?: number;
|
|
18
18
|
cover?: ReactNode;
|
|
19
19
|
coverClass?: string;
|
|
20
|
-
usePreview?: boolean |
|
|
20
|
+
usePreview?: boolean | IPreview;
|
|
21
21
|
}
|
|
22
22
|
interface IImageList extends Omit<IImage, "src" | "alt"> {
|
|
23
23
|
items: string[] | IImage[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes, RefObject, ReactNode, ChangeEvent } from 'react';
|
|
2
2
|
import { BaseInput } from '../../type/index.js';
|
|
3
|
+
import { IButton } from '../button/type.js';
|
|
3
4
|
|
|
4
5
|
interface IUpload extends Omit<BaseInput, "ref">, Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "onChange"> {
|
|
5
6
|
ref?: RefObject<RefUpload | null>;
|
|
@@ -13,7 +14,7 @@ interface IUpload extends Omit<BaseInput, "ref">, Omit<InputHTMLAttributes<HTMLI
|
|
|
13
14
|
mode?: "default" | "card";
|
|
14
15
|
droppable?: boolean;
|
|
15
16
|
cardSize?: string;
|
|
16
|
-
|
|
17
|
+
defaultButtonProps?: IButton;
|
|
17
18
|
shouldUpload?: (file: IFile) => boolean;
|
|
18
19
|
uploader?: (file: IFile) => Promise<IFile>;
|
|
19
20
|
renderItem?: (file: IFile, i: number) => ReactNode;
|