@ug666/admin-react 0.0.0-stage → 0.1.0-beta.0
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/index-3dcgfy6t.js +131 -0
- package/dist/index-4tstw263.js +43 -0
- package/dist/index-aqqcc4wq.js +34 -0
- package/dist/index-keve3ryw.js +39 -0
- package/dist/index-nyrhj7se.js +63 -0
- package/dist/index-zt432pkz.js +125 -0
- package/dist/index.js +28 -0
- package/dist/index.ts.js +1 -0
- package/dist/patterns/AdminConfirmAction.js +6 -0
- package/dist/patterns/AdminDetailPage.js +7 -0
- package/dist/patterns/AdminFormPage.js +7 -0
- package/dist/patterns/AdminListPage.js +7 -0
- package/dist/patterns/AdminPage.js +6 -0
- package/dist/patterns/AdminSearchForm.js +8 -0
- package/package.json +41 -4
- package/src/index.ts +8 -0
- package/src/patterns/AdminConfirmAction.tsx +44 -0
- package/src/patterns/AdminDetailPage.tsx +44 -0
- package/src/patterns/AdminFormPage.tsx +113 -0
- package/src/patterns/AdminListPage.tsx +51 -0
- package/src/patterns/AdminPage.tsx +51 -0
- package/src/patterns/AdminSearchForm.tsx +124 -0
- package/README.md +0 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// packages/admin-react/src/patterns/AdminSearchForm.tsx
|
|
2
|
+
import {
|
|
3
|
+
UGButton,
|
|
4
|
+
UGForm,
|
|
5
|
+
UGFormControl,
|
|
6
|
+
UGFormField,
|
|
7
|
+
UGFormItem,
|
|
8
|
+
UGFormLabel
|
|
9
|
+
} from "@ug666/ui-react";
|
|
10
|
+
import { ChevronDown, ChevronUp, RotateCcw, Search } from "lucide-react";
|
|
11
|
+
import {
|
|
12
|
+
useId,
|
|
13
|
+
useState
|
|
14
|
+
} from "react";
|
|
15
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
16
|
+
function AdminSearchField2({
|
|
17
|
+
name,
|
|
18
|
+
label,
|
|
19
|
+
labelFor,
|
|
20
|
+
className,
|
|
21
|
+
itemClassName,
|
|
22
|
+
itemStyle,
|
|
23
|
+
children
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */ jsxDEV(UGFormField, {
|
|
26
|
+
name,
|
|
27
|
+
className: className ? `admin-search-field ${className}` : "admin-search-field",
|
|
28
|
+
children: /* @__PURE__ */ jsxDEV(UGFormItem, {
|
|
29
|
+
className: itemClassName,
|
|
30
|
+
style: itemStyle,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsxDEV(UGFormLabel, {
|
|
33
|
+
htmlFor: labelFor,
|
|
34
|
+
children: label
|
|
35
|
+
}, undefined, false, undefined, this),
|
|
36
|
+
/* @__PURE__ */ jsxDEV(UGFormControl, {
|
|
37
|
+
children
|
|
38
|
+
}, undefined, false, undefined, this)
|
|
39
|
+
]
|
|
40
|
+
}, undefined, true, undefined, this)
|
|
41
|
+
}, undefined, false, undefined, this);
|
|
42
|
+
}
|
|
43
|
+
function AdminSearchForm2({
|
|
44
|
+
children,
|
|
45
|
+
expandedContent,
|
|
46
|
+
labelWidth = "max-content",
|
|
47
|
+
expandLabel = "展开",
|
|
48
|
+
collapseLabel = "收起",
|
|
49
|
+
loading = false,
|
|
50
|
+
onReset,
|
|
51
|
+
onSubmit
|
|
52
|
+
}) {
|
|
53
|
+
const [expanded, setExpanded] = useState(false);
|
|
54
|
+
const expandedId = useId();
|
|
55
|
+
function handleSubmit(event) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
onSubmit();
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ jsxDEV(UGForm, {
|
|
60
|
+
className: "admin-search-form",
|
|
61
|
+
layout: "horizontal",
|
|
62
|
+
labelPosition: "right",
|
|
63
|
+
labelWidth,
|
|
64
|
+
size: "default",
|
|
65
|
+
onSubmit: handleSubmit,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
68
|
+
className: "admin-search-form__fields",
|
|
69
|
+
children: [
|
|
70
|
+
children,
|
|
71
|
+
expandedContent ? /* @__PURE__ */ jsxDEV("div", {
|
|
72
|
+
id: expandedId,
|
|
73
|
+
className: "admin-search-form__expanded",
|
|
74
|
+
hidden: !expanded,
|
|
75
|
+
children: expandedContent
|
|
76
|
+
}, undefined, false, undefined, this) : null
|
|
77
|
+
]
|
|
78
|
+
}, undefined, true, undefined, this),
|
|
79
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
80
|
+
className: "admin-search-form__actions",
|
|
81
|
+
children: [
|
|
82
|
+
expandedContent ? /* @__PURE__ */ jsxDEV(UGButton, {
|
|
83
|
+
"aria-expanded": expanded,
|
|
84
|
+
"aria-controls": expandedId,
|
|
85
|
+
onClick: () => setExpanded((value) => !value),
|
|
86
|
+
tone: "neutral",
|
|
87
|
+
type: "button",
|
|
88
|
+
variant: "text",
|
|
89
|
+
children: [
|
|
90
|
+
expanded ? /* @__PURE__ */ jsxDEV(ChevronUp, {
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
size: 16
|
|
93
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV(ChevronDown, {
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
size: 16
|
|
96
|
+
}, undefined, false, undefined, this),
|
|
97
|
+
expanded ? collapseLabel : expandLabel
|
|
98
|
+
]
|
|
99
|
+
}, undefined, true, undefined, this) : null,
|
|
100
|
+
/* @__PURE__ */ jsxDEV(UGButton, {
|
|
101
|
+
loading,
|
|
102
|
+
tone: "primary",
|
|
103
|
+
type: "submit",
|
|
104
|
+
variant: "solid",
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsxDEV(Search, {
|
|
107
|
+
"aria-hidden": "true",
|
|
108
|
+
size: 16
|
|
109
|
+
}, undefined, false, undefined, this),
|
|
110
|
+
"查询"
|
|
111
|
+
]
|
|
112
|
+
}, undefined, true, undefined, this),
|
|
113
|
+
/* @__PURE__ */ jsxDEV(UGButton, {
|
|
114
|
+
onClick: onReset,
|
|
115
|
+
type: "button",
|
|
116
|
+
variant: "default",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsxDEV(RotateCcw, {
|
|
119
|
+
"aria-hidden": "true",
|
|
120
|
+
size: 16
|
|
121
|
+
}, undefined, false, undefined, this),
|
|
122
|
+
"重置"
|
|
123
|
+
]
|
|
124
|
+
}, undefined, true, undefined, this)
|
|
125
|
+
]
|
|
126
|
+
}, undefined, true, undefined, this)
|
|
127
|
+
]
|
|
128
|
+
}, undefined, true, undefined, this);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { AdminSearchField2, AdminSearchForm2 };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AdminPage2
|
|
3
|
+
} from "./index-keve3ryw.js";
|
|
4
|
+
|
|
5
|
+
// packages/admin-react/src/patterns/AdminDetailPage.tsx
|
|
6
|
+
import { UGCard, UGCardContent, UGCardHeader, UGCardTitle } from "@ug666/ui-react";
|
|
7
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
8
|
+
function AdminDetailPage2({ sections, ...pageProps }) {
|
|
9
|
+
return /* @__PURE__ */ jsxDEV(AdminPage2, {
|
|
10
|
+
...pageProps,
|
|
11
|
+
children: /* @__PURE__ */ jsxDEV("div", {
|
|
12
|
+
className: "admin-detail-sections",
|
|
13
|
+
children: sections.map((section) => /* @__PURE__ */ jsxDEV(UGCard, {
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsxDEV(UGCardHeader, {
|
|
16
|
+
children: /* @__PURE__ */ jsxDEV(UGCardTitle, {
|
|
17
|
+
children: section.title
|
|
18
|
+
}, undefined, false, undefined, this)
|
|
19
|
+
}, undefined, false, undefined, this),
|
|
20
|
+
/* @__PURE__ */ jsxDEV(UGCardContent, {
|
|
21
|
+
className: "admin-card-content",
|
|
22
|
+
children: /* @__PURE__ */ jsxDEV("dl", {
|
|
23
|
+
className: "admin-description-list",
|
|
24
|
+
children: section.items.map((item) => /* @__PURE__ */ jsxDEV("div", {
|
|
25
|
+
className: "admin-description-list__item",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxDEV("dt", {
|
|
28
|
+
children: item.label
|
|
29
|
+
}, undefined, false, undefined, this),
|
|
30
|
+
/* @__PURE__ */ jsxDEV("dd", {
|
|
31
|
+
children: item.value ?? "—"
|
|
32
|
+
}, undefined, false, undefined, this)
|
|
33
|
+
]
|
|
34
|
+
}, item.label, true, undefined, this))
|
|
35
|
+
}, undefined, false, undefined, this)
|
|
36
|
+
}, undefined, false, undefined, this)
|
|
37
|
+
]
|
|
38
|
+
}, section.id, true, undefined, this))
|
|
39
|
+
}, undefined, false, undefined, this)
|
|
40
|
+
}, undefined, false, undefined, this);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { AdminDetailPage2 };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// packages/admin-react/src/patterns/AdminConfirmAction.tsx
|
|
2
|
+
import { UGAlert, UGAlertDescription } from "@ug666/ui-react";
|
|
3
|
+
import { UGConfirmDialog } from "@ug666/ui-react/patterns";
|
|
4
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
5
|
+
function AdminConfirmAction2({
|
|
6
|
+
open,
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
confirmText,
|
|
10
|
+
loading = false,
|
|
11
|
+
error,
|
|
12
|
+
onOpenChange,
|
|
13
|
+
onConfirm
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsxDEV(UGConfirmDialog, {
|
|
16
|
+
closeOnConfirm: false,
|
|
17
|
+
confirmText,
|
|
18
|
+
description,
|
|
19
|
+
loading,
|
|
20
|
+
onConfirm,
|
|
21
|
+
onOpenChange,
|
|
22
|
+
open,
|
|
23
|
+
title,
|
|
24
|
+
variant: "destructive",
|
|
25
|
+
children: error ? /* @__PURE__ */ jsxDEV(UGAlert, {
|
|
26
|
+
variant: "destructive",
|
|
27
|
+
children: /* @__PURE__ */ jsxDEV(UGAlertDescription, {
|
|
28
|
+
children: error
|
|
29
|
+
}, undefined, false, undefined, this)
|
|
30
|
+
}, undefined, false, undefined, this) : null
|
|
31
|
+
}, undefined, false, undefined, this);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { AdminConfirmAction2 };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// packages/admin-react/src/patterns/AdminPage.tsx
|
|
2
|
+
import { UGPageHeader } from "@ug666/ui-react/patterns";
|
|
3
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
4
|
+
function AdminPage2({
|
|
5
|
+
className,
|
|
6
|
+
title,
|
|
7
|
+
description,
|
|
8
|
+
badge,
|
|
9
|
+
meta,
|
|
10
|
+
primaryAction,
|
|
11
|
+
secondaryActions,
|
|
12
|
+
visuallyHiddenHeader = false,
|
|
13
|
+
children
|
|
14
|
+
}) {
|
|
15
|
+
const actions = secondaryActions || primaryAction ? /* @__PURE__ */ jsxDEV(Fragment, {
|
|
16
|
+
children: [
|
|
17
|
+
secondaryActions,
|
|
18
|
+
primaryAction
|
|
19
|
+
]
|
|
20
|
+
}, undefined, true, undefined, this) : undefined;
|
|
21
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
22
|
+
className: className ? `admin-page ${className}` : "admin-page",
|
|
23
|
+
children: [
|
|
24
|
+
visuallyHiddenHeader ? /* @__PURE__ */ jsxDEV("h1", {
|
|
25
|
+
className: "sr-only",
|
|
26
|
+
children: title
|
|
27
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV(UGPageHeader, {
|
|
28
|
+
actions,
|
|
29
|
+
badge,
|
|
30
|
+
description,
|
|
31
|
+
meta,
|
|
32
|
+
title
|
|
33
|
+
}, undefined, false, undefined, this),
|
|
34
|
+
children
|
|
35
|
+
]
|
|
36
|
+
}, undefined, true, undefined, this);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { AdminPage2 };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AdminPage2
|
|
3
|
+
} from "./index-keve3ryw.js";
|
|
4
|
+
|
|
5
|
+
// packages/admin-react/src/patterns/AdminListPage.tsx
|
|
6
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
7
|
+
function AdminListPage2({
|
|
8
|
+
search,
|
|
9
|
+
summary,
|
|
10
|
+
searchId,
|
|
11
|
+
searchHidden = false,
|
|
12
|
+
toolbarStart,
|
|
13
|
+
toolbarEnd,
|
|
14
|
+
children,
|
|
15
|
+
footer,
|
|
16
|
+
...pageProps
|
|
17
|
+
}) {
|
|
18
|
+
const { primaryAction, secondaryActions, ...headerProps } = pageProps;
|
|
19
|
+
return /* @__PURE__ */ jsxDEV(AdminPage2, {
|
|
20
|
+
...headerProps,
|
|
21
|
+
visuallyHiddenHeader: true,
|
|
22
|
+
className: "admin-page--list",
|
|
23
|
+
children: /* @__PURE__ */ jsxDEV("div", {
|
|
24
|
+
className: "admin-list-panel",
|
|
25
|
+
children: [
|
|
26
|
+
search ? /* @__PURE__ */ jsxDEV("div", {
|
|
27
|
+
id: searchId,
|
|
28
|
+
className: "admin-list-search",
|
|
29
|
+
hidden: searchHidden,
|
|
30
|
+
children: search
|
|
31
|
+
}, undefined, false, undefined, this) : null,
|
|
32
|
+
summary,
|
|
33
|
+
primaryAction || secondaryActions || toolbarStart || toolbarEnd ? /* @__PURE__ */ jsxDEV("div", {
|
|
34
|
+
className: "admin-list-actions",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
37
|
+
className: "admin-list-actions__start",
|
|
38
|
+
children: [
|
|
39
|
+
primaryAction,
|
|
40
|
+
secondaryActions,
|
|
41
|
+
toolbarStart
|
|
42
|
+
]
|
|
43
|
+
}, undefined, true, undefined, this),
|
|
44
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
45
|
+
className: "admin-list-actions__end",
|
|
46
|
+
children: toolbarEnd
|
|
47
|
+
}, undefined, false, undefined, this)
|
|
48
|
+
]
|
|
49
|
+
}, undefined, true, undefined, this) : null,
|
|
50
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
51
|
+
className: "admin-list-content",
|
|
52
|
+
children
|
|
53
|
+
}, undefined, false, undefined, this),
|
|
54
|
+
footer ? /* @__PURE__ */ jsxDEV("div", {
|
|
55
|
+
className: "admin-list-footer",
|
|
56
|
+
children: footer
|
|
57
|
+
}, undefined, false, undefined, this) : null
|
|
58
|
+
]
|
|
59
|
+
}, undefined, true, undefined, this)
|
|
60
|
+
}, undefined, false, undefined, this);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { AdminListPage2 };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AdminPage2
|
|
3
|
+
} from "./index-keve3ryw.js";
|
|
4
|
+
|
|
5
|
+
// packages/admin-react/src/patterns/AdminFormPage.tsx
|
|
6
|
+
import { t } from "@ug666/admin-core/i18n";
|
|
7
|
+
import { UGAlert, UGAlertDescription, UGButton, UGCard, UGCardContent } from "@ug666/ui-react";
|
|
8
|
+
import { UGConfirmDialog } from "@ug666/ui-react/patterns";
|
|
9
|
+
import { ArrowLeft, Save } from "lucide-react";
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
import { useBlocker } from "react-router-dom";
|
|
12
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
13
|
+
function AdminFormPage2({
|
|
14
|
+
title,
|
|
15
|
+
description,
|
|
16
|
+
children,
|
|
17
|
+
error,
|
|
18
|
+
isDirty = false,
|
|
19
|
+
submitting = false,
|
|
20
|
+
submitDisabled = false,
|
|
21
|
+
submitLabel = t("common.save"),
|
|
22
|
+
submitAndReturnLabel = t("common.saveAndReturn"),
|
|
23
|
+
onCancel,
|
|
24
|
+
onSubmit,
|
|
25
|
+
onSubmitAndReturn
|
|
26
|
+
}) {
|
|
27
|
+
const blocker = useBlocker(({ currentLocation, nextLocation }) => isDirty && currentLocation.pathname !== nextLocation.pathname);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
function handleBeforeUnload(event) {
|
|
30
|
+
if (!isDirty)
|
|
31
|
+
return;
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
event.returnValue = "";
|
|
34
|
+
}
|
|
35
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
36
|
+
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
37
|
+
}, [isDirty]);
|
|
38
|
+
function handleSubmit(event) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
onSubmit();
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsxDEV(AdminPage2, {
|
|
43
|
+
description,
|
|
44
|
+
title,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsxDEV(UGCard, {
|
|
47
|
+
className: "admin-form-panel",
|
|
48
|
+
children: /* @__PURE__ */ jsxDEV(UGCardContent, {
|
|
49
|
+
className: "admin-card-content",
|
|
50
|
+
children: /* @__PURE__ */ jsxDEV("form", {
|
|
51
|
+
className: "admin-form",
|
|
52
|
+
onSubmit: handleSubmit,
|
|
53
|
+
children: [
|
|
54
|
+
error ? /* @__PURE__ */ jsxDEV(UGAlert, {
|
|
55
|
+
variant: "destructive",
|
|
56
|
+
children: /* @__PURE__ */ jsxDEV(UGAlertDescription, {
|
|
57
|
+
children: error
|
|
58
|
+
}, undefined, false, undefined, this)
|
|
59
|
+
}, undefined, false, undefined, this) : null,
|
|
60
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
61
|
+
className: "admin-form__fields",
|
|
62
|
+
children
|
|
63
|
+
}, undefined, false, undefined, this),
|
|
64
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
65
|
+
className: "admin-form__actions",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxDEV(UGButton, {
|
|
68
|
+
disabled: submitting,
|
|
69
|
+
onClick: onCancel,
|
|
70
|
+
type: "button",
|
|
71
|
+
variant: "default",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsxDEV(ArrowLeft, {
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
size: 16
|
|
76
|
+
}, undefined, false, undefined, this),
|
|
77
|
+
"返回"
|
|
78
|
+
]
|
|
79
|
+
}, undefined, true, undefined, this),
|
|
80
|
+
/* @__PURE__ */ jsxDEV(UGButton, {
|
|
81
|
+
disabled: submitDisabled,
|
|
82
|
+
loading: submitting,
|
|
83
|
+
tone: "primary",
|
|
84
|
+
type: "submit",
|
|
85
|
+
variant: "solid",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxDEV(Save, {
|
|
88
|
+
"aria-hidden": "true",
|
|
89
|
+
size: 16
|
|
90
|
+
}, undefined, false, undefined, this),
|
|
91
|
+
submitLabel
|
|
92
|
+
]
|
|
93
|
+
}, undefined, true, undefined, this),
|
|
94
|
+
onSubmitAndReturn ? /* @__PURE__ */ jsxDEV(UGButton, {
|
|
95
|
+
disabled: submitting || submitDisabled,
|
|
96
|
+
onClick: onSubmitAndReturn,
|
|
97
|
+
type: "button",
|
|
98
|
+
variant: "default",
|
|
99
|
+
children: submitAndReturnLabel
|
|
100
|
+
}, undefined, false, undefined, this) : null
|
|
101
|
+
]
|
|
102
|
+
}, undefined, true, undefined, this)
|
|
103
|
+
]
|
|
104
|
+
}, undefined, true, undefined, this)
|
|
105
|
+
}, undefined, false, undefined, this)
|
|
106
|
+
}, undefined, false, undefined, this),
|
|
107
|
+
/* @__PURE__ */ jsxDEV(UGConfirmDialog, {
|
|
108
|
+
closeOnConfirm: false,
|
|
109
|
+
confirmText: "放弃修改",
|
|
110
|
+
description: "当前页面存在尚未保存的修改,离开后这些内容将丢失。",
|
|
111
|
+
onCancel: () => blocker.reset?.(),
|
|
112
|
+
onConfirm: () => blocker.proceed?.(),
|
|
113
|
+
onOpenChange: (open) => {
|
|
114
|
+
if (!open)
|
|
115
|
+
blocker.reset?.();
|
|
116
|
+
},
|
|
117
|
+
open: blocker.state === "blocked",
|
|
118
|
+
title: "确认离开当前页面?",
|
|
119
|
+
variant: "destructive"
|
|
120
|
+
}, undefined, false, undefined, this)
|
|
121
|
+
]
|
|
122
|
+
}, undefined, true, undefined, this);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { AdminFormPage2 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AdminConfirmAction2
|
|
3
|
+
} from "./index-aqqcc4wq.js";
|
|
4
|
+
import {
|
|
5
|
+
AdminPage2
|
|
6
|
+
} from "./index-keve3ryw.js";
|
|
7
|
+
import {
|
|
8
|
+
AdminDetailPage2
|
|
9
|
+
} from "./index-4tstw263.js";
|
|
10
|
+
import {
|
|
11
|
+
AdminFormPage2
|
|
12
|
+
} from "./index-zt432pkz.js";
|
|
13
|
+
import {
|
|
14
|
+
AdminListPage2
|
|
15
|
+
} from "./index-nyrhj7se.js";
|
|
16
|
+
import {
|
|
17
|
+
AdminSearchField2,
|
|
18
|
+
AdminSearchForm2
|
|
19
|
+
} from "./index-3dcgfy6t.js";
|
|
20
|
+
export {
|
|
21
|
+
AdminConfirmAction2 as AdminConfirmAction,
|
|
22
|
+
AdminDetailPage2 as AdminDetailPage,
|
|
23
|
+
AdminFormPage2 as AdminFormPage,
|
|
24
|
+
AdminListPage2 as AdminListPage,
|
|
25
|
+
AdminPage2 as AdminPage,
|
|
26
|
+
AdminSearchField2 as AdminSearchField,
|
|
27
|
+
AdminSearchForm2 as AdminSearchForm
|
|
28
|
+
};
|
package/dist/index.ts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.ts/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ug666/admin-react",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "UG Admin React 渲染层:AdminPage/AdminListPage/AdminFormPage/AdminDetailPage 等页面壳与组合模式",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./patterns/*": {
|
|
12
|
+
"types": "./src/patterns/*.tsx",
|
|
13
|
+
"default": "./src/patterns/*.tsx"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/react": "^19.0.0",
|
|
23
|
+
"@types/react-dom": "^19.0.0",
|
|
24
|
+
"@ug666/admin-core": "file:../admin-core",
|
|
25
|
+
"@ug666/ui-react": "0.3.0-beta.3",
|
|
26
|
+
"lucide-react": "^1.61.0",
|
|
27
|
+
"react": "^19.0.0",
|
|
28
|
+
"react-router-dom": "^7.18.2"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./src/index.ts",
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "bun run scripts/packages/build-packages.ts"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@ug666/admin-core": "^0.1.0-0",
|
|
38
|
+
"@ug666/ui-react": "^0.3.0-0",
|
|
39
|
+
"lucide-react": "*",
|
|
40
|
+
"react": "^19.0.0",
|
|
41
|
+
"react-router-dom": "^7.0.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @description: admin-react 公开入口;按子路径导出,构建产物与类型统一从这里收口。 */
|
|
2
|
+
|
|
3
|
+
export * from "./patterns/AdminConfirmAction";
|
|
4
|
+
export * from "./patterns/AdminDetailPage";
|
|
5
|
+
export * from "./patterns/AdminFormPage";
|
|
6
|
+
export * from "./patterns/AdminListPage";
|
|
7
|
+
export * from "./patterns/AdminPage";
|
|
8
|
+
export * from "./patterns/AdminSearchForm";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { UGAlert, UGAlertDescription } from "@ug666/ui-react";
|
|
2
|
+
import { UGConfirmDialog } from "@ug666/ui-react/patterns";
|
|
3
|
+
|
|
4
|
+
export interface AdminConfirmActionProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
confirmText: string;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
onOpenChange: (open: boolean) => void;
|
|
12
|
+
onConfirm: () => void | Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function AdminConfirmAction({
|
|
16
|
+
open,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
confirmText,
|
|
20
|
+
loading = false,
|
|
21
|
+
error,
|
|
22
|
+
onOpenChange,
|
|
23
|
+
onConfirm,
|
|
24
|
+
}: AdminConfirmActionProps) {
|
|
25
|
+
return (
|
|
26
|
+
<UGConfirmDialog
|
|
27
|
+
closeOnConfirm={false}
|
|
28
|
+
confirmText={confirmText}
|
|
29
|
+
description={description}
|
|
30
|
+
loading={loading}
|
|
31
|
+
onConfirm={onConfirm}
|
|
32
|
+
onOpenChange={onOpenChange}
|
|
33
|
+
open={open}
|
|
34
|
+
title={title}
|
|
35
|
+
variant="destructive"
|
|
36
|
+
>
|
|
37
|
+
{error ? (
|
|
38
|
+
<UGAlert variant="destructive">
|
|
39
|
+
<UGAlertDescription>{error}</UGAlertDescription>
|
|
40
|
+
</UGAlert>
|
|
41
|
+
) : null}
|
|
42
|
+
</UGConfirmDialog>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { UGCard, UGCardContent, UGCardHeader, UGCardTitle } from "@ug666/ui-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { AdminPage, type AdminPageProps } from "./AdminPage";
|
|
4
|
+
|
|
5
|
+
export interface AdminDetailItem {
|
|
6
|
+
label: string;
|
|
7
|
+
value: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface AdminDetailSection {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
items: readonly AdminDetailItem[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface AdminDetailPageProps extends Omit<AdminPageProps, "children"> {
|
|
17
|
+
sections: readonly AdminDetailSection[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function AdminDetailPage({ sections, ...pageProps }: AdminDetailPageProps) {
|
|
21
|
+
return (
|
|
22
|
+
<AdminPage {...pageProps}>
|
|
23
|
+
<div className="admin-detail-sections">
|
|
24
|
+
{sections.map((section) => (
|
|
25
|
+
<UGCard key={section.id}>
|
|
26
|
+
<UGCardHeader>
|
|
27
|
+
<UGCardTitle>{section.title}</UGCardTitle>
|
|
28
|
+
</UGCardHeader>
|
|
29
|
+
<UGCardContent className="admin-card-content">
|
|
30
|
+
<dl className="admin-description-list">
|
|
31
|
+
{section.items.map((item) => (
|
|
32
|
+
<div className="admin-description-list__item" key={item.label}>
|
|
33
|
+
<dt>{item.label}</dt>
|
|
34
|
+
<dd>{item.value ?? "—"}</dd>
|
|
35
|
+
</div>
|
|
36
|
+
))}
|
|
37
|
+
</dl>
|
|
38
|
+
</UGCardContent>
|
|
39
|
+
</UGCard>
|
|
40
|
+
))}
|
|
41
|
+
</div>
|
|
42
|
+
</AdminPage>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { t } from "@ug666/admin-core/i18n";
|
|
2
|
+
import { UGAlert, UGAlertDescription, UGButton, UGCard, UGCardContent } from "@ug666/ui-react";
|
|
3
|
+
import { UGConfirmDialog } from "@ug666/ui-react/patterns";
|
|
4
|
+
import { ArrowLeft, Save } from "lucide-react";
|
|
5
|
+
import { type FormEvent, type ReactNode, useEffect } from "react";
|
|
6
|
+
import { useBlocker } from "react-router-dom";
|
|
7
|
+
import { AdminPage } from "./AdminPage";
|
|
8
|
+
|
|
9
|
+
export interface AdminFormPageProps {
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
error?: string;
|
|
14
|
+
isDirty?: boolean;
|
|
15
|
+
submitting?: boolean;
|
|
16
|
+
submitDisabled?: boolean;
|
|
17
|
+
submitLabel?: string;
|
|
18
|
+
submitAndReturnLabel?: string;
|
|
19
|
+
onCancel: () => void;
|
|
20
|
+
onSubmit: () => void;
|
|
21
|
+
onSubmitAndReturn?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function AdminFormPage({
|
|
25
|
+
title,
|
|
26
|
+
description,
|
|
27
|
+
children,
|
|
28
|
+
error,
|
|
29
|
+
isDirty = false,
|
|
30
|
+
submitting = false,
|
|
31
|
+
submitDisabled = false,
|
|
32
|
+
submitLabel = t("common.save"),
|
|
33
|
+
submitAndReturnLabel = t("common.saveAndReturn"),
|
|
34
|
+
onCancel,
|
|
35
|
+
onSubmit,
|
|
36
|
+
onSubmitAndReturn,
|
|
37
|
+
}: AdminFormPageProps) {
|
|
38
|
+
const blocker = useBlocker(
|
|
39
|
+
({ currentLocation, nextLocation }) =>
|
|
40
|
+
isDirty && currentLocation.pathname !== nextLocation.pathname,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
function handleBeforeUnload(event: BeforeUnloadEvent) {
|
|
45
|
+
if (!isDirty) return;
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
event.returnValue = "";
|
|
48
|
+
}
|
|
49
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
50
|
+
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
51
|
+
}, [isDirty]);
|
|
52
|
+
|
|
53
|
+
function handleSubmit(event: FormEvent<HTMLFormElement>) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
onSubmit();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<AdminPage description={description} title={title}>
|
|
60
|
+
<UGCard className="admin-form-panel">
|
|
61
|
+
<UGCardContent className="admin-card-content">
|
|
62
|
+
<form className="admin-form" onSubmit={handleSubmit}>
|
|
63
|
+
{error ? (
|
|
64
|
+
<UGAlert variant="destructive">
|
|
65
|
+
<UGAlertDescription>{error}</UGAlertDescription>
|
|
66
|
+
</UGAlert>
|
|
67
|
+
) : null}
|
|
68
|
+
<div className="admin-form__fields">{children}</div>
|
|
69
|
+
<div className="admin-form__actions">
|
|
70
|
+
<UGButton disabled={submitting} onClick={onCancel} type="button" variant="default">
|
|
71
|
+
<ArrowLeft aria-hidden="true" size={16} />
|
|
72
|
+
返回
|
|
73
|
+
</UGButton>
|
|
74
|
+
<UGButton
|
|
75
|
+
disabled={submitDisabled}
|
|
76
|
+
loading={submitting}
|
|
77
|
+
tone="primary"
|
|
78
|
+
type="submit"
|
|
79
|
+
variant="solid"
|
|
80
|
+
>
|
|
81
|
+
<Save aria-hidden="true" size={16} />
|
|
82
|
+
{submitLabel}
|
|
83
|
+
</UGButton>
|
|
84
|
+
{onSubmitAndReturn ? (
|
|
85
|
+
<UGButton
|
|
86
|
+
disabled={submitting || submitDisabled}
|
|
87
|
+
onClick={onSubmitAndReturn}
|
|
88
|
+
type="button"
|
|
89
|
+
variant="default"
|
|
90
|
+
>
|
|
91
|
+
{submitAndReturnLabel}
|
|
92
|
+
</UGButton>
|
|
93
|
+
) : null}
|
|
94
|
+
</div>
|
|
95
|
+
</form>
|
|
96
|
+
</UGCardContent>
|
|
97
|
+
</UGCard>
|
|
98
|
+
<UGConfirmDialog
|
|
99
|
+
closeOnConfirm={false}
|
|
100
|
+
confirmText="放弃修改"
|
|
101
|
+
description="当前页面存在尚未保存的修改,离开后这些内容将丢失。"
|
|
102
|
+
onCancel={() => blocker.reset?.()}
|
|
103
|
+
onConfirm={() => blocker.proceed?.()}
|
|
104
|
+
onOpenChange={(open) => {
|
|
105
|
+
if (!open) blocker.reset?.();
|
|
106
|
+
}}
|
|
107
|
+
open={blocker.state === "blocked"}
|
|
108
|
+
title="确认离开当前页面?"
|
|
109
|
+
variant="destructive"
|
|
110
|
+
/>
|
|
111
|
+
</AdminPage>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { AdminPage, type AdminPageProps } from "./AdminPage";
|
|
3
|
+
|
|
4
|
+
export interface AdminListPageProps extends Omit<AdminPageProps, "children"> {
|
|
5
|
+
search?: ReactNode;
|
|
6
|
+
summary?: ReactNode;
|
|
7
|
+
searchId?: string;
|
|
8
|
+
searchHidden?: boolean;
|
|
9
|
+
toolbarStart?: ReactNode;
|
|
10
|
+
toolbarEnd?: ReactNode;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function AdminListPage({
|
|
16
|
+
search,
|
|
17
|
+
summary,
|
|
18
|
+
searchId,
|
|
19
|
+
searchHidden = false,
|
|
20
|
+
toolbarStart,
|
|
21
|
+
toolbarEnd,
|
|
22
|
+
children,
|
|
23
|
+
footer,
|
|
24
|
+
...pageProps
|
|
25
|
+
}: AdminListPageProps) {
|
|
26
|
+
const { primaryAction, secondaryActions, ...headerProps } = pageProps;
|
|
27
|
+
return (
|
|
28
|
+
<AdminPage {...headerProps} visuallyHiddenHeader className="admin-page--list">
|
|
29
|
+
<div className="admin-list-panel">
|
|
30
|
+
{search ? (
|
|
31
|
+
<div id={searchId} className="admin-list-search" hidden={searchHidden}>
|
|
32
|
+
{search}
|
|
33
|
+
</div>
|
|
34
|
+
) : null}
|
|
35
|
+
{summary}
|
|
36
|
+
{primaryAction || secondaryActions || toolbarStart || toolbarEnd ? (
|
|
37
|
+
<div className="admin-list-actions">
|
|
38
|
+
<div className="admin-list-actions__start">
|
|
39
|
+
{primaryAction}
|
|
40
|
+
{secondaryActions}
|
|
41
|
+
{toolbarStart}
|
|
42
|
+
</div>
|
|
43
|
+
<div className="admin-list-actions__end">{toolbarEnd}</div>
|
|
44
|
+
</div>
|
|
45
|
+
) : null}
|
|
46
|
+
<div className="admin-list-content">{children}</div>
|
|
47
|
+
{footer ? <div className="admin-list-footer">{footer}</div> : null}
|
|
48
|
+
</div>
|
|
49
|
+
</AdminPage>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { UGPageHeader } from "@ug666/ui-react/patterns";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export interface AdminPageProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
badge?: ReactNode;
|
|
9
|
+
meta?: ReactNode;
|
|
10
|
+
primaryAction?: ReactNode;
|
|
11
|
+
secondaryActions?: ReactNode;
|
|
12
|
+
visuallyHiddenHeader?: boolean;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function AdminPage({
|
|
17
|
+
className,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
badge,
|
|
21
|
+
meta,
|
|
22
|
+
primaryAction,
|
|
23
|
+
secondaryActions,
|
|
24
|
+
visuallyHiddenHeader = false,
|
|
25
|
+
children,
|
|
26
|
+
}: AdminPageProps) {
|
|
27
|
+
const actions =
|
|
28
|
+
secondaryActions || primaryAction ? (
|
|
29
|
+
<>
|
|
30
|
+
{secondaryActions}
|
|
31
|
+
{primaryAction}
|
|
32
|
+
</>
|
|
33
|
+
) : undefined;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className={className ? `admin-page ${className}` : "admin-page"}>
|
|
37
|
+
{visuallyHiddenHeader ? (
|
|
38
|
+
<h1 className="sr-only">{title}</h1>
|
|
39
|
+
) : (
|
|
40
|
+
<UGPageHeader
|
|
41
|
+
actions={actions}
|
|
42
|
+
badge={badge}
|
|
43
|
+
description={description}
|
|
44
|
+
meta={meta}
|
|
45
|
+
title={title}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
{children}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UGButton,
|
|
3
|
+
UGForm,
|
|
4
|
+
UGFormControl,
|
|
5
|
+
UGFormField,
|
|
6
|
+
UGFormItem,
|
|
7
|
+
UGFormLabel,
|
|
8
|
+
} from "@ug666/ui-react";
|
|
9
|
+
import { ChevronDown, ChevronUp, RotateCcw, Search } from "lucide-react";
|
|
10
|
+
import {
|
|
11
|
+
type CSSProperties,
|
|
12
|
+
type FormEvent,
|
|
13
|
+
type ReactElement,
|
|
14
|
+
type ReactNode,
|
|
15
|
+
useId,
|
|
16
|
+
useState,
|
|
17
|
+
} from "react";
|
|
18
|
+
|
|
19
|
+
export function AdminSearchField({
|
|
20
|
+
name,
|
|
21
|
+
label,
|
|
22
|
+
labelFor,
|
|
23
|
+
className,
|
|
24
|
+
itemClassName,
|
|
25
|
+
itemStyle,
|
|
26
|
+
children,
|
|
27
|
+
}: {
|
|
28
|
+
name: string;
|
|
29
|
+
label: string;
|
|
30
|
+
labelFor?: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
itemClassName?: string;
|
|
33
|
+
itemStyle?: CSSProperties;
|
|
34
|
+
children: ReactElement;
|
|
35
|
+
}) {
|
|
36
|
+
return (
|
|
37
|
+
<UGFormField
|
|
38
|
+
name={name}
|
|
39
|
+
className={className ? `admin-search-field ${className}` : "admin-search-field"}
|
|
40
|
+
>
|
|
41
|
+
<UGFormItem className={itemClassName} style={itemStyle}>
|
|
42
|
+
<UGFormLabel htmlFor={labelFor}>{label}</UGFormLabel>
|
|
43
|
+
<UGFormControl>{children}</UGFormControl>
|
|
44
|
+
</UGFormItem>
|
|
45
|
+
</UGFormField>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface AdminSearchFormProps {
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
expandedContent?: ReactNode;
|
|
52
|
+
labelWidth?: string | number;
|
|
53
|
+
expandLabel?: string;
|
|
54
|
+
collapseLabel?: string;
|
|
55
|
+
loading?: boolean;
|
|
56
|
+
onReset: () => void;
|
|
57
|
+
onSubmit: () => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function AdminSearchForm({
|
|
61
|
+
children,
|
|
62
|
+
expandedContent,
|
|
63
|
+
labelWidth = "max-content",
|
|
64
|
+
expandLabel = "展开",
|
|
65
|
+
collapseLabel = "收起",
|
|
66
|
+
loading = false,
|
|
67
|
+
onReset,
|
|
68
|
+
onSubmit,
|
|
69
|
+
}: AdminSearchFormProps) {
|
|
70
|
+
const [expanded, setExpanded] = useState(false);
|
|
71
|
+
const expandedId = useId();
|
|
72
|
+
|
|
73
|
+
function handleSubmit(event: FormEvent<HTMLFormElement>) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
onSubmit();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<UGForm
|
|
80
|
+
className="admin-search-form"
|
|
81
|
+
layout="horizontal"
|
|
82
|
+
labelPosition="right"
|
|
83
|
+
labelWidth={labelWidth}
|
|
84
|
+
size="default"
|
|
85
|
+
onSubmit={handleSubmit}
|
|
86
|
+
>
|
|
87
|
+
<div className="admin-search-form__fields">
|
|
88
|
+
{children}
|
|
89
|
+
{expandedContent ? (
|
|
90
|
+
<div id={expandedId} className="admin-search-form__expanded" hidden={!expanded}>
|
|
91
|
+
{expandedContent}
|
|
92
|
+
</div>
|
|
93
|
+
) : null}
|
|
94
|
+
</div>
|
|
95
|
+
<div className="admin-search-form__actions">
|
|
96
|
+
{expandedContent ? (
|
|
97
|
+
<UGButton
|
|
98
|
+
aria-expanded={expanded}
|
|
99
|
+
aria-controls={expandedId}
|
|
100
|
+
onClick={() => setExpanded((value) => !value)}
|
|
101
|
+
tone="neutral"
|
|
102
|
+
type="button"
|
|
103
|
+
variant="text"
|
|
104
|
+
>
|
|
105
|
+
{expanded ? (
|
|
106
|
+
<ChevronUp aria-hidden="true" size={16} />
|
|
107
|
+
) : (
|
|
108
|
+
<ChevronDown aria-hidden="true" size={16} />
|
|
109
|
+
)}
|
|
110
|
+
{expanded ? collapseLabel : expandLabel}
|
|
111
|
+
</UGButton>
|
|
112
|
+
) : null}
|
|
113
|
+
<UGButton loading={loading} tone="primary" type="submit" variant="solid">
|
|
114
|
+
<Search aria-hidden="true" size={16} />
|
|
115
|
+
查询
|
|
116
|
+
</UGButton>
|
|
117
|
+
<UGButton onClick={onReset} type="button" variant="default">
|
|
118
|
+
<RotateCcw aria-hidden="true" size={16} />
|
|
119
|
+
重置
|
|
120
|
+
</UGButton>
|
|
121
|
+
</div>
|
|
122
|
+
</UGForm>
|
|
123
|
+
);
|
|
124
|
+
}
|
package/README.md
DELETED