@hkyhy/marsun-components-core 0.1.46 → 0.1.49
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/dist/_virtual/zh-cn.js +3 -0
- package/dist/_virtual/zh-cn.js.map +1 -0
- package/dist/_virtual/zh-cn2.js +5 -0
- package/dist/_virtual/zh-cn2.js.map +1 -0
- package/dist/components/Filter/FilterDatePicker/index.js +10 -9
- package/dist/components/Filter/FilterDatePicker/index.js.map +1 -1
- package/dist/components/Filter/FilterDateRange/index.js +3 -2
- package/dist/components/Filter/FilterDateRange/index.js.map +1 -1
- package/dist/components/Form/index.d.ts +1 -1
- package/dist/components/Form/kneFormInfo.d.ts +2 -0
- package/dist/components/Form/kneFormInfo.js +18 -17
- package/dist/components/Form/kneFormInfo.js.map +1 -1
- package/dist/components/OrgTree/OrgTree.js +52 -43
- package/dist/components/OrgTree/OrgTree.js.map +1 -1
- package/dist/components/OrgTree/style.module.scss.js +5 -5
- package/dist/components/PermissionBindPanel/PermissionBindPanel.d.ts +4 -1
- package/dist/components/PermissionBindPanel/PermissionBindPanel.js +121 -117
- package/dist/components/PermissionBindPanel/PermissionBindPanel.js.map +1 -1
- package/dist/components/ReactFilter/common/TypeDateRangePickerField/index.js +31 -30
- package/dist/components/ReactFilter/common/TypeDateRangePickerField/index.js.map +1 -1
- package/dist/components/ReactFilter/fields/DatePickerFilterItem.js +7 -6
- package/dist/components/ReactFilter/fields/DatePickerFilterItem.js.map +1 -1
- package/dist/components/ReactFilter/fields/DateRangePickerFilterItem.js +3 -2
- package/dist/components/ReactFilter/fields/DateRangePickerFilterItem.js.map +1 -1
- package/dist/components/ReactFilter/fields/TypeDateRangePickerFilterItem.js +11 -10
- package/dist/components/ReactFilter/fields/TypeDateRangePickerFilterItem.js.map +1 -1
- package/dist/components/SegmentedRadio/SegmentedRadio.d.ts +29 -0
- package/dist/components/SegmentedRadio/SegmentedRadio.js +48 -0
- package/dist/components/SegmentedRadio/SegmentedRadio.js.map +1 -0
- package/dist/components/SegmentedRadio/index.d.ts +2 -0
- package/dist/components/SegmentedRadio/style.module.scss.js +9 -0
- package/dist/components/SegmentedRadio/style.module.scss.js.map +1 -0
- package/dist/components/Stat/StatCard/index.d.ts +4 -0
- package/dist/components/Stat/StatCard/index.js +45 -29
- package/dist/components/Stat/StatCard/index.js.map +1 -1
- package/dist/components/Stat/StatCardList.d.ts +0 -2
- package/dist/components/Stat/StatCardList.js.map +1 -1
- package/dist/components/Tag/Tags/index.d.ts +2 -2
- package/dist/components/Tag/Tags/index.js +37 -22
- package/dist/components/Tag/Tags/index.js.map +1 -1
- package/dist/components/Tag/Tags/style.module.scss.js +3 -3
- package/dist/components/TooltipInfo/TooltipInfo.js +14 -8
- package/dist/components/TooltipInfo/TooltipInfo.js.map +1 -1
- package/dist/components/Upload/index.d.ts +6 -23
- package/dist/components/Upload/index.js +254 -141
- package/dist/components/Upload/index.js.map +1 -1
- package/dist/components/Upload/style.module.scss.js +22 -15
- package/dist/components/Upload/style.module.scss.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +580 -576
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/node_modules/dayjs/locale/zh-cn.js +25 -0
- package/dist/node_modules/dayjs/locale/zh-cn.js.map +1 -0
- package/dist/provider/MarsunCoreProvider.js +10 -9
- package/dist/provider/MarsunCoreProvider.js.map +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/utils/ensureDayjsZhCn.d.ts +0 -0
- package/dist/utils/ensureDayjsZhCn.js +4 -0
- package/dist/utils/ensureDayjsZhCn.js.map +1 -0
- package/package.json +6 -2
|
@@ -1,32 +1,47 @@
|
|
|
1
|
-
import { jsx as c, Fragment as
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
const { otherCount:
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
t.map((
|
|
10
|
-
|
|
1
|
+
import { jsx as c, Fragment as C, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as N } from "antd";
|
|
3
|
+
import g, { SEMANTIC_COLORS as v } from "../SemanticTag.js";
|
|
4
|
+
import m from "./style.module.scss.js";
|
|
5
|
+
import p from "classnames";
|
|
6
|
+
const x = 8, a = (t, n) => {
|
|
7
|
+
const { otherCount: o = 0, nowrap: i = !1, className: s, color: l } = n, e = i ? p("tags-tag-list-nowrap", m["tags-tag-list-nowrap"]) : void 0;
|
|
8
|
+
return /* @__PURE__ */ f("div", { className: p("tags-tag-list", m["tags-tag-list"], e, s), children: [
|
|
9
|
+
t.map((r) => /* @__PURE__ */ c(g, { color: l, children: r }, r)),
|
|
10
|
+
o > 0 && /* @__PURE__ */ f(g, { color: l, children: [
|
|
11
11
|
"+",
|
|
12
|
-
|
|
12
|
+
o
|
|
13
13
|
] })
|
|
14
14
|
] });
|
|
15
|
-
},
|
|
15
|
+
}, j = ({
|
|
16
16
|
tags: t,
|
|
17
|
-
showLength:
|
|
18
|
-
empty:
|
|
19
|
-
className:
|
|
20
|
-
color:
|
|
17
|
+
showLength: n,
|
|
18
|
+
empty: o = "-",
|
|
19
|
+
className: i,
|
|
20
|
+
color: s = v.INFO
|
|
21
21
|
}) => {
|
|
22
22
|
if (!(t != null && t.length))
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
return o != null ? /* @__PURE__ */ c(C, { children: o }) : null;
|
|
24
|
+
const l = n != null && n > 0 ? n : null;
|
|
25
|
+
if (l == null)
|
|
26
|
+
return a(t, { className: i, color: s });
|
|
27
|
+
const e = t.slice(0, l), r = Math.max(0, t.length - l), h = t.some((T) => T.length > x), u = r > 0 || h, d = a(e, {
|
|
28
|
+
otherCount: r,
|
|
29
|
+
nowrap: u,
|
|
30
|
+
className: i,
|
|
31
|
+
color: s
|
|
32
|
+
});
|
|
33
|
+
return u ? /* @__PURE__ */ c(
|
|
34
|
+
N,
|
|
35
|
+
{
|
|
36
|
+
title: a(t, {
|
|
37
|
+
className: p("tags-tag-list-tooltip", m["tags-tag-list-tooltip"]),
|
|
38
|
+
color: s
|
|
39
|
+
}),
|
|
40
|
+
children: d
|
|
41
|
+
}
|
|
42
|
+
) : d;
|
|
28
43
|
};
|
|
29
44
|
export {
|
|
30
|
-
|
|
45
|
+
j as default
|
|
31
46
|
};
|
|
32
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Tag/Tags/index.tsx"],"sourcesContent":["import { Tooltip } from 'antd';\nimport React from 'react';\nimport SemanticTag, { SEMANTIC_COLORS, type SemanticColor } from '../SemanticTag';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\nexport interface TagsProps {\n /** 标签列表 */\n tags?: string[];\n /**
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Tag/Tags/index.tsx"],"sourcesContent":["import { Tooltip } from 'antd';\nimport React from 'react';\nimport SemanticTag, { SEMANTIC_COLORS, type SemanticColor } from '../SemanticTag';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\n/** 单标签超过该字数时,即使未超出 showLength 也走紧凑+Tooltip,避免表格列溢出 */\nconst LONG_TAG_CHARS = 8;\n\nexport interface TagsProps {\n /** 标签列表 */\n tags?: string[];\n /** 最多展示的标签数量;未传或无效时展示全部 */\n showLength?: number;\n /** 无标签时的占位,传 null 则不渲染 */\n empty?: React.ReactNode;\n className?: string;\n /** 标签颜色,默认 INFO */\n color?: SemanticColor | string;\n}\n\nconst renderTags = (\n tagList: string[],\n options: {\n otherCount?: number;\n nowrap?: boolean;\n className?: string;\n color: SemanticColor | string;\n },\n) => {\n const { otherCount = 0, nowrap = false, className, color } = options;\n const layoutClass = nowrap\n ? classNames('tags-tag-list-nowrap', styles['tags-tag-list-nowrap'])\n : undefined;\n\n return (\n <div className={classNames('tags-tag-list', styles['tags-tag-list'], layoutClass, className)}>\n {tagList.map((tag) => (\n <SemanticTag key={tag} color={color}>\n {tag}\n </SemanticTag>\n ))}\n {otherCount > 0 && <SemanticTag color={color}>+{otherCount}</SemanticTag>}\n </div>\n );\n};\n\n/** 通用标签列表(SemanticTag + showLength 截断;长文案 ellipsis + hover 全量) */\nconst Tags: React.FC<TagsProps> = ({\n tags,\n showLength,\n empty = '-',\n className,\n color = SEMANTIC_COLORS.INFO,\n}) => {\n if (!tags?.length) {\n return empty != null ? <>{empty}</> : null;\n }\n\n const limit = showLength != null && showLength > 0 ? showLength : null;\n if (limit == null) {\n return renderTags(tags, { className, color });\n }\n\n const visibleTags = tags.slice(0, limit);\n const otherCount = Math.max(0, tags.length - limit);\n const hasLongTag = tags.some((t) => t.length > LONG_TAG_CHARS);\n const needsCompact = otherCount > 0 || hasLongTag;\n const visible = renderTags(visibleTags, {\n otherCount,\n nowrap: needsCompact,\n className,\n color,\n });\n\n if (!needsCompact) {\n return visible;\n }\n\n return (\n <Tooltip\n title={renderTags(tags, {\n className: classNames('tags-tag-list-tooltip', styles['tags-tag-list-tooltip']),\n color,\n })}\n >\n {visible}\n </Tooltip>\n );\n};\n\nexport default Tags;\n"],"names":["LONG_TAG_CHARS","renderTags","tagList","options","otherCount","nowrap","className","color","layoutClass","classNames","styles","jsxs","tag","jsx","SemanticTag","Tags","tags","showLength","empty","SEMANTIC_COLORS","Fragment","limit","visibleTags","hasLongTag","t","needsCompact","visible","Tooltip"],"mappings":";;;;;AAOA,MAAMA,IAAiB,GAcjBC,IAAa,CACjBC,GACAC,MAMG;AACH,QAAM,EAAE,YAAAC,IAAa,GAAG,QAAAC,IAAS,IAAO,WAAAC,GAAW,OAAAC,MAAUJ,GACvDK,IAAcH,IAChBI,EAAW,wBAAwBC,EAAO,sBAAsB,CAAC,IACjE;AAEJ,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAWF,EAAW,iBAAiBC,EAAO,eAAe,GAAGF,GAAaF,CAAS,GACxF,UAAA;AAAA,IAAAJ,EAAQ,IAAI,CAACU,MACZ,gBAAAC,EAACC,KAAsB,OAAAP,GACpB,UAAAK,EAAA,GADeA,CAElB,CACD;AAAA,IACAR,IAAa,KAAK,gBAAAO,EAACG,GAAA,EAAY,OAAAP,GAAc,UAAA;AAAA,MAAA;AAAA,MAAEH;AAAA,IAAA,EAAA,CAAW;AAAA,EAAA,GAC7D;AAEJ,GAGMW,IAA4B,CAAC;AAAA,EACjC,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAZ;AAAA,EACA,OAAAC,IAAQY,EAAgB;AAC1B,MAAM;AACJ,MAAI,EAACH,KAAA,QAAAA,EAAM;AACT,WAAOE,KAAS,OAAO,gBAAAL,EAAAO,GAAA,EAAG,UAAAF,EAAA,CAAM,IAAM;AAGxC,QAAMG,IAAQJ,KAAc,QAAQA,IAAa,IAAIA,IAAa;AAClE,MAAII,KAAS;AACX,WAAOpB,EAAWe,GAAM,EAAE,WAAAV,GAAW,OAAAC,GAAO;AAG9C,QAAMe,IAAcN,EAAK,MAAM,GAAGK,CAAK,GACjCjB,IAAa,KAAK,IAAI,GAAGY,EAAK,SAASK,CAAK,GAC5CE,IAAaP,EAAK,KAAK,CAACQ,MAAMA,EAAE,SAASxB,CAAc,GACvDyB,IAAerB,IAAa,KAAKmB,GACjCG,IAAUzB,EAAWqB,GAAa;AAAA,IACtC,YAAAlB;AAAA,IACA,QAAQqB;AAAA,IACR,WAAAnB;AAAA,IACA,OAAAC;AAAA,EAAA,CACD;AAED,SAAKkB,IAKH,gBAAAZ;AAAA,IAACc;AAAA,IAAA;AAAA,MACC,OAAO1B,EAAWe,GAAM;AAAA,QACtB,WAAWP,EAAW,yBAAyBC,EAAO,uBAAuB,CAAC;AAAA,QAC9E,OAAAH;AAAA,MAAA,CACD;AAAA,MAEA,UAAAmB;AAAA,IAAA;AAAA,EAAA,IAVIA;AAaX;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const t = {
|
|
2
|
-
"tags-tag-list": "_tags-tag-
|
|
3
|
-
"tags-tag-list-nowrap": "_tags-tag-list-
|
|
4
|
-
"tags-tag-list-tooltip": "_tags-tag-list-
|
|
2
|
+
"tags-tag-list": "_tags-tag-list_y1jed_1",
|
|
3
|
+
"tags-tag-list-nowrap": "_tags-tag-list-nowrap_y1jed_9",
|
|
4
|
+
"tags-tag-list-tooltip": "_tags-tag-list-tooltip_y1jed_20"
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
7
|
t as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o, Fragment as m } from "react/jsx-runtime";
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { Tooltip as d } from "antd";
|
|
3
|
+
import s from "../Descriptions/CommonDescriptions.js";
|
|
4
|
+
const c = ({
|
|
5
5
|
content: t,
|
|
6
6
|
children: r,
|
|
7
7
|
column: i = 1,
|
|
@@ -12,30 +12,36 @@ const b = ({
|
|
|
12
12
|
mouseEnterDelay: l = 0.3,
|
|
13
13
|
...f
|
|
14
14
|
}) => a || t.length === 0 ? /* @__PURE__ */ o(m, { children: r }) : /* @__PURE__ */ o(
|
|
15
|
-
|
|
15
|
+
d,
|
|
16
16
|
{
|
|
17
17
|
placement: e,
|
|
18
18
|
mouseEnterDelay: l,
|
|
19
19
|
destroyOnHidden: !0,
|
|
20
20
|
classNames: { root: ["tooltip-info-overlay", n].filter(Boolean).join(" ") },
|
|
21
21
|
styles: {
|
|
22
|
+
root: {
|
|
23
|
+
maxWidth: 320
|
|
24
|
+
},
|
|
22
25
|
container: {
|
|
26
|
+
boxSizing: "border-box",
|
|
23
27
|
minWidth: 220,
|
|
24
|
-
|
|
28
|
+
width: "100%",
|
|
25
29
|
padding: "8px 12px",
|
|
26
30
|
background: "var(--tooltip-info-bg, var(--bg-color-white, #ffffff))",
|
|
27
31
|
color: "var(--tooltip-info-color, var(--font-color, #222222))",
|
|
28
32
|
boxShadow: "0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12)",
|
|
29
|
-
...p
|
|
33
|
+
...p,
|
|
34
|
+
// 硬上限:避免 Descriptions 长文把气泡横向撑爆
|
|
35
|
+
maxWidth: 320
|
|
30
36
|
}
|
|
31
37
|
},
|
|
32
38
|
getPopupContainer: () => document.body,
|
|
33
|
-
title: /* @__PURE__ */ o(
|
|
39
|
+
title: /* @__PURE__ */ o(s, { content: t, column: i, size: "small" }),
|
|
34
40
|
...f,
|
|
35
41
|
children: r
|
|
36
42
|
}
|
|
37
43
|
);
|
|
38
44
|
export {
|
|
39
|
-
|
|
45
|
+
c as default
|
|
40
46
|
};
|
|
41
47
|
//# sourceMappingURL=TooltipInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipInfo.js","sources":["../../../src/components/TooltipInfo/TooltipInfo.tsx"],"sourcesContent":["import type { TooltipProps } from 'antd';\nimport { Tooltip } from 'antd';\nimport React from 'react';\nimport type { DescriptionItem } from '../Descriptions/CommonDescriptions';\nimport CommonDescriptions from '../Descriptions/CommonDescriptions';\nimport './style.module.scss';\n\nexport interface TooltipInfoProps extends Pick<\n TooltipProps,\n 'placement' | 'mouseEnterDelay' | 'mouseLeaveDelay'\n> {\n /** 详情描述项,内部使用 CommonDescriptions 渲染 */\n content: DescriptionItem[];\n children: React.ReactNode;\n /** CommonDescriptions 列数,默认 1 */\n column?: number;\n /** 为 true 或 content 为空时不展示 Tooltip */\n hidden?: boolean;\n /** @deprecated 使用 classNames.root */\n overlayClassName?: string;\n /** @deprecated 使用 styles.root */\n overlayStyle?: React.CSSProperties;\n}\n\n/** Tooltip 详情展示,内部统一使用 CommonDescriptions */\nconst TooltipInfo: React.FC<TooltipInfoProps> = ({\n content,\n children,\n column = 1,\n hidden = false,\n placement = 'top',\n overlayClassName,\n overlayStyle,\n mouseEnterDelay = 0.3,\n ...rest\n}) => {\n if (hidden || content.length === 0) {\n return <>{children}</>;\n }\n\n return (\n <Tooltip\n placement={placement}\n mouseEnterDelay={mouseEnterDelay}\n destroyOnHidden\n classNames={{ root: ['tooltip-info-overlay', overlayClassName].filter(Boolean).join(' ') }}\n styles={{\n container: {\n minWidth: 220,\n
|
|
1
|
+
{"version":3,"file":"TooltipInfo.js","sources":["../../../src/components/TooltipInfo/TooltipInfo.tsx"],"sourcesContent":["import type { TooltipProps } from 'antd';\nimport { Tooltip } from 'antd';\nimport React from 'react';\nimport type { DescriptionItem } from '../Descriptions/CommonDescriptions';\nimport CommonDescriptions from '../Descriptions/CommonDescriptions';\nimport './style.module.scss';\n\nexport interface TooltipInfoProps extends Pick<\n TooltipProps,\n 'placement' | 'mouseEnterDelay' | 'mouseLeaveDelay'\n> {\n /** 详情描述项,内部使用 CommonDescriptions 渲染 */\n content: DescriptionItem[];\n children: React.ReactNode;\n /** CommonDescriptions 列数,默认 1 */\n column?: number;\n /** 为 true 或 content 为空时不展示 Tooltip */\n hidden?: boolean;\n /** @deprecated 使用 classNames.root */\n overlayClassName?: string;\n /** @deprecated 使用 styles.root */\n overlayStyle?: React.CSSProperties;\n}\n\n/** Tooltip 详情展示,内部统一使用 CommonDescriptions */\nconst TooltipInfo: React.FC<TooltipInfoProps> = ({\n content,\n children,\n column = 1,\n hidden = false,\n placement = 'top',\n overlayClassName,\n overlayStyle,\n mouseEnterDelay = 0.3,\n ...rest\n}) => {\n if (hidden || content.length === 0) {\n return <>{children}</>;\n }\n\n return (\n <Tooltip\n placement={placement}\n mouseEnterDelay={mouseEnterDelay}\n destroyOnHidden\n classNames={{ root: ['tooltip-info-overlay', overlayClassName].filter(Boolean).join(' ') }}\n styles={{\n root: {\n maxWidth: 320,\n },\n container: {\n boxSizing: 'border-box',\n minWidth: 220,\n width: '100%',\n padding: '8px 12px',\n background: 'var(--tooltip-info-bg, var(--bg-color-white, #ffffff))',\n color: 'var(--tooltip-info-color, var(--font-color, #222222))',\n boxShadow: '0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12)',\n ...overlayStyle,\n // 硬上限:避免 Descriptions 长文把气泡横向撑爆\n maxWidth: 320,\n },\n }}\n getPopupContainer={() => document.body}\n title={<CommonDescriptions content={content} column={column} size=\"small\" />}\n {...rest}\n >\n {children}\n </Tooltip>\n );\n};\n\nexport default TooltipInfo;\n"],"names":["TooltipInfo","content","children","column","hidden","placement","overlayClassName","overlayStyle","mouseEnterDelay","rest","jsx","Tooltip","CommonDescriptions"],"mappings":";;;AAyBA,MAAMA,IAA0C,CAAC;AAAA,EAC/C,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,GAAGC;AACL,MACML,KAAUH,EAAQ,WAAW,2BACrB,UAAAC,GAAS,IAInB,gBAAAQ;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAAN;AAAA,IACA,iBAAAG;AAAA,IACA,iBAAe;AAAA,IACf,YAAY,EAAE,MAAM,CAAC,wBAAwBF,CAAgB,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAAA;AAAA,IACvF,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,UAAU;AAAA,MAAA;AAAA,MAEZ,WAAW;AAAA,QACT,WAAW;AAAA,QACX,UAAU;AAAA,QACV,OAAO;AAAA,QACP,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,WAAW;AAAA,QACX,GAAGC;AAAA;AAAA,QAEH,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IAEF,mBAAmB,MAAM,SAAS;AAAA,IAClC,OAAO,gBAAAG,EAACE,GAAA,EAAmB,SAAAX,GAAkB,QAAAE,GAAgB,MAAK,SAAQ;AAAA,IACzE,GAAGM;AAAA,IAEH,UAAAP;AAAA,EAAA;AAAA;"}
|
|
@@ -2,6 +2,8 @@ import { UploadFile } from 'antd/es/upload/interface';
|
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
/** 上传变体 */
|
|
4
4
|
export type UploadVariant = 'panel' | 'button';
|
|
5
|
+
/** 已选文件列表样式:text=行列表;picture-card=图片卡片(含预览) */
|
|
6
|
+
export type UploadListType = 'text' | 'picture-card';
|
|
5
7
|
export interface CommonUploadProps {
|
|
6
8
|
value?: UploadFile[];
|
|
7
9
|
onChange?: (value: UploadFile[]) => void;
|
|
@@ -17,6 +19,8 @@ export interface CommonUploadProps {
|
|
|
17
19
|
accept?: string;
|
|
18
20
|
/** panel = 拖拽面板(Dragger 样式),button = 按钮(默认) */
|
|
19
21
|
variant?: UploadVariant;
|
|
22
|
+
/** 列表展现;图片场景用 picture-card(预览+缩略图) */
|
|
23
|
+
listType?: UploadListType;
|
|
20
24
|
children?: React.ReactNode;
|
|
21
25
|
renderTips?: () => React.ReactNode;
|
|
22
26
|
/** 是否展示已上传文件列表,默认 true(tips 下方) */
|
|
@@ -38,29 +42,8 @@ export type CommonUploadRef = {
|
|
|
38
42
|
/**
|
|
39
43
|
* CommonUpload — 通用上传组件
|
|
40
44
|
*
|
|
41
|
-
* -
|
|
42
|
-
* -
|
|
43
|
-
*
|
|
44
|
-
* ## 两种变体
|
|
45
|
-
*
|
|
46
|
-
* - **`variant="button"`(默认)** — 虚线边框按钮 + 底部提示文案 + 已传文件列表
|
|
47
|
-
* - **`variant="panel"`** — Dragger 拖拽面板 + 底部已传文件列表
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```tsx
|
|
51
|
-
* // 在 Form.Item 中使用
|
|
52
|
-
* <Form.Item name="files" label="简历附件" rules={[{ required: true, message: '请上传文件' }]}>
|
|
53
|
-
* <CommonUpload accept=".pdf,.jpg,.png" maxLength={10} />
|
|
54
|
-
* </Form.Item>
|
|
55
|
-
*
|
|
56
|
-
* // 独立使用(Modal 内、非表单场景)
|
|
57
|
-
* <CommonUpload variant="panel" accept=".doc,.pdf" onSave={(list) => setFiles(list)} />
|
|
58
|
-
*
|
|
59
|
-
* // ref 手动触发上传
|
|
60
|
-
* const ref = useRef<CommonUploadRef>(null);
|
|
61
|
-
* <CommonUpload ref={ref} onUpload={...} />;
|
|
62
|
-
* ref.current?.upload();
|
|
63
|
-
* ```
|
|
45
|
+
* - `listType="text"`(默认):行列表;图片有缩略图时可「预览」
|
|
46
|
+
* - `listType="picture-card"`:antd 图片卡片(内置预览/删除图标)
|
|
64
47
|
*/
|
|
65
48
|
declare const CommonUpload: React.ForwardRefExoticComponent<CommonUploadProps & React.RefAttributes<CommonUploadRef>>;
|
|
66
49
|
export default CommonUpload;
|