@para-ui/core 4.0.29 → 4.0.31
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/AutoButton/index.d.ts +41 -0
- package/AutoButton/index.js +213 -0
- package/AutoButton/lang/en_US.d.ts +4 -0
- package/AutoButton/lang/index.d.ts +9 -0
- package/AutoButton/lang/zh_CN.d.ts +4 -0
- package/Badge/index.d.ts +3 -1
- package/Badge/index.js +15 -5
- package/Card/index.d.ts +53 -0
- package/Card/index.js +218 -0
- package/Card/lang/en_US.d.ts +5 -0
- package/Card/lang/index.d.ts +11 -0
- package/Card/lang/zh_CN.d.ts +5 -0
- package/Cascader/index.js +6 -7
- package/ComboSelect/index.js +7 -4
- package/CycleSelector/index.js +3 -1
- package/DatePicker/index.js +3 -1
- package/DragVerify/index.js +7 -2
- package/DynamicMultiBox/index.js +8 -6
- package/Form/index.js +8 -5
- package/FormItem/index.js +8 -5
- package/Image/index.js +3 -4
- package/PopConfirm/index.js +2 -2
- package/PopMenu/index.js +16 -5
- package/QuickReply/index.js +1 -1
- package/README.md +14 -0
- package/RangeInput/index.d.ts +59 -0
- package/RangeInput/index.js +193 -0
- package/Select/index.js +2 -2
- package/Selector/index.js +282 -548
- package/SelectorPicker/index.js +5 -5
- package/SingleBox/index.js +2 -2
- package/SortBox/index.d.ts +27 -0
- package/SortBox/index.js +64 -0
- package/Stepper/index.js +1 -1
- package/Switch/index.js +2 -2
- package/Table/index.js +471 -409
- package/Tabs/index.js +2 -2
- package/Tag/index.js +82 -53
- package/TextEditor/index.js +3 -3
- package/TimePicker/index.js +3 -1
- package/Timeline/index.js +14 -20
- package/ToggleButton/index.js +25 -26
- package/Transfer/index.js +48 -43
- package/Tree/index.js +8 -5
- package/Upload/ImageUpload/index.d.ts +2 -7
- package/Upload/index.js +848 -495
- package/Upload/interface.d.ts +18 -0
- package/_verture/{Portal-5bd49559.js → Portal-edd94cac.js} +2 -2
- package/_verture/{index-15a0b6a6.js → index-3795d730.js} +1 -1
- package/_verture/{index-e9405e35.js → index-567b5779.js} +395 -313
- package/_verture/{index-68f0506c.js → index-8752ccab.js} +4 -5
- package/_verture/index-94e24006.js +327 -0
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
- package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
- package/index.d.ts +8 -0
- package/index.js +16 -11
- package/locale/en-US.d.ts +7 -0
- package/locale/index.d.ts +14 -0
- package/locale/index.js +14 -0
- package/locale/zh-CN.d.ts +7 -0
- package/package.json +2 -4
- package/umd/AutoButton.js +43 -0
- package/umd/Badge.js +1 -1
- package/umd/Card.js +1 -0
- package/umd/DragVerify.js +1 -1
- package/umd/FunctionModal.js +3 -3
- package/umd/Modal.js +2 -2
- package/umd/PopMenu.js +2 -2
- package/umd/RangeInput.js +43 -0
- package/umd/SortBox.js +41 -0
- package/umd/Upload.js +4 -4
- package/umd/locale.js +1 -1
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- /package/_verture/{index-0f5ee6f7.js → index-c8cb6751.js} +0 -0
- /package/_verture/{typeof-6ec38efd.js → typeof-4646b22c.js} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author linhd
|
|
3
|
+
* @date 2024/8/12 17:16
|
|
4
|
+
* @description 超出自适应按钮
|
|
5
|
+
*/
|
|
6
|
+
import React, { FunctionComponent, ReactNode } from 'react';
|
|
7
|
+
import { ButtonProps, IconButtonProps } from '../Button';
|
|
8
|
+
import { SplitButtonProps } from "../Button/SplitButton";
|
|
9
|
+
import { Placement } from '../Dropdown';
|
|
10
|
+
import './index.scss';
|
|
11
|
+
type TypeAutoButtonItemProps = ButtonProps | IconButtonProps | SplitButtonProps;
|
|
12
|
+
interface AutoButtonItemOtherProps {
|
|
13
|
+
/** 不传就是正常的按钮 */
|
|
14
|
+
buttonType?: 'icon' | 'split';
|
|
15
|
+
}
|
|
16
|
+
export type AutoButtonItemProps = TypeAutoButtonItemProps & AutoButtonItemOtherProps;
|
|
17
|
+
export interface AutoButtonProps {
|
|
18
|
+
/** 样式class */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** style */
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
/** 数据 */
|
|
23
|
+
list: AutoButtonItemProps[];
|
|
24
|
+
/** 右间距 默认16px */
|
|
25
|
+
marginRight?: string;
|
|
26
|
+
/** 更多按钮 */
|
|
27
|
+
moreProps?: {
|
|
28
|
+
buttonType?: 'icon';
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
};
|
|
32
|
+
/** 位置 */
|
|
33
|
+
morePlacement?: Placement;
|
|
34
|
+
/** 浮层最大宽 默认500px */
|
|
35
|
+
moreMaxWidth?: string;
|
|
36
|
+
/** 触发下拉的行为 */
|
|
37
|
+
trigger?: ('click' | 'hover' | 'contextMenu')[];
|
|
38
|
+
[name: string]: any;
|
|
39
|
+
}
|
|
40
|
+
export declare const AutoButton: FunctionComponent<AutoButtonProps>;
|
|
41
|
+
export default AutoButton;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect, Fragment } from 'react';
|
|
4
|
+
import { Button } from '../Button/index.js';
|
|
5
|
+
import AutoTips from '../AutoTips/index.js';
|
|
6
|
+
import MoreVert from '@para-ui/icons/MoreVert';
|
|
7
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
8
|
+
import { D as Dropdown } from '../_verture/index-bde7aabe.js';
|
|
9
|
+
import { Tooltip } from '../Tooltip/index.js';
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
|
|
12
|
+
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
13
|
+
import '@para-ui/icons/LoadingF';
|
|
14
|
+
import '@para-ui/icons/Down';
|
|
15
|
+
import '@paraview/lib';
|
|
16
|
+
import 'rc-dropdown';
|
|
17
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
18
|
+
import 'dayjs';
|
|
19
|
+
import 'rc-tooltip';
|
|
20
|
+
import 'rc-tooltip/lib/placements';
|
|
21
|
+
import '@para-ui/icons/Forbid';
|
|
22
|
+
import '../_verture/index-ca413216.js';
|
|
23
|
+
|
|
24
|
+
var en = {
|
|
25
|
+
more: 'More'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var zh = {
|
|
29
|
+
more: '更多'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var localeJson = {
|
|
33
|
+
zh,
|
|
34
|
+
en
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-auto-button {\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n}\n\n.paraui-v4-auto-button-dropdown .auto-button-dropdown-content .item-btn {\n height: 30px;\n line-height: 30px;\n color: rgb(29, 33, 38);\n cursor: pointer;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-auto-button-dropdown .auto-button-dropdown-content .item-btn > .paraui-v4-auto-tips {\n padding: 0 10px;\n}\n.paraui-v4-auto-button-dropdown .auto-button-dropdown-content .item-btn:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-auto-button-dropdown .auto-button-dropdown-content .item-btn.item-btn-disabled {\n background-color: rgb(255, 255, 255);\n color: rgb(161, 168, 179);\n cursor: not-allowed;\n}";
|
|
38
|
+
styleInject(css_248z);
|
|
39
|
+
|
|
40
|
+
const AutoButton = props => {
|
|
41
|
+
const {
|
|
42
|
+
className,
|
|
43
|
+
style,
|
|
44
|
+
list,
|
|
45
|
+
marginRight = '16px',
|
|
46
|
+
moreProps,
|
|
47
|
+
morePlacement = 'bottomLeft',
|
|
48
|
+
moreMaxWidth = '500px',
|
|
49
|
+
trigger = ['hover']
|
|
50
|
+
} = props;
|
|
51
|
+
const intl = useFormatMessage('AutoButton', localeJson);
|
|
52
|
+
const [morePos, setMorePos] = useState(null); // 超出在原始位置
|
|
53
|
+
//const [openMoreCom, setOpenMoreCom] = useState<boolean>(false); // 显示更多
|
|
54
|
+
const comRef = useRef(null);
|
|
55
|
+
const constData = useRef({
|
|
56
|
+
timer: null
|
|
57
|
+
});
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
changeSize();
|
|
60
|
+
window.addEventListener('resize', changeSize);
|
|
61
|
+
return () => {
|
|
62
|
+
window.removeEventListener('resize', changeSize);
|
|
63
|
+
clearTimeout(constData.current.timer);
|
|
64
|
+
};
|
|
65
|
+
}, [list]);
|
|
66
|
+
const changeSize = () => {
|
|
67
|
+
clearTimeout(constData.current.timer);
|
|
68
|
+
//closeMore();
|
|
69
|
+
constData.current.timer = setTimeout(() => {
|
|
70
|
+
setMorePos(list.length);
|
|
71
|
+
if (list.length > 1) handMultiline();
|
|
72
|
+
}, 100);
|
|
73
|
+
};
|
|
74
|
+
const handMultiline = index => {
|
|
75
|
+
if (index === null || index === 0) return;
|
|
76
|
+
if (index === undefined) index = list.length;
|
|
77
|
+
const boxDom = comRef.current;
|
|
78
|
+
if (!boxDom) return;
|
|
79
|
+
if (boxDom.scrollWidth > boxDom.clientWidth) {
|
|
80
|
+
const num = Number(index) - 1;
|
|
81
|
+
// 超出
|
|
82
|
+
setMorePos(num);
|
|
83
|
+
handMultiline(num);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
/** 更多每一项点击事件 */
|
|
87
|
+
const clickBtn = (item, event, parentItem) => {
|
|
88
|
+
if (parentItem) {
|
|
89
|
+
parentItem.onClick && parentItem.onClick(item, event);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
item.onClick && item.onClick(event);
|
|
93
|
+
};
|
|
94
|
+
/** 更多每一项内容 */
|
|
95
|
+
const renderMoreContentItem = (item, label, parentItem) => {
|
|
96
|
+
return jsx("div", Object.assign({
|
|
97
|
+
className: clsx('item-btn', {
|
|
98
|
+
'item-btn-disabled': item.disabled
|
|
99
|
+
}),
|
|
100
|
+
onClick: event => {
|
|
101
|
+
if (item.disabled) return;
|
|
102
|
+
clickBtn(item, event, parentItem);
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
children: jsx(AutoTips, Object.assign({
|
|
106
|
+
placement: "top-start"
|
|
107
|
+
}, {
|
|
108
|
+
children: item[label]
|
|
109
|
+
}))
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
/** 更多每一项 */
|
|
113
|
+
const renderMoreItem = (item, label, parentItem) => {
|
|
114
|
+
if (item.disabled && item.disabledTooltip) {
|
|
115
|
+
return jsx(Tooltip, Object.assign({
|
|
116
|
+
disabled: true
|
|
117
|
+
}, item.disabledTooltip, {
|
|
118
|
+
children: renderMoreContentItem(item, label, parentItem)
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
return renderMoreContentItem(item, label, parentItem);
|
|
122
|
+
};
|
|
123
|
+
/** 更多按钮浮层内容 */
|
|
124
|
+
const handleMoreOverlay = () => {
|
|
125
|
+
return jsx("div", Object.assign({
|
|
126
|
+
className: 'auto-button-dropdown-content',
|
|
127
|
+
style: {
|
|
128
|
+
maxWidth: moreMaxWidth
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
children: list && list.map((item, index) => {
|
|
132
|
+
var _a;
|
|
133
|
+
if (morePos !== null && morePos > index) return null;
|
|
134
|
+
if (item.buttonType !== 'split') {
|
|
135
|
+
return jsx(Fragment, {
|
|
136
|
+
children: renderMoreItem(item, 'children')
|
|
137
|
+
}, index);
|
|
138
|
+
}
|
|
139
|
+
return jsx(Fragment, {
|
|
140
|
+
children: (_a = item.options) === null || _a === void 0 ? void 0 : _a.map((itemChild, inx) => {
|
|
141
|
+
return jsx(Fragment, {
|
|
142
|
+
children: renderMoreItem(itemChild, 'label', item)
|
|
143
|
+
}, index + '-' + inx);
|
|
144
|
+
})
|
|
145
|
+
}, index);
|
|
146
|
+
})
|
|
147
|
+
}));
|
|
148
|
+
};
|
|
149
|
+
/** 更多按钮 */
|
|
150
|
+
const handleMoreBtn = () => {
|
|
151
|
+
if (!(morePos !== null && list.length > morePos)) return null;
|
|
152
|
+
const {
|
|
153
|
+
buttonType,
|
|
154
|
+
icon = jsx(MoreVert, {}),
|
|
155
|
+
children = intl({
|
|
156
|
+
id: 'more'
|
|
157
|
+
})
|
|
158
|
+
} = moreProps || {};
|
|
159
|
+
let Dom = jsx(Button, Object.assign({
|
|
160
|
+
variant: "outlined",
|
|
161
|
+
startIcon: icon,
|
|
162
|
+
className: "auto-button-more"
|
|
163
|
+
}, {
|
|
164
|
+
children: children
|
|
165
|
+
}));
|
|
166
|
+
if (buttonType === 'icon') {
|
|
167
|
+
Dom = jsx(Button, Object.assign({
|
|
168
|
+
variant: "outlined",
|
|
169
|
+
className: "auto-button-more"
|
|
170
|
+
}, {
|
|
171
|
+
children: icon
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
return jsx(Dropdown, Object.assign({
|
|
175
|
+
overlayClassName: "".concat($prefixCls, "-auto-button-dropdown"),
|
|
176
|
+
overlay: handleMoreOverlay(),
|
|
177
|
+
placement: morePlacement,
|
|
178
|
+
trigger: trigger
|
|
179
|
+
}, {
|
|
180
|
+
children: Dom
|
|
181
|
+
}));
|
|
182
|
+
};
|
|
183
|
+
return jsxs("div", Object.assign({
|
|
184
|
+
className: clsx(className, "".concat($prefixCls, "-auto-button")),
|
|
185
|
+
style: style,
|
|
186
|
+
ref: comRef
|
|
187
|
+
}, {
|
|
188
|
+
children: [list.map((item, index) => {
|
|
189
|
+
if (morePos !== null && morePos <= index) return null;
|
|
190
|
+
const {
|
|
191
|
+
buttonType
|
|
192
|
+
} = item,
|
|
193
|
+
otherItemProps = __rest(item, ["buttonType"]);
|
|
194
|
+
let Dom = Button;
|
|
195
|
+
const styleItem = {
|
|
196
|
+
marginRight: morePos === index + 1 ? 0 : marginRight
|
|
197
|
+
};
|
|
198
|
+
// 存在更多按钮
|
|
199
|
+
if (morePos !== null && list.length > morePos) styleItem.marginRight = marginRight;
|
|
200
|
+
if (buttonType === 'icon') {
|
|
201
|
+
Dom = Button.IconButton;
|
|
202
|
+
}
|
|
203
|
+
if (buttonType === 'split') {
|
|
204
|
+
Dom = Button.SplitButton;
|
|
205
|
+
}
|
|
206
|
+
return jsx(Dom, Object.assign({}, otherItemProps, {
|
|
207
|
+
style: styleItem
|
|
208
|
+
}), index);
|
|
209
|
+
}), handleMoreBtn()]
|
|
210
|
+
}));
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export { AutoButton, AutoButton as default };
|
package/Badge/index.d.ts
CHANGED
|
@@ -12,12 +12,14 @@ export interface BadgeProps {
|
|
|
12
12
|
style?: React.CSSProperties;
|
|
13
13
|
/** 内容 */
|
|
14
14
|
children?: ReactNode;
|
|
15
|
-
/** 标记内容,
|
|
15
|
+
/** 标记内容, 不传为圆点类型, null不显示 */
|
|
16
16
|
sign?: ReactNode;
|
|
17
17
|
/** 背景色 */
|
|
18
18
|
backgroundColor?: string;
|
|
19
19
|
/** 文字色 */
|
|
20
20
|
color?: string;
|
|
21
|
+
/** 偏移量 */
|
|
22
|
+
offset?: [number, number];
|
|
21
23
|
}
|
|
22
24
|
export declare const Badge: FunctionComponent<BadgeProps>;
|
|
23
25
|
export default Badge;
|
package/Badge/index.js
CHANGED
|
@@ -13,24 +13,34 @@ const Badge = props => {
|
|
|
13
13
|
children,
|
|
14
14
|
sign,
|
|
15
15
|
backgroundColor,
|
|
16
|
-
color
|
|
16
|
+
color,
|
|
17
|
+
offset
|
|
17
18
|
} = props;
|
|
18
19
|
// 判断数据类型
|
|
19
20
|
const handleType = () => {
|
|
20
21
|
const type = typeof sign;
|
|
21
22
|
if (type === 'undefined') return 'dot';
|
|
22
23
|
if (type === 'number') return 'number';
|
|
24
|
+
if (sign === null) {
|
|
25
|
+
return 'null';
|
|
26
|
+
}
|
|
23
27
|
return 'text';
|
|
24
28
|
};
|
|
25
29
|
const type = handleType();
|
|
26
30
|
// 标记内容
|
|
27
31
|
const handleSign = () => {
|
|
32
|
+
if (type === null) return null;
|
|
33
|
+
const styleSign = {
|
|
34
|
+
backgroundColor,
|
|
35
|
+
color
|
|
36
|
+
};
|
|
37
|
+
if (offset) {
|
|
38
|
+
styleSign.right = -offset[0] + 'px';
|
|
39
|
+
styleSign.marginTop = offset[1] + 'px';
|
|
40
|
+
}
|
|
28
41
|
return jsxs("span", Object.assign({
|
|
29
42
|
className: "pos-box ".concat(type),
|
|
30
|
-
style:
|
|
31
|
-
backgroundColor,
|
|
32
|
-
color
|
|
33
|
-
}
|
|
43
|
+
style: styleSign
|
|
34
44
|
}, {
|
|
35
45
|
children: [type === 'number' && jsx("span", {
|
|
36
46
|
children: handleNumber()
|
package/Card/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author linhd
|
|
3
|
+
* @date 2024/8/6 10:02
|
|
4
|
+
* @description 卡片
|
|
5
|
+
*/
|
|
6
|
+
import React, { FunctionComponent, ReactNode } from 'react';
|
|
7
|
+
import './index.scss';
|
|
8
|
+
export interface CardItemProps {
|
|
9
|
+
render?: ReactNode;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
[name: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface CardLineNumProps {
|
|
14
|
+
/** 容器宽度 */
|
|
15
|
+
width: number;
|
|
16
|
+
/** 展示个数 */
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CardProps {
|
|
20
|
+
/** 样式class */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** style */
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
/** 数据源 */
|
|
25
|
+
list?: CardItemProps[];
|
|
26
|
+
/** box-shadow, 是否带投影 */
|
|
27
|
+
boxShadow?: boolean | string;
|
|
28
|
+
/** border, 是否边框 */
|
|
29
|
+
border?: boolean | string;
|
|
30
|
+
/** 背景图片 */
|
|
31
|
+
backgroundImage?: string;
|
|
32
|
+
/** 宽度与每行个数互斥 默认300px */
|
|
33
|
+
width?: string;
|
|
34
|
+
/** 高度 默认140ox */
|
|
35
|
+
height?: string;
|
|
36
|
+
/** 每行个数与宽度互斥 */
|
|
37
|
+
lineNum?: number | CardLineNumProps[];
|
|
38
|
+
/** 右间距 默认20px */
|
|
39
|
+
marginRight?: string;
|
|
40
|
+
/** 下间距 默认20px */
|
|
41
|
+
marginBottom?: string;
|
|
42
|
+
/** 是否显示加载更多 */
|
|
43
|
+
showMore?: boolean;
|
|
44
|
+
/** 加载更多内容 */
|
|
45
|
+
moreRender?: ReactNode;
|
|
46
|
+
/** loading */
|
|
47
|
+
loadingMoreRender?: ReactNode;
|
|
48
|
+
/** 加载更多事件 */
|
|
49
|
+
onMore?: () => Promise<void> | void;
|
|
50
|
+
[name: string]: any;
|
|
51
|
+
}
|
|
52
|
+
export declare const Card: FunctionComponent<CardProps>;
|
|
53
|
+
export default Card;
|
package/Card/index.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { a as __awaiter } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
|
|
7
|
+
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
8
|
+
import '../_verture/index-ca413216.js';
|
|
9
|
+
import '@paraview/lib';
|
|
10
|
+
|
|
11
|
+
var en = {
|
|
12
|
+
more: 'Mouse scrolling to load more data',
|
|
13
|
+
loadingMore: 'Loading...'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var zh = {
|
|
17
|
+
more: '鼠标滚动,加载更多数据',
|
|
18
|
+
loadingMore: '数据正在加载中…'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var localeJson = {
|
|
22
|
+
zh,
|
|
23
|
+
en
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-card {\n width: 100%;\n height: 100%;\n overflow: auto;\n}\n.paraui-v4-card > .card-list {\n display: flex;\n flex-wrap: wrap;\n}\n.paraui-v4-card > .card-list > .card-item {\n border-radius: 4px;\n overflow: auto;\n}\n.paraui-v4-card > .more {\n text-align: center;\n}\n.paraui-v4-card > .more > .more-content {\n font-size: 14px;\n text-align: center;\n color: rgb(161, 168, 179);\n display: inline-block;\n}\n.paraui-v4-card.paraui-v4-card-more > .more > .more-content {\n cursor: pointer;\n}\n.paraui-v4-card.paraui-v4-card-more > .more > .more-content:hover {\n color: rgb(46, 101, 230);\n}";
|
|
27
|
+
styleInject(css_248z);
|
|
28
|
+
|
|
29
|
+
const Card = props => {
|
|
30
|
+
const {
|
|
31
|
+
className,
|
|
32
|
+
style,
|
|
33
|
+
list,
|
|
34
|
+
boxShadow,
|
|
35
|
+
border,
|
|
36
|
+
backgroundImage,
|
|
37
|
+
width = '300px',
|
|
38
|
+
height = '140px',
|
|
39
|
+
lineNum,
|
|
40
|
+
marginRight = '20px',
|
|
41
|
+
marginBottom = '20px',
|
|
42
|
+
showMore = false,
|
|
43
|
+
moreRender,
|
|
44
|
+
loadingMoreRender,
|
|
45
|
+
onMore
|
|
46
|
+
} = props;
|
|
47
|
+
const intl = useFormatMessage('Card', localeJson);
|
|
48
|
+
const [lineNumCom, setLineNumCom] = useState();
|
|
49
|
+
//const [itemWidth, setItemWidth] = useState<string>('');
|
|
50
|
+
const [loadingMore, setLoadingMore] = useState(false);
|
|
51
|
+
const constData = useRef({});
|
|
52
|
+
const refBox = useRef(null);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
window.removeEventListener('resize', resize);
|
|
56
|
+
(_a = refBox.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', scroll);
|
|
57
|
+
window.addEventListener('resize', resize);
|
|
58
|
+
(_b = refBox.current) === null || _b === void 0 ? void 0 : _b.addEventListener('scroll', scroll);
|
|
59
|
+
return () => {
|
|
60
|
+
var _a;
|
|
61
|
+
window.removeEventListener('resize', resize);
|
|
62
|
+
(_a = refBox.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', scroll);
|
|
63
|
+
};
|
|
64
|
+
}, [showMore, onMore]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
resize();
|
|
67
|
+
}, [list, lineNum]);
|
|
68
|
+
const resize = () => {
|
|
69
|
+
if (!refBox.current) return;
|
|
70
|
+
const refBoxRect = refBox.current.getBoundingClientRect();
|
|
71
|
+
const card = refBox.current.querySelector('.card-list');
|
|
72
|
+
const cardRect = card.getBoundingClientRect();
|
|
73
|
+
const cardItem = refBox.current.querySelector('.card-list > .card-item');
|
|
74
|
+
const cardItemRect = cardItem.getBoundingClientRect();
|
|
75
|
+
const cardItemMarginRight = parseFloat(cardItem.style.marginRight);
|
|
76
|
+
const scrollWidth = refBoxRect.width - cardRect.width; // 滚动条宽度
|
|
77
|
+
const boxWidt = scrollWidth !== 0 ? refBoxRect.width - scrollWidth - 4 : refBoxRect.width;
|
|
78
|
+
let n = Math.floor((boxWidt + cardItemMarginRight) / (cardItemRect.width + cardItemMarginRight));
|
|
79
|
+
if (props.width === undefined && props.lineNum) {
|
|
80
|
+
if (typeof lineNum === "number") {
|
|
81
|
+
n = lineNum;
|
|
82
|
+
} else {
|
|
83
|
+
const arr = props.lineNum.sort((a, b) => a.width - b.width);
|
|
84
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
85
|
+
const item = arr[i];
|
|
86
|
+
if (item.width > refBoxRect.width) {
|
|
87
|
+
n = item.size;
|
|
88
|
+
break;
|
|
89
|
+
} else {
|
|
90
|
+
if (i === arr.length - 1) {
|
|
91
|
+
n = item.size;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//constData.current.itemWidth = (refBoxRect.width + cardItemMarginRight) / n - cardItemMarginRight;
|
|
97
|
+
let rightTotal = (n - 1) * cardItemMarginRight;
|
|
98
|
+
if (scrollWidth) {
|
|
99
|
+
// 出现滚动条,加4
|
|
100
|
+
rightTotal = rightTotal + 4;
|
|
101
|
+
}
|
|
102
|
+
const right = rightTotal / n + 'px';
|
|
103
|
+
constData.current.itemWidth = "calc(".concat(1 / n * 100, "% - ").concat(right, ")");
|
|
104
|
+
//setItemWidth(constData.current.itemWidth);
|
|
105
|
+
const cardArr = refBox.current.querySelectorAll('.card-list > .card-item');
|
|
106
|
+
cardArr.forEach(item => {
|
|
107
|
+
item.style.width = constData.current.itemWidth;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (n !== constData.current.lineNumCom) {
|
|
111
|
+
constData.current.lineNumCom = n;
|
|
112
|
+
setLineNumCom(n);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const scroll = () => {
|
|
116
|
+
var _a, _b, _c;
|
|
117
|
+
if (!showMore || !refBox.current || !props.onMore || constData.current.loadingMore) return;
|
|
118
|
+
if (refBox.current.scrollHeight - (refBox.current.clientHeight + refBox.current.scrollTop) < 1) {
|
|
119
|
+
if (((_a = constData.current.pos) === null || _a === void 0 ? void 0 : _a.clientHeight) === refBox.current.clientHeight && ((_b = constData.current.pos) === null || _b === void 0 ? void 0 : _b.scrollTop) === refBox.current.scrollTop && ((_c = constData.current.pos) === null || _c === void 0 ? void 0 : _c.scrollHeight) === refBox.current.scrollHeight) {
|
|
120
|
+
constData.current.pos = {};
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
constData.current.pos = {
|
|
124
|
+
clientHeight: refBox.current.clientHeight,
|
|
125
|
+
scrollTop: refBox.current.scrollTop,
|
|
126
|
+
scrollHeight: refBox.current.scrollHeight
|
|
127
|
+
};
|
|
128
|
+
// 滚动到底部
|
|
129
|
+
moreFunc();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const moreFunc = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
if (constData.current.loadingMore) return;
|
|
134
|
+
constData.current.loadingMore = true;
|
|
135
|
+
setLoadingMore(true);
|
|
136
|
+
yield props.onMore();
|
|
137
|
+
setLoadingMore(false);
|
|
138
|
+
constData.current.loadingMore = false;
|
|
139
|
+
});
|
|
140
|
+
const handleStyleItem = (item, index) => {
|
|
141
|
+
const styleCard = {
|
|
142
|
+
height,
|
|
143
|
+
marginBottom,
|
|
144
|
+
marginRight
|
|
145
|
+
};
|
|
146
|
+
if (boxShadow) {
|
|
147
|
+
if (boxShadow === true) {
|
|
148
|
+
styleCard.boxShadow = '1px 1px 10px 2px rgba(212,218,227,0.40)';
|
|
149
|
+
} else {
|
|
150
|
+
styleCard.boxShadow = boxShadow;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (border) {
|
|
154
|
+
if (border === true) {
|
|
155
|
+
styleCard.border = '1px solid rgba(212, 218, 227, 0.4)';
|
|
156
|
+
} else {
|
|
157
|
+
styleCard.border = border;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (backgroundImage) {
|
|
161
|
+
styleCard.backgroundImage = backgroundImage;
|
|
162
|
+
styleCard.backgroundSize = '100% 100%';
|
|
163
|
+
styleCard.backgroundRepeat = 'no-repeat';
|
|
164
|
+
}
|
|
165
|
+
// 默认宽度
|
|
166
|
+
if (lineNum === undefined) {
|
|
167
|
+
styleCard.width = width;
|
|
168
|
+
}
|
|
169
|
+
/*if (props.width === undefined && lineNum) {
|
|
170
|
+
styleCard.width = constData.current.itemWidth;
|
|
171
|
+
}*/
|
|
172
|
+
if (constData.current.lineNumCom && (index + 1) % constData.current.lineNumCom === 0) {
|
|
173
|
+
styleCard.marginRight = 0;
|
|
174
|
+
}
|
|
175
|
+
return Object.assign(Object.assign({}, styleCard), item.style);
|
|
176
|
+
};
|
|
177
|
+
const handleMore = () => {
|
|
178
|
+
if (loadingMore) {
|
|
179
|
+
return loadingMoreRender ? loadingMoreRender : intl({
|
|
180
|
+
id: 'loadingMore'
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return moreRender ? moreRender : intl({
|
|
184
|
+
id: 'more'
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
return jsxs("div", Object.assign({
|
|
188
|
+
className: clsx(className, "".concat($prefixCls, "-card"), {
|
|
189
|
+
["".concat($prefixCls, "-card-more")]: showMore && !loadingMore
|
|
190
|
+
}),
|
|
191
|
+
style: style,
|
|
192
|
+
ref: refBox
|
|
193
|
+
}, {
|
|
194
|
+
children: [jsx("div", Object.assign({
|
|
195
|
+
className: 'card-list'
|
|
196
|
+
}, {
|
|
197
|
+
children: list === null || list === void 0 ? void 0 : list.map((item, index) => {
|
|
198
|
+
return jsx("div", Object.assign({
|
|
199
|
+
className: 'card-item',
|
|
200
|
+
style: handleStyleItem(item, index)
|
|
201
|
+
}, {
|
|
202
|
+
children: item.render
|
|
203
|
+
}), index);
|
|
204
|
+
})
|
|
205
|
+
})), showMore && jsx("div", Object.assign({
|
|
206
|
+
className: 'more'
|
|
207
|
+
}, {
|
|
208
|
+
children: jsx("div", Object.assign({
|
|
209
|
+
className: 'more-content',
|
|
210
|
+
onClick: moreFunc
|
|
211
|
+
}, {
|
|
212
|
+
children: handleMore()
|
|
213
|
+
}))
|
|
214
|
+
}))]
|
|
215
|
+
}));
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export { Card, Card as default };
|
package/Cascader/index.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { C as Cascader } from '../_verture/index-
|
|
2
|
-
export { C as default } from '../_verture/index-
|
|
1
|
+
import { C as Cascader } from '../_verture/index-8752ccab.js';
|
|
2
|
+
export { C as default } from '../_verture/index-8752ccab.js';
|
|
3
3
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
|
-
import '../_verture/Portal-
|
|
6
|
-
import '../_verture/slicedToArray-
|
|
7
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
5
|
+
import '../_verture/Portal-edd94cac.js';
|
|
6
|
+
import '../_verture/slicedToArray-75fa4188.js';
|
|
8
7
|
import 'react';
|
|
9
8
|
import 'react-dom';
|
|
10
9
|
import '../_verture/typeof-adeedc13.js';
|
|
11
|
-
import '../_verture/toConsumableArray-
|
|
10
|
+
import '../_verture/toConsumableArray-c7a8028f.js';
|
|
12
11
|
import '../_verture/defineProperty-6f62bb2a.js';
|
|
13
12
|
import 'rc-motion';
|
|
14
13
|
import 'clsx';
|
|
15
|
-
import '../_verture/typeof-
|
|
14
|
+
import '../_verture/typeof-4646b22c.js';
|
|
16
15
|
import 'rc-tree/lib/utils/conductUtil';
|
|
17
16
|
import '@para-ui/icons/Right';
|
|
18
17
|
import '@para-ui/icons/Down';
|