@guorui20/typical-page-shells 0.1.1
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/LICENSE +201 -0
- package/README.md +17 -0
- package/dist/host.d.ts +1 -0
- package/dist/host.js +7 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +75 -0
- package/dist/pro-detail-drawer/entry.d.ts +12 -0
- package/dist/pro-detail-drawer/entry.js +23 -0
- package/dist/pro-detail-drawer/index.d.ts +1 -0
- package/dist/pro-detail-drawer/index.js +7 -0
- package/dist/pro-detail-drawer/index.module.scss.js +9 -0
- package/dist/pro-detail-page/ProDetailPage.d.ts +3 -0
- package/dist/pro-detail-page/ProDetailPage.js +13 -0
- package/dist/pro-detail-page/context/entry.d.ts +15 -0
- package/dist/pro-detail-page/context/entry.js +29 -0
- package/dist/pro-detail-page/context/index.d.ts +2 -0
- package/dist/pro-detail-page/context/inner.d.ts +10 -0
- package/dist/pro-detail-page/context/inner.js +9 -0
- package/dist/pro-detail-page/hooks/use-fetch-detail.d.ts +11 -0
- package/dist/pro-detail-page/hooks/use-fetch-detail.js +18 -0
- package/dist/pro-detail-page/hooks/use-props.d.ts +9 -0
- package/dist/pro-detail-page/hooks/use-props.js +12 -0
- package/dist/pro-detail-page/index.d.ts +3 -0
- package/dist/pro-detail-page/index.js +7 -0
- package/dist/pro-detail-page/index.module.scss.js +7 -0
- package/dist/pro-detail-page/types.d.ts +3 -0
- package/dist/pro-edit-page/ProEditPage.d.ts +3 -0
- package/dist/pro-edit-page/ProEditPage.js +11 -0
- package/dist/pro-edit-page/StableProTextArea.d.ts +8 -0
- package/dist/pro-edit-page/StableProTextArea.js +47 -0
- package/dist/pro-edit-page/bridge/form.d.ts +6 -0
- package/dist/pro-edit-page/bridge/form.js +15 -0
- package/dist/pro-edit-page/components/cancel-button.d.ts +2 -0
- package/dist/pro-edit-page/components/cancel-button.js +10 -0
- package/dist/pro-edit-page/components/index.d.ts +3 -0
- package/dist/pro-edit-page/components/stash-button.d.ts +2 -0
- package/dist/pro-edit-page/components/stash-button.js +22 -0
- package/dist/pro-edit-page/components/submit-button.d.ts +2 -0
- package/dist/pro-edit-page/components/submit-button.js +22 -0
- package/dist/pro-edit-page/context/entry.d.ts +27 -0
- package/dist/pro-edit-page/context/entry.js +37 -0
- package/dist/pro-edit-page/context/index.d.ts +2 -0
- package/dist/pro-edit-page/context/inner.d.ts +9 -0
- package/dist/pro-edit-page/context/inner.js +16 -0
- package/dist/pro-edit-page/hooks/use-detail-load.d.ts +11 -0
- package/dist/pro-edit-page/hooks/use-detail-load.js +23 -0
- package/dist/pro-edit-page/hooks/use-props.d.ts +31 -0
- package/dist/pro-edit-page/hooks/use-props.js +24 -0
- package/dist/pro-edit-page/hooks/use-stash-action.d.ts +9 -0
- package/dist/pro-edit-page/hooks/use-stash-action.js +19 -0
- package/dist/pro-edit-page/hooks/use-submit-action.d.ts +9 -0
- package/dist/pro-edit-page/hooks/use-submit-action.js +19 -0
- package/dist/pro-edit-page/index.d.ts +7 -0
- package/dist/pro-edit-page/index.js +19 -0
- package/dist/pro-edit-page/index.module.scss.js +11 -0
- package/dist/pro-edit-page/types.d.ts +27 -0
- package/dist/pro-edit-page/utils/resolve-form-data.d.ts +13 -0
- package/dist/pro-edit-page/utils/resolve-form-data.js +10 -0
- package/dist/pro-form-drawer/entry.d.ts +12 -0
- package/dist/pro-form-drawer/entry.js +23 -0
- package/dist/pro-form-drawer/index.d.ts +1 -0
- package/dist/pro-form-drawer/index.js +7 -0
- package/dist/pro-form-drawer/index.module.scss.js +9 -0
- package/dist/pro-list-page/ProListPage.d.ts +3 -0
- package/dist/pro-list-page/ProListPage.js +11 -0
- package/dist/pro-list-page/bridge/index.d.ts +2 -0
- package/dist/pro-list-page/bridge/query-filter.d.ts +23 -0
- package/dist/pro-list-page/bridge/query-filter.js +146 -0
- package/dist/pro-list-page/bridge/table.d.ts +7 -0
- package/dist/pro-list-page/bridge/table.js +62 -0
- package/dist/pro-list-page/context/entry.d.ts +24 -0
- package/dist/pro-list-page/context/entry.js +42 -0
- package/dist/pro-list-page/context/index.d.ts +2 -0
- package/dist/pro-list-page/context/inner.d.ts +10 -0
- package/dist/pro-list-page/context/inner.js +16 -0
- package/dist/pro-list-page/hooks/use-fetch-list.d.ts +25 -0
- package/dist/pro-list-page/hooks/use-fetch-list.js +64 -0
- package/dist/pro-list-page/hooks/use-filter-height.d.ts +7 -0
- package/dist/pro-list-page/hooks/use-filter-height.js +22 -0
- package/dist/pro-list-page/hooks/use-props.d.ts +9 -0
- package/dist/pro-list-page/hooks/use-props.js +16 -0
- package/dist/pro-list-page/index.d.ts +6 -0
- package/dist/pro-list-page/index.js +16 -0
- package/dist/pro-list-page/index.module.scss.js +7 -0
- package/dist/pro-list-page/query-filter-picker-overlay.d.ts +23 -0
- package/dist/pro-list-page/query-filter-picker-overlay.js +8 -0
- package/dist/pro-list-page/types.d.ts +8 -0
- package/dist/pro-stat-page/entry.d.ts +30 -0
- package/dist/pro-stat-page/entry.js +101 -0
- package/dist/pro-stat-page/index.d.ts +1 -0
- package/dist/pro-stat-page/index.js +8 -0
- package/dist/pro-stat-page/index.module.scss.js +31 -0
- package/dist/pro-table-page/entry.d.ts +17 -0
- package/dist/pro-table-page/entry.js +70 -0
- package/dist/pro-table-page/index.d.ts +1 -0
- package/dist/pro-table-page/index.js +8 -0
- package/dist/pro-table-page/index.module.scss.js +23 -0
- package/dist/pro-tree-split-page/entry.d.ts +20 -0
- package/dist/pro-tree-split-page/entry.js +107 -0
- package/dist/pro-tree-split-page/index.d.ts +1 -0
- package/dist/pro-tree-split-page/index.js +6 -0
- package/dist/pro-tree-split-page/index.module.scss.js +25 -0
- package/dist/schema-field-map/StableProCheckSelect.d.ts +9 -0
- package/dist/schema-field-map/StableProCheckSelect.js +16 -0
- package/dist/schema-field-map/field-map.d.ts +9 -0
- package/dist/schema-field-map/field-map.js +33 -0
- package/dist/schema-field-map/index.d.ts +2 -0
- package/dist/styles.css +1 -0
- package/dist/typical-page-host/index.d.ts +18 -0
- package/dist/typical-page-host/index.js +40 -0
- package/package.json +101 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Loading as p } from "@hi-ui/hiui";
|
|
3
|
+
import { SchemaForm as d } from "@hi-ui/schema-form";
|
|
4
|
+
/* empty css */
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { useProEditPageContext as f } from "../context/entry.js";
|
|
7
|
+
import { useInnerContext as s } from "../context/inner.js";
|
|
8
|
+
import { TypicalPageFieldMapProvider as a } from "../../schema-field-map/field-map.js";
|
|
9
|
+
function v(r) {
|
|
10
|
+
const { formRef: i, loading: e } = f(), { propsRef: t } = s(), { fields: m, groups: n } = t.current;
|
|
11
|
+
return /* @__PURE__ */ o(p, { visible: e.detailLoading, children: /* @__PURE__ */ o(a, { children: /* @__PURE__ */ o(d, { ...r, fields: m, groups: n, formRef: i }) }) });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
v as Form
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Button as c } from "@hi-ui/hiui";
|
|
3
|
+
import { useInnerContext as p } from "../context/inner.js";
|
|
4
|
+
function m(t) {
|
|
5
|
+
const { propsRef: n } = p(), { children: o = "取消", ...r } = t;
|
|
6
|
+
return /* @__PURE__ */ e(c, { type: "default", onClick: () => n.current.onCancel?.(), ...r, children: o });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
m as CancelButton
|
|
10
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { Button as u, message as r } from "@hi-ui/hiui";
|
|
3
|
+
import { resolveFormData as l } from "../utils/resolve-form-data.js";
|
|
4
|
+
import { useProEditPageContext as h } from "../context/entry.js";
|
|
5
|
+
import { useInnerContext as d } from "../context/inner.js";
|
|
6
|
+
function b(n) {
|
|
7
|
+
const { formRef: s, loading: a, stashAsync: c } = h(), { propsRef: e } = d(), { children: i = "暂存", ...f } = n, m = async () => {
|
|
8
|
+
const o = await l({
|
|
9
|
+
formRef: s,
|
|
10
|
+
before: e.current.beforeStash
|
|
11
|
+
});
|
|
12
|
+
o !== !1 && c(o).then((t) => {
|
|
13
|
+
r.open({ type: "success", title: "暂存成功" }), e.current.onStashSuccess?.(t);
|
|
14
|
+
}).catch((t) => {
|
|
15
|
+
r.open({ type: "error", title: t?.message ?? "暂存失败" }), e.current.onStashError?.(t);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ p(u, { type: "default", loading: a.stashLoading, onClick: m, ...f, children: i });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
b as StashButton
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { Button as p, message as r } from "@hi-ui/hiui";
|
|
3
|
+
import { resolveFormData as l } from "../utils/resolve-form-data.js";
|
|
4
|
+
import { useProEditPageContext as b } from "../context/entry.js";
|
|
5
|
+
import { useInnerContext as d } from "../context/inner.js";
|
|
6
|
+
function C(n) {
|
|
7
|
+
const { formRef: s, loading: i, submitAsync: m } = b(), { propsRef: o } = d(), { children: c = "保存", ...u } = n, a = async () => {
|
|
8
|
+
const e = await l({
|
|
9
|
+
formRef: s,
|
|
10
|
+
before: o.current.beforeSubmit
|
|
11
|
+
});
|
|
12
|
+
e !== !1 && m(e).then((t) => {
|
|
13
|
+
r.open({ type: "success", title: "保存成功" }), o.current.onSubmitSuccess?.(t);
|
|
14
|
+
}).catch((t) => {
|
|
15
|
+
r.open({ type: "error", title: t?.message ?? "保存失败" }), o.current.onSubmitError?.(t);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ f(p, { type: "primary", loading: i.submitLoading, onClick: a, ...u, children: c });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
C as SubmitButton
|
|
22
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EnhancedFormHelpers } from '@hi-ui/schema-form';
|
|
3
|
+
/** 提交/暂存接口:成功返回任意,失败 throw */
|
|
4
|
+
export type EditRequestFn = (formData: Record<string, unknown>) => Promise<unknown>;
|
|
5
|
+
/** 加载详情接口:成功返回表单数据用于回填,失败 throw;无入参,上下文由用户自行组装 */
|
|
6
|
+
export type DetailRequestFn = () => Promise<Record<string, unknown>>;
|
|
7
|
+
export type ProEditPageContextType = {
|
|
8
|
+
/** 表单 ref,由 FormBridge 内部的 SchemaForm 赋值 */
|
|
9
|
+
formRef: React.RefObject<EnhancedFormHelpers>;
|
|
10
|
+
loading: {
|
|
11
|
+
submitLoading: boolean;
|
|
12
|
+
stashLoading: boolean;
|
|
13
|
+
detailLoading: boolean;
|
|
14
|
+
};
|
|
15
|
+
submitAsync: (formData: Record<string, unknown>) => Promise<unknown>;
|
|
16
|
+
stashAsync: (formData: Record<string, unknown>) => Promise<unknown>;
|
|
17
|
+
};
|
|
18
|
+
export type ProEditPageProviderProps = {
|
|
19
|
+
/** 提交接口 */
|
|
20
|
+
submitRequest?: EditRequestFn;
|
|
21
|
+
/** 暂存接口 */
|
|
22
|
+
stashRequest?: EditRequestFn;
|
|
23
|
+
/** 加载详情接口(编辑模式) */
|
|
24
|
+
detailRequest?: DetailRequestFn;
|
|
25
|
+
};
|
|
26
|
+
export declare function ProEditPageProvider(props: React.PropsWithChildren<ProEditPageProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare function useProEditPageContext(): ProEditPageContextType;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import e, { useRef as l } from "react";
|
|
3
|
+
import { useLoadDetail as g } from "../hooks/use-detail-load.js";
|
|
4
|
+
import { useSubmitAction as x } from "../hooks/use-submit-action.js";
|
|
5
|
+
import { useStashAction as h } from "../hooks/use-stash-action.js";
|
|
6
|
+
const r = e.createContext(
|
|
7
|
+
null
|
|
8
|
+
);
|
|
9
|
+
function v(t) {
|
|
10
|
+
const o = l(null), { children: i, submitRequest: s, stashRequest: n, detailRequest: u } = t, { submitAsync: a, submitLoading: c } = x({ submitRequest: s }), { stashAsync: d, stashLoading: m } = h({ stashRequest: n }), { detailLoading: P } = g({ detailRequest: u, formRef: o });
|
|
11
|
+
return /* @__PURE__ */ f(
|
|
12
|
+
r.Provider,
|
|
13
|
+
{
|
|
14
|
+
value: {
|
|
15
|
+
formRef: o,
|
|
16
|
+
loading: {
|
|
17
|
+
submitLoading: c,
|
|
18
|
+
stashLoading: m,
|
|
19
|
+
detailLoading: P
|
|
20
|
+
},
|
|
21
|
+
submitAsync: a,
|
|
22
|
+
stashAsync: d
|
|
23
|
+
},
|
|
24
|
+
children: i
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function A() {
|
|
29
|
+
const t = e.useContext(r);
|
|
30
|
+
if (!t)
|
|
31
|
+
throw new Error("useProEditPageContext must be used within a ProEditPageProvider");
|
|
32
|
+
return t;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
v as ProEditPageProvider,
|
|
36
|
+
A as useProEditPageContext
|
|
37
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { NormalizedProEditPageProps } from '../hooks/use-props';
|
|
3
|
+
export type InnerContextValue = {
|
|
4
|
+
propsRef: React.MutableRefObject<NormalizedProEditPageProps>;
|
|
5
|
+
};
|
|
6
|
+
export declare function InnerProvider(props: React.PropsWithChildren<{
|
|
7
|
+
value: InnerContextValue;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useInnerContext(): InnerContextValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
const t = n.createContext(null);
|
|
4
|
+
function u(e) {
|
|
5
|
+
return /* @__PURE__ */ r(t.Provider, { value: e.value, children: e.children });
|
|
6
|
+
}
|
|
7
|
+
function c() {
|
|
8
|
+
const e = n.useContext(t);
|
|
9
|
+
if (!e)
|
|
10
|
+
throw new Error("useInnerContext must be used within a ProEditPage");
|
|
11
|
+
return e;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
u as InnerProvider,
|
|
15
|
+
c as useInnerContext
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EnhancedFormHelpers } from '@hi-ui/schema-form';
|
|
3
|
+
import type { DetailRequestFn } from '../context/entry';
|
|
4
|
+
type UseDetailLoadParams = {
|
|
5
|
+
detailRequest?: DetailRequestFn;
|
|
6
|
+
formRef: React.RefObject<EnhancedFormHelpers>;
|
|
7
|
+
};
|
|
8
|
+
export declare function useLoadDetail(params: UseDetailLoadParams): {
|
|
9
|
+
detailLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect as i } from "react";
|
|
2
|
+
import { useLatest as o, useRequest as f } from "ahooks";
|
|
3
|
+
function m(s) {
|
|
4
|
+
const { detailRequest: c, formRef: t } = s, e = o(c), { loading: a, runAsync: r } = f(
|
|
5
|
+
async () => {
|
|
6
|
+
if (e.current)
|
|
7
|
+
return await e.current();
|
|
8
|
+
},
|
|
9
|
+
{ manual: !0 }
|
|
10
|
+
);
|
|
11
|
+
return i(() => {
|
|
12
|
+
if (!e.current) return;
|
|
13
|
+
let n = !1;
|
|
14
|
+
return r().then((u) => {
|
|
15
|
+
!n && u && t.current && t.current.setFieldsValue(u);
|
|
16
|
+
}), () => {
|
|
17
|
+
n = !0;
|
|
18
|
+
};
|
|
19
|
+
}, [e, r, t]), { detailLoading: a };
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
m as useLoadDetail
|
|
23
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReadonlyRefObject } from '@hi-ui/use-ref-state';
|
|
2
|
+
import type { ProEditPageProps } from '../types';
|
|
3
|
+
/** 统一化后的 ProEditPage props,供 context 的 propsRef 使用 */
|
|
4
|
+
export type NormalizedProEditPageProps = ReturnType<typeof getNormalizedProps>;
|
|
5
|
+
declare function getNormalizedProps(props: ProEditPageProps): {
|
|
6
|
+
fields: import("@hi-ui/schema-core").FieldConfigType<AnyObject, Pick<import("@hi-ui/grid").ColProps, "span" | "offset" | "justify" | "order">>[];
|
|
7
|
+
groups: import("@hi-ui/schema-core").GroupConfigType<import("@hi-ui/schema-core").FormGroupType>[] | undefined;
|
|
8
|
+
steps: [] | undefined;
|
|
9
|
+
beforeSubmit: import("../types").BeforeActionFn | undefined;
|
|
10
|
+
beforeStash: import("../types").BeforeActionFn | undefined;
|
|
11
|
+
onCancel: (() => void) | undefined;
|
|
12
|
+
onSubmitSuccess: ((res: import("../types").EditResponse) => void) | undefined;
|
|
13
|
+
onSubmitError: ((res: import("../types").EditResponse) => void) | undefined;
|
|
14
|
+
onStashSuccess: ((res: import("../types").EditResponse) => void) | undefined;
|
|
15
|
+
onStashError: ((res: import("../types").EditResponse) => void) | undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare function useProps(props: ProEditPageProps): {
|
|
18
|
+
propsRef: ReadonlyRefObject<{
|
|
19
|
+
fields: import("@hi-ui/schema-core").FieldConfigType<AnyObject, Pick<import("@hi-ui/grid").ColProps, "span" | "offset" | "justify" | "order">>[];
|
|
20
|
+
groups: import("@hi-ui/schema-core").GroupConfigType<import("@hi-ui/schema-core").FormGroupType>[] | undefined;
|
|
21
|
+
steps: [] | undefined;
|
|
22
|
+
beforeSubmit: import("../types").BeforeActionFn | undefined;
|
|
23
|
+
beforeStash: import("../types").BeforeActionFn | undefined;
|
|
24
|
+
onCancel: (() => void) | undefined;
|
|
25
|
+
onSubmitSuccess: ((res: import("../types").EditResponse) => void) | undefined;
|
|
26
|
+
onSubmitError: ((res: import("../types").EditResponse) => void) | undefined;
|
|
27
|
+
onStashSuccess: ((res: import("../types").EditResponse) => void) | undefined;
|
|
28
|
+
onStashError: ((res: import("../types").EditResponse) => void) | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
export { getNormalizedProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useLatest as a } from "ahooks";
|
|
2
|
+
function b(t) {
|
|
3
|
+
const o = t.fields ?? [], s = t.groups, n = t.steps, e = t.beforeSubmit, c = t.beforeStash, r = t.onCancel, u = t.onSubmitSuccess, S = t.onSubmitError, i = t.onStashSuccess, f = t.onStashError;
|
|
4
|
+
return {
|
|
5
|
+
fields: o,
|
|
6
|
+
groups: s,
|
|
7
|
+
steps: n,
|
|
8
|
+
beforeSubmit: e,
|
|
9
|
+
beforeStash: c,
|
|
10
|
+
onCancel: r,
|
|
11
|
+
onSubmitSuccess: u,
|
|
12
|
+
onSubmitError: S,
|
|
13
|
+
onStashSuccess: i,
|
|
14
|
+
onStashError: f
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function h(t) {
|
|
18
|
+
const o = b(t);
|
|
19
|
+
return { propsRef: a(o) };
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
b as getNormalizedProps,
|
|
23
|
+
h as useProps
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProEditPageProviderProps } from '../context/entry';
|
|
2
|
+
type UseStashActionParams = {
|
|
3
|
+
stashRequest?: ProEditPageProviderProps['stashRequest'];
|
|
4
|
+
};
|
|
5
|
+
export declare function useStashAction(params: UseStashActionParams): {
|
|
6
|
+
stashAsync: (formData: Record<string, unknown>) => Promise<unknown>;
|
|
7
|
+
stashLoading: boolean;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useRequest as a } from "ahooks";
|
|
2
|
+
function c(r) {
|
|
3
|
+
const { stashRequest: t } = r, { loading: e, runAsync: n } = a(
|
|
4
|
+
async (o) => {
|
|
5
|
+
if (t)
|
|
6
|
+
return await t(o).catch((s) => {
|
|
7
|
+
throw console.error("[ProEditPage] stash request error:", s), s;
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
{ manual: !0 }
|
|
11
|
+
);
|
|
12
|
+
return {
|
|
13
|
+
stashAsync: n,
|
|
14
|
+
stashLoading: e
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
c as useStashAction
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProEditPageProviderProps } from '../context/entry';
|
|
2
|
+
type UseSubmitActionParams = {
|
|
3
|
+
submitRequest?: ProEditPageProviderProps['submitRequest'];
|
|
4
|
+
};
|
|
5
|
+
export declare function useSubmitAction(params: UseSubmitActionParams): {
|
|
6
|
+
submitAsync: (formData: Record<string, unknown>) => Promise<unknown>;
|
|
7
|
+
submitLoading: boolean;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useRequest as s } from "ahooks";
|
|
2
|
+
function c(u) {
|
|
3
|
+
const { submitRequest: t } = u, { loading: e, runAsync: n } = s(
|
|
4
|
+
async (o) => {
|
|
5
|
+
if (t)
|
|
6
|
+
return await t(o).catch((r) => {
|
|
7
|
+
throw console.error("[ProEditPage] submit request error:", r), r;
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
{ manual: !0 }
|
|
11
|
+
);
|
|
12
|
+
return {
|
|
13
|
+
submitAsync: n,
|
|
14
|
+
submitLoading: e
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
c as useSubmitAction
|
|
19
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ProEditPage } from './ProEditPage';
|
|
2
|
+
export { ProEditPageProvider, useProEditPageContext } from './context';
|
|
3
|
+
export { Form, type FormProps } from './bridge/form';
|
|
4
|
+
export { SubmitButton, StashButton, CancelButton } from './components';
|
|
5
|
+
export type { ProEditPageProps } from './types';
|
|
6
|
+
export { StableProTextArea } from './StableProTextArea';
|
|
7
|
+
export { default as proEditPageShellStyles } from './index.module.scss';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ProEditPage as r } from "./ProEditPage.js";
|
|
2
|
+
import { Form as a } from "./bridge/form.js";
|
|
3
|
+
import { StableProTextArea as x } from "./StableProTextArea.js";
|
|
4
|
+
import { default as p } from "./index.module.scss.js";
|
|
5
|
+
import { CancelButton as d } from "./components/cancel-button.js";
|
|
6
|
+
import { ProEditPageProvider as l, useProEditPageContext as u } from "./context/entry.js";
|
|
7
|
+
import { StashButton as S } from "./components/stash-button.js";
|
|
8
|
+
import { SubmitButton as s } from "./components/submit-button.js";
|
|
9
|
+
export {
|
|
10
|
+
d as CancelButton,
|
|
11
|
+
a as Form,
|
|
12
|
+
r as ProEditPage,
|
|
13
|
+
l as ProEditPageProvider,
|
|
14
|
+
x as StableProTextArea,
|
|
15
|
+
S as StashButton,
|
|
16
|
+
s as SubmitButton,
|
|
17
|
+
p as proEditPageShellStyles,
|
|
18
|
+
u as useProEditPageContext
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const o = "_pageContainer_p6ji9_3", n = "_formScrollBody_p6ji9_2", t = "_inlineEditFooter_p6ji9_29", e = {
|
|
2
|
+
pageContainer: o,
|
|
3
|
+
formScrollBody: n,
|
|
4
|
+
inlineEditFooter: t
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
e as default,
|
|
8
|
+
n as formScrollBody,
|
|
9
|
+
t as inlineEditFooter,
|
|
10
|
+
o as pageContainer
|
|
11
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { SchemaFormProps, EnhancedFormHelpers } from '@hi-ui/schema-form';
|
|
3
|
+
/** 提交/暂存回调入参:成功时为接口返回值,失败时为错误对象 */
|
|
4
|
+
export type EditResponse = unknown;
|
|
5
|
+
/** before 回调签名:已校验的 data、ctx.formRef,返回 formData 继续,返回 false 中止 */
|
|
6
|
+
export type BeforeActionFn = (data: AnyObject, ctx: {
|
|
7
|
+
formRef: RefObject<EnhancedFormHelpers>;
|
|
8
|
+
}) => Promise<AnyObject | boolean | void> | AnyObject | boolean | void;
|
|
9
|
+
export type ProEditPageProps = {
|
|
10
|
+
fields?: SchemaFormProps['fields'];
|
|
11
|
+
groups?: SchemaFormProps['groups'];
|
|
12
|
+
steps?: [];
|
|
13
|
+
/** 提交前回调:校验/脏检查,返回 formData 继续,返回 false 中止 */
|
|
14
|
+
beforeSubmit?: BeforeActionFn;
|
|
15
|
+
/** 暂存前回调 */
|
|
16
|
+
beforeStash?: BeforeActionFn;
|
|
17
|
+
/** 取消回调 */
|
|
18
|
+
onCancel?: () => void;
|
|
19
|
+
/** 提交成功回调 */
|
|
20
|
+
onSubmitSuccess?: (res: EditResponse) => void;
|
|
21
|
+
/** 提交失败回调 */
|
|
22
|
+
onSubmitError?: (res: EditResponse) => void;
|
|
23
|
+
/** 暂存成功回调 */
|
|
24
|
+
onStashSuccess?: (res: EditResponse) => void;
|
|
25
|
+
/** 暂存失败回调 */
|
|
26
|
+
onStashError?: (res: EditResponse) => void;
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { EnhancedFormHelpers } from '@hi-ui/schema-form';
|
|
3
|
+
import type { BeforeActionFn } from '../types';
|
|
4
|
+
export type ResolveFormDataOpts = {
|
|
5
|
+
formRef: RefObject<EnhancedFormHelpers>;
|
|
6
|
+
before?: BeforeActionFn;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* 解析 formData
|
|
10
|
+
* - 始终先执行 formRef.validate,校验通过后再执行 before(若有)
|
|
11
|
+
* - before 明确返回 false 时中止,返回其他值则继续
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveFormData(opts: ResolveFormDataOpts): Promise<AnyObject | false>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
async function s(a) {
|
|
2
|
+
const { formRef: o, before: n } = a, e = await o.current?.validate?.();
|
|
3
|
+
if (e === void 0) return !1;
|
|
4
|
+
if (!n) return e;
|
|
5
|
+
const f = { formRef: o }, t = e;
|
|
6
|
+
return Promise.resolve(n(t, f)).then((r) => r === !1 ? !1 : r === void 0 || r === !0 ? t : r);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
s as resolveFormData
|
|
10
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Drawer } from '@hi-ui/hiui';
|
|
3
|
+
import styles from './index.module.scss';
|
|
4
|
+
export type ProFormDrawerProps = ComponentProps<typeof Drawer> & {
|
|
5
|
+
bodyClassName?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function ProFormDrawer({ className, bodyClassName, children, ...drawerProps }: ProFormDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ProDrawerFooterActions({ className, children, }: {
|
|
9
|
+
className?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { styles as proFormDrawerStyles };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { cx as m } from "@hi-ui/classname";
|
|
3
|
+
import { Drawer as i } from "@hi-ui/hiui";
|
|
4
|
+
import a from "./index.module.scss.js";
|
|
5
|
+
function w({
|
|
6
|
+
className: o,
|
|
7
|
+
bodyClassName: r,
|
|
8
|
+
children: e,
|
|
9
|
+
...s
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ t(i, { className: m(a.drawerRoot, o), ...s, children: r ? /* @__PURE__ */ t("div", { className: r, children: e }) : e });
|
|
12
|
+
}
|
|
13
|
+
function l({
|
|
14
|
+
className: o,
|
|
15
|
+
children: r
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ t("div", { className: m(a.drawerFooterActions, o), children: r });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
l as ProDrawerFooterActions,
|
|
21
|
+
w as ProFormDrawer,
|
|
22
|
+
a as proFormDrawerStyles
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProFormDrawer, ProDrawerFooterActions, proFormDrawerStyles } from './entry';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useProps as i } from "./hooks/use-props.js";
|
|
3
|
+
import t from "./index.module.scss.js";
|
|
4
|
+
import { InnerProvider as n } from "./context/inner.js";
|
|
5
|
+
function l(r) {
|
|
6
|
+
const { propsRef: o } = i(r);
|
|
7
|
+
return /* @__PURE__ */ e(n, { value: { propsRef: o }, children: /* @__PURE__ */ e("div", { className: `pro-list-page ${t.pageContainer}`, children: r.children }) });
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
l as ProListPage
|
|
11
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type QueryFilterProps, type FilterFieldProps } from '@hi-ui/query-filter';
|
|
3
|
+
import type { FieldConfigType } from '@hi-ui/schema-core';
|
|
4
|
+
import type { ProFieldMapType } from '@hi-ui/schema-fields';
|
|
5
|
+
/** 唯一转换:FieldConfigType[] → FilterFieldProps[] + defaultFormData,组件由 field.renderer.renderFormItem 提供 */
|
|
6
|
+
export declare function mapFields(fields: FieldConfigType[], fieldMap: ProFieldMapType): FilterFieldProps[];
|
|
7
|
+
export type ProListPageQueryFilterProps = {
|
|
8
|
+
/** 为 false 时不渲染前置关键词框(例如筛选区仅有选择型控件、无文本检索) */
|
|
9
|
+
showKeywordSearch?: boolean;
|
|
10
|
+
/** 行内筛选字段名是否可见。典型列表页默认隐藏外部 label;FilterDrawer 同样复用 filterFields.label。 */
|
|
11
|
+
showLabel?: boolean;
|
|
12
|
+
/** 前置合并关键词检索占位符(`field="keyword"`,与典型页「多字段合并一框」一致) */
|
|
13
|
+
searchPlaceholder?: string;
|
|
14
|
+
prepend?: React.ReactNode | React.ReactNode[];
|
|
15
|
+
append?: React.ReactNode | React.ReactNode[];
|
|
16
|
+
defaultVisible?: boolean;
|
|
17
|
+
drawerWidth?: number;
|
|
18
|
+
drawerTitle?: React.ReactNode;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
export type QueryFilterBridgeProps = Omit<QueryFilterProps, 'filterFields' | 'formData'> & ProListPageQueryFilterProps;
|
|
22
|
+
declare function QueryFilterBridge(props: QueryFilterBridgeProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export { QueryFilterBridge as QueryFilter };
|