@hkyhy/marsun-components-core 0.1.24 → 0.1.26
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/components/Auth/UserProfileCard/UserProfileCard.d.ts +23 -0
- package/dist/components/Auth/UserProfileCard/UserProfileCard.js +57 -0
- package/dist/components/Auth/UserProfileCard/UserProfileCard.js.map +1 -0
- package/dist/components/Auth/UserProfileCard/index.d.ts +2 -0
- package/dist/components/Auth/UserProfileCard/style.module.scss.js +14 -0
- package/dist/components/Auth/UserProfileCard/style.module.scss.js.map +1 -0
- package/dist/components/Auth/index.d.ts +2 -0
- package/dist/components/Filter/FilterSelect/index.d.ts +4 -2
- package/dist/components/Filter/FilterSelect/index.js +253 -157
- package/dist/components/Filter/FilterSelect/index.js.map +1 -1
- package/dist/components/Filter/FilterSelect/style.module.scss.js +14 -12
- package/dist/components/Filter/FilterSelect/style.module.scss.js.map +1 -1
- package/dist/components/Table/Table.d.ts +8 -0
- package/dist/components/Table/Table.js +39 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/style.module.scss.js +7 -0
- package/dist/components/Table/style.module.scss.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +410 -405
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/utils/authRedirect.d.ts +17 -4
- package/dist/utils/authRedirect.js +39 -20
- package/dist/utils/authRedirect.js.map +1 -1
- package/dist/utils/createMarsunRequest.d.ts +2 -0
- package/dist/utils/createMarsunRequest.js +20 -18
- package/dist/utils/createMarsunRequest.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MenuProps } from 'antd';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export type UserProfileCardProps = {
|
|
4
|
+
/** 主文案(姓名 / 展示名) */
|
|
5
|
+
name: string;
|
|
6
|
+
/** 副文案(邮箱 / 工号等) */
|
|
7
|
+
sub?: string;
|
|
8
|
+
/** 头像文字,默认 name 首字 */
|
|
9
|
+
avatarText?: string;
|
|
10
|
+
/** 侧栏折叠时仅显示头像 */
|
|
11
|
+
collapsed?: boolean;
|
|
12
|
+
/** 自定义下拉菜单;不传则在提供 onLogout 时生成「退出登录」 */
|
|
13
|
+
menuItems?: MenuProps['items'];
|
|
14
|
+
/** 点击默认「退出登录」时回调 */
|
|
15
|
+
onLogout?: () => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 侧栏底部用户卡片:整卡点击向上展开菜单(默认退出登录)。
|
|
20
|
+
* 纯 UI;是否挂载由业务根据登录态决定。
|
|
21
|
+
*/
|
|
22
|
+
declare const UserProfileCard: React.FC<UserProfileCardProps>;
|
|
23
|
+
export default UserProfileCard;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { LogOut as u } from "../../Icons/index.js";
|
|
3
|
+
import { Avatar as h, Dropdown as N } from "antd";
|
|
4
|
+
import p from "classnames";
|
|
5
|
+
import { useMemo as v } from "react";
|
|
6
|
+
import r from "./style.module.scss.js";
|
|
7
|
+
const C = ({
|
|
8
|
+
name: l,
|
|
9
|
+
sub: t,
|
|
10
|
+
avatarText: f,
|
|
11
|
+
collapsed: i = !1,
|
|
12
|
+
menuItems: a,
|
|
13
|
+
onLogout: s,
|
|
14
|
+
className: m
|
|
15
|
+
}) => {
|
|
16
|
+
const d = (f || l).trim().charAt(0).toUpperCase() || "U", o = v(() => a || (s ? [
|
|
17
|
+
{
|
|
18
|
+
key: "logout",
|
|
19
|
+
danger: !0,
|
|
20
|
+
label: "退出登录",
|
|
21
|
+
icon: /* @__PURE__ */ e(u, { size: 14 }),
|
|
22
|
+
onClick: s
|
|
23
|
+
}
|
|
24
|
+
] : []), [a, s]), c = /* @__PURE__ */ n(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
className: p(
|
|
29
|
+
r["user-profile-card"],
|
|
30
|
+
i && r["user-profile-card--collapsed"],
|
|
31
|
+
m
|
|
32
|
+
),
|
|
33
|
+
"aria-label": "用户菜单",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ e(h, { className: r["user-profile-avatar"], size: i ? 32 : 40, children: d }),
|
|
36
|
+
i ? null : /* @__PURE__ */ n("div", { className: r["user-profile-meta"], children: [
|
|
37
|
+
/* @__PURE__ */ e("div", { className: r["user-profile-name"], title: l, children: l }),
|
|
38
|
+
t ? /* @__PURE__ */ e("div", { className: r["user-profile-sub"], title: t, children: t }) : null
|
|
39
|
+
] })
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ e(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: p(
|
|
47
|
+
r["user-profile-wrap"],
|
|
48
|
+
i && r["user-profile-wrap--collapsed"]
|
|
49
|
+
),
|
|
50
|
+
children: o && o.length > 0 ? /* @__PURE__ */ e(N, { menu: { items: o }, trigger: ["click"], placement: "topLeft", children: c }) : c
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
C as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=UserProfileCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfileCard.js","sources":["../../../../src/components/Auth/UserProfileCard/UserProfileCard.tsx"],"sourcesContent":["import { LogOut } from '../../Icons';\nimport { Avatar, Dropdown } from 'antd';\nimport type { MenuProps } from 'antd';\nimport classNames from 'classnames';\nimport React, { useMemo } from 'react';\nimport styles from './style.module.scss';\n\nexport type UserProfileCardProps = {\n /** 主文案(姓名 / 展示名) */\n name: string;\n /** 副文案(邮箱 / 工号等) */\n sub?: string;\n /** 头像文字,默认 name 首字 */\n avatarText?: string;\n /** 侧栏折叠时仅显示头像 */\n collapsed?: boolean;\n /** 自定义下拉菜单;不传则在提供 onLogout 时生成「退出登录」 */\n menuItems?: MenuProps['items'];\n /** 点击默认「退出登录」时回调 */\n onLogout?: () => void;\n className?: string;\n};\n\n/**\n * 侧栏底部用户卡片:整卡点击向上展开菜单(默认退出登录)。\n * 纯 UI;是否挂载由业务根据登录态决定。\n */\nconst UserProfileCard: React.FC<UserProfileCardProps> = ({\n name,\n sub,\n avatarText,\n collapsed = false,\n menuItems,\n onLogout,\n className,\n}) => {\n const initial = (avatarText || name).trim().charAt(0).toUpperCase() || 'U';\n\n const items = useMemo<MenuProps['items']>(() => {\n if (menuItems) return menuItems;\n if (!onLogout) return [];\n return [\n {\n key: 'logout',\n danger: true,\n label: '退出登录',\n icon: <LogOut size={14} />,\n onClick: onLogout,\n },\n ];\n }, [menuItems, onLogout]);\n\n const card = (\n <button\n type=\"button\"\n className={classNames(\n styles['user-profile-card'],\n collapsed && styles['user-profile-card--collapsed'],\n className,\n )}\n aria-label=\"用户菜单\"\n >\n <Avatar className={styles['user-profile-avatar']} size={collapsed ? 32 : 40}>\n {initial}\n </Avatar>\n {!collapsed ? (\n <div className={styles['user-profile-meta']}>\n <div className={styles['user-profile-name']} title={name}>\n {name}\n </div>\n {sub ? (\n <div className={styles['user-profile-sub']} title={sub}>\n {sub}\n </div>\n ) : null}\n </div>\n ) : null}\n </button>\n );\n\n return (\n <div\n className={classNames(\n styles['user-profile-wrap'],\n collapsed && styles['user-profile-wrap--collapsed'],\n )}\n >\n {items && items.length > 0 ? (\n <Dropdown menu={{ items }} trigger={['click']} placement=\"topLeft\">\n {card}\n </Dropdown>\n ) : (\n card\n )}\n </div>\n );\n};\n\nexport default UserProfileCard;\n"],"names":["UserProfileCard","name","sub","avatarText","collapsed","menuItems","onLogout","className","initial","items","useMemo","jsx","LogOut","card","jsxs","classNames","styles","Avatar","Dropdown"],"mappings":";;;;;;AA2BA,MAAMA,IAAkD,CAAC;AAAA,EACvD,MAAAC;AAAA,EACA,KAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AACF,MAAM;AACJ,QAAMC,KAAWL,KAAcF,GAAM,OAAO,OAAO,CAAC,EAAE,YAAA,KAAiB,KAEjEQ,IAAQC,EAA4B,MACpCL,MACCC,IACE;AAAA,IACL;AAAA,MACE,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM,gBAAAK,EAACC,GAAA,EAAO,MAAM,GAAA,CAAI;AAAA,MACxB,SAASN;AAAA,IAAA;AAAA,EACX,IARoB,CAAA,IAUrB,CAACD,GAAWC,CAAQ,CAAC,GAElBO,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAWC;AAAA,QACTC,EAAO,mBAAmB;AAAA,QAC1BZ,KAAaY,EAAO,8BAA8B;AAAA,QAClDT;AAAA,MAAA;AAAA,MAEF,cAAW;AAAA,MAEX,UAAA;AAAA,QAAA,gBAAAI,EAACM,GAAA,EAAO,WAAWD,EAAO,qBAAqB,GAAG,MAAMZ,IAAY,KAAK,IACtE,UAAAI,EAAA,CACH;AAAA,QACEJ,IAWE,OAVF,gBAAAU,EAAC,SAAI,WAAWE,EAAO,mBAAmB,GACxC,UAAA;AAAA,UAAA,gBAAAL,EAAC,SAAI,WAAWK,EAAO,mBAAmB,GAAG,OAAOf,GACjD,UAAAA,GACH;AAAA,UACCC,IACC,gBAAAS,EAAC,OAAA,EAAI,WAAWK,EAAO,kBAAkB,GAAG,OAAOd,GAChD,UAAAA,EAAA,CACH,IACE;AAAA,QAAA,EAAA,CACN;AAAA,MACE;AAAA,IAAA;AAAA,EAAA;AAIR,SACE,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWI;AAAA,QACTC,EAAO,mBAAmB;AAAA,QAC1BZ,KAAaY,EAAO,8BAA8B;AAAA,MAAA;AAAA,MAGnD,eAASP,EAAM,SAAS,IACvB,gBAAAE,EAACO,KAAS,MAAM,EAAE,OAAAT,EAAA,GAAS,SAAS,CAAC,OAAO,GAAG,WAAU,WACtD,aACH,IAEAI;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const r = {
|
|
2
|
+
"user-profile-wrap": "_user-profile-wrap_1rbrn_1",
|
|
3
|
+
"user-profile-wrap--collapsed": "_user-profile-wrap--collapsed_1rbrn_6",
|
|
4
|
+
"user-profile-card": "_user-profile-card_1rbrn_12",
|
|
5
|
+
"user-profile-card--collapsed": "_user-profile-card--collapsed_1rbrn_30",
|
|
6
|
+
"user-profile-avatar": "_user-profile-avatar_1rbrn_36",
|
|
7
|
+
"user-profile-meta": "_user-profile-meta_1rbrn_43",
|
|
8
|
+
"user-profile-name": "_user-profile-name_1rbrn_48",
|
|
9
|
+
"user-profile-sub": "_user-profile-sub_1rbrn_58"
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
r as default
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=style.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as PermissionGuard } from './PermissionGuard';
|
|
2
2
|
export { default as ProtectedRoute } from './ProtectedRoute';
|
|
3
3
|
export { hasPermission } from './hasPermission';
|
|
4
|
+
export { UserProfileCard } from './UserProfileCard';
|
|
5
|
+
export type { UserProfileCardProps } from './UserProfileCard';
|
|
@@ -6,10 +6,12 @@ interface FilterSelectProps extends BaseFilterProps {
|
|
|
6
6
|
options: FilterOption[];
|
|
7
7
|
value?: FilterSelectValue;
|
|
8
8
|
onChange?: (value: FilterSelectValue) => void;
|
|
9
|
-
/**
|
|
9
|
+
/** 默认值:与默认值相同时视为未筛选(除非 showDefaultAsSelected) */
|
|
10
10
|
defaultValue?: string | number;
|
|
11
|
-
/**
|
|
11
|
+
/** 多选默认值:与默认集合相同时视为未筛选(除非 showDefaultAsSelected) */
|
|
12
12
|
defaultValues?: (string | number)[];
|
|
13
|
+
/** 为 true 时,value 等于默认仍展示在「您已选择」并保持选中态 */
|
|
14
|
+
showDefaultAsSelected?: boolean;
|
|
13
15
|
placeholder?: string;
|
|
14
16
|
searchable?: boolean;
|
|
15
17
|
/** 是否多选 */
|
|
@@ -1,207 +1,303 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Check as
|
|
3
|
-
import { Input as
|
|
4
|
-
import { useState as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { resolveFilterVisible as
|
|
8
|
-
import { useFilterRegister as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const { Search:
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return r.departmentName &&
|
|
1
|
+
import { jsxs as b, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Check as oe, X as le } from "../../Icons/index.js";
|
|
3
|
+
import { Input as ae, Checkbox as Q, Space as fe } from "antd";
|
|
4
|
+
import { useState as E, useRef as ge, useMemo as U, useEffect as W } from "react";
|
|
5
|
+
import de from "../../Form/PersonOptionRow/index.js";
|
|
6
|
+
import he from "../FilterPopover/index.js";
|
|
7
|
+
import { resolveFilterVisible as Y } from "../types.js";
|
|
8
|
+
import { useFilterRegister as me } from "../useFilterState.js";
|
|
9
|
+
import g from "./style.module.scss.js";
|
|
10
|
+
import v from "classnames";
|
|
11
|
+
const { Search: ve } = ae;
|
|
12
|
+
function Se(r) {
|
|
13
|
+
const s = [r.label];
|
|
14
|
+
return r.departmentName && s.push(r.departmentName), s.join(" · ");
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
return [r.label, r.departmentName, r.email, r.phone, r.employeeId].filter(Boolean).some((
|
|
16
|
+
function Ae(r, s) {
|
|
17
|
+
const i = s.toLowerCase();
|
|
18
|
+
return [r.label, r.departmentName, r.email, r.phone, r.employeeId].filter(Boolean).some((o) => String(o).toLowerCase().includes(i));
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
if (!(r != null && r.length) && !(
|
|
22
|
-
if (!r || !
|
|
23
|
-
const
|
|
24
|
-
return
|
|
20
|
+
function Z(r, s) {
|
|
21
|
+
if (!(r != null && r.length) && !(s != null && s.length)) return !0;
|
|
22
|
+
if (!r || !s || r.length !== s.length) return !1;
|
|
23
|
+
const i = [...r].map(String).sort(), o = [...s].map(String).sort();
|
|
24
|
+
return i.every((l, a) => l === o[a]);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
function _(r) {
|
|
27
|
+
return Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
|
|
28
|
+
}
|
|
29
|
+
function q(r, s, i, o, l) {
|
|
30
|
+
if (o) {
|
|
31
|
+
const a = _(r);
|
|
32
|
+
return !l && (i != null && i.length) && Z(a, i) ? [] : a;
|
|
30
33
|
}
|
|
31
|
-
if (!(
|
|
34
|
+
if (!(!l && s !== void 0 && r === s))
|
|
32
35
|
return r;
|
|
33
36
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
37
|
+
function I(r, s, i, o) {
|
|
38
|
+
return o ? _(r) : q(r, s, i, !1, !0);
|
|
39
|
+
}
|
|
40
|
+
function xe(r, s, i, o, l) {
|
|
41
|
+
if (i) {
|
|
36
42
|
const d = r || [];
|
|
37
|
-
return d.length
|
|
38
|
-
var
|
|
39
|
-
return ((
|
|
43
|
+
return d.length ? l != null && l.length && Z(d, l) ? "全部" : d.map((N) => {
|
|
44
|
+
var w;
|
|
45
|
+
return ((w = s.find((n) => String(n.value) === String(N))) == null ? void 0 : w.label) ?? String(N);
|
|
40
46
|
}).join("、") : "";
|
|
41
47
|
}
|
|
42
48
|
if (r == null) return "";
|
|
43
|
-
const
|
|
44
|
-
return
|
|
49
|
+
const a = s.find((d) => String(d.value) === String(r));
|
|
50
|
+
return a ? o ? Se(a) : a.label : String(r);
|
|
45
51
|
}
|
|
46
|
-
const
|
|
52
|
+
const Re = ({
|
|
47
53
|
filterKey: r,
|
|
48
|
-
label:
|
|
49
|
-
options:
|
|
50
|
-
value:
|
|
51
|
-
onChange:
|
|
52
|
-
defaultValue:
|
|
53
|
-
defaultValues:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
label: s,
|
|
55
|
+
options: i = [],
|
|
56
|
+
value: o,
|
|
57
|
+
onChange: l,
|
|
58
|
+
defaultValue: a,
|
|
59
|
+
defaultValues: d,
|
|
60
|
+
showDefaultAsSelected: N = !1,
|
|
61
|
+
searchable: w = !1,
|
|
62
|
+
multiple: n = !1,
|
|
63
|
+
minSelection: h,
|
|
64
|
+
variant: K = "default",
|
|
65
|
+
active: V,
|
|
66
|
+
hidden: u,
|
|
67
|
+
display: T
|
|
61
68
|
}) => {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
const p = K === "person", [ee, F] = E(!1), [O, j] = E(""), f = q(
|
|
70
|
+
o,
|
|
71
|
+
a,
|
|
72
|
+
d,
|
|
73
|
+
n,
|
|
74
|
+
N
|
|
75
|
+
), [S, y] = E(
|
|
76
|
+
() => I(o, a, d, n) ?? (n ? [] : void 0)
|
|
77
|
+
), P = me(), R = ge(l);
|
|
78
|
+
R.current = l;
|
|
79
|
+
const X = U(() => {
|
|
80
|
+
const e = Array.isArray(f) ? f : f != null && f !== "" ? [f] : [], t = !n || h == null || e.length > h;
|
|
68
81
|
return () => {
|
|
69
|
-
var
|
|
70
|
-
|
|
82
|
+
var c;
|
|
83
|
+
t && ((c = R.current) == null || c.call(R, void 0));
|
|
71
84
|
};
|
|
72
|
-
}, [
|
|
73
|
-
|
|
85
|
+
}, [f, h, n]), $ = () => {
|
|
86
|
+
y(
|
|
87
|
+
I(o, a, d, n) ?? (n ? [] : void 0)
|
|
88
|
+
), j("");
|
|
74
89
|
};
|
|
75
|
-
|
|
76
|
-
const e = I(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
W(() => {
|
|
91
|
+
const e = I(o, a, d, n);
|
|
92
|
+
y(e ?? (n ? [] : void 0));
|
|
93
|
+
const t = q(
|
|
94
|
+
o,
|
|
95
|
+
a,
|
|
96
|
+
d,
|
|
97
|
+
n,
|
|
98
|
+
N
|
|
99
|
+
);
|
|
100
|
+
(t == null || Array.isArray(t) && t.length === 0) && j("");
|
|
101
|
+
}, [o, a, d, n, N]);
|
|
102
|
+
const D = U(
|
|
103
|
+
() => xe(f, i, n, p, d),
|
|
104
|
+
[i, f, n, p, d]
|
|
82
105
|
);
|
|
83
|
-
if (
|
|
84
|
-
if (!
|
|
85
|
-
if (!
|
|
86
|
-
|
|
106
|
+
if (W(() => {
|
|
107
|
+
if (!P) return;
|
|
108
|
+
if (!Y({ display: T, hidden: u }, { filterKey: r, label: s, value: o })) {
|
|
109
|
+
P.unregister(r);
|
|
87
110
|
return;
|
|
88
111
|
}
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
label:
|
|
93
|
-
valueLabel:
|
|
94
|
-
onRemove:
|
|
95
|
-
removable:
|
|
112
|
+
if (D) {
|
|
113
|
+
const t = Array.isArray(f) ? f : f != null && f !== "" ? [f] : [], c = !n || h == null || t.length > h;
|
|
114
|
+
P.register(r, {
|
|
115
|
+
label: s,
|
|
116
|
+
valueLabel: D,
|
|
117
|
+
onRemove: X,
|
|
118
|
+
removable: c
|
|
96
119
|
});
|
|
97
120
|
} else
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
const
|
|
101
|
-
(e) =>
|
|
102
|
-
) :
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
!e &&
|
|
108
|
-
},
|
|
109
|
-
if (!
|
|
110
|
-
const
|
|
111
|
-
let
|
|
112
|
-
|
|
121
|
+
P.unregister(r);
|
|
122
|
+
}, [D, r, s, u, T, X]), !Y({ display: T, hidden: u }, { filterKey: r, label: s, value: o })) return null;
|
|
123
|
+
const A = O ? i.filter(
|
|
124
|
+
(e) => p ? Ae(e, O) : e.label.toLowerCase().includes(O.toLowerCase())
|
|
125
|
+
) : i, re = () => {
|
|
126
|
+
l == null || l(S), F(!1);
|
|
127
|
+
}, te = () => {
|
|
128
|
+
$(), F(!1);
|
|
129
|
+
}, ne = (e) => {
|
|
130
|
+
!e && n && $(), F(e);
|
|
131
|
+
}, se = (e) => {
|
|
132
|
+
if (!n) {
|
|
133
|
+
const t = a !== void 0 && e === a;
|
|
134
|
+
let c;
|
|
135
|
+
S === e || t ? c = void 0 : c = e, y(c), l == null || l(c), F(!1);
|
|
113
136
|
}
|
|
114
|
-
},
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
137
|
+
}, M = (e) => {
|
|
138
|
+
const t = S || [], c = t.some((x) => String(x) === String(e));
|
|
139
|
+
if (c && h != null && t.length <= h)
|
|
140
|
+
return;
|
|
141
|
+
const L = c ? t.filter((x) => String(x) !== String(e)) : [...t, e];
|
|
142
|
+
y(L);
|
|
143
|
+
}, k = Array.isArray(S) ? S : [], G = A.filter(
|
|
144
|
+
(e) => k.some((t) => String(t) === String(e.value))
|
|
145
|
+
).length, z = A.length > 0 && G === A.length, ce = G > 0 && !z, H = (e) => {
|
|
146
|
+
const t = k, c = A.map((C) => C.value);
|
|
147
|
+
if (e) {
|
|
148
|
+
const C = new Set(t.map(String)), J = [...t];
|
|
149
|
+
for (const B of c)
|
|
150
|
+
C.has(String(B)) || (J.push(B), C.add(String(B)));
|
|
151
|
+
y(J);
|
|
117
152
|
return;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
153
|
+
}
|
|
154
|
+
const L = new Set(c.map(String));
|
|
155
|
+
let x = t.filter((C) => !L.has(String(C)));
|
|
156
|
+
h != null && x.length < h && (x = t.slice(0, h)), y(x);
|
|
157
|
+
}, ie = n ? Array.isArray(f) && f.length > 0 : f != null && f !== "";
|
|
158
|
+
return /* @__PURE__ */ b(
|
|
159
|
+
he,
|
|
123
160
|
{
|
|
124
|
-
label:
|
|
125
|
-
active:
|
|
126
|
-
open:
|
|
127
|
-
onOpenChange:
|
|
128
|
-
onConfirm:
|
|
129
|
-
onReset:
|
|
161
|
+
label: s,
|
|
162
|
+
active: V || ie,
|
|
163
|
+
open: ee,
|
|
164
|
+
onOpenChange: ne,
|
|
165
|
+
onConfirm: n ? re : void 0,
|
|
166
|
+
onReset: n ? te : void 0,
|
|
130
167
|
children: [
|
|
131
|
-
|
|
132
|
-
|
|
168
|
+
w && /* @__PURE__ */ m(
|
|
169
|
+
ve,
|
|
133
170
|
{
|
|
134
|
-
placeholder: `搜索${
|
|
171
|
+
placeholder: `搜索${s}`,
|
|
135
172
|
allowClear: !0,
|
|
136
173
|
size: "middle",
|
|
137
|
-
className:
|
|
138
|
-
value:
|
|
139
|
-
onChange: (e) =>
|
|
174
|
+
className: v("filter-select-search", g["filter-select-search"]),
|
|
175
|
+
value: O,
|
|
176
|
+
onChange: (e) => j(e.target.value)
|
|
140
177
|
}
|
|
141
178
|
),
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
|
|
179
|
+
/* @__PURE__ */ b("div", { className: v("filter-select-options", g["filter-select-options"]), children: [
|
|
180
|
+
n && A.length > 0 && /* @__PURE__ */ b(
|
|
144
181
|
"div",
|
|
145
182
|
{
|
|
146
|
-
className:
|
|
183
|
+
className: v(
|
|
147
184
|
"filter-select-option",
|
|
148
|
-
|
|
149
|
-
|
|
185
|
+
g["filter-select-option"],
|
|
186
|
+
"filter-select-select-all",
|
|
187
|
+
g["filter-select-select-all"]
|
|
150
188
|
),
|
|
151
|
-
onClick: () =>
|
|
189
|
+
onClick: () => H(!z),
|
|
152
190
|
children: [
|
|
153
|
-
|
|
154
|
-
|
|
191
|
+
/* @__PURE__ */ m(
|
|
192
|
+
Q,
|
|
155
193
|
{
|
|
156
|
-
checked:
|
|
157
|
-
|
|
158
|
-
|
|
194
|
+
checked: z,
|
|
195
|
+
indeterminate: ce,
|
|
196
|
+
onChange: (e) => H(e.target.checked),
|
|
197
|
+
onClick: (e) => e.stopPropagation()
|
|
159
198
|
}
|
|
160
199
|
),
|
|
161
|
-
|
|
162
|
-
|
|
200
|
+
/* @__PURE__ */ m("span", { children: "全选" })
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
A.map((e) => /* @__PURE__ */ b(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
className: v(
|
|
208
|
+
"filter-select-option",
|
|
209
|
+
g["filter-select-option"],
|
|
210
|
+
!n && S === e.value && v(
|
|
211
|
+
"filter-select-option-selected",
|
|
212
|
+
g["filter-select-option-selected"]
|
|
213
|
+
)
|
|
214
|
+
),
|
|
215
|
+
onClick: () => n ? M(e.value) : se(e.value),
|
|
216
|
+
children: [
|
|
217
|
+
n && /* @__PURE__ */ m(
|
|
218
|
+
Q,
|
|
219
|
+
{
|
|
220
|
+
checked: k.some((t) => String(t) === String(e.value)),
|
|
221
|
+
onChange: () => M(e.value),
|
|
222
|
+
onClick: (t) => t.stopPropagation()
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
p ? /* @__PURE__ */ m(de, { option: e }) : /* @__PURE__ */ m("span", { children: e.label }),
|
|
226
|
+
!n && !p && S === e.value && /* @__PURE__ */ m(
|
|
227
|
+
oe,
|
|
228
|
+
{
|
|
229
|
+
className: v(
|
|
230
|
+
"filter-select-option-check",
|
|
231
|
+
g["filter-select-option-check"]
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
)
|
|
163
235
|
]
|
|
164
236
|
},
|
|
165
237
|
String(e.value)
|
|
166
238
|
)),
|
|
167
|
-
|
|
239
|
+
A.length === 0 && /* @__PURE__ */ m("div", { className: v("filter-select-empty", g["filter-select-empty"]), children: "暂无数据" })
|
|
168
240
|
] }),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
241
|
+
n && k.length > 0 && /* @__PURE__ */ b(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
className: v("filter-select-selected-bar", g["filter-select-selected-bar"]),
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ m(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
className: v(
|
|
250
|
+
"filter-select-selected-label",
|
|
251
|
+
g["filter-select-selected-label"]
|
|
252
|
+
),
|
|
253
|
+
children: "已选:"
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ m(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: v(
|
|
260
|
+
"filter-select-selected-tags",
|
|
261
|
+
g["filter-select-selected-tags"]
|
|
262
|
+
),
|
|
263
|
+
children: /* @__PURE__ */ m(fe, { size: [4, 4], wrap: !0, children: k.map((e) => {
|
|
264
|
+
const t = i.find((L) => String(L.value) === String(e)), c = h == null || k.length > h;
|
|
265
|
+
return /* @__PURE__ */ b(
|
|
266
|
+
"span",
|
|
267
|
+
{
|
|
268
|
+
className: v(
|
|
269
|
+
"filter-select-selected-tag",
|
|
270
|
+
g["filter-select-selected-tag"],
|
|
271
|
+
!c && g["filter-select-selected-tag-disabled"]
|
|
272
|
+
),
|
|
273
|
+
onClick: () => c && M(e),
|
|
274
|
+
children: [
|
|
275
|
+
(t == null ? void 0 : t.label) ?? String(e),
|
|
276
|
+
/* @__PURE__ */ m(
|
|
277
|
+
le,
|
|
278
|
+
{
|
|
279
|
+
className: v(
|
|
280
|
+
"filter-select-selected-remove",
|
|
281
|
+
g["filter-select-selected-remove"],
|
|
282
|
+
!c && g["filter-select-selected-remove-disabled"]
|
|
283
|
+
)
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
String(e)
|
|
289
|
+
);
|
|
290
|
+
}) })
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
)
|
|
200
296
|
]
|
|
201
297
|
}
|
|
202
298
|
);
|
|
203
299
|
};
|
|
204
300
|
export {
|
|
205
|
-
|
|
301
|
+
Re as default
|
|
206
302
|
};
|
|
207
303
|
//# sourceMappingURL=index.js.map
|