@para-ui/core 4.0.28 → 4.0.30
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/ContentBox/index.d.ts +33 -0
- package/ContentBox/index.js +89 -0
- package/README.md +7 -0
- package/RangeInput/index.d.ts +55 -0
- package/RangeInput/index.js +169 -0
- package/Transfer/index.js +49 -43
- package/Upload/index.js +756 -479
- package/index.d.ts +4 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/umd/ContentBox.js +28 -0
- package/umd/RangeInput.js +43 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
import { LoadingProps } from '../Loading';
|
|
4
|
+
import { EmptyProps } from '../Empty';
|
|
5
|
+
export interface ContentBoxProps {
|
|
6
|
+
/** className */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** className */
|
|
9
|
+
scrollClassName?: string;
|
|
10
|
+
/** style */
|
|
11
|
+
scrollStyle?: CSSProperties;
|
|
12
|
+
/** style */
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
/** 是否正在加载 */
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
/** loading 属性*/
|
|
17
|
+
loadingProps?: LoadingProps;
|
|
18
|
+
/** loading 是否显示在内容上方*/
|
|
19
|
+
loadingOverlay?: boolean;
|
|
20
|
+
/** empty */
|
|
21
|
+
empty?: boolean;
|
|
22
|
+
/** 是否支持滚动 */
|
|
23
|
+
scroll?: boolean;
|
|
24
|
+
/** emptyProps */
|
|
25
|
+
emptyProps?: EmptyProps;
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
/** 自定义加载组件 */
|
|
28
|
+
loadingComponent?: ReactNode;
|
|
29
|
+
/** 自定义空组件 */
|
|
30
|
+
emptyComponent?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
declare const ContentBox: React.ForwardRefExoticComponent<ContentBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export default ContentBox;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
4
|
+
import { Loading } from '../Loading/index.js';
|
|
5
|
+
import Empty from '../Empty/index.js';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
8
|
+
import '@para-ui/icons/LoadingF';
|
|
9
|
+
import '../_verture/useFormatMessage-1fc7c957.js';
|
|
10
|
+
import '../_verture/index-ca413216.js';
|
|
11
|
+
import '@paraview/lib';
|
|
12
|
+
import '../_verture/useGlobalProps-4ae1a007.js';
|
|
13
|
+
|
|
14
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-content-box {\n height: 100%;\n position: relative;\n}\n.paraui-v4-content-box-scroll {\n overflow: auto;\n width: 100%;\n max-height: 100%;\n position: relative;\n}\n.paraui-v4-content-box-fill {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.paraui-v4-content-box-loading {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 101;\n background-color: white;\n opacity: 0.7;\n}";
|
|
15
|
+
styleInject(css_248z);
|
|
16
|
+
|
|
17
|
+
const ContentBox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
18
|
+
let {
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
loading,
|
|
22
|
+
empty,
|
|
23
|
+
scroll,
|
|
24
|
+
children,
|
|
25
|
+
scrollClassName,
|
|
26
|
+
scrollStyle,
|
|
27
|
+
emptyProps,
|
|
28
|
+
loadingComponent,
|
|
29
|
+
loadingOverlay = true,
|
|
30
|
+
loadingProps,
|
|
31
|
+
emptyComponent
|
|
32
|
+
} = _ref;
|
|
33
|
+
const renderLoadingContent = () => {
|
|
34
|
+
if (loading) {
|
|
35
|
+
return loadingComponent ? jsx("div", Object.assign({
|
|
36
|
+
className: clsx("".concat($prefixCls, "-content-box-loading"), loadingProps === null || loadingProps === void 0 ? void 0 : loadingProps.className),
|
|
37
|
+
style: Object.assign(Object.assign({}, loadingProps === null || loadingProps === void 0 ? void 0 : loadingProps.style), {
|
|
38
|
+
opacity: loadingProps === null || loadingProps === void 0 ? void 0 : loadingProps.opacity
|
|
39
|
+
})
|
|
40
|
+
}, {
|
|
41
|
+
children: loadingComponent
|
|
42
|
+
})) : jsx(Loading, Object.assign({}, loadingProps), loadingOverlay ? 'loading' : 'loading-overlay');
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
const renderEmptyContent = () => {
|
|
47
|
+
if (!loading && empty) {
|
|
48
|
+
return jsx("div", Object.assign({
|
|
49
|
+
className: "".concat($prefixCls, "-content-box-fill")
|
|
50
|
+
}, {
|
|
51
|
+
children: emptyComponent ? emptyComponent : jsx(Empty, Object.assign({}, emptyProps))
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
const renderContent = () => {
|
|
57
|
+
const loadingContent = renderLoadingContent();
|
|
58
|
+
// 如果loadingOverlay为false, loading时不显示内容
|
|
59
|
+
if (!loadingOverlay && loadingContent) {
|
|
60
|
+
return jsx("div", Object.assign({
|
|
61
|
+
className: "".concat($prefixCls, "-content-box-fill")
|
|
62
|
+
}, {
|
|
63
|
+
children: loadingContent
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
const emptyContent = renderEmptyContent();
|
|
67
|
+
if (emptyContent) {
|
|
68
|
+
return emptyContent;
|
|
69
|
+
}
|
|
70
|
+
return scroll ? jsx("div", Object.assign({
|
|
71
|
+
className: clsx("".concat($prefixCls, "-content-box-scroll"), scrollClassName),
|
|
72
|
+
style: scrollStyle
|
|
73
|
+
}, {
|
|
74
|
+
children: children
|
|
75
|
+
})) : jsx(Fragment, {
|
|
76
|
+
children: children
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return jsxs("div", Object.assign({
|
|
80
|
+
ref: ref,
|
|
81
|
+
className: clsx("".concat($prefixCls, "-content-box"), className),
|
|
82
|
+
style: style
|
|
83
|
+
}, {
|
|
84
|
+
children: [renderContent(), renderLoadingContent()]
|
|
85
|
+
}));
|
|
86
|
+
});
|
|
87
|
+
ContentBox.displayName = 'ContentBox';
|
|
88
|
+
|
|
89
|
+
export { ContentBox as default };
|
package/README.md
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author linhd
|
|
3
|
+
* @date 2024/7/29 10:21
|
|
4
|
+
* @description 范围输入框
|
|
5
|
+
*/
|
|
6
|
+
import React, { FunctionComponent, ReactNode } from 'react';
|
|
7
|
+
import { LabelTooltipProps } from '../Label';
|
|
8
|
+
import { InputNumberProps } from '../InputNumber';
|
|
9
|
+
import { HelperTextDetailProps } from '../HelperText';
|
|
10
|
+
import { TooltipProps } from '../Tooltip';
|
|
11
|
+
import './index.scss';
|
|
12
|
+
export interface RangeInputProps extends HelperTextDetailProps {
|
|
13
|
+
/** 样式class */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** style */
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
/** 标题 */
|
|
18
|
+
label?: ReactNode;
|
|
19
|
+
/** 帮组提示信息 */
|
|
20
|
+
labelTooltip?: LabelTooltipProps;
|
|
21
|
+
/** 尺寸 */
|
|
22
|
+
size?: 'small' | 'medium' | 'large';
|
|
23
|
+
/** 是否必填 */
|
|
24
|
+
required?: boolean;
|
|
25
|
+
/** 是否禁用 */
|
|
26
|
+
disabled?: boolean | [boolean, boolean];
|
|
27
|
+
/**
|
|
28
|
+
* 禁用提示
|
|
29
|
+
*/
|
|
30
|
+
disabledTooltip?: TooltipProps | [TooltipProps, TooltipProps];
|
|
31
|
+
/** 默认值 不受控 */
|
|
32
|
+
defaultValue?: [number | null, number | null];
|
|
33
|
+
/** 默认值 */
|
|
34
|
+
value?: [number | null, number | null];
|
|
35
|
+
/** 中间符号 */
|
|
36
|
+
separator?: ReactNode;
|
|
37
|
+
/** 单位 */
|
|
38
|
+
unit?: ReactNode;
|
|
39
|
+
/** 提示语 */
|
|
40
|
+
placeholder?: ReactNode | [ReactNode, ReactNode];
|
|
41
|
+
/** 输入框其他参数 */
|
|
42
|
+
otherProps?: [InputNumberProps, InputNumberProps];
|
|
43
|
+
/**
|
|
44
|
+
* 改变值
|
|
45
|
+
* */
|
|
46
|
+
onChange?: (val: [number | null, number | null], index: number) => void;
|
|
47
|
+
/** 失去焦点 */
|
|
48
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>, index: number) => void;
|
|
49
|
+
/** 得到焦点 */
|
|
50
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>, index: number) => void;
|
|
51
|
+
/** 回车事件 */
|
|
52
|
+
onEnter?: (event: React.KeyboardEventHandler<HTMLInputElement>, index: number) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare const RangeInput: FunctionComponent<RangeInputProps>;
|
|
55
|
+
export default RangeInput;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
4
|
+
import Label from '../Label/index.js';
|
|
5
|
+
import { InputNumber } from '../InputNumber/index.js';
|
|
6
|
+
import HelperText from '../HelperText/index.js';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import { Tooltip } from '../Tooltip/index.js';
|
|
9
|
+
import { DeepClone } from '@paraview/lib';
|
|
10
|
+
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
11
|
+
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
12
|
+
import '../Help/index.js';
|
|
13
|
+
import '@para-ui/icons/Help';
|
|
14
|
+
import 'rc-tooltip';
|
|
15
|
+
import 'rc-tooltip/lib/placements';
|
|
16
|
+
import '@para-ui/icons/Forbid';
|
|
17
|
+
import 'rc-input-number';
|
|
18
|
+
import '@para-ui/icons/Up';
|
|
19
|
+
import '@para-ui/icons/Down';
|
|
20
|
+
|
|
21
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-range-input {\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n display: inline-block;\n width: 100%;\n}\n.paraui-v4-range-input > .range-input-content {\n border: 1px solid;\n border-radius: 4px;\n border-color: rgb(212, 218, 227);\n display: flex;\n align-items: center;\n width: 100%;\n position: relative;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-range-input > .range-input-content:hover {\n border-color: rgb(46, 101, 230);\n}\n.paraui-v4-range-input > .range-input-content > .paraui-v4-input-number > .input-number-content {\n border: none;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-range-input > .range-input-content > .separator {\n color: rgb(29, 33, 38);\n font-size: 14px;\n padding-left: 10px;\n height: 100%;\n display: flex;\n align-items: center;\n line-height: 1;\n}\n.paraui-v4-range-input > .range-input-content > .unit {\n color: rgb(29, 33, 38);\n font-size: 14px;\n padding: 0 10px;\n}\n.paraui-v4-range-input.paraui-v4-range-input-focus > .range-input-content {\n border-color: rgb(46, 101, 230);\n}\n.paraui-v4-range-input.paraui-v4-range-input-disabled > .range-input-content {\n cursor: not-allowed;\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-range-input.paraui-v4-range-input-disabled > .range-input-content:hover {\n border-color: rgb(212, 218, 227);\n}\n.paraui-v4-range-input.paraui-v4-range-input-disabled > .range-input-content > .paraui-v4-input-number > .input-number-content {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-range-input.paraui-v4-range-input-error > .range-input-content {\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-range-input.paraui-v4-range-input-error > .range-input-content:hover {\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-range-input.paraui-v4-range-input-small > .range-input-content {\n height: 28px;\n}\n.paraui-v4-range-input.paraui-v4-range-input-small > .range-input-content > .paraui-v4-input-number .input-number-content {\n height: 26px;\n}\n.paraui-v4-range-input.paraui-v4-range-input-medium > .range-input-content {\n height: 28px;\n}\n.paraui-v4-range-input.paraui-v4-range-input-medium > .range-input-content > .paraui-v4-input-number .input-number-content {\n height: 26px;\n}\n.paraui-v4-range-input.paraui-v4-range-input-large > .range-input-content {\n height: 32px;\n}\n.paraui-v4-range-input.paraui-v4-range-input-large > .range-input-content > .paraui-v4-input-number .input-number-content {\n height: 30px;\n}";
|
|
22
|
+
styleInject(css_248z);
|
|
23
|
+
|
|
24
|
+
const RangeInput = props => {
|
|
25
|
+
const {
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
28
|
+
label,
|
|
29
|
+
labelTooltip,
|
|
30
|
+
size = 'large',
|
|
31
|
+
required = false,
|
|
32
|
+
disabled = false,
|
|
33
|
+
disabledTooltip,
|
|
34
|
+
defaultValue,
|
|
35
|
+
value,
|
|
36
|
+
error = false,
|
|
37
|
+
hideErrorDom,
|
|
38
|
+
helperText = '',
|
|
39
|
+
separator = '~',
|
|
40
|
+
unit,
|
|
41
|
+
placeholder,
|
|
42
|
+
onFocus,
|
|
43
|
+
onBlur,
|
|
44
|
+
onEnter,
|
|
45
|
+
onChange,
|
|
46
|
+
otherProps
|
|
47
|
+
} = props;
|
|
48
|
+
const [valueCom, setValueCom] = useState([null, null]);
|
|
49
|
+
const [focus, setFocus] = useState(false); // 是否获取焦点
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (props.defaultValue !== undefined) setValueCom(props.defaultValue);
|
|
52
|
+
}, []);
|
|
53
|
+
// 监听value
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (value !== undefined) {
|
|
56
|
+
setValueCom(value);
|
|
57
|
+
}
|
|
58
|
+
}, [value]);
|
|
59
|
+
/** 处理placeholder */
|
|
60
|
+
const handlePlaceholder = index => {
|
|
61
|
+
if (placeholder && placeholder instanceof Array) {
|
|
62
|
+
return placeholder[index];
|
|
63
|
+
}
|
|
64
|
+
return placeholder;
|
|
65
|
+
};
|
|
66
|
+
/** 处理disabled */
|
|
67
|
+
const handleDisabled = index => {
|
|
68
|
+
if (disabled && disabled instanceof Array) {
|
|
69
|
+
return disabled[index];
|
|
70
|
+
}
|
|
71
|
+
return disabled;
|
|
72
|
+
};
|
|
73
|
+
/** 得到焦点 */
|
|
74
|
+
const onFocusCom = index => event => {
|
|
75
|
+
setFocus(true);
|
|
76
|
+
onFocus && onFocus(event, index);
|
|
77
|
+
};
|
|
78
|
+
/** 失去焦点 */
|
|
79
|
+
const onBlurCom = index => event => {
|
|
80
|
+
setFocus(false);
|
|
81
|
+
onBlur && onBlur(event, index);
|
|
82
|
+
if (valueCom[0] !== null && valueCom[1] !== null) {
|
|
83
|
+
if (valueCom[0] > valueCom[1]) {
|
|
84
|
+
onChangeCom(index)(null);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
/** 回车事件 */
|
|
89
|
+
const onEnterCom = index => event => {
|
|
90
|
+
onEnter && onEnter(event, index);
|
|
91
|
+
};
|
|
92
|
+
/** change事件 */
|
|
93
|
+
const onChangeCom = index => val => {
|
|
94
|
+
const valHandle = valueCom ? DeepClone(valueCom) : [];
|
|
95
|
+
valHandle[index] = val;
|
|
96
|
+
if (props.value === undefined) {
|
|
97
|
+
setValueCom(valHandle);
|
|
98
|
+
}
|
|
99
|
+
onChange && onChange(valHandle, index);
|
|
100
|
+
};
|
|
101
|
+
const contentRender = () => {
|
|
102
|
+
return jsxs("div", Object.assign({
|
|
103
|
+
className: 'range-input-content'
|
|
104
|
+
}, {
|
|
105
|
+
children: [jsx(InputNumber, Object.assign({}, otherProps && otherProps[0], {
|
|
106
|
+
btnMode: "none",
|
|
107
|
+
hideErrorDom: true,
|
|
108
|
+
placeholder: handlePlaceholder(0),
|
|
109
|
+
disabled: handleDisabled(0),
|
|
110
|
+
disabledTooltip: disabledTooltip === null || disabledTooltip === void 0 ? void 0 : disabledTooltip[0],
|
|
111
|
+
value: valueCom[0],
|
|
112
|
+
onFocus: onFocusCom(0),
|
|
113
|
+
onBlur: onBlurCom(0),
|
|
114
|
+
onPressEnter: onEnterCom(0),
|
|
115
|
+
onChange: onChangeCom(0)
|
|
116
|
+
})), jsx("span", Object.assign({
|
|
117
|
+
className: 'separator'
|
|
118
|
+
}, {
|
|
119
|
+
children: separator
|
|
120
|
+
})), jsx(InputNumber, Object.assign({}, otherProps && otherProps[1], {
|
|
121
|
+
btnMode: "none",
|
|
122
|
+
hideErrorDom: true,
|
|
123
|
+
placeholder: handlePlaceholder(1),
|
|
124
|
+
disabled: handleDisabled(1),
|
|
125
|
+
disabledTooltip: disabledTooltip === null || disabledTooltip === void 0 ? void 0 : disabledTooltip[1],
|
|
126
|
+
value: valueCom[1],
|
|
127
|
+
onFocus: onFocusCom(1),
|
|
128
|
+
onBlur: onBlurCom(1),
|
|
129
|
+
onPressEnter: onEnterCom(1),
|
|
130
|
+
onChange: onChangeCom(1)
|
|
131
|
+
})), unit && jsx("span", Object.assign({
|
|
132
|
+
className: 'unit'
|
|
133
|
+
}, {
|
|
134
|
+
children: unit
|
|
135
|
+
}))]
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
/** 处理内容 */
|
|
139
|
+
const handleContent = () => {
|
|
140
|
+
if (disabledTooltip && !(disabledTooltip instanceof Array)) {
|
|
141
|
+
return jsx(Tooltip, Object.assign({
|
|
142
|
+
disabled: true
|
|
143
|
+
}, disabledTooltip, {
|
|
144
|
+
children: contentRender()
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
return contentRender();
|
|
148
|
+
};
|
|
149
|
+
return jsxs("div", Object.assign({
|
|
150
|
+
className: clsx(className, "".concat($prefixCls, "-range-input"), "".concat($prefixCls, "-range-input-").concat(size), {
|
|
151
|
+
["".concat($prefixCls, "-range-input-focus")]: focus,
|
|
152
|
+
["".concat($prefixCls, "-range-input-disabled")]: disabled === true || handleDisabled(0) && handleDisabled(1),
|
|
153
|
+
["".concat($prefixCls, "-range-input-error")]: error
|
|
154
|
+
}),
|
|
155
|
+
style: style
|
|
156
|
+
}, {
|
|
157
|
+
children: [jsx(Label, Object.assign({
|
|
158
|
+
label: label,
|
|
159
|
+
required: required
|
|
160
|
+
}, labelTooltip)), handleContent(), jsx(HelperText, {
|
|
161
|
+
className: "range-input-error-text",
|
|
162
|
+
error: error,
|
|
163
|
+
helperText: helperText,
|
|
164
|
+
hideErrorDom: hideErrorDom
|
|
165
|
+
})]
|
|
166
|
+
}));
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export { RangeInput, RangeInput as default };
|
package/Transfer/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import ExpandLess from '@para-ui/icons/Up';
|
|
|
8
8
|
import Down from '@para-ui/icons/Down';
|
|
9
9
|
import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
|
|
10
10
|
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
11
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
11
12
|
import { Search } from '../Search/index.js';
|
|
12
13
|
import SearchIcon from '@para-ui/icons/Search';
|
|
13
14
|
import AutoTips from '../AutoTips/index.js';
|
|
@@ -27,6 +28,7 @@ import '../_verture/usePopupContainer-635f66f4.js';
|
|
|
27
28
|
import 'dayjs';
|
|
28
29
|
import '@paraview/lib';
|
|
29
30
|
import '../_verture/index-ca413216.js';
|
|
31
|
+
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
30
32
|
import '../TextField/index.js';
|
|
31
33
|
import '../Label/index.js';
|
|
32
34
|
import '../Help/index.js';
|
|
@@ -59,8 +61,8 @@ var zh = {
|
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
var localeJson = {
|
|
62
|
-
zh,
|
|
63
|
-
en
|
|
64
|
+
zh: zh,
|
|
65
|
+
en: en
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
var useClick = function useClick(callback, doubleCallback) {
|
|
@@ -88,32 +90,36 @@ var useClick = function useClick(callback, doubleCallback) {
|
|
|
88
90
|
};
|
|
89
91
|
};
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
93
|
+
var Box = function Box(props) {
|
|
94
|
+
var title = props.title,
|
|
95
|
+
data = props.data,
|
|
96
|
+
onSearch = props.onSearch,
|
|
97
|
+
onchange = props.onchange,
|
|
98
|
+
onMove = props.onMove,
|
|
99
|
+
queryAll = props.queryAll,
|
|
100
|
+
inverse = props.inverse,
|
|
101
|
+
direction = props.direction,
|
|
102
|
+
fluctuationPosition = props.fluctuationPosition,
|
|
103
|
+
fluctuationOrther = props.fluctuationOrther,
|
|
104
|
+
onEndSort = props.onEndSort,
|
|
105
|
+
multiple = props.multiple,
|
|
106
|
+
rightIcon = props.rightIcon,
|
|
107
|
+
style = props.style,
|
|
108
|
+
customKey = props.customKey;
|
|
109
|
+
var intl = useFormatMessage('Transfer', localeJson);
|
|
110
|
+
var _useState = useState([]),
|
|
111
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
112
|
+
checkCount = _useState2[0],
|
|
113
|
+
setCheckCount = _useState2[1];
|
|
114
|
+
var _useState3 = useState(0),
|
|
115
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
116
|
+
disabledCount = _useState4[0],
|
|
117
|
+
setDisabledCount = _useState4[1];
|
|
118
|
+
var ref = useRef();
|
|
119
|
+
useEffect(function () {
|
|
120
|
+
var arr = [];
|
|
121
|
+
var count = 0;
|
|
122
|
+
data.forEach(function (item, index) {
|
|
117
123
|
if (item.checked && !item.hide) {
|
|
118
124
|
arr.push(index);
|
|
119
125
|
}
|
|
@@ -124,29 +130,29 @@ const Box = props => {
|
|
|
124
130
|
setDisabledCount(count);
|
|
125
131
|
setCheckCount(arr);
|
|
126
132
|
}, [data]);
|
|
127
|
-
useEffect(()
|
|
133
|
+
useEffect(function () {
|
|
128
134
|
if (direction == 'right') {
|
|
129
135
|
new Sortable(ref.current, {
|
|
130
136
|
animation: 180,
|
|
131
137
|
ghostClass: 'blue-background-class',
|
|
132
138
|
dragClass: 'drag-item',
|
|
133
139
|
easing: 'step-start',
|
|
134
|
-
onEnd: evt
|
|
140
|
+
onEnd: function onEnd(evt) {
|
|
135
141
|
onEndSort === null || onEndSort === void 0 ? void 0 : onEndSort(evt.oldIndex, evt.newIndex);
|
|
136
142
|
}
|
|
137
143
|
});
|
|
138
144
|
}
|
|
139
145
|
}, []);
|
|
140
|
-
|
|
146
|
+
var handler = useClick(function (e, index, item) {
|
|
141
147
|
if (item.disabled) return;
|
|
142
148
|
onchange(e, !item.checked, index, direction, multiple);
|
|
143
|
-
}, (e, index, item)
|
|
149
|
+
}, function (e, index, item) {
|
|
144
150
|
if (item === null || item === void 0 ? void 0 : item.disabled) return;
|
|
145
151
|
onchange(e, true, index, direction, false);
|
|
146
152
|
onMove(direction === 'right' ? 'left' : 'right');
|
|
147
153
|
});
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
var itemStyle = function itemStyle(data) {
|
|
155
|
+
var stlye = {};
|
|
150
156
|
if (data === null || data === void 0 ? void 0 : data.tagColor) {
|
|
151
157
|
stlye.borderLeft = "4px solid ".concat(data.tagColor);
|
|
152
158
|
}
|
|
@@ -171,15 +177,15 @@ const Box = props => {
|
|
|
171
177
|
showBtn: false,
|
|
172
178
|
rightIcon: jsx(SearchIcon, {}),
|
|
173
179
|
rightIconExist: true,
|
|
174
|
-
onChange: val
|
|
180
|
+
onChange: function onChange(val) {
|
|
175
181
|
onSearch(val, direction);
|
|
176
182
|
},
|
|
177
|
-
onClickRightIcon: val
|
|
183
|
+
onClickRightIcon: function onClickRightIcon(val) {
|
|
178
184
|
onSearch(val, direction);
|
|
179
185
|
},
|
|
180
|
-
onEnter: event
|
|
186
|
+
onEnter: function onEnter(event) {
|
|
181
187
|
var _a;
|
|
182
|
-
|
|
188
|
+
var val = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
183
189
|
onSearch(val, direction);
|
|
184
190
|
},
|
|
185
191
|
allowClear: false
|
|
@@ -187,11 +193,11 @@ const Box = props => {
|
|
|
187
193
|
className: "context",
|
|
188
194
|
ref: ref
|
|
189
195
|
}, {
|
|
190
|
-
children: data.map((item, index)
|
|
196
|
+
children: data.map(function (item, index) {
|
|
191
197
|
return jsxs("div", Object.assign({
|
|
192
198
|
className: clsx('item', (item === null || item === void 0 ? void 0 : item.tagColor) && 'item-border', (item === null || item === void 0 ? void 0 : item.disabled) && 'item-disabled', (item === null || item === void 0 ? void 0 : item.checked) && 'item-checked', fluctuationPosition === index && 'item-fluctuation', fluctuationOrther === index && 'item-fluctuationOrther'),
|
|
193
199
|
style: itemStyle(item),
|
|
194
|
-
onClick: e
|
|
200
|
+
onClick: function onClick(e) {
|
|
195
201
|
handler(e, index, item);
|
|
196
202
|
}
|
|
197
203
|
}, {
|
|
@@ -223,7 +229,7 @@ const Box = props => {
|
|
|
223
229
|
children: [jsx(Button, Object.assign({
|
|
224
230
|
variant: "text",
|
|
225
231
|
className: "".concat(checkCount.length === data.length - disabledCount && data.length > 0 ? 'btn-on' : ''),
|
|
226
|
-
onClick: ()
|
|
232
|
+
onClick: function onClick() {
|
|
227
233
|
queryAll(checkCount.length !== data.length - disabledCount, direction);
|
|
228
234
|
}
|
|
229
235
|
}, {
|
|
@@ -234,7 +240,7 @@ const Box = props => {
|
|
|
234
240
|
variant: "text",
|
|
235
241
|
className: "".concat(checkCount.length === 0 || checkCount.length === data.length - disabledCount ? 'btn-off' : ''),
|
|
236
242
|
disabled: checkCount.length === 0 || checkCount.length === data.length - disabledCount,
|
|
237
|
-
onClick: ()
|
|
243
|
+
onClick: function onClick() {
|
|
238
244
|
inverse(direction);
|
|
239
245
|
}
|
|
240
246
|
}, {
|
|
@@ -250,7 +256,7 @@ const Box = props => {
|
|
|
250
256
|
}))]
|
|
251
257
|
}));
|
|
252
258
|
};
|
|
253
|
-
|
|
259
|
+
var Sortablejs = Sortable;
|
|
254
260
|
|
|
255
261
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-transfer {\n display: flex;\n font-size: 14px;\n user-select: none;\n}\n.paraui-v4-transfer .blue-background-class {\n background-color: rgb(240, 245, 255);\n}\n.paraui-v4-transfer .drag-item {\n background: rgb(255, 255, 255) !important;\n box-shadow: rgba(212, 218, 227, 0.4);\n}\n.paraui-v4-transfer .box {\n border-radius: 4px;\n border: 1px solid rgb(212, 218, 227);\n overflow: hidden;\n}\n.paraui-v4-transfer .box .box-header {\n background: rgb(247, 248, 250);\n color: rgb(29, 33, 38);\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 10px;\n height: 36px;\n border-bottom: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-transfer .box .count {\n color: rgb(29, 33, 38);\n letter-spacing: 1px;\n}\n.paraui-v4-transfer .box .context {\n height: 400px;\n overflow: auto;\n margin-top: 4px;\n}\n.paraui-v4-transfer .box .context .item-fluctuation {\n animation: flucturation 0.4s forwards;\n}\n.paraui-v4-transfer .box .context .item-fluctuationOrther {\n animation: flucturationOrther 0.5s forwards;\n}\n.paraui-v4-transfer .box .context .item {\n padding: 0px 10px;\n height: 30px;\n display: flex;\n align-items: center;\n cursor: pointer;\n}\n.paraui-v4-transfer .box .context .item.item-checked:hover {\n background-color: rgb(247, 248, 250) !important;\n}\n.paraui-v4-transfer .box .context .item.item-checked > .item-label {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .context .item > .item-label {\n flex: 1;\n overflow: hidden;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-transfer .box .context .item:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-transfer .box .context .item.item-disabled:hover {\n background: inherit;\n cursor: no-drop;\n}\n.paraui-v4-transfer .box .context .item.item-disabled > .item-label {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .context .item .handle {\n margin-left: 8px;\n display: flex;\n align-content: center;\n}\n.paraui-v4-transfer .box .context .item .handle .handle-line {\n height: 12px;\n border-left: 1px solid rgb(212, 218, 227);\n margin: auto 10px auto 0;\n}\n.paraui-v4-transfer .box .context .item .handle svg {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-transfer .box .context .item .handle:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .context .item-border {\n padding-left: 6px;\n}\n.paraui-v4-transfer .box .text-field-content {\n border: none;\n border-radius: 0;\n border-bottom: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-transfer .box .footer {\n display: flex;\n align-items: center;\n border-top: 1px solid rgb(212, 218, 227);\n height: 36px;\n justify-content: space-between;\n padding: 0 10px;\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) button {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) button:hover {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) .btn-off {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) .btn-off:hover {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) > button {\n padding: 0;\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) > button:nth-child(2) {\n margin-left: 16px;\n}\n.paraui-v4-transfer .moveBtn {\n display: flex;\n height: 500px;\n flex-direction: column;\n justify-content: center;\n margin: 0 20px;\n}\n.paraui-v4-transfer .moveBtn > button {\n background-color: rgb(46, 101, 230);\n color: rgb(255, 255, 255);\n}\n.paraui-v4-transfer .moveBtn .btn-left {\n margin-top: 16px;\n}\n\n@keyframes flucturation {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(36px);\n }\n}\n@keyframes flucturationOrther {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(-36px);\n }\n}";
|
|
256
262
|
styleInject(css_248z);
|