@para-ui/core 3.0.19 → 3.0.21
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/CheckboxGroup/index.d.ts +2 -0
- package/CheckboxGroup/index.js +17 -0
- package/DatePicker/generatePicker/index.d.ts +2 -0
- package/DatePicker/index.js +91 -8
- package/DatePicker/util.d.ts +2 -0
- package/Form/index.js +1 -1
- package/FormItem/index.js +1 -1
- package/HelperText/index.d.ts +6 -2
- package/HelperText/index.js +2 -1
- package/InputLang/index.js +2 -1
- package/Menu/index.js +1 -1
- package/MultiBox/index.d.ts +7 -0
- package/MultiBox/index.js +111 -48
- package/MultiBox/lang/en_US.d.ts +4 -0
- package/MultiBox/lang/index.d.ts +9 -0
- package/MultiBox/lang/zh_CN.d.ts +4 -0
- package/PageHeader/index.js +1 -1
- package/README.md +21 -1
- package/RadioGroup/index.d.ts +2 -0
- package/RadioGroup/index.js +17 -0
- package/Search/index.js +1 -1
- package/Select/index.js +3 -2
- package/SelectInput/index.d.ts +2 -1
- package/SelectInput/index.js +1 -0
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +70 -23
- package/SingleBox/lang/en_US.d.ts +4 -0
- package/SingleBox/lang/index.d.ts +9 -0
- package/SingleBox/lang/zh_CN.d.ts +4 -0
- package/TimePicker/index.js +1 -0
- package/Transfer/box.d.ts +6 -1
- package/Transfer/index.d.ts +10 -4
- package/Transfer/index.js +107 -64
- package/Upload/index.js +92 -31
- package/_verture/{index-733c62a0.js → index-b4f57a63.js} +7 -7
- package/index.js +3 -2
- package/package.json +1 -1
package/SingleBox/index.js
CHANGED
|
@@ -6,9 +6,10 @@ import { useState, useEffect } from 'react';
|
|
|
6
6
|
import { TextField } from '../TextField/index.js';
|
|
7
7
|
import Label from '../Label/index.js';
|
|
8
8
|
import HelperText from '../HelperText/index.js';
|
|
9
|
-
import
|
|
9
|
+
import PlusCircleF from '@para-ui/icons/PlusCircleF';
|
|
10
10
|
import Delete from '@para-ui/icons/Delete';
|
|
11
11
|
import { $ as $prefixCls } from '../_verture/constant-bf34e6fa.js';
|
|
12
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-f4452258.js';
|
|
12
13
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
13
14
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
14
15
|
import '@paraview/lib';
|
|
@@ -30,7 +31,20 @@ import '../_verture/usePopupContainer-874d101b.js';
|
|
|
30
31
|
import '../Help/index.js';
|
|
31
32
|
import '@para-ui/icons/Help';
|
|
32
33
|
|
|
33
|
-
var
|
|
34
|
+
var en = {
|
|
35
|
+
add: 'Newly Added'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var zh = {
|
|
39
|
+
add: '新增'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var localeJson = {
|
|
43
|
+
zh: zh,
|
|
44
|
+
en: en
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n/**\n* @author linhd\n* @date 2022/8/12 5:28 PM\n* @description 全局css前缀\n*/\n.paraui-v3-single-box {\n display: inline-block;\n width: 100%;\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}\n.paraui-v3-single-box > .single-box-content {\n line-height: 0;\n}\n.paraui-v3-single-box > .single-box-content > .single-box-content-item {\n display: flex;\n}\n.paraui-v3-single-box > .single-box-content > .single-box-content-item .content-box {\n flex: 1;\n}\n.paraui-v3-single-box > .single-box-content > .single-box-content-item > .opera-box {\n display: flex;\n align-items: center;\n margin-left: 12px;\n}\n.paraui-v3-single-box > .single-box-content > .single-box-content-item > .opera-box > .del-box {\n cursor: pointer;\n border-radius: 4px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v3-single-box > .single-box-content > .single-box-content-item > .opera-box > .del-box:hover {\n background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-v3-single-box > .single-box-content > .single-box-content-item > .opera-box > .del-box:hover svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-single-box > .single-box-content > .single-box-content-item > .opera-box > .del-box svg {\n font-size: 24px;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-single-box > .single-box-add {\n text-align: center;\n border: 1px dashed;\n border-color: rgba(171, 176, 185, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n cursor: pointer;\n background-color: rgba(171, 176, 185, 0.12);\n color: rgb(54, 102, 214);\n font-size: 14px;\n}\n.paraui-v3-single-box > .single-box-add > svg {\n font-size: 16px;\n color: rgb(54, 102, 214);\n margin-right: 8px;\n}\n.paraui-v3-single-box > .single-box-add:hover {\n border-color: rgba(54, 102, 214, 0.4);\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-single-box.paraui-v3-single-box-small > .single-box-content > .single-box-content-item > .opera-box {\n height: 28px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-small > .single-box-content > .single-box-content-item > .opera-box > .del-box {\n width: 28px;\n height: 28px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-small > .single-box-add {\n height: 28px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-medium > .single-box-content > .single-box-content-item > .opera-box {\n height: 32px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-medium > .single-box-content > .single-box-content-item > .opera-box > .del-box {\n width: 32px;\n height: 32px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-medium > .single-box-add {\n height: 32px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-large > .single-box-content > .single-box-content-item > .opera-box {\n height: 36px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-large > .single-box-content > .single-box-content-item > .opera-box > .del-box {\n width: 36px;\n height: 36px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-large > .single-box-add {\n height: 36px;\n}\n.paraui-v3-single-box.paraui-v3-single-box-disabled > .single-box-content > .single-box-content-item > .opera-box > .del-box {\n cursor: not-allowed;\n}\n.paraui-v3-single-box.paraui-v3-single-box-disabled > .single-box-content > .single-box-content-item > .opera-box > .del-box:hover {\n background-color: transparent;\n}\n.paraui-v3-single-box.paraui-v3-single-box-disabled > .single-box-content > .single-box-content-item > .opera-box > .del-box:hover svg {\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-single-box.paraui-v3-single-box-disabled > .single-box-content > .single-box-content-item > .opera-box > .del-box svg {\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-single-box.paraui-v3-single-box-disabled > .single-box-add {\n border-color: rgba(171, 176, 185, 0.4);\n cursor: not-allowed;\n background-color: rgba(171, 176, 185, 0.12);\n color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-single-box.paraui-v3-single-box-disabled > .single-box-add > svg {\n color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-single-box.paraui-v3-single-box-disabled > .single-box-add:hover {\n border-color: rgba(171, 176, 185, 0.4);\n color: rgba(46, 55, 67, 0.4);\n}";
|
|
34
48
|
styleInject(css_248z);
|
|
35
49
|
|
|
36
50
|
var SingleBox = function SingleBox(props) {
|
|
@@ -48,14 +62,15 @@ var SingleBox = function SingleBox(props) {
|
|
|
48
62
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
49
63
|
_props$required = props.required,
|
|
50
64
|
required = _props$required === void 0 ? false : _props$required,
|
|
51
|
-
_props$error = props.error,
|
|
52
|
-
error = _props$error === void 0 ? false : _props$error,
|
|
53
65
|
hideErrorDom = props.hideErrorDom,
|
|
54
66
|
_props$helperText = props.helperText,
|
|
55
67
|
helperText = _props$helperText === void 0 ? '' : _props$helperText,
|
|
56
68
|
value = props.value,
|
|
57
69
|
onChange = props.onChange,
|
|
58
70
|
fetchSuggestions = props.fetchSuggestions;
|
|
71
|
+
var isError = helperText && typeof helperText === 'string' ? true : false;
|
|
72
|
+
var isErrorArr = helperText instanceof Array;
|
|
73
|
+
var intl = useFormatMessage('SingleBox', localeJson);
|
|
59
74
|
|
|
60
75
|
var _useState = useState([]),
|
|
61
76
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -68,8 +83,30 @@ var SingleBox = function SingleBox(props) {
|
|
|
68
83
|
useEffect(function () {
|
|
69
84
|
if (value !== undefined) setValueCom(_toConsumableArray(value));
|
|
70
85
|
}, [value]);
|
|
86
|
+
/** 处理错误 */
|
|
87
|
+
|
|
88
|
+
var handError = function handError(index) {
|
|
89
|
+
var obj = {
|
|
90
|
+
error: false,
|
|
91
|
+
helperText: ''
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
if (isErrorArr) {
|
|
95
|
+
var errorItem = helperText[index];
|
|
96
|
+
|
|
97
|
+
if (errorItem) {
|
|
98
|
+
obj = {
|
|
99
|
+
error: true,
|
|
100
|
+
helperText: errorItem
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return obj;
|
|
106
|
+
};
|
|
71
107
|
/** 增加 */
|
|
72
108
|
|
|
109
|
+
|
|
73
110
|
var add = function add() {
|
|
74
111
|
if (disabled) return;
|
|
75
112
|
valueCom.push('');
|
|
@@ -148,7 +185,6 @@ var SingleBox = function SingleBox(props) {
|
|
|
148
185
|
var str = $prefixCls + '-single-box';
|
|
149
186
|
if (className) str += ' ' + className;
|
|
150
187
|
if (size) str += " ".concat($prefixCls, "-single-box-").concat(size);
|
|
151
|
-
if (error) str += " ".concat($prefixCls, "-single-box-error");
|
|
152
188
|
if (disabled) str += " ".concat($prefixCls, "-single-box-disabled");
|
|
153
189
|
return str;
|
|
154
190
|
};
|
|
@@ -164,34 +200,45 @@ var SingleBox = function SingleBox(props) {
|
|
|
164
200
|
return jsxs("div", Object.assign({
|
|
165
201
|
className: "single-box-content-item"
|
|
166
202
|
}, {
|
|
167
|
-
children: [jsx(
|
|
168
|
-
className:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
203
|
+
children: [jsx("div", Object.assign({
|
|
204
|
+
className: "content-box"
|
|
205
|
+
}, {
|
|
206
|
+
children: jsx(TextField, Object.assign({
|
|
207
|
+
className: 'single-box-text-field',
|
|
208
|
+
disabled: disabled,
|
|
209
|
+
value: item,
|
|
210
|
+
placeholder: placeholder,
|
|
211
|
+
size: size
|
|
212
|
+
}, handError(index), {
|
|
213
|
+
onChange: changeInput(index),
|
|
214
|
+
fetchSuggestions: fetchSuggestions,
|
|
215
|
+
onSelect: selectValue(index)
|
|
216
|
+
}))
|
|
217
|
+
})), jsx("div", Object.assign({
|
|
218
|
+
className: "opera-box"
|
|
179
219
|
}, {
|
|
180
|
-
children: jsx(
|
|
220
|
+
children: jsx("span", Object.assign({
|
|
221
|
+
className: "del-box",
|
|
181
222
|
onClick: del(index)
|
|
182
|
-
}
|
|
223
|
+
}, {
|
|
224
|
+
children: jsx(Delete, {})
|
|
225
|
+
}))
|
|
183
226
|
}))]
|
|
184
227
|
}), index);
|
|
185
228
|
})
|
|
186
|
-
})),
|
|
229
|
+
})), jsxs("div", Object.assign({
|
|
187
230
|
className: "single-box-add",
|
|
188
231
|
onClick: add
|
|
189
232
|
}, {
|
|
190
|
-
children: jsx(
|
|
233
|
+
children: [jsx(PlusCircleF, {}), jsx("span", {
|
|
234
|
+
children: intl({
|
|
235
|
+
id: 'add'
|
|
236
|
+
})
|
|
237
|
+
})]
|
|
191
238
|
})), jsx(HelperText, {
|
|
192
239
|
className: "single-box-error",
|
|
193
|
-
error:
|
|
194
|
-
helperText: helperText,
|
|
240
|
+
error: isError,
|
|
241
|
+
helperText: isError ? helperText : undefined,
|
|
195
242
|
hideErrorDom: hideErrorDom
|
|
196
243
|
})]
|
|
197
244
|
}));
|
package/TimePicker/index.js
CHANGED
package/Transfer/box.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import Sortable from 'sortablejs';
|
|
2
3
|
interface IBox {
|
|
3
4
|
title: string;
|
|
4
5
|
data: ItemDataProps[];
|
|
@@ -12,6 +13,9 @@ interface IBox {
|
|
|
12
13
|
fluctuationPosition?: number;
|
|
13
14
|
fluctuationOrther?: number;
|
|
14
15
|
onEndSort?: (oldIndex: any, newIndex: any) => void;
|
|
16
|
+
rightIcon?: (item: ItemDataProps) => ReactNode;
|
|
17
|
+
style: CSSProperties | undefined;
|
|
18
|
+
customKey: string;
|
|
15
19
|
}
|
|
16
20
|
export interface ItemDataProps {
|
|
17
21
|
/** 唯一值,用来过滤 */
|
|
@@ -31,3 +35,4 @@ export interface ItemDataProps {
|
|
|
31
35
|
}
|
|
32
36
|
export declare const Box: (props: IBox) => JSX.Element;
|
|
33
37
|
export default Box;
|
|
38
|
+
export declare const Sortablejs: typeof Sortable;
|
package/Transfer/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="sortablejs" />
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
3
|
import { ItemDataProps } from './box';
|
|
3
4
|
import './style/index.scss';
|
|
4
5
|
/**
|
|
@@ -15,12 +16,17 @@ interface TransferProps {
|
|
|
15
16
|
className?: string;
|
|
16
17
|
style?: CSSProperties;
|
|
17
18
|
data?: Array<ItemDataProps>;
|
|
18
|
-
value?: Array<
|
|
19
|
-
onChange?: (data: Array<
|
|
20
|
-
onSort?: (data: Array<
|
|
19
|
+
value?: Array<string>;
|
|
20
|
+
onChange?: (data: Array<string>) => void;
|
|
21
|
+
onSort?: (data: Array<string>) => void;
|
|
21
22
|
titles?: Array<string>;
|
|
22
23
|
trim?: boolean;
|
|
23
24
|
multiple?: boolean;
|
|
25
|
+
rightIcon?: (item: ItemDataProps) => ReactNode;
|
|
26
|
+
render?: (data: ItemDataProps) => void;
|
|
27
|
+
customKey?: string;
|
|
24
28
|
}
|
|
25
29
|
export declare const Transfer: (props: TransferProps) => JSX.Element;
|
|
26
30
|
export default Transfer;
|
|
31
|
+
export declare type IItemDataProps = ItemDataProps;
|
|
32
|
+
export declare const SSortablejs: typeof import("sortablejs");
|
package/Transfer/index.js
CHANGED
|
@@ -10,7 +10,6 @@ import ExpandLess from '@para-ui/icons/Up';
|
|
|
10
10
|
import Down from '@para-ui/icons/Down';
|
|
11
11
|
import { u as useFormatMessage } from '../_verture/useFormatMessage-f4452258.js';
|
|
12
12
|
import { $ as $prefixCls } from '../_verture/constant-bf34e6fa.js';
|
|
13
|
-
import { ArrayToObject } from '@paraview/lib';
|
|
14
13
|
import { Search } from '../Search/index.js';
|
|
15
14
|
import SearchIcon from '@para-ui/icons/Search';
|
|
16
15
|
import AutoTips from '../AutoTips/index.js';
|
|
@@ -31,6 +30,7 @@ import '../TextField/index.js';
|
|
|
31
30
|
import '../Label/index.js';
|
|
32
31
|
import '../Help/index.js';
|
|
33
32
|
import '@para-ui/icons/Help';
|
|
33
|
+
import '@paraview/lib';
|
|
34
34
|
import '@para-ui/icons/PreviewClose';
|
|
35
35
|
import '@para-ui/icons/PreviewOpen';
|
|
36
36
|
import '@para-ui/icons/CloseCircle';
|
|
@@ -3123,7 +3123,10 @@ var Box = function Box(props) {
|
|
|
3123
3123
|
fluctuationPosition = props.fluctuationPosition,
|
|
3124
3124
|
fluctuationOrther = props.fluctuationOrther,
|
|
3125
3125
|
onEndSort = props.onEndSort,
|
|
3126
|
-
multiple = props.multiple
|
|
3126
|
+
multiple = props.multiple,
|
|
3127
|
+
rightIcon = props.rightIcon,
|
|
3128
|
+
style = props.style,
|
|
3129
|
+
customKey = props.customKey;
|
|
3127
3130
|
var intl = useFormatMessage('Transfer', localeJson);
|
|
3128
3131
|
|
|
3129
3132
|
var _useState = useState([]),
|
|
@@ -3173,7 +3176,8 @@ var Box = function Box(props) {
|
|
|
3173
3176
|
onMove(direction === "right" ? 'left' : 'right');
|
|
3174
3177
|
});
|
|
3175
3178
|
return jsxs("div", Object.assign({
|
|
3176
|
-
className: "box"
|
|
3179
|
+
className: "box",
|
|
3180
|
+
style: style
|
|
3177
3181
|
}, {
|
|
3178
3182
|
children: [jsx("div", Object.assign({
|
|
3179
3183
|
className: "box-header"
|
|
@@ -3210,14 +3214,18 @@ var Box = function Box(props) {
|
|
|
3210
3214
|
className: 'item-label'
|
|
3211
3215
|
}, {
|
|
3212
3216
|
children: jsx(AutoTips, {
|
|
3213
|
-
children: item.name || item
|
|
3217
|
+
children: item.name || item[item[customKey]]
|
|
3214
3218
|
})
|
|
3215
|
-
})),
|
|
3219
|
+
})), rightIcon ? jsx("div", Object.assign({
|
|
3220
|
+
className: 'right-icon'
|
|
3221
|
+
}, {
|
|
3222
|
+
children: rightIcon(item)
|
|
3223
|
+
})) : null, direction === 'right' ? jsx("div", Object.assign({
|
|
3216
3224
|
className: 'handle'
|
|
3217
3225
|
}, {
|
|
3218
3226
|
children: jsx(Drag, {})
|
|
3219
3227
|
})) : null]
|
|
3220
|
-
}), item
|
|
3228
|
+
}), item[item[customKey]] || item.name);
|
|
3221
3229
|
})
|
|
3222
3230
|
})), jsxs("div", Object.assign({
|
|
3223
3231
|
className: 'footer'
|
|
@@ -3251,8 +3259,9 @@ var Box = function Box(props) {
|
|
|
3251
3259
|
}))]
|
|
3252
3260
|
}));
|
|
3253
3261
|
};
|
|
3262
|
+
var Sortablejs = Sortable;
|
|
3254
3263
|
|
|
3255
|
-
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n/**\n* @author linhd\n* @date 2022/8/12 5:28 PM\n* @description 全局css前缀\n*/\n.paraui-v3-transfer {\n display: flex;\n font-size: 14px;\n user-select: none;\n
|
|
3264
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n/**\n* @author linhd\n* @date 2022/8/12 5:28 PM\n* @description 全局css前缀\n*/\n.paraui-v3-transfer {\n display: flex;\n font-size: 14px;\n user-select: none;\n}\n.paraui-v3-transfer .blue-background-class {\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-transfer .box {\n border-radius: 4px;\n border: 1px solid rgba(171, 176, 185, 0.4);\n overflow: hidden;\n}\n.paraui-v3-transfer .box .box-header {\n background: rgba(171, 176, 185, 0.12);\n color: rgb(46, 55, 67);\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 10px;\n height: 36px;\n border-bottom: 1px solid rgba(171, 176, 185, 0.4);\n}\n.paraui-v3-transfer .box .count {\n margin: 0 10px 0 0;\n color: rgb(46, 55, 67);\n letter-spacing: 1px;\n margin: 0 16px 0 auto;\n}\n.paraui-v3-transfer .box .context {\n height: 400px;\n overflow: auto;\n scrollbar-base-color: red;\n}\n.paraui-v3-transfer .box .context .item-fluctuation {\n animation: flucturation 0.4s forwards;\n}\n.paraui-v3-transfer .box .context .item-fluctuationOrther {\n animation: flucturationOrther 0.5s forwards;\n}\n.paraui-v3-transfer .box .context .item {\n padding: 0px 8px;\n height: 36px;\n display: flex;\n align-items: center;\n cursor: pointer;\n}\n.paraui-v3-transfer .box .context .item.item-checked {\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-transfer .box .context .item.item-checked:hover {\n background-color: rgba(54, 102, 214, 0.05) !important;\n}\n.paraui-v3-transfer .box .context .item.item-checked > .item-label {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-transfer .box .context .item > .item-label {\n margin-left: 8px;\n flex: 1;\n overflow: hidden;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-transfer .box .context .item:hover {\n background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-v3-transfer .box .context .item.item-disabled:hover {\n background: inherit;\n cursor: no-drop;\n}\n.paraui-v3-transfer .box .context .item.item-disabled > .item-label {\n color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-transfer .box .context .item .handle {\n margin-left: 14px;\n display: flex;\n align-content: center;\n}\n.paraui-v3-transfer .box .context .item .handle svg {\n color: rgb(28, 41, 60);\n}\n.paraui-v3-transfer .box .context .item .handle:hover {\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-transfer .box .context .item .handle:hover svg {\n color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-transfer .box .text-field-content {\n border: none;\n border-radius: 0;\n border-bottom: 1px solid rgba(171, 176, 185, 0.4);\n}\n.paraui-v3-transfer .box .footer {\n display: flex;\n align-items: center;\n border-top: 1px solid rgba(171, 176, 185, 0.4);\n}\n.paraui-v3-transfer .box .footer .btn-on {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-transfer .box .footer .btn-off {\n color: rgba(171, 176, 185, 0.4);\n}\n.paraui-v3-transfer .box .footer button {\n color: rgb(46, 55, 67);\n padding: 0 0 0 16px;\n}\n.paraui-v3-transfer .box .footer button:hover {\n color: #3666D6;\n}\n.paraui-v3-transfer ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: rgb(54, 102, 214);\n}\n.paraui-v3-transfer .moveBtn {\n display: flex;\n height: 500px;\n flex-direction: column;\n justify-content: center;\n margin: 0 24px;\n}\n.paraui-v3-transfer .moveBtn > button:hover {\n color: white;\n background: rgb(54, 102, 214);\n}\n.paraui-v3-transfer .moveBtn .btn-left {\n margin-top: 20px;\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}";
|
|
3256
3265
|
styleInject(css_248z);
|
|
3257
3266
|
|
|
3258
3267
|
var Transfer = function Transfer(props) {
|
|
@@ -3262,6 +3271,8 @@ var Transfer = function Transfer(props) {
|
|
|
3262
3271
|
var _props$data = props.data,
|
|
3263
3272
|
data = _props$data === void 0 ? [] : _props$data,
|
|
3264
3273
|
value = props.value,
|
|
3274
|
+
_props$customKey = props.customKey,
|
|
3275
|
+
customKey = _props$customKey === void 0 ? 'key' : _props$customKey,
|
|
3265
3276
|
onChange = props.onChange,
|
|
3266
3277
|
_props$titles = props.titles,
|
|
3267
3278
|
titles = _props$titles === void 0 ? [intl({
|
|
@@ -3270,74 +3281,58 @@ var Transfer = function Transfer(props) {
|
|
|
3270
3281
|
id: 'right'
|
|
3271
3282
|
})] : _props$titles,
|
|
3272
3283
|
className = props.className,
|
|
3273
|
-
style = props.style,
|
|
3284
|
+
_props$style = props.style,
|
|
3285
|
+
style = _props$style === void 0 ? {
|
|
3286
|
+
width: '298px'
|
|
3287
|
+
} : _props$style,
|
|
3274
3288
|
onSort = props.onSort,
|
|
3275
3289
|
_props$trim = props.trim,
|
|
3276
3290
|
trim = _props$trim === void 0 ? false : _props$trim,
|
|
3277
3291
|
_props$multiple = props.multiple,
|
|
3278
|
-
multiple = _props$multiple === void 0 ? true : _props$multiple
|
|
3292
|
+
multiple = _props$multiple === void 0 ? true : _props$multiple,
|
|
3293
|
+
rightIcon = props.rightIcon,
|
|
3294
|
+
_props$render = props.render,
|
|
3295
|
+
render = _props$render === void 0 ? function (item) {} : _props$render;
|
|
3279
3296
|
|
|
3280
|
-
var _useState = useState(
|
|
3297
|
+
var _useState = useState({}),
|
|
3281
3298
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3282
|
-
|
|
3283
|
-
|
|
3299
|
+
transData = _useState2[0],
|
|
3300
|
+
setTransData = _useState2[1];
|
|
3284
3301
|
|
|
3285
3302
|
var _useState3 = useState([]),
|
|
3286
3303
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
3287
|
-
|
|
3288
|
-
|
|
3304
|
+
leftData = _useState4[0],
|
|
3305
|
+
setLeftData = _useState4[1];
|
|
3289
3306
|
|
|
3290
3307
|
var _useState5 = useState([]),
|
|
3291
3308
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3292
|
-
|
|
3293
|
-
|
|
3309
|
+
rightData = _useState6[0],
|
|
3310
|
+
setRightData = _useState6[1];
|
|
3294
3311
|
|
|
3295
3312
|
var _useState7 = useState([]),
|
|
3296
3313
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
3297
|
-
|
|
3298
|
-
|
|
3314
|
+
leftCount = _useState8[0],
|
|
3315
|
+
setLeftCount = _useState8[1];
|
|
3299
3316
|
|
|
3300
|
-
var _useState9 = useState(),
|
|
3317
|
+
var _useState9 = useState([]),
|
|
3301
3318
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
3302
|
-
|
|
3303
|
-
|
|
3319
|
+
rightCount = _useState10[0],
|
|
3320
|
+
setRightCount = _useState10[1];
|
|
3304
3321
|
|
|
3305
3322
|
var _useState11 = useState(),
|
|
3306
3323
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
3307
|
-
|
|
3308
|
-
|
|
3324
|
+
fluctuationPosition = _useState12[0],
|
|
3325
|
+
setFluctuationPosition = _useState12[1];
|
|
3309
3326
|
|
|
3310
|
-
var _useState13 = useState(
|
|
3327
|
+
var _useState13 = useState(),
|
|
3311
3328
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
useEffect(function () {
|
|
3316
|
-
if (value) {
|
|
3317
|
-
setRightData(_toConsumableArray(value));
|
|
3318
|
-
filterLeftData(_toConsumableArray(value));
|
|
3319
|
-
}
|
|
3320
|
-
}, [value]);
|
|
3321
|
-
/**
|
|
3322
|
-
* @description 过滤左边数据
|
|
3323
|
-
* @param arr {ItemDataProps} 右边数据源
|
|
3324
|
-
* */
|
|
3329
|
+
fluctuationOrther = _useState14[0],
|
|
3330
|
+
setFluctuationOrther = _useState14[1];
|
|
3325
3331
|
|
|
3326
|
-
var
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
var leftArr = props.data || [];
|
|
3331
|
-
|
|
3332
|
-
for (var i = 0, l = leftArr.length; i < l; i++) {
|
|
3333
|
-
var item = leftArr[i];
|
|
3334
|
-
var key = item.key || item.name || '';
|
|
3335
|
-
if (key && (keyJson[key] || nameJson[key])) continue;
|
|
3336
|
-
handArr.push(item);
|
|
3337
|
-
}
|
|
3338
|
-
|
|
3339
|
-
setLeftData(handArr);
|
|
3340
|
-
};
|
|
3332
|
+
var _useState15 = useState(false),
|
|
3333
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
3334
|
+
animationsLock = _useState16[0],
|
|
3335
|
+
setAnimationLock = _useState16[1];
|
|
3341
3336
|
|
|
3342
3337
|
var onchange = useCallback(function (e, bol, index, direction, multiple) {
|
|
3343
3338
|
if (direction === 'left') {
|
|
@@ -3395,18 +3390,22 @@ var Transfer = function Transfer(props) {
|
|
|
3395
3390
|
});
|
|
3396
3391
|
} else {
|
|
3397
3392
|
newData = _toConsumableArray(leftData);
|
|
3398
|
-
newData.forEach(function (item
|
|
3393
|
+
newData.forEach(function (item) {
|
|
3399
3394
|
if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
|
|
3400
3395
|
item.checked = false;
|
|
3401
3396
|
rightData.push(item);
|
|
3402
|
-
leftData.splice(
|
|
3397
|
+
leftData.splice(leftData.indexOf(item), 1);
|
|
3403
3398
|
}
|
|
3404
3399
|
});
|
|
3405
3400
|
}
|
|
3406
3401
|
|
|
3407
3402
|
setLeftData(_toConsumableArray(leftData));
|
|
3408
3403
|
setRightData(_toConsumableArray(rightData));
|
|
3409
|
-
|
|
3404
|
+
var rArr = [];
|
|
3405
|
+
rightData.forEach(function (item) {
|
|
3406
|
+
rArr.push(item[customKey]);
|
|
3407
|
+
});
|
|
3408
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(rArr);
|
|
3410
3409
|
}; // 上下移动
|
|
3411
3410
|
|
|
3412
3411
|
|
|
@@ -3422,8 +3421,12 @@ var Transfer = function Transfer(props) {
|
|
|
3422
3421
|
setFluctuationOrther(undefined);
|
|
3423
3422
|
pre.splice.apply(pre, [rightCount[0] - 1, 0].concat(_toConsumableArray(pre.splice(rightCount[0], 1))));
|
|
3424
3423
|
setAnimationLock(false);
|
|
3425
|
-
|
|
3426
|
-
|
|
3424
|
+
var rArr = [];
|
|
3425
|
+
pre.forEach(function (item) {
|
|
3426
|
+
rArr.push(item[customKey]);
|
|
3427
|
+
});
|
|
3428
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([].concat(rArr));
|
|
3429
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([].concat(rArr));
|
|
3427
3430
|
return _toConsumableArray(pre);
|
|
3428
3431
|
});
|
|
3429
3432
|
}, 400);
|
|
@@ -3436,8 +3439,12 @@ var Transfer = function Transfer(props) {
|
|
|
3436
3439
|
setFluctuationOrther(undefined);
|
|
3437
3440
|
pre.splice.apply(pre, [rightCount[0] + 1, 0].concat(_toConsumableArray(pre.splice(rightCount[0], 1))));
|
|
3438
3441
|
setAnimationLock(false);
|
|
3439
|
-
|
|
3440
|
-
|
|
3442
|
+
var rArr = [];
|
|
3443
|
+
pre.forEach(function (item) {
|
|
3444
|
+
rArr.push(item[customKey]);
|
|
3445
|
+
});
|
|
3446
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([].concat(rArr));
|
|
3447
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([].concat(rArr));
|
|
3441
3448
|
return _toConsumableArray(pre);
|
|
3442
3449
|
});
|
|
3443
3450
|
}, 400);
|
|
@@ -3475,11 +3482,41 @@ var Transfer = function Transfer(props) {
|
|
|
3475
3482
|
var onEndSort = useCallback(function (oldIndex, newIndex) {
|
|
3476
3483
|
setRightData(function (pre) {
|
|
3477
3484
|
pre.splice.apply(pre, [newIndex, 0].concat(_toConsumableArray(pre.splice(oldIndex, 1))));
|
|
3478
|
-
|
|
3479
|
-
|
|
3485
|
+
var rArr = [];
|
|
3486
|
+
pre.forEach(function (item) {
|
|
3487
|
+
rArr.push(item[customKey]);
|
|
3488
|
+
});
|
|
3489
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([].concat(rArr));
|
|
3490
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([].concat(rArr));
|
|
3480
3491
|
return _toConsumableArray(pre);
|
|
3481
3492
|
});
|
|
3482
3493
|
}, []);
|
|
3494
|
+
useEffect(function () {
|
|
3495
|
+
if (data.length) {
|
|
3496
|
+
var _leftData = {};
|
|
3497
|
+
data.forEach(function (item) {
|
|
3498
|
+
var key = item[customKey];
|
|
3499
|
+
render(item);
|
|
3500
|
+
_leftData[key] = item;
|
|
3501
|
+
});
|
|
3502
|
+
setTransData(Object.assign({}, _leftData));
|
|
3503
|
+
}
|
|
3504
|
+
}, [data]);
|
|
3505
|
+
useEffect(function () {
|
|
3506
|
+
var rData = [];
|
|
3507
|
+
var lData = [];
|
|
3508
|
+
|
|
3509
|
+
for (var key in transData) {
|
|
3510
|
+
if (value && value.indexOf(key) >= 0) {
|
|
3511
|
+
rData.push(transData[key]);
|
|
3512
|
+
} else {
|
|
3513
|
+
lData.push(transData[key]);
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
|
|
3517
|
+
setRightData([].concat(rData));
|
|
3518
|
+
setLeftData([].concat(lData));
|
|
3519
|
+
}, [value, transData]);
|
|
3483
3520
|
useEffect(function () {
|
|
3484
3521
|
var arr = [];
|
|
3485
3522
|
leftData.forEach(function (item, index) {
|
|
@@ -3497,14 +3534,16 @@ var Transfer = function Transfer(props) {
|
|
|
3497
3534
|
setRightCount(rArr);
|
|
3498
3535
|
}, [leftData, rightData]);
|
|
3499
3536
|
return jsxs("div", Object.assign({
|
|
3500
|
-
className: clsx("".concat($prefixCls, "-transfer"), className)
|
|
3501
|
-
style: style
|
|
3537
|
+
className: clsx("".concat($prefixCls, "-transfer"), className)
|
|
3502
3538
|
}, {
|
|
3503
3539
|
children: [jsx(Box, {
|
|
3504
3540
|
title: titles[0],
|
|
3505
3541
|
queryAll: queryAll,
|
|
3506
3542
|
data: leftData,
|
|
3543
|
+
style: style,
|
|
3507
3544
|
direction: "left",
|
|
3545
|
+
customKey: customKey,
|
|
3546
|
+
rightIcon: rightIcon,
|
|
3508
3547
|
onchange: onchange,
|
|
3509
3548
|
multiple: multiple,
|
|
3510
3549
|
onMove: onMove,
|
|
@@ -3582,7 +3621,10 @@ var Transfer = function Transfer(props) {
|
|
|
3582
3621
|
title: titles[1],
|
|
3583
3622
|
queryAll: queryAll,
|
|
3584
3623
|
data: rightData,
|
|
3624
|
+
style: style,
|
|
3585
3625
|
direction: "right",
|
|
3626
|
+
customKey: customKey,
|
|
3627
|
+
rightIcon: rightIcon,
|
|
3586
3628
|
onchange: onchange,
|
|
3587
3629
|
multiple: multiple,
|
|
3588
3630
|
onMove: onMove,
|
|
@@ -3594,5 +3636,6 @@ var Transfer = function Transfer(props) {
|
|
|
3594
3636
|
})]
|
|
3595
3637
|
}));
|
|
3596
3638
|
};
|
|
3639
|
+
var SSortablejs = Sortablejs;
|
|
3597
3640
|
|
|
3598
|
-
export { Transfer, Transfer as default };
|
|
3641
|
+
export { SSortablejs, Transfer, Transfer as default };
|