@pnt-team/pnt-component-frontend 0.0.138 → 0.0.139
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/api/cos.d.ts +103 -0
- package/lib/cjs/api/cos.js +146 -0
- package/lib/cjs/api/index.d.ts +23 -0
- package/lib/cjs/api/index.js +38 -0
- package/lib/cjs/api/types/index.d.ts +117 -0
- package/lib/cjs/api/types/index.js +17 -0
- package/lib/cjs/assets/css/tdesign-theme.css +584 -0
- package/lib/cjs/assets/images/uploadImg.png +0 -0
- package/lib/cjs/assets/svg/inputSearch.svg +4 -0
- package/lib/cjs/assets/svg/inputTip.svg +5 -0
- package/lib/cjs/components/PntRegionSelect/index.scss +1 -1
- package/lib/esm/api/cos.d.ts +103 -0
- package/lib/esm/api/cos.js +189 -0
- package/lib/esm/api/index.d.ts +23 -0
- package/lib/esm/api/index.js +23 -0
- package/lib/esm/api/types/index.d.ts +117 -0
- package/lib/esm/api/types/index.js +1 -0
- package/lib/esm/assets/css/tdesign-theme.css +584 -0
- package/lib/esm/assets/images/uploadImg.png +0 -0
- package/lib/esm/assets/svg/inputSearch.svg +4 -0
- package/lib/esm/assets/svg/inputTip.svg +5 -0
- package/lib/esm/assets/svg/inputWarnTip.svg +5 -0
- package/lib/esm/components/PntBusinessSelect/index.d.ts +192 -0
- package/lib/esm/components/PntBusinessSelect/index.js +513 -0
- package/lib/esm/components/PntBusinessSelect/index.scss +27 -0
- package/lib/esm/components/PntCosUploader/index.d.ts +134 -0
- package/lib/esm/components/PntCosUploader/index.js +300 -0
- package/lib/esm/components/PntGeneralLayout/index.d.ts +114 -0
- package/lib/esm/components/PntGeneralLayout/index.js +103 -0
- package/lib/esm/components/PntGeneralLayout/index.scss +121 -0
- package/lib/esm/components/PntImage/index.d.ts +93 -0
- package/lib/esm/components/PntImage/index.js +200 -0
- package/lib/esm/components/PntImage/index.scss +61 -0
- package/lib/esm/components/PntRegionSelect/ImportDialog.d.ts +29 -0
- package/lib/esm/components/PntRegionSelect/ImportDialog.js +244 -0
- package/lib/esm/components/PntRegionSelect/index.d.ts +39 -0
- package/lib/esm/components/PntRegionSelect/index.js +471 -0
- package/lib/esm/components/PntRegionSelect/index.scss +174 -0
- package/lib/esm/components/PntRegionSelect/types.d.ts +181 -0
- package/lib/esm/components/PntRegionSelect/types.js +77 -0
- package/lib/esm/components/PntSecureBox/index.d.ts +122 -0
- package/lib/esm/components/PntSecureBox/index.js +166 -0
- package/lib/esm/components/PntSecureBox/index.scss +23 -0
- package/lib/esm/components/PntTable/index.d.ts +14 -0
- package/lib/esm/components/PntTable/index.js +404 -0
- package/lib/esm/components/PntTable/index.scss +290 -0
- package/lib/esm/components/PntTable/types.d.ts +250 -0
- package/lib/esm/components/PntTable/types.js +81 -0
- package/lib/esm/components/PntTable/useTableCore.d.ts +38 -0
- package/lib/esm/components/PntTable/useTableCore.js +499 -0
- package/lib/esm/components/PntUpload/index.d.ts +149 -0
- package/lib/esm/components/PntUpload/index.js +276 -0
- package/lib/esm/components/PntUpload/index.scss +101 -0
- package/lib/esm/config.d.ts +97 -0
- package/lib/esm/config.js +60 -0
- package/lib/esm/global.css +2 -0
- package/lib/esm/global.d.ts +39 -0
- package/lib/esm/hooks/useHighSecurity.d.ts +88 -0
- package/lib/esm/hooks/useHighSecurity.js +250 -0
- package/lib/esm/index.d.ts +16 -0
- package/lib/esm/index.js +33 -0
- package/lib/esm/utils/const.d.ts +13 -0
- package/lib/esm/utils/const.js +23 -0
- package/lib/esm/utils/index.d.ts +6 -0
- package/lib/esm/utils/index.js +22 -0
- package/lib/umd/pnt-component-frontend.min.css +1 -0
- package/lib/umd/pnt-component-frontend.min.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
.pnt-general-layout {
|
|
2
|
+
// 可通过 props(bodyPadding / cardRadius)覆盖的布局变量
|
|
3
|
+
--pnt-layout-body-padding: 24px;
|
|
4
|
+
--pnt-layout-card-radius: 4px;
|
|
5
|
+
|
|
6
|
+
height: 100%;
|
|
7
|
+
background-color: rgba(0, 0, 0, 0);
|
|
8
|
+
|
|
9
|
+
.t-layout__header {
|
|
10
|
+
height: auto;
|
|
11
|
+
flex-shrink: 0;
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
align-items: stretch;
|
|
15
|
+
border-bottom: 1px solid #f0f3f6;
|
|
16
|
+
|
|
17
|
+
.header-title {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 24px;
|
|
21
|
+
|
|
22
|
+
.goback-icon {
|
|
23
|
+
margin-right: 12px;
|
|
24
|
+
color: #3f8cff;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.title {
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
font-size: 20px;
|
|
31
|
+
line-height: 24px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 统一 flex 居中:高度由 header-title 的 padding 撑起(72px),
|
|
36
|
+
// 比固定 line-height: 72px 更稳,按钮高度变化也不会错位
|
|
37
|
+
.header-operation {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
padding-right: 24px;
|
|
41
|
+
|
|
42
|
+
.t-button + .t-button {
|
|
43
|
+
margin-left: 12px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 无头部分割线变体(headerBordered={false})
|
|
49
|
+
&--borderless {
|
|
50
|
+
.t-layout__header {
|
|
51
|
+
border-bottom: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.general-layout-sub-header {
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
border-bottom: 1px solid #f0f3f6;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.general-layout-body {
|
|
61
|
+
// flex 自动填满 header/sub-header/footer 之外的剩余空间;
|
|
62
|
+
// min-height: 0 保证内容超长时由 body 自身滚动,而不是撑破布局
|
|
63
|
+
flex: 1 1 auto;
|
|
64
|
+
min-height: 0;
|
|
65
|
+
padding: var(--pnt-layout-body-padding);
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
background: #fafafa;
|
|
68
|
+
|
|
69
|
+
// 卡片/业务容器取各项目选择器超集,统一去阴影、间距与圆角
|
|
70
|
+
> div.tea-card,
|
|
71
|
+
> div.t-card,
|
|
72
|
+
> div.t-loading__parent > div.t-card,
|
|
73
|
+
> div[class*='-wrapper'],
|
|
74
|
+
> div[class*='-block'] {
|
|
75
|
+
box-shadow: none;
|
|
76
|
+
margin-bottom: 24px;
|
|
77
|
+
border-radius: var(--pnt-layout-card-radius);
|
|
78
|
+
|
|
79
|
+
.t-card__body {
|
|
80
|
+
border-radius: var(--pnt-layout-card-radius);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
> div:last-child,
|
|
85
|
+
> div:last-child.t-card,
|
|
86
|
+
> div:last-child.tea-card,
|
|
87
|
+
> div.t-loading__parent > div:last-child.t-card,
|
|
88
|
+
> div:last-child[class*='-wrapper'],
|
|
89
|
+
> div:last-child[class*='-block'] {
|
|
90
|
+
margin-bottom: 0;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.t-layout__footer {
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
padding: 18px 24px;
|
|
97
|
+
background: #fff;
|
|
98
|
+
border-top: 1px solid #f0f3f6;
|
|
99
|
+
|
|
100
|
+
.t-button {
|
|
101
|
+
font-size: 14px;
|
|
102
|
+
min-width: 92px;
|
|
103
|
+
height: 36px;
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
|
|
106
|
+
& + .t-button {
|
|
107
|
+
margin-left: 12px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 底部按钮不约束尺寸变体(footerButton='auto'),仅保留按钮间距
|
|
113
|
+
&--footer-auto {
|
|
114
|
+
.t-layout__footer .t-button {
|
|
115
|
+
font-size: inherit;
|
|
116
|
+
min-width: 0;
|
|
117
|
+
height: auto;
|
|
118
|
+
font-weight: inherit;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
/**
|
|
4
|
+
* PntImage 文案集合
|
|
5
|
+
* @description 所有内部展示文案均可通过 texts prop 自定义,用于多语言场景
|
|
6
|
+
*/
|
|
7
|
+
export interface PntImageTexts {
|
|
8
|
+
/** 上传中占位文案(仅上传预览模式生效) */
|
|
9
|
+
uploading?: string;
|
|
10
|
+
/** 图片加载中占位文案(纯预览模式生效,透传给 tdesign Image loading) */
|
|
11
|
+
loading?: string;
|
|
12
|
+
/** 图片加载失败占位文案(纯预览模式生效,透传给 tdesign Image error) */
|
|
13
|
+
loadFailed?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PntImageProps {
|
|
16
|
+
/**
|
|
17
|
+
* 图片地址
|
|
18
|
+
* @description 图片的完整 URL 地址;为空则展示 defaultImg 或内置 uploadImg
|
|
19
|
+
*/
|
|
20
|
+
src: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* alt 文本
|
|
23
|
+
* @description 图片加载失败时的替代文本,纯预览模式必传以提升可访问性
|
|
24
|
+
*/
|
|
25
|
+
alt?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 默认图片
|
|
28
|
+
* @description src 为空时展示的占位图;不传则使用内置的 uploadImg
|
|
29
|
+
*/
|
|
30
|
+
defaultImg?: string;
|
|
31
|
+
/**
|
|
32
|
+
* 快捷尺寸(正方形)
|
|
33
|
+
* @description 预设尺寸:`small`=36px、`medium`=60px、`large`=136px;默认 `large`
|
|
34
|
+
* 若 `style` 中显式指定了 width/height,则以 style 为准;非正方形场景请使用 `style`
|
|
35
|
+
*/
|
|
36
|
+
size?: 'small' | 'medium' | 'large';
|
|
37
|
+
/**
|
|
38
|
+
* 自定义样式
|
|
39
|
+
* @description 一般用于控制图片宽高;其中 width/height 优先级高于 size
|
|
40
|
+
*/
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
/**
|
|
43
|
+
* 上传中状态
|
|
44
|
+
* @description 当为 true 时显示上传中 loading 占位,阻止其他操作;仅在上传预览模式(传入 onRemove)生效
|
|
45
|
+
*/
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 删除回调
|
|
49
|
+
* @description 传入即启用「上传预览模式」,mask 含预览 + 删除按钮;不传则为「纯预览模式」
|
|
50
|
+
* @param e - 事件对象
|
|
51
|
+
*/
|
|
52
|
+
onRemove?: (e: any) => void;
|
|
53
|
+
/**
|
|
54
|
+
* attach 容器
|
|
55
|
+
* @description 弹窗场景下需要透传给 tdesign ImageViewer 的 attach,避免预览浮层被父容器裁剪
|
|
56
|
+
*/
|
|
57
|
+
container?: HTMLElement | (() => HTMLElement);
|
|
58
|
+
/**
|
|
59
|
+
* 多语言文案
|
|
60
|
+
* @description 传入即覆盖默认中文文案;仅对应字段会覆盖,未传字段仍用默认值
|
|
61
|
+
*/
|
|
62
|
+
texts?: PntImageTexts;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* PntImage 业务图片组件
|
|
66
|
+
* @description 统一覆盖「上传图片预览」和「纯图片预览」两种业务场景,避免业务侧维护两套组件
|
|
67
|
+
*
|
|
68
|
+
* 模式判定:传入 `onRemove` 即为上传预览模式,否则为纯预览模式
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* // 上传预览模式
|
|
73
|
+
* <PntImage
|
|
74
|
+
* src={iconUrl}
|
|
75
|
+
* loading={loading}
|
|
76
|
+
* defaultImg={defaultImg}
|
|
77
|
+
* onRemove={handleRemove}
|
|
78
|
+
* size="large"
|
|
79
|
+
* />
|
|
80
|
+
*
|
|
81
|
+
* // 纯预览模式
|
|
82
|
+
* <PntImage
|
|
83
|
+
* src={url}
|
|
84
|
+
* alt="avatar"
|
|
85
|
+
* size="medium"
|
|
86
|
+
* container={container}
|
|
87
|
+
* />
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @returns {ReactElement} 业务图片组件
|
|
91
|
+
*/
|
|
92
|
+
declare const PntImage: FC<PntImageProps>;
|
|
93
|
+
export default PntImage;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import uploadImg from "../../assets/images/uploadImg.png";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BrowseIcon, DeleteIcon, ImageErrorIcon, ImageIcon, LoadingIcon } from 'tdesign-icons-react';
|
|
4
|
+
import { Image, ImageViewer, Space } from 'tdesign-react';
|
|
5
|
+
import "./index.scss";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* PntImage 文案集合
|
|
9
|
+
* @description 所有内部展示文案均可通过 texts prop 自定义,用于多语言场景
|
|
10
|
+
*/
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
/**
|
|
15
|
+
* 默认中文文案
|
|
16
|
+
*/
|
|
17
|
+
const DEFAULT_TEXTS = {
|
|
18
|
+
uploading: '上传中',
|
|
19
|
+
loading: '加载中',
|
|
20
|
+
loadFailed: '加载失败'
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* PntImage 业务图片组件
|
|
24
|
+
* @description 统一覆盖「上传图片预览」和「纯图片预览」两种业务场景,避免业务侧维护两套组件
|
|
25
|
+
*
|
|
26
|
+
* 模式判定:传入 `onRemove` 即为上传预览模式,否则为纯预览模式
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // 上传预览模式
|
|
31
|
+
* <PntImage
|
|
32
|
+
* src={iconUrl}
|
|
33
|
+
* loading={loading}
|
|
34
|
+
* defaultImg={defaultImg}
|
|
35
|
+
* onRemove={handleRemove}
|
|
36
|
+
* size="large"
|
|
37
|
+
* />
|
|
38
|
+
*
|
|
39
|
+
* // 纯预览模式
|
|
40
|
+
* <PntImage
|
|
41
|
+
* src={url}
|
|
42
|
+
* alt="avatar"
|
|
43
|
+
* size="medium"
|
|
44
|
+
* container={container}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @returns {ReactElement} 业务图片组件
|
|
49
|
+
*/
|
|
50
|
+
const PntImage = ({
|
|
51
|
+
src,
|
|
52
|
+
alt = '',
|
|
53
|
+
defaultImg,
|
|
54
|
+
size,
|
|
55
|
+
style,
|
|
56
|
+
loading = false,
|
|
57
|
+
onRemove,
|
|
58
|
+
container,
|
|
59
|
+
texts
|
|
60
|
+
}) => {
|
|
61
|
+
// 模式判定:传入 onRemove 即为上传预览模式
|
|
62
|
+
const isUploadMode = typeof onRemove === 'function';
|
|
63
|
+
const finalSrc = src?.length ? src : defaultImg || uploadImg;
|
|
64
|
+
|
|
65
|
+
// 预设尺寸映射:small=36 / medium=60 / large=136(默认 large)
|
|
66
|
+
const SIZE_MAP = {
|
|
67
|
+
small: 36,
|
|
68
|
+
medium: 60,
|
|
69
|
+
large: 136
|
|
70
|
+
};
|
|
71
|
+
const sizeValue = SIZE_MAP[size ?? 'large'];
|
|
72
|
+
|
|
73
|
+
// 合并尺寸:size 提供正方形宽高,style 中显式的 width/height 优先级更高
|
|
74
|
+
const sizeStyle = {
|
|
75
|
+
width: `${sizeValue}px`,
|
|
76
|
+
height: `${sizeValue}px`
|
|
77
|
+
};
|
|
78
|
+
const mergedStyle = {
|
|
79
|
+
...sizeStyle,
|
|
80
|
+
...style
|
|
81
|
+
};
|
|
82
|
+
const attach = container ? typeof container === 'function' ? container : () => container : undefined;
|
|
83
|
+
// 合并文案:texts 字段覆盖默认中文
|
|
84
|
+
const finalTexts = {
|
|
85
|
+
...DEFAULT_TEXTS,
|
|
86
|
+
...texts
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 上传预览模式的 loading 占位
|
|
91
|
+
* @param isImageLoading - 是否为 tdesign Image 内部图片加载状态(区别于上传中状态)
|
|
92
|
+
*/
|
|
93
|
+
const UploadLoadingContent = isImageLoading => /*#__PURE__*/_jsx("div", {
|
|
94
|
+
className: isImageLoading ? 'pnt-image-progress' : 'pnt-image-upload-progress',
|
|
95
|
+
style: style,
|
|
96
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
97
|
+
className: "pnt-image-loading",
|
|
98
|
+
children: [/*#__PURE__*/_jsx(LoadingIcon, {
|
|
99
|
+
size: "18px",
|
|
100
|
+
name: "loading"
|
|
101
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
102
|
+
children: finalTexts.uploading
|
|
103
|
+
})]
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 纯预览模式:图片加载中占位(透传给 tdesign Image loading)
|
|
109
|
+
*/
|
|
110
|
+
const basicImageLoading = /*#__PURE__*/_jsxs(Space, {
|
|
111
|
+
direction: "vertical",
|
|
112
|
+
align: "center",
|
|
113
|
+
size: "small",
|
|
114
|
+
style: {
|
|
115
|
+
color: 'var(--td-text-color-disabled)'
|
|
116
|
+
},
|
|
117
|
+
children: [/*#__PURE__*/_jsx(ImageIcon, {
|
|
118
|
+
size: 24
|
|
119
|
+
}), finalTexts.loading]
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 纯预览模式:图片加载失败占位(透传给 tdesign Image error)
|
|
124
|
+
*/
|
|
125
|
+
const basicImageError = /*#__PURE__*/_jsxs(Space, {
|
|
126
|
+
direction: "vertical",
|
|
127
|
+
align: "center",
|
|
128
|
+
size: "small",
|
|
129
|
+
children: [/*#__PURE__*/_jsx(ImageErrorIcon, {
|
|
130
|
+
size: 24
|
|
131
|
+
}), finalTexts.loadFailed]
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 纯预览模式 mask:半透明遮罩,点击触发预览
|
|
136
|
+
*/
|
|
137
|
+
const basicMask = open => /*#__PURE__*/_jsx("div", {
|
|
138
|
+
className: "pnt-image-mask pnt-image-mask--basic",
|
|
139
|
+
style: {
|
|
140
|
+
background: 'rgba(0,0,0,.1)',
|
|
141
|
+
height: '100%'
|
|
142
|
+
},
|
|
143
|
+
onClick: open
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 上传预览模式 mask:预览按钮 + 分隔线 + 删除按钮
|
|
148
|
+
*/
|
|
149
|
+
const uploadMask = open => /*#__PURE__*/_jsxs("div", {
|
|
150
|
+
className: "pnt-image-mask pnt-image-mask--upload",
|
|
151
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
152
|
+
children: /*#__PURE__*/_jsx(BrowseIcon, {
|
|
153
|
+
onClick: open,
|
|
154
|
+
size: "16px",
|
|
155
|
+
name: "browse"
|
|
156
|
+
})
|
|
157
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
158
|
+
className: "pnt-image-divider"
|
|
159
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
160
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {
|
|
161
|
+
onClick: onRemove,
|
|
162
|
+
size: "16px",
|
|
163
|
+
name: "delete"
|
|
164
|
+
})
|
|
165
|
+
})]
|
|
166
|
+
});
|
|
167
|
+
return /*#__PURE__*/_jsx("div", {
|
|
168
|
+
className: "pnt-image-wrapper",
|
|
169
|
+
onClick: e => {
|
|
170
|
+
// 上传预览模式:图片已上传或上传中时阻止冒泡,避免触发外层 Upload
|
|
171
|
+
if (isUploadMode && (src?.length || loading)) {
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
children: isUploadMode && loading ? UploadLoadingContent(false) : /*#__PURE__*/_jsx(ImageViewer, {
|
|
176
|
+
images: [finalSrc],
|
|
177
|
+
closeOnOverlay: true
|
|
178
|
+
// @ts-expect-error - attach 在 tdesign-react 运行时支持但未在类型定义中声明(弹窗 attach 容器)
|
|
179
|
+
,
|
|
180
|
+
attach: attach,
|
|
181
|
+
trigger: ({
|
|
182
|
+
open
|
|
183
|
+
}) => {
|
|
184
|
+
const mask = isUploadMode ? uploadMask(open) : basicMask(open);
|
|
185
|
+
return /*#__PURE__*/_jsx(Image, {
|
|
186
|
+
alt: alt,
|
|
187
|
+
src: finalSrc,
|
|
188
|
+
loading: isUploadMode ? UploadLoadingContent(true) : basicImageLoading,
|
|
189
|
+
error: isUploadMode ? undefined : basicImageError,
|
|
190
|
+
overlayContent: isUploadMode ? src ? mask : /*#__PURE__*/_jsx(_Fragment, {}) : mask,
|
|
191
|
+
overlayTrigger: "hover",
|
|
192
|
+
fit: "contain",
|
|
193
|
+
className: "pnt-image",
|
|
194
|
+
style: mergedStyle
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
export default PntImage;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.pnt-image-wrapper {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
.pnt-image-progress,
|
|
5
|
+
.pnt-image-upload-progress {
|
|
6
|
+
width: 136px;
|
|
7
|
+
height: 136px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
|
|
12
|
+
.pnt-image-loading {
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
text-align: center;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
border-radius: 4px;
|
|
21
|
+
background-color: #f7f8fa;
|
|
22
|
+
|
|
23
|
+
svg {
|
|
24
|
+
color: var(--td-brand-color);
|
|
25
|
+
font-size: 24px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
p {
|
|
29
|
+
margin-top: 4px;
|
|
30
|
+
color: #808191;
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.pnt-image {
|
|
37
|
+
width: 136px;
|
|
38
|
+
height: 136px;
|
|
39
|
+
|
|
40
|
+
.pnt-image-mask {
|
|
41
|
+
background: rgba(0, 0, 0, 60%);
|
|
42
|
+
color: #fff;
|
|
43
|
+
height: 100%;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
|
|
48
|
+
// 纯预览模式:半透明遮罩,鼠标手型
|
|
49
|
+
&--basic {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 上传预览模式:分隔线
|
|
54
|
+
.pnt-image-divider {
|
|
55
|
+
margin: 0 var(--td-comp-margin-l);
|
|
56
|
+
border-left: 1px var(--td-text-color-anti) solid;
|
|
57
|
+
height: var(--td-comp-size-xxxs);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import type { PntRegionSelectTexts, RegionOption } from './types';
|
|
3
|
+
/** 解析后单行状态 */
|
|
4
|
+
export type ImportRowStatus = 'pending' | 'exists' | 'unmatched';
|
|
5
|
+
export interface ImportRow {
|
|
6
|
+
/** 用户输入的原始文本 */
|
|
7
|
+
region: string;
|
|
8
|
+
status: ImportRowStatus;
|
|
9
|
+
}
|
|
10
|
+
/** 组件内部选项额外携带数据源原始码(保留前导零) */
|
|
11
|
+
type ImportRegionOption = RegionOption & {
|
|
12
|
+
rawRegionCode?: string;
|
|
13
|
+
};
|
|
14
|
+
interface ImportDialogProps {
|
|
15
|
+
visible: boolean;
|
|
16
|
+
options: ImportRegionOption[];
|
|
17
|
+
currentValue: string[];
|
|
18
|
+
texts: Required<PntRegionSelectTexts>;
|
|
19
|
+
dialogProps?: Record<string, unknown>;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
/** 导入确认:回传合并后的值与本次新增项 */
|
|
22
|
+
onConfirm: (nextValue: string[], added: string[]) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 批量导入弹窗:
|
|
26
|
+
* 粘贴文本 → 按 代码/中文名/英文名(大小写不敏感)解析 → 分类展示 → 确认导入
|
|
27
|
+
*/
|
|
28
|
+
declare const ImportDialog: FC<ImportDialogProps>;
|
|
29
|
+
export default ImportDialog;
|