@hkyhy/marsun-components-core 0.1.46 → 0.1.47
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/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/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/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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +132 -131
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export type { PersonOptionRowProps } from './PersonOptionRow';
|
|
|
9
9
|
export { default as FormDataSync } from './FormDataSync';
|
|
10
10
|
export type { FormDataSyncProps } from './FormDataSync';
|
|
11
11
|
/** @kne/form-info — 业务从包根导入,勿直连 @kne/form-info */
|
|
12
|
-
export { FormInfo, Form, FormModal, FormSteps, FormStepsModal, List, TableList, MultiField, Input, TextArea, Select, InputNumber, Switch, RadioGroup, SubmitButton, ResetButton, CancelButton, } from './kneFormInfo';
|
|
12
|
+
export { FormInfo, Form, FormModal, FormSteps, FormStepsModal, List, TableList, MultiField, Input, TextArea, Select, InputNumber, Switch, RadioGroup, TreeSelect, SubmitButton, ResetButton, CancelButton, } from './kneFormInfo';
|
|
13
13
|
export type { FormInfoProps, FormProps, FormModalProps, FormStepsProps, FormStepsModalProps, ListProps, TableListProps, MultiFieldProps, } from './kneFormInfo';
|
|
14
14
|
/** @kne/react-form — 引擎 API;默认组件为 ReactForm(勿与 FormInfo 的 Form 混淆) */
|
|
15
15
|
export { ReactForm, GroupList, useField, useFormApi, useFormContext, useGroup, useSubmit, useReset, RULES, preset, interceptors, compileErrMsg, computedFieldValueFromFormData, computedFormDataFormState, filterEmpty, findField, formUtils, isEmpty, isNotEmpty, matchFields, stateToError, stateToIsPass, } from './kneReactForm';
|
|
@@ -43,6 +43,8 @@ export declare const Select: ComponentType<FieldProps>;
|
|
|
43
43
|
export declare const InputNumber: ComponentType<FieldProps>;
|
|
44
44
|
export declare const Switch: ComponentType<FieldProps>;
|
|
45
45
|
export declare const RadioGroup: ComponentType<FieldProps>;
|
|
46
|
+
/** 与 Input/Select 同源再导出,避免业务直连 @kne/react-form-antd 导致双 Context */
|
|
47
|
+
export declare const TreeSelect: ComponentType<FieldProps>;
|
|
46
48
|
export declare const SubmitButton: ComponentType<ButtonProps>;
|
|
47
49
|
export declare const ResetButton: ComponentType<ButtonProps>;
|
|
48
50
|
export declare const CancelButton: ComponentType<ButtonProps>;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import t, { Form as o, FormModal as s, FormSteps as e, FormStepsModal as n, List as a, MultiField as r, TableList as
|
|
3
|
-
import { CancelButton as
|
|
4
|
-
const I = t, L = o, R = s,
|
|
2
|
+
import t, { Form as o, FormModal as s, FormSteps as e, FormStepsModal as n, List as a, MultiField as r, TableList as c } from "@kne/form-info";
|
|
3
|
+
import { CancelButton as u, Input as m, InputNumber as i, RadioGroup as l, ResetButton as p, Select as S, SubmitButton as F, Switch as $, TextArea as d, TreeSelect as B } from "@kne/react-form-antd";
|
|
4
|
+
const I = t, L = o, R = s, f = e, x = n, h = a, w = c, A = r, C = m, G = d, N = S, g = i, j = $, k = l, q = B, v = F, y = p, z = u;
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
z as CancelButton,
|
|
7
7
|
L as Form,
|
|
8
8
|
I as FormInfo,
|
|
9
9
|
R as FormModal,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
f as FormSteps,
|
|
11
|
+
x as FormStepsModal,
|
|
12
|
+
C as Input,
|
|
13
|
+
g as InputNumber,
|
|
14
|
+
h as List,
|
|
15
|
+
A as MultiField,
|
|
16
|
+
k as RadioGroup,
|
|
17
|
+
y as ResetButton,
|
|
18
|
+
N as Select,
|
|
19
|
+
v as SubmitButton,
|
|
20
|
+
j as Switch,
|
|
21
|
+
w as TableList,
|
|
22
|
+
G as TextArea,
|
|
23
|
+
q as TreeSelect
|
|
23
24
|
};
|
|
24
25
|
//# sourceMappingURL=kneFormInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kneFormInfo.js","sources":["../../../src/components/Form/kneFormInfo.ts"],"sourcesContent":["/**\n * 经 core 再导出 @kne/form-info(业务唯一入口)。\n * 布局组件来自 @kne/form-info;字段组件须从 @kne/react-form-antd 具名导入\n * (form-info 的 `export *` 在 Vite 下经 namespace 读取时常为 undefined)。\n */\nimport '@kne/form-info/dist/index.css';\nimport FormInfoBase, {\n Form as KneForm,\n FormModal as KneFormModal,\n FormSteps as KneFormSteps,\n FormStepsModal as KneFormStepsModal,\n List as KneList,\n MultiField as KneMultiField,\n TableList as KneTableList,\n type FormModalProps,\n type FormProps,\n type FormStepsModalProps,\n type FormStepsProps,\n type ListProps,\n type MultiFieldProps,\n type TableListProps,\n type FormInfoProps,\n} from '@kne/form-info';\nimport {\n CancelButton as KneCancelButton,\n Input as KneInput,\n InputNumber as KneInputNumber,\n RadioGroup as KneRadioGroup,\n ResetButton as KneResetButton,\n Select as KneSelect,\n SubmitButton as KneSubmitButton,\n Switch as KneSwitch,\n TextArea as KneTextArea,\n} from '@kne/react-form-antd';\nimport type { ComponentType, FC, ReactNode } from 'react';\n\ntype FieldProps = {\n name: string;\n label?: ReactNode;\n rule?: string;\n placeholder?: string;\n disabled?: boolean;\n block?: boolean;\n rows?: number;\n options?: unknown[];\n [key: string]: unknown;\n};\n\ntype ButtonProps = {\n children?: ReactNode;\n type?: string;\n loading?: boolean;\n [key: string]: unknown;\n};\n\ntype ItemTitleCtx = { index: number; data?: Record<string, unknown> };\n\nexport type {\n FormInfoProps,\n FormProps,\n FormModalProps,\n FormStepsProps,\n FormStepsModalProps,\n ListProps,\n TableListProps,\n MultiFieldProps,\n};\n\nexport const FormInfo = FormInfoBase;\nexport const Form = KneForm;\nexport const FormModal = KneFormModal as FC<FormModalProps & { children?: ReactNode }>;\nexport const FormSteps = KneFormSteps as FC<FormStepsProps>;\nexport const FormStepsModal = KneFormStepsModal as FC<FormStepsModalProps>;\n\nexport const List = KneList as FC<\n Omit<ListProps, 'itemTitle'> & {\n maxLength?: number;\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const TableList = KneTableList as FC<\n Omit<TableListProps, 'itemTitle'> & {\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const MultiField = KneMultiField as FC<MultiFieldProps>;\n\nexport const Input = KneInput as ComponentType<FieldProps>;\nexport const TextArea = KneTextArea as ComponentType<FieldProps>;\nexport const Select = KneSelect as ComponentType<FieldProps>;\nexport const InputNumber = KneInputNumber as ComponentType<FieldProps>;\nexport const Switch = KneSwitch as ComponentType<FieldProps>;\nexport const RadioGroup = KneRadioGroup as ComponentType<FieldProps>;\nexport const SubmitButton = KneSubmitButton as ComponentType<ButtonProps>;\nexport const ResetButton = KneResetButton as ComponentType<ButtonProps>;\nexport const CancelButton = KneCancelButton as ComponentType<ButtonProps>;\n"],"names":["FormInfo","FormInfoBase","Form","KneForm","FormModal","KneFormModal","FormSteps","KneFormSteps","FormStepsModal","KneFormStepsModal","List","KneList","TableList","KneTableList","MultiField","KneMultiField","Input","KneInput","TextArea","KneTextArea","Select","KneSelect","InputNumber","KneInputNumber","Switch","KneSwitch","RadioGroup","KneRadioGroup","SubmitButton","KneSubmitButton","ResetButton","KneResetButton","CancelButton","KneCancelButton"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"kneFormInfo.js","sources":["../../../src/components/Form/kneFormInfo.ts"],"sourcesContent":["/**\n * 经 core 再导出 @kne/form-info(业务唯一入口)。\n * 布局组件来自 @kne/form-info;字段组件须从 @kne/react-form-antd 具名导入\n * (form-info 的 `export *` 在 Vite 下经 namespace 读取时常为 undefined)。\n */\nimport '@kne/form-info/dist/index.css';\nimport FormInfoBase, {\n Form as KneForm,\n FormModal as KneFormModal,\n FormSteps as KneFormSteps,\n FormStepsModal as KneFormStepsModal,\n List as KneList,\n MultiField as KneMultiField,\n TableList as KneTableList,\n type FormModalProps,\n type FormProps,\n type FormStepsModalProps,\n type FormStepsProps,\n type ListProps,\n type MultiFieldProps,\n type TableListProps,\n type FormInfoProps,\n} from '@kne/form-info';\nimport {\n CancelButton as KneCancelButton,\n Input as KneInput,\n InputNumber as KneInputNumber,\n RadioGroup as KneRadioGroup,\n ResetButton as KneResetButton,\n Select as KneSelect,\n SubmitButton as KneSubmitButton,\n Switch as KneSwitch,\n TextArea as KneTextArea,\n TreeSelect as KneTreeSelect,\n} from '@kne/react-form-antd';\nimport type { ComponentType, FC, ReactNode } from 'react';\n\ntype FieldProps = {\n name: string;\n label?: ReactNode;\n rule?: string;\n placeholder?: string;\n disabled?: boolean;\n block?: boolean;\n rows?: number;\n options?: unknown[];\n [key: string]: unknown;\n};\n\ntype ButtonProps = {\n children?: ReactNode;\n type?: string;\n loading?: boolean;\n [key: string]: unknown;\n};\n\ntype ItemTitleCtx = { index: number; data?: Record<string, unknown> };\n\nexport type {\n FormInfoProps,\n FormProps,\n FormModalProps,\n FormStepsProps,\n FormStepsModalProps,\n ListProps,\n TableListProps,\n MultiFieldProps,\n};\n\nexport const FormInfo = FormInfoBase;\nexport const Form = KneForm;\nexport const FormModal = KneFormModal as FC<FormModalProps & { children?: ReactNode }>;\nexport const FormSteps = KneFormSteps as FC<FormStepsProps>;\nexport const FormStepsModal = KneFormStepsModal as FC<FormStepsModalProps>;\n\nexport const List = KneList as FC<\n Omit<ListProps, 'itemTitle'> & {\n maxLength?: number;\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const TableList = KneTableList as FC<\n Omit<TableListProps, 'itemTitle'> & {\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const MultiField = KneMultiField as FC<MultiFieldProps>;\n\nexport const Input = KneInput as ComponentType<FieldProps>;\nexport const TextArea = KneTextArea as ComponentType<FieldProps>;\nexport const Select = KneSelect as ComponentType<FieldProps>;\nexport const InputNumber = KneInputNumber as ComponentType<FieldProps>;\nexport const Switch = KneSwitch as ComponentType<FieldProps>;\nexport const RadioGroup = KneRadioGroup as ComponentType<FieldProps>;\n/** 与 Input/Select 同源再导出,避免业务直连 @kne/react-form-antd 导致双 Context */\nexport const TreeSelect = KneTreeSelect as ComponentType<FieldProps>;\nexport const SubmitButton = KneSubmitButton as ComponentType<ButtonProps>;\nexport const ResetButton = KneResetButton as ComponentType<ButtonProps>;\nexport const CancelButton = KneCancelButton as ComponentType<ButtonProps>;\n"],"names":["FormInfo","FormInfoBase","Form","KneForm","FormModal","KneFormModal","FormSteps","KneFormSteps","FormStepsModal","KneFormStepsModal","List","KneList","TableList","KneTableList","MultiField","KneMultiField","Input","KneInput","TextArea","KneTextArea","Select","KneSelect","InputNumber","KneInputNumber","Switch","KneSwitch","RadioGroup","KneRadioGroup","TreeSelect","KneTreeSelect","SubmitButton","KneSubmitButton","ResetButton","KneResetButton","CancelButton","KneCancelButton"],"mappings":";;;AAqEO,MAAMA,IAAWC,GACXC,IAAOC,GACPC,IAAYC,GACZC,IAAYC,GACZC,IAAiBC,GAEjBC,IAAOC,GAMPC,IAAYC,GAKZC,IAAaC,GAEbC,IAAQC,GACRC,IAAWC,GACXC,IAASC,GACTC,IAAcC,GACdC,IAASC,GACTC,IAAaC,GAEbC,IAAaC,GACbC,IAAeC,GACfC,IAAcC,GACdC,IAAeC;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Plus as
|
|
3
|
-
import { Spin as
|
|
1
|
+
import { jsx as a, jsxs as u, Fragment as K } from "react/jsx-runtime";
|
|
2
|
+
import { Plus as S, Pencil as w, Trash2 as j } from "../Icons/index.js";
|
|
3
|
+
import { Spin as v, Tree as B, Tooltip as F, Space as L, Button as p, Popconfirm as M } from "antd";
|
|
4
4
|
import o from "classnames";
|
|
5
5
|
import { useMemo as O, useState as q, useEffect as A } from "react";
|
|
6
6
|
import c from "./style.module.scss.js";
|
|
7
|
-
function T(
|
|
7
|
+
function T(t) {
|
|
8
8
|
var l;
|
|
9
9
|
const i = [];
|
|
10
|
-
for (const n of
|
|
10
|
+
for (const n of t)
|
|
11
11
|
i.push(n.id), (l = n.children) != null && l.length && i.push(...T(n.children));
|
|
12
12
|
return i;
|
|
13
13
|
}
|
|
14
|
-
function k(
|
|
14
|
+
function k(t, i) {
|
|
15
15
|
var l;
|
|
16
|
-
for (const n of
|
|
16
|
+
for (const n of t) {
|
|
17
17
|
if (n.id === i)
|
|
18
18
|
return { id: n.id, name: n.name, parentId: n.parentId ?? null };
|
|
19
19
|
if ((l = n.children) != null && l.length) {
|
|
@@ -23,21 +23,21 @@ function k(a, i) {
|
|
|
23
23
|
}
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
nodes:
|
|
26
|
+
const U = ({
|
|
27
|
+
nodes: t,
|
|
28
28
|
loading: i = !1,
|
|
29
29
|
editable: l = !1,
|
|
30
30
|
className: n,
|
|
31
31
|
selectedKeys: m,
|
|
32
32
|
onSelect: f,
|
|
33
|
-
onAdd:
|
|
34
|
-
onEdit:
|
|
35
|
-
onDelete:
|
|
36
|
-
deleteConfirmTitle:
|
|
33
|
+
onAdd: g,
|
|
34
|
+
onEdit: h,
|
|
35
|
+
onDelete: d,
|
|
36
|
+
deleteConfirmTitle: E = "确认删除该节点?",
|
|
37
37
|
deleteOkText: x = "删除",
|
|
38
|
-
deleteOkType:
|
|
38
|
+
deleteOkType: b = "danger"
|
|
39
39
|
}) => {
|
|
40
|
-
const y = O(() => T(
|
|
40
|
+
const y = O(() => T(t), [t]), [C, N] = q([]);
|
|
41
41
|
A(() => {
|
|
42
42
|
N(y);
|
|
43
43
|
}, [y]);
|
|
@@ -46,43 +46,52 @@ const R = ({
|
|
|
46
46
|
return {
|
|
47
47
|
key: r.id,
|
|
48
48
|
title: /* @__PURE__ */ u("div", { className: o("marsun-org-tree-row", c["marsun-org-tree-row"]), children: [
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
/* @__PURE__ */ a(
|
|
50
|
+
F,
|
|
51
|
+
{
|
|
52
|
+
title: r.nameExtra ? /* @__PURE__ */ u(K, { children: [
|
|
53
|
+
r.name,
|
|
54
|
+
r.nameExtra
|
|
55
|
+
] }) : r.name,
|
|
56
|
+
children: /* @__PURE__ */ u("span", { className: o("marsun-org-tree-name", c["marsun-org-tree-name"]), children: [
|
|
57
|
+
r.name,
|
|
58
|
+
r.nameExtra ? /* @__PURE__ */ a(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
className: o("marsun-org-tree-extra", c["marsun-org-tree-extra"]),
|
|
62
|
+
children: r.nameExtra
|
|
63
|
+
}
|
|
64
|
+
) : null
|
|
65
|
+
] })
|
|
66
|
+
}
|
|
67
|
+
),
|
|
59
68
|
l ? /* @__PURE__ */ u(
|
|
60
69
|
L,
|
|
61
70
|
{
|
|
62
71
|
size: 0,
|
|
63
72
|
className: o("marsun-org-tree-actions", c["marsun-org-tree-actions"]),
|
|
64
73
|
children: [
|
|
65
|
-
|
|
74
|
+
g ? /* @__PURE__ */ a(
|
|
66
75
|
p,
|
|
67
76
|
{
|
|
68
77
|
type: "text",
|
|
69
78
|
size: "small",
|
|
70
79
|
"aria-label": "添加子节点",
|
|
71
|
-
icon: /* @__PURE__ */
|
|
80
|
+
icon: /* @__PURE__ */ a(S, { size: 14 }),
|
|
72
81
|
onClick: (e) => {
|
|
73
|
-
e.stopPropagation(),
|
|
82
|
+
e.stopPropagation(), g(r.id);
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
85
|
) : null,
|
|
77
|
-
|
|
86
|
+
h ? /* @__PURE__ */ a(
|
|
78
87
|
p,
|
|
79
88
|
{
|
|
80
89
|
type: "text",
|
|
81
90
|
size: "small",
|
|
82
91
|
"aria-label": "编辑",
|
|
83
|
-
icon: /* @__PURE__ */
|
|
92
|
+
icon: /* @__PURE__ */ a(w, { size: 14 }),
|
|
84
93
|
onClick: (e) => {
|
|
85
|
-
e.stopPropagation(),
|
|
94
|
+
e.stopPropagation(), h({
|
|
86
95
|
id: r.id,
|
|
87
96
|
name: r.name,
|
|
88
97
|
parentId: r.parentId ?? null
|
|
@@ -90,23 +99,23 @@ const R = ({
|
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
) : null,
|
|
93
|
-
|
|
102
|
+
d ? /* @__PURE__ */ a(
|
|
94
103
|
M,
|
|
95
104
|
{
|
|
96
|
-
title:
|
|
105
|
+
title: E,
|
|
97
106
|
okText: x,
|
|
98
|
-
okType:
|
|
107
|
+
okType: b,
|
|
99
108
|
cancelText: "取消",
|
|
100
|
-
onConfirm: (e) => (e == null || e.stopPropagation(),
|
|
109
|
+
onConfirm: (e) => (e == null || e.stopPropagation(), d({ id: r.id, name: r.name })),
|
|
101
110
|
onCancel: (e) => e == null ? void 0 : e.stopPropagation(),
|
|
102
|
-
children: /* @__PURE__ */
|
|
111
|
+
children: /* @__PURE__ */ a(
|
|
103
112
|
p,
|
|
104
113
|
{
|
|
105
114
|
type: "text",
|
|
106
115
|
size: "small",
|
|
107
116
|
danger: !0,
|
|
108
117
|
"aria-label": x,
|
|
109
|
-
icon: /* @__PURE__ */
|
|
118
|
+
icon: /* @__PURE__ */ a(j, { size: 14 }),
|
|
110
119
|
onClick: (e) => e.stopPropagation()
|
|
111
120
|
}
|
|
112
121
|
)
|
|
@@ -118,19 +127,19 @@ const R = ({
|
|
|
118
127
|
] }),
|
|
119
128
|
children: (z = r.children) != null && z.length ? P(r.children) : void 0
|
|
120
129
|
};
|
|
121
|
-
}), I = P(
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
|
|
130
|
+
}), I = P(t);
|
|
131
|
+
return /* @__PURE__ */ a(v, { spinning: i, children: /* @__PURE__ */ a(
|
|
132
|
+
B,
|
|
124
133
|
{
|
|
125
134
|
className: o("marsun-org-tree", c["marsun-org-tree"], n),
|
|
126
135
|
treeData: I,
|
|
127
|
-
expandedKeys:
|
|
136
|
+
expandedKeys: C,
|
|
128
137
|
onExpand: (s) => N(s),
|
|
129
138
|
selectedKeys: m,
|
|
130
139
|
onSelect: (s) => {
|
|
131
140
|
if (!f) return;
|
|
132
141
|
const r = s[0] != null ? String(s[0]) : "";
|
|
133
|
-
f(r ? k(
|
|
142
|
+
f(r ? k(t, r) : null);
|
|
134
143
|
},
|
|
135
144
|
showLine: !0,
|
|
136
145
|
blockNode: !0
|
|
@@ -138,6 +147,6 @@ const R = ({
|
|
|
138
147
|
) });
|
|
139
148
|
};
|
|
140
149
|
export {
|
|
141
|
-
|
|
150
|
+
U as default
|
|
142
151
|
};
|
|
143
152
|
//# sourceMappingURL=OrgTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrgTree.js","sources":["../../../src/components/OrgTree/OrgTree.tsx"],"sourcesContent":["import { Pencil, Plus, Trash2 } from '../Icons';\nimport { Button, Popconfirm, Space, Spin, Tooltip, Tree } from 'antd';\nimport type { DataNode } from 'antd/es/tree';\nimport classNames from 'classnames';\nimport React, { useEffect, useMemo, useState, type Key, type ReactNode } from 'react';\nimport styles from './style.module.scss';\n\nexport type OrgTreeNode = {\n id: string;\n name: string;\n parentId?: string | null;\n children?: OrgTreeNode[];\n /** 名称旁附加文案(如 mapped) */\n nameExtra?: ReactNode;\n};\n\nexport type OrgTreeProps = {\n nodes: OrgTreeNode[];\n loading?: boolean;\n /** 展示节点内增删改操作 */\n editable?: boolean;\n className?: string;\n /** 受控选中(点选节点,如右侧岗位面板) */\n selectedKeys?: Key[];\n onSelect?: (node: { id: string; name: string; parentId: string | null } | null) => void;\n onAdd?: (parentId: string) => void;\n onEdit?: (node: { id: string; name: string; parentId: string | null }) => void;\n /** 确认删除后回调;由业务执行 API */\n onDelete?: (node: { id: string; name: string }) => void | Promise<void>;\n /** 删除确认文案 */\n deleteConfirmTitle?: string;\n /** 确认钮文案(软禁用场景可传「禁用」) */\n deleteOkText?: string;\n deleteOkType?: 'primary' | 'danger';\n};\n\nfunction collectAllKeys(nodes: OrgTreeNode[]): string[] {\n const keys: string[] = [];\n for (const n of nodes) {\n keys.push(n.id);\n if (n.children?.length) keys.push(...collectAllKeys(n.children));\n }\n return keys;\n}\n\nfunction findOrgNode(\n list: OrgTreeNode[],\n id: string,\n): { id: string; name: string; parentId: string | null } | null {\n for (const n of list) {\n if (n.id === id) {\n return { id: n.id, name: n.name, parentId: n.parentId ?? null };\n }\n if (n.children?.length) {\n const hit = findOrgNode(n.children, id);\n if (hit) return hit;\n }\n }\n return null;\n}\n\n/**\n * 组织树(对齐 Assets 组织架构行为):默认展开、节点 hover 增删改。\n * 纯 UI,无业务 API。\n */\nconst OrgTree: React.FC<OrgTreeProps> = ({\n nodes,\n loading = false,\n editable = false,\n className,\n selectedKeys,\n onSelect,\n onAdd,\n onEdit,\n onDelete,\n deleteConfirmTitle = '确认删除该节点?',\n deleteOkText = '删除',\n deleteOkType = 'danger',\n}) => {\n const allKeys = useMemo(() => collectAllKeys(nodes), [nodes]);\n const [expandedKeys, setExpandedKeys] = useState<Key[]>([]);\n\n useEffect(() => {\n setExpandedKeys(allKeys);\n }, [allKeys]);\n\n const buildTreeNodes = (list: OrgTreeNode[]): DataNode[] =>\n list.map((node) => ({\n key: node.id,\n title: (\n <div className={classNames('marsun-org-tree-row', styles['marsun-org-tree-row'])}>\n <Tooltip
|
|
1
|
+
{"version":3,"file":"OrgTree.js","sources":["../../../src/components/OrgTree/OrgTree.tsx"],"sourcesContent":["import { Pencil, Plus, Trash2 } from '../Icons';\nimport { Button, Popconfirm, Space, Spin, Tooltip, Tree } from 'antd';\nimport type { DataNode } from 'antd/es/tree';\nimport classNames from 'classnames';\nimport React, { useEffect, useMemo, useState, type Key, type ReactNode } from 'react';\nimport styles from './style.module.scss';\n\nexport type OrgTreeNode = {\n id: string;\n name: string;\n parentId?: string | null;\n children?: OrgTreeNode[];\n /** 名称旁附加文案(如 mapped) */\n nameExtra?: ReactNode;\n};\n\nexport type OrgTreeProps = {\n nodes: OrgTreeNode[];\n loading?: boolean;\n /** 展示节点内增删改操作 */\n editable?: boolean;\n className?: string;\n /** 受控选中(点选节点,如右侧岗位面板) */\n selectedKeys?: Key[];\n onSelect?: (node: { id: string; name: string; parentId: string | null } | null) => void;\n onAdd?: (parentId: string) => void;\n onEdit?: (node: { id: string; name: string; parentId: string | null }) => void;\n /** 确认删除后回调;由业务执行 API */\n onDelete?: (node: { id: string; name: string }) => void | Promise<void>;\n /** 删除确认文案 */\n deleteConfirmTitle?: string;\n /** 确认钮文案(软禁用场景可传「禁用」) */\n deleteOkText?: string;\n deleteOkType?: 'primary' | 'danger';\n};\n\nfunction collectAllKeys(nodes: OrgTreeNode[]): string[] {\n const keys: string[] = [];\n for (const n of nodes) {\n keys.push(n.id);\n if (n.children?.length) keys.push(...collectAllKeys(n.children));\n }\n return keys;\n}\n\nfunction findOrgNode(\n list: OrgTreeNode[],\n id: string,\n): { id: string; name: string; parentId: string | null } | null {\n for (const n of list) {\n if (n.id === id) {\n return { id: n.id, name: n.name, parentId: n.parentId ?? null };\n }\n if (n.children?.length) {\n const hit = findOrgNode(n.children, id);\n if (hit) return hit;\n }\n }\n return null;\n}\n\n/**\n * 组织树(对齐 Assets 组织架构行为):默认展开、节点 hover 增删改。\n * 纯 UI,无业务 API。\n */\nconst OrgTree: React.FC<OrgTreeProps> = ({\n nodes,\n loading = false,\n editable = false,\n className,\n selectedKeys,\n onSelect,\n onAdd,\n onEdit,\n onDelete,\n deleteConfirmTitle = '确认删除该节点?',\n deleteOkText = '删除',\n deleteOkType = 'danger',\n}) => {\n const allKeys = useMemo(() => collectAllKeys(nodes), [nodes]);\n const [expandedKeys, setExpandedKeys] = useState<Key[]>([]);\n\n useEffect(() => {\n setExpandedKeys(allKeys);\n }, [allKeys]);\n\n const buildTreeNodes = (list: OrgTreeNode[]): DataNode[] =>\n list.map((node) => ({\n key: node.id,\n title: (\n <div className={classNames('marsun-org-tree-row', styles['marsun-org-tree-row'])}>\n <Tooltip\n title={\n node.nameExtra ? (\n <>\n {node.name}\n {node.nameExtra}\n </>\n ) : (\n node.name\n )\n }\n >\n <span className={classNames('marsun-org-tree-name', styles['marsun-org-tree-name'])}>\n {node.name}\n {node.nameExtra ? (\n <span\n className={classNames('marsun-org-tree-extra', styles['marsun-org-tree-extra'])}\n >\n {node.nameExtra}\n </span>\n ) : null}\n </span>\n </Tooltip>\n {editable ? (\n <Space\n size={0}\n className={classNames('marsun-org-tree-actions', styles['marsun-org-tree-actions'])}\n >\n {onAdd ? (\n <Button\n type=\"text\"\n size=\"small\"\n aria-label=\"添加子节点\"\n icon={<Plus size={14} />}\n onClick={(e) => {\n e.stopPropagation();\n onAdd(node.id);\n }}\n />\n ) : null}\n {onEdit ? (\n <Button\n type=\"text\"\n size=\"small\"\n aria-label=\"编辑\"\n icon={<Pencil size={14} />}\n onClick={(e) => {\n e.stopPropagation();\n onEdit({\n id: node.id,\n name: node.name,\n parentId: node.parentId ?? null,\n });\n }}\n />\n ) : null}\n {onDelete ? (\n <Popconfirm\n title={deleteConfirmTitle}\n okText={deleteOkText}\n okType={deleteOkType}\n cancelText=\"取消\"\n onConfirm={(e) => {\n e?.stopPropagation();\n return onDelete({ id: node.id, name: node.name });\n }}\n onCancel={(e) => e?.stopPropagation()}\n >\n <Button\n type=\"text\"\n size=\"small\"\n danger\n aria-label={deleteOkText}\n icon={<Trash2 size={14} />}\n onClick={(e) => e.stopPropagation()}\n />\n </Popconfirm>\n ) : null}\n </Space>\n ) : null}\n </div>\n ),\n children: node.children?.length ? buildTreeNodes(node.children) : undefined,\n }));\n\n const treeData = buildTreeNodes(nodes);\n\n return (\n <Spin spinning={loading}>\n <Tree\n className={classNames('marsun-org-tree', styles['marsun-org-tree'], className)}\n treeData={treeData}\n expandedKeys={expandedKeys}\n onExpand={(keys) => setExpandedKeys(keys)}\n selectedKeys={selectedKeys}\n onSelect={(keys) => {\n if (!onSelect) return;\n const id = keys[0] != null ? String(keys[0]) : '';\n onSelect(id ? findOrgNode(nodes, id) : null);\n }}\n showLine\n blockNode\n />\n </Spin>\n );\n};\n\nexport default OrgTree;\n"],"names":["collectAllKeys","nodes","keys","_a","findOrgNode","list","id","hit","OrgTree","loading","editable","className","selectedKeys","onSelect","onAdd","onEdit","onDelete","deleteConfirmTitle","deleteOkText","deleteOkType","allKeys","useMemo","expandedKeys","setExpandedKeys","useState","useEffect","buildTreeNodes","node","classNames","styles","jsx","Tooltip","jsxs","Fragment","Space","Button","Plus","Pencil","Popconfirm","Trash2","treeData","Spin","Tree"],"mappings":";;;;;;AAoCA,SAASA,EAAeC,G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AW,EAASP,IAAKF,EAAYH,GAAOK,CAAE,IAAI,IAAI;AAAA,MAC7C;AAAA,MACA,UAAQ;AAAA,MACR,WAAS;AAAA,IAAA;AAAA,EAAA,GAEb;AAEJ;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const r = {
|
|
2
|
-
"marsun-org-tree": "_marsun-org-
|
|
3
|
-
"marsun-org-tree-row": "_marsun-org-tree-
|
|
4
|
-
"marsun-org-tree-actions": "_marsun-org-tree-
|
|
5
|
-
"marsun-org-tree-name": "_marsun-org-tree-
|
|
6
|
-
"marsun-org-tree-extra": "_marsun-org-tree-
|
|
2
|
+
"marsun-org-tree": "_marsun-org-tree_j34q1_2",
|
|
3
|
+
"marsun-org-tree-row": "_marsun-org-tree-row_j34q1_10",
|
|
4
|
+
"marsun-org-tree-actions": "_marsun-org-tree-actions_j34q1_18",
|
|
5
|
+
"marsun-org-tree-name": "_marsun-org-tree-name_j34q1_22",
|
|
6
|
+
"marsun-org-tree-extra": "_marsun-org-tree-extra_j34q1_33"
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
9
9
|
r as default
|
|
@@ -9,12 +9,15 @@ export type PermissionBindPanelProps = {
|
|
|
9
9
|
onChange: (nextIds: string[]) => void;
|
|
10
10
|
/** SYSTEM 入口码;未勾时禁用 requiresSystemEntry 模块 */
|
|
11
11
|
systemEntryCodes?: string[];
|
|
12
|
+
/** 只读预览(如用户有效权限):勾选态展示、禁止改、左右栏仍受 height 约束 */
|
|
13
|
+
readOnly?: boolean;
|
|
12
14
|
className?: string;
|
|
13
15
|
style?: CSSProperties;
|
|
16
|
+
/** 左右栏最大高度(默认 420) */
|
|
14
17
|
height?: number;
|
|
15
18
|
};
|
|
16
19
|
/**
|
|
17
20
|
* 角色绑权三栏信息架构:左页面模块 · 主区按业务功能点分类分组勾选。
|
|
18
21
|
* defaultGranted 叶子勾选且不可取消。
|
|
19
22
|
*/
|
|
20
|
-
export default function PermissionBindPanel({ catalog, permissions, value, onChange, systemEntryCodes, className, style, height, }: PermissionBindPanelProps): import("react").JSX.Element;
|
|
23
|
+
export default function PermissionBindPanel({ catalog, permissions, value, onChange, systemEntryCodes, readOnly, className, style, height, }: PermissionBindPanelProps): import("react").JSX.Element;
|