@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.
Files changed (111) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/dist/host.d.ts +1 -0
  4. package/dist/host.js +7 -0
  5. package/dist/index.d.ts +10 -0
  6. package/dist/index.js +75 -0
  7. package/dist/pro-detail-drawer/entry.d.ts +12 -0
  8. package/dist/pro-detail-drawer/entry.js +23 -0
  9. package/dist/pro-detail-drawer/index.d.ts +1 -0
  10. package/dist/pro-detail-drawer/index.js +7 -0
  11. package/dist/pro-detail-drawer/index.module.scss.js +9 -0
  12. package/dist/pro-detail-page/ProDetailPage.d.ts +3 -0
  13. package/dist/pro-detail-page/ProDetailPage.js +13 -0
  14. package/dist/pro-detail-page/context/entry.d.ts +15 -0
  15. package/dist/pro-detail-page/context/entry.js +29 -0
  16. package/dist/pro-detail-page/context/index.d.ts +2 -0
  17. package/dist/pro-detail-page/context/inner.d.ts +10 -0
  18. package/dist/pro-detail-page/context/inner.js +9 -0
  19. package/dist/pro-detail-page/hooks/use-fetch-detail.d.ts +11 -0
  20. package/dist/pro-detail-page/hooks/use-fetch-detail.js +18 -0
  21. package/dist/pro-detail-page/hooks/use-props.d.ts +9 -0
  22. package/dist/pro-detail-page/hooks/use-props.js +12 -0
  23. package/dist/pro-detail-page/index.d.ts +3 -0
  24. package/dist/pro-detail-page/index.js +7 -0
  25. package/dist/pro-detail-page/index.module.scss.js +7 -0
  26. package/dist/pro-detail-page/types.d.ts +3 -0
  27. package/dist/pro-edit-page/ProEditPage.d.ts +3 -0
  28. package/dist/pro-edit-page/ProEditPage.js +11 -0
  29. package/dist/pro-edit-page/StableProTextArea.d.ts +8 -0
  30. package/dist/pro-edit-page/StableProTextArea.js +47 -0
  31. package/dist/pro-edit-page/bridge/form.d.ts +6 -0
  32. package/dist/pro-edit-page/bridge/form.js +15 -0
  33. package/dist/pro-edit-page/components/cancel-button.d.ts +2 -0
  34. package/dist/pro-edit-page/components/cancel-button.js +10 -0
  35. package/dist/pro-edit-page/components/index.d.ts +3 -0
  36. package/dist/pro-edit-page/components/stash-button.d.ts +2 -0
  37. package/dist/pro-edit-page/components/stash-button.js +22 -0
  38. package/dist/pro-edit-page/components/submit-button.d.ts +2 -0
  39. package/dist/pro-edit-page/components/submit-button.js +22 -0
  40. package/dist/pro-edit-page/context/entry.d.ts +27 -0
  41. package/dist/pro-edit-page/context/entry.js +37 -0
  42. package/dist/pro-edit-page/context/index.d.ts +2 -0
  43. package/dist/pro-edit-page/context/inner.d.ts +9 -0
  44. package/dist/pro-edit-page/context/inner.js +16 -0
  45. package/dist/pro-edit-page/hooks/use-detail-load.d.ts +11 -0
  46. package/dist/pro-edit-page/hooks/use-detail-load.js +23 -0
  47. package/dist/pro-edit-page/hooks/use-props.d.ts +31 -0
  48. package/dist/pro-edit-page/hooks/use-props.js +24 -0
  49. package/dist/pro-edit-page/hooks/use-stash-action.d.ts +9 -0
  50. package/dist/pro-edit-page/hooks/use-stash-action.js +19 -0
  51. package/dist/pro-edit-page/hooks/use-submit-action.d.ts +9 -0
  52. package/dist/pro-edit-page/hooks/use-submit-action.js +19 -0
  53. package/dist/pro-edit-page/index.d.ts +7 -0
  54. package/dist/pro-edit-page/index.js +19 -0
  55. package/dist/pro-edit-page/index.module.scss.js +11 -0
  56. package/dist/pro-edit-page/types.d.ts +27 -0
  57. package/dist/pro-edit-page/utils/resolve-form-data.d.ts +13 -0
  58. package/dist/pro-edit-page/utils/resolve-form-data.js +10 -0
  59. package/dist/pro-form-drawer/entry.d.ts +12 -0
  60. package/dist/pro-form-drawer/entry.js +23 -0
  61. package/dist/pro-form-drawer/index.d.ts +1 -0
  62. package/dist/pro-form-drawer/index.js +7 -0
  63. package/dist/pro-form-drawer/index.module.scss.js +9 -0
  64. package/dist/pro-list-page/ProListPage.d.ts +3 -0
  65. package/dist/pro-list-page/ProListPage.js +11 -0
  66. package/dist/pro-list-page/bridge/index.d.ts +2 -0
  67. package/dist/pro-list-page/bridge/query-filter.d.ts +23 -0
  68. package/dist/pro-list-page/bridge/query-filter.js +146 -0
  69. package/dist/pro-list-page/bridge/table.d.ts +7 -0
  70. package/dist/pro-list-page/bridge/table.js +62 -0
  71. package/dist/pro-list-page/context/entry.d.ts +24 -0
  72. package/dist/pro-list-page/context/entry.js +42 -0
  73. package/dist/pro-list-page/context/index.d.ts +2 -0
  74. package/dist/pro-list-page/context/inner.d.ts +10 -0
  75. package/dist/pro-list-page/context/inner.js +16 -0
  76. package/dist/pro-list-page/hooks/use-fetch-list.d.ts +25 -0
  77. package/dist/pro-list-page/hooks/use-fetch-list.js +64 -0
  78. package/dist/pro-list-page/hooks/use-filter-height.d.ts +7 -0
  79. package/dist/pro-list-page/hooks/use-filter-height.js +22 -0
  80. package/dist/pro-list-page/hooks/use-props.d.ts +9 -0
  81. package/dist/pro-list-page/hooks/use-props.js +16 -0
  82. package/dist/pro-list-page/index.d.ts +6 -0
  83. package/dist/pro-list-page/index.js +16 -0
  84. package/dist/pro-list-page/index.module.scss.js +7 -0
  85. package/dist/pro-list-page/query-filter-picker-overlay.d.ts +23 -0
  86. package/dist/pro-list-page/query-filter-picker-overlay.js +8 -0
  87. package/dist/pro-list-page/types.d.ts +8 -0
  88. package/dist/pro-stat-page/entry.d.ts +30 -0
  89. package/dist/pro-stat-page/entry.js +101 -0
  90. package/dist/pro-stat-page/index.d.ts +1 -0
  91. package/dist/pro-stat-page/index.js +8 -0
  92. package/dist/pro-stat-page/index.module.scss.js +31 -0
  93. package/dist/pro-table-page/entry.d.ts +17 -0
  94. package/dist/pro-table-page/entry.js +70 -0
  95. package/dist/pro-table-page/index.d.ts +1 -0
  96. package/dist/pro-table-page/index.js +8 -0
  97. package/dist/pro-table-page/index.module.scss.js +23 -0
  98. package/dist/pro-tree-split-page/entry.d.ts +20 -0
  99. package/dist/pro-tree-split-page/entry.js +107 -0
  100. package/dist/pro-tree-split-page/index.d.ts +1 -0
  101. package/dist/pro-tree-split-page/index.js +6 -0
  102. package/dist/pro-tree-split-page/index.module.scss.js +25 -0
  103. package/dist/schema-field-map/StableProCheckSelect.d.ts +9 -0
  104. package/dist/schema-field-map/StableProCheckSelect.js +16 -0
  105. package/dist/schema-field-map/field-map.d.ts +9 -0
  106. package/dist/schema-field-map/field-map.js +33 -0
  107. package/dist/schema-field-map/index.d.ts +2 -0
  108. package/dist/styles.css +1 -0
  109. package/dist/typical-page-host/index.d.ts +18 -0
  110. package/dist/typical-page-host/index.js +40 -0
  111. package/package.json +101 -0
@@ -0,0 +1,146 @@
1
+ import { jsxs as B, jsx as u, Fragment as S } from "react/jsx-runtime";
2
+ import Q, { useState as y, useMemo as C } from "react";
3
+ import { useMemoizedFn as V } from "ahooks";
4
+ import { Button as q } from "@hi-ui/hiui";
5
+ import { ClearOutlined as Y } from "@hi-ui/icons";
6
+ import { QueryFilterProvider as E, QueryFilter as j, FilterDrawer as L, FilterButton as z, SearchInput as O } from "@hi-ui/query-filter";
7
+ import { useSubscribe as K } from "@hi-ui/use-subscription";
8
+ import { matchFieldRenderFn as T } from "@hi-ui/schema-fields";
9
+ import { toValues as h, toFilters as g, buildEmptyFilterFormValues as _ } from "../hooks/use-fetch-list.js";
10
+ import { useProListPageContext as w } from "../context/entry.js";
11
+ import { useInnerContext as P } from "../context/inner.js";
12
+ import { useTypicalPageFieldMap as G } from "../../schema-field-map/field-map.js";
13
+ function H(e, r) {
14
+ return e.map((t) => {
15
+ const n = t.title, l = t.dataIndex, p = !t.control?.hidden;
16
+ return {
17
+ field: l,
18
+ // 保留 label 给 FilterDrawer 和显式 showLabel 场景复用;典型列表页行内筛选默认隐藏该标签。
19
+ label: n,
20
+ visible: p,
21
+ component: Q.createElement(J, { field: t, fieldMap: r })
22
+ };
23
+ });
24
+ }
25
+ function J(e) {
26
+ const { field: r, fieldMap: o, ...t } = e, n = r, l = n.renderer?.renderFormItem ?? T({
27
+ name: "QueryFilter",
28
+ field: n,
29
+ fieldMap: o,
30
+ renderKey: "renderFormItem"
31
+ });
32
+ return l ? /* @__PURE__ */ u(S, { children: l(null, {
33
+ field: n,
34
+ // @ts-expect-error 无法获取正确的 formBinding 类型
35
+ formBinding: t,
36
+ rawData: {},
37
+ // @ts-expect-error 此处没有定义 formRef
38
+ formRef: null
39
+ }) }) : null;
40
+ }
41
+ const N = (e) => e === void 0 || e === "" || e === null || Array.isArray(e) && e.length === 0;
42
+ function U() {
43
+ const { subscription: e } = w(), { allDepValues: r } = K(e, ["filters"]), o = r.filters, t = h(o ?? []), n = Object.values(t).filter((l) => !N(l)).length;
44
+ return { formData: t, filteredCount: n };
45
+ }
46
+ function W() {
47
+ const { propsRef: e } = P(), r = e.current.queryFields, o = G(), t = C(
48
+ () => H(r ?? [], o),
49
+ [r, o]
50
+ ), [n, l] = y({}), { allFields: p, showedFields: f } = C(() => {
51
+ const s = [], m = [];
52
+ for (const i of t) {
53
+ const a = n[i.field] ?? i.visible;
54
+ s.push({ ...i, visible: a }), a && m.push(i);
55
+ }
56
+ return { allFields: s, showedFields: m };
57
+ }, [t, n]), F = V((s) => {
58
+ l((m) => {
59
+ const i = { ...m };
60
+ return s.forEach((a) => {
61
+ i[a.field] = a.visible ?? !0;
62
+ }), i;
63
+ });
64
+ });
65
+ return { allFields: p, showedFields: f, setAllFields: F };
66
+ }
67
+ function X(e) {
68
+ const { subscription: r } = w(), { allDepValues: o } = K(r, ["filters"]), t = h(o.filters ?? []), n = t.keyword != null && t.keyword !== "" ? String(t.keyword) : "", l = V(
69
+ (p, f) => {
70
+ const F = h(r.getValue().filters ?? []);
71
+ r.mergeValue({
72
+ filters: g({ ...F, keyword: f }),
73
+ pagination: { current: 1 }
74
+ });
75
+ }
76
+ );
77
+ return /* @__PURE__ */ u(O, { placeholder: e.placeholder, value: n, onChange: l });
78
+ }
79
+ function ue(e) {
80
+ const { subscription: r } = w(), { propsRef: o } = P(), {
81
+ // 典型表格页默认回到 HiUI5 QueryFilter 官方行为:showLabel=false + appearance=contained。
82
+ // 这里需要显式给 contained,避免把 `appearance={undefined}` 传下去时冲掉 QueryFilter 内部默认值。
83
+ appearance: t = "contained",
84
+ showKeywordSearch: n = !0,
85
+ showLabel: l = !1,
86
+ searchPlaceholder: p = "关键词",
87
+ prepend: f,
88
+ ...F
89
+ } = e, { formData: s, filteredCount: m } = U(), { allFields: i, showedFields: a, setAllFields: R } = W(), [x, b] = y(!1), [D, k] = y(0), I = (d) => {
90
+ const v = { ...h(r.getValue().filters ?? []), ...d };
91
+ r.mergeValue({
92
+ filters: g(v),
93
+ pagination: { current: 1 }
94
+ }), e.onChange?.(d);
95
+ }, M = (d, c) => {
96
+ R(c);
97
+ const A = { ...h(r.getValue().filters ?? []), ...d };
98
+ r.mergeValue({
99
+ filters: g(A),
100
+ pagination: { current: 1 }
101
+ });
102
+ };
103
+ return /* @__PURE__ */ B(E, { children: [
104
+ /* @__PURE__ */ u(
105
+ j,
106
+ {
107
+ prepend: f ?? (n ? /* @__PURE__ */ u(X, { placeholder: p }) : void 0),
108
+ append: [
109
+ /* @__PURE__ */ u(z, { count: m, onClick: () => b(!0), children: "全部筛选" }, "all-filter"),
110
+ m > 0 ? /* @__PURE__ */ u(q, { icon: /* @__PURE__ */ u(Y, {}), onClick: () => {
111
+ const d = _(o.current.queryFields, {
112
+ includeKeyword: n && f == null
113
+ });
114
+ r.setValue((c) => ({
115
+ ...c,
116
+ filters: g(d),
117
+ pagination: { ...c.pagination, current: 1 }
118
+ })), k((c) => c + 1), e.onChange?.(d);
119
+ }, children: "清空" }, "clear-filter") : null
120
+ ],
121
+ appearance: t,
122
+ showLabel: l,
123
+ ...F,
124
+ onChange: I,
125
+ formData: s,
126
+ filterFields: a
127
+ }
128
+ ),
129
+ /* @__PURE__ */ u(
130
+ L,
131
+ {
132
+ width: 360,
133
+ visible: x,
134
+ title: "全部筛选",
135
+ formData: s,
136
+ onChange: M,
137
+ filterFields: i,
138
+ onClose: () => b(!1)
139
+ }
140
+ )
141
+ ] }, D);
142
+ }
143
+ export {
144
+ ue as QueryFilter,
145
+ H as mapFields
146
+ };
@@ -0,0 +1,7 @@
1
+ import type { TableProps } from '@hi-ui/hiui';
2
+ type PaginationProps = NonNullable<Partial<TableProps['pagination']>>;
3
+ type TableBridgeProps = Omit<TableProps, 'data' | 'pagination'> & {
4
+ paginationProps?: PaginationProps;
5
+ };
6
+ declare function TableBridge(props: TableBridgeProps): import("react/jsx-runtime").JSX.Element;
7
+ export { TableBridge as Table, type TableBridgeProps as TableProps, };
@@ -0,0 +1,62 @@
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import { SchemaTable as b } from "@hi-ui/schema-table";
3
+ import { useSubscribe as C } from "@hi-ui/use-subscription";
4
+ import { cx as P } from "@hi-ui/classname";
5
+ import x from "@hi-ui/empty-state";
6
+ import { useProListPageContext as z } from "../context/entry.js";
7
+ import { useInnerContext as S } from "../context/inner.js";
8
+ function N(t) {
9
+ const { subscription: i, listData: o, isListDataLoading: m } = z(), { propsRef: c } = S(), { tableFields: n = [] } = c.current, { allDepValues: f } = C(i, ["filters", "pagination"]), s = f.pagination, p = (e, a, l) => {
10
+ i.mergeValue({ pagination: { current: e, pageSize: l } }), t.paginationProps?.onChange?.(e, a, l);
11
+ }, d = (e, a) => {
12
+ i.mergeValue({ pagination: { current: a, pageSize: e } }), t.paginationProps?.onPageSizeChange?.(e, a);
13
+ }, u = P("pro-list-page__table", t.className), r = o.total ?? 0, h = r > 0;
14
+ return /* @__PURE__ */ g(
15
+ b,
16
+ {
17
+ fields: n,
18
+ dataSource: o.list,
19
+ className: u,
20
+ tableProps: {
21
+ fieldKey: "id",
22
+ setting: !0,
23
+ loading: m,
24
+ fixedToColumn: {
25
+ // TODO 此处还有优化空间
26
+ left: n.filter((e) => e.control?.fixed === "left").map((e) => e.dataIndex).slice(-1)[0],
27
+ right: n.filter((e) => e.control?.fixed === "right").map((e) => e.dataIndex).slice(-1)[0]
28
+ },
29
+ sticky: !0,
30
+ bordered: !1,
31
+ ...t,
32
+ /** 与典型页表格行高基线一致:列表默认中号 */
33
+ size: t.size ?? "md",
34
+ /** 默认 true;置于 `...props` 之后以便单页 `resizable={false}` 覆盖 */
35
+ resizable: t.resizable !== !1,
36
+ /**
37
+ * 空数据:`@hi-ui/table` 用 `pagination={false}` 整块不渲染底部分页(见 `Table.js` · `hiddenPagination`)。
38
+ * 总条数 0 时仍传对象会出现「共 0 条」等,与产品约定不符。
39
+ */
40
+ pagination: h ? {
41
+ showTotal: !0,
42
+ showJumper: !0,
43
+ pageSizeOptions: [20, 50, 100, 200],
44
+ ...t.paginationProps,
45
+ total: r,
46
+ current: s.current,
47
+ pageSize: s.pageSize,
48
+ onChange: p,
49
+ onPageSizeChange: d
50
+ } : !1,
51
+ /**
52
+ * 与 HiUI 文档「基础用法」一致:`<EmptyState />` 使用默认灰阶线稿资源(`icons/default`)。
53
+ * **禁止**表格空状态使用 `@hi-ui/empty-state` 的 `*_COLORFUL` 插图(见 `empty-state.mdx` · 彩色图标)。
54
+ */
55
+ emptyContent: t.emptyContent ?? /* @__PURE__ */ g(x, {})
56
+ }
57
+ }
58
+ );
59
+ }
60
+ export {
61
+ N as Table
62
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { type Subscription } from '@hi-ui/use-subscription';
3
+ import type { GetDataSourceBasicParamsType, GetDataSourceResType, GetDataSourceType } from '@hi-ui/schema-core';
4
+ /** 与 table-normal ListSubscriptionType 对齐:筛选、排序、分页 */
5
+ export type ListSubscriptionType = {
6
+ filters: GetDataSourceBasicParamsType['filters'];
7
+ sorters: GetDataSourceBasicParamsType['sorters'];
8
+ pagination: NonNullable<GetDataSourceBasicParamsType['pagination']>;
9
+ };
10
+ /** 对外暴露的 context 类型:仅包含 subscription,由 Provider 提供 */
11
+ export type ProListPageContextValue = {
12
+ subscription: Subscription<ListSubscriptionType>;
13
+ listData: GetDataSourceResType;
14
+ isListDataLoading: boolean;
15
+ getListData: () => Promise<GetDataSourceResType>;
16
+ refreshListData: () => Promise<GetDataSourceResType>;
17
+ };
18
+ export type ProListPageProviderProps = {
19
+ request?: GetDataSourceType<AnyObject>;
20
+ /** 初始每页条数,默认 20 */
21
+ defaultPageSize?: number;
22
+ };
23
+ export declare function ProListPageProvider(props: React.PropsWithChildren<ProListPageProviderProps>): import("react/jsx-runtime").JSX.Element;
24
+ export declare function useProListPageContext(): ProListPageContextValue;
@@ -0,0 +1,42 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import s from "react";
3
+ import { useSubscription as c } from "@hi-ui/use-subscription";
4
+ import { useFetchList as L } from "../hooks/use-fetch-list.js";
5
+ const a = s.createContext(null);
6
+ function d(e) {
7
+ const { request: r, defaultPageSize: o } = e, i = c({
8
+ filters: [],
9
+ sorters: [],
10
+ pagination: {
11
+ current: 1,
12
+ pageSize: o ?? 20
13
+ }
14
+ }), t = L({ subscription: i, request: r }), n = s.useMemo(
15
+ () => ({
16
+ subscription: i,
17
+ listData: t.listData,
18
+ isListDataLoading: t.isListDataLoading,
19
+ getListData: t.getListData,
20
+ refreshListData: t.refreshListData
21
+ }),
22
+ [
23
+ // 依赖项
24
+ i,
25
+ t.listData,
26
+ t.isListDataLoading,
27
+ t.getListData,
28
+ t.refreshListData
29
+ ]
30
+ );
31
+ return /* @__PURE__ */ u(a.Provider, { value: n, children: e.children });
32
+ }
33
+ function l() {
34
+ const e = s.useContext(a);
35
+ if (!e)
36
+ throw new Error("useProListPageContext must be used within a ProListPageProvider");
37
+ return e;
38
+ }
39
+ export {
40
+ d as ProListPageProvider,
41
+ l as useProListPageContext
42
+ };
@@ -0,0 +1,2 @@
1
+ export { useInnerContext, InnerProvider } from './inner';
2
+ export { ProListPageProvider, useProListPageContext, type ProListPageContextValue } from './entry';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { NormalizedProListPageProps } from '../hooks/use-props';
3
+ export type InnerContextValue = {
4
+ propsRef: React.MutableRefObject<NormalizedProListPageProps>;
5
+ };
6
+ export declare function InnerProvider(props: React.PropsWithChildren<{
7
+ value: InnerContextValue;
8
+ }>): import("react/jsx-runtime").JSX.Element;
9
+ /** 仅在 EntryProvider 内部可用,外部调用返回 null */
10
+ 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 i(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 ProListPage.useInnerContext");
11
+ return e;
12
+ }
13
+ export {
14
+ i as InnerProvider,
15
+ c as useInnerContext
16
+ };
@@ -0,0 +1,25 @@
1
+ import { type Subscription } from '@hi-ui/use-subscription';
2
+ import type { FieldConfigType, GetDataSourceParamsType, GetDataSourceType } from '@hi-ui/schema-core';
3
+ import type { ListSubscriptionType } from '../context/entry';
4
+ type Filters = Required<GetDataSourceParamsType>['filters'];
5
+ type UseFetchListParams = {
6
+ subscription: Subscription<ListSubscriptionType>;
7
+ request?: GetDataSourceType<AnyObject>;
8
+ };
9
+ export declare function useFetchList(params: UseFetchListParams): {
10
+ listData: import("@hi-ui/schema-core").GetDataSourceResType<AnyObject>;
11
+ isListDataLoading: boolean;
12
+ getListData: () => Promise<import("@hi-ui/schema-core").GetDataSourceResType<AnyObject>>;
13
+ refreshListData: () => Promise<import("@hi-ui/schema-core").GetDataSourceResType<AnyObject>>;
14
+ };
15
+ export declare function toFilters(data: UnknownObject): Filters;
16
+ export declare function toValues(filters: Filters): UnknownObject;
17
+ export declare function buildEmptyFilterFormValues(queryFields: FieldConfigType[] | undefined, options: {
18
+ includeKeyword?: boolean;
19
+ }): Record<string, unknown>;
20
+ export declare function toLegacyQueryParams(params: GetDataSourceParamsType): {
21
+ sorters: import("@hi-ui/schema-core").SortingStateType[] | undefined;
22
+ current: number | undefined;
23
+ pageSize: number | undefined;
24
+ };
25
+ export {};
@@ -0,0 +1,64 @@
1
+ import { useRequest as p } from "ahooks";
2
+ import { useSubscribe as g } from "@hi-ui/use-subscription";
3
+ const u = { list: [], total: 0, pageSize: 0, current: 0 };
4
+ function h(t) {
5
+ const { subscription: e, request: r } = t, { allDepValues: n } = g(e, ["filters", "sorters", "pagination"]), { filters: i, sorters: s, pagination: a } = n, { data: c, loading: l, runAsync: f, refreshAsync: d } = p(
6
+ async function() {
7
+ const o = r;
8
+ return o ? o({
9
+ pagination: a ?? { current: 1, pageSize: 20 },
10
+ filters: i,
11
+ sorters: s
12
+ }) : u;
13
+ },
14
+ {
15
+ refreshDeps: [i, s, a],
16
+ debounceWait: 200
17
+ }
18
+ );
19
+ return {
20
+ listData: c ?? u,
21
+ isListDataLoading: l,
22
+ getListData: f,
23
+ refreshListData: d
24
+ };
25
+ }
26
+ function v(t) {
27
+ return Object.entries(t).map(([e, r]) => ({ id: e, value: r }));
28
+ }
29
+ function m(t) {
30
+ return Array.isArray(t) ? Object.fromEntries(t.map((e) => [e.id, e?.value])) : {};
31
+ }
32
+ function y(t) {
33
+ const e = String(t.valueType ?? "").toLowerCase();
34
+ if (e.includes("date") || e.includes("time"))
35
+ return null;
36
+ if (e.includes("check") && (e.includes("select") || e.includes("tree")))
37
+ return [];
38
+ }
39
+ function z(t, e) {
40
+ const r = {};
41
+ e.includeKeyword !== !1 && (r.keyword = "");
42
+ for (const n of t ?? []) {
43
+ const i = n.dataIndex;
44
+ i == null || i === "" || (r[String(i)] = y(n));
45
+ }
46
+ return r;
47
+ }
48
+ function A(t) {
49
+ const { pagination: e, filters: r, sorters: n } = t;
50
+ return {
51
+ current: e?.current,
52
+ pageSize: e?.pageSize,
53
+ ...r ? m(r) : {},
54
+ sorters: n
55
+ // TODO 待更新
56
+ };
57
+ }
58
+ export {
59
+ z as buildEmptyFilterFormValues,
60
+ v as toFilters,
61
+ A as toLegacyQueryParams,
62
+ m as toValues,
63
+ h as useFetchList
64
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 通过监听筛选容器 DOM 尺寸变化获取高度,用于表格 sticky 定位
3
+ */
4
+ export declare function useFilterHeight(): {
5
+ filterRef: import("react").RefObject<HTMLDivElement>;
6
+ filterHeight: number;
7
+ };
@@ -0,0 +1,22 @@
1
+ import { useRef as u, useState as l, useEffect as a } from "react";
2
+ function m() {
3
+ const t = u(null), [o, r] = l(0);
4
+ return a(() => {
5
+ const e = t.current;
6
+ if (!e) return;
7
+ const s = requestAnimationFrame(() => {
8
+ r(e.offsetHeight);
9
+ }), n = new ResizeObserver((i) => {
10
+ for (const f of i) {
11
+ const c = f.target;
12
+ r(c.offsetHeight);
13
+ }
14
+ });
15
+ return n.observe(e), () => {
16
+ cancelAnimationFrame(s), n.disconnect();
17
+ };
18
+ }, []), { filterRef: t, filterHeight: o };
19
+ }
20
+ export {
21
+ m as useFilterHeight
22
+ };
@@ -0,0 +1,9 @@
1
+ import type { ProListPageProps } from '../types';
2
+ import { ReadonlyRefObject } from '@hi-ui/use-ref-state';
3
+ /** 统一化后的 ProListPage props,供 context 的 propsRef 使用 */
4
+ export type NormalizedProListPageProps = ProListPageProps;
5
+ declare function getNormalizedProps(props: ProListPageProps): NormalizedProListPageProps;
6
+ export declare function useProps(props: ProListPageProps): {
7
+ propsRef: ReadonlyRefObject<ProListPageProps>;
8
+ };
9
+ export { getNormalizedProps };
@@ -0,0 +1,16 @@
1
+ import { useLatest as o } from "ahooks";
2
+ function r(e) {
3
+ const t = e.queryFields ?? [], s = e.tableFields ?? [];
4
+ return {
5
+ queryFields: t,
6
+ tableFields: s
7
+ };
8
+ }
9
+ function i(e) {
10
+ const t = r(e);
11
+ return { propsRef: o(t) };
12
+ }
13
+ export {
14
+ r as getNormalizedProps,
15
+ i as useProps
16
+ };
@@ -0,0 +1,6 @@
1
+ export { ProListPage } from './ProListPage';
2
+ export * from './bridge';
3
+ export { queryFilterPickerOverlay, queryFilterDatePickerOverlay, } from './query-filter-picker-overlay';
4
+ export type { ProListPageProps } from './types';
5
+ export { ProListPageProvider, useProListPageContext } from './context/entry';
6
+ export { useFilterHeight } from './hooks/use-filter-height';
@@ -0,0 +1,16 @@
1
+ import { ProListPage as o } from "./ProListPage.js";
2
+ import { queryFilterDatePickerOverlay as i, queryFilterPickerOverlay as P } from "./query-filter-picker-overlay.js";
3
+ import { ProListPageProvider as l, useProListPageContext as x } from "./context/entry.js";
4
+ import { useFilterHeight as m } from "./hooks/use-filter-height.js";
5
+ import { QueryFilter as s } from "./bridge/query-filter.js";
6
+ import { Table as y } from "./bridge/table.js";
7
+ export {
8
+ o as ProListPage,
9
+ l as ProListPageProvider,
10
+ s as QueryFilter,
11
+ y as Table,
12
+ i as queryFilterDatePickerOverlay,
13
+ P as queryFilterPickerOverlay,
14
+ m as useFilterHeight,
15
+ x as useProListPageContext
16
+ };
@@ -0,0 +1,7 @@
1
+ const e = "_pageContainer_4xrht_1", t = {
2
+ pageContainer: e
3
+ };
4
+ export {
5
+ t as default,
6
+ e as pageContainer
7
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * HiUI `@hi-ui/picker`(`Select` / `CheckSelect` 等):`optionWidth` 未定义时 `matchWidth: true`,
3
+ * 下拉层宽度贴合触发器。表格筛选触发器较窄时选项会换行。
4
+ * 传本对象可关闭「与触发器同宽」,由面板内容撑开宽度。
5
+ *
6
+ * @see `typical-page-patterns.md` §3 · 筛选区 · 下拉选项区宽度
7
+ */
8
+ export declare const queryFilterPickerOverlay: {
9
+ readonly matchWidth: false;
10
+ };
11
+ /**
12
+ * `QueryFilter` 行内 / 抽屉内的 `@hi-ui/date-picker`:
13
+ * `table-stat` 等页面存在 **`filterContainer` `position:sticky` + `z-index`**、白卡 **`overflow:hidden`**、
14
+ * **`Table` `maxHeight` + 粘性表头** 等叠层,默认 Popper **`z-index`(约 1030)** 仍可能与表头等竞争,
15
+ * 表现为 **日期范围面板点选无效或选不满**。
16
+ * 须显式抬高层级并挂到 `document.body`,与 `queryFilterPickerOverlay` 分工对称(Picker vs DatePicker)。
17
+ *
18
+ * @see `typical-page-patterns.md` §3 · 筛选区 · DatePicker 浮层
19
+ */
20
+ export declare const queryFilterDatePickerOverlay: {
21
+ readonly zIndex: 1200;
22
+ readonly container: () => HTMLElement | null;
23
+ };
@@ -0,0 +1,8 @@
1
+ const e = { matchWidth: !1 }, t = {
2
+ zIndex: 1200,
3
+ container: () => typeof document < "u" ? document.body : null
4
+ };
5
+ export {
6
+ t as queryFilterDatePickerOverlay,
7
+ e as queryFilterPickerOverlay
8
+ };
@@ -0,0 +1,8 @@
1
+ import type { FieldConfigType } from '@hi-ui/schema-core';
2
+ export type { GetDataSourceType } from '@hi-ui/schema-core';
3
+ export type ProListPageProps = {
4
+ /** 查询区字段配置 */
5
+ queryFields: FieldConfigType[];
6
+ /** 表格列字段配置 */
7
+ tableFields: FieldConfigType[];
8
+ };
@@ -0,0 +1,30 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import type { FieldConfigType } from '@hi-ui/schema-core';
3
+ import { Table } from '../pro-list-page';
4
+ import styles from './index.module.scss';
5
+ type StatOverviewBaseItem = {
6
+ title: string;
7
+ value?: number | string;
8
+ };
9
+ export declare function renderStatTableTextEllipsis(cellValue: unknown): import("react/jsx-runtime").JSX.Element;
10
+ type StatOverviewGridProps<T extends StatOverviewBaseItem> = {
11
+ request: () => Promise<{
12
+ list: T[];
13
+ }>;
14
+ minCardWidth?: number;
15
+ cardGap?: number;
16
+ renderCard?: (item: T) => ReactNode;
17
+ getKey?: (item: T, index: number) => string;
18
+ };
19
+ export declare function StatOverviewGrid<T extends StatOverviewBaseItem>({ request, minCardWidth, cardGap, renderCard, getKey, }: StatOverviewGridProps<T>): import("react/jsx-runtime").JSX.Element | null;
20
+ type StatListPageFrameProps = {
21
+ title: string;
22
+ extra?: ReactNode;
23
+ queryFields: FieldConfigType[];
24
+ tableFields: FieldConfigType[];
25
+ searchPlaceholder: string;
26
+ statSection?: ReactNode;
27
+ tableProps?: Partial<ComponentProps<typeof Table>>;
28
+ };
29
+ export declare function StatListPageFrame({ title, extra, queryFields, tableFields, searchPlaceholder, statSection, tableProps, }: StatListPageFrameProps): import("react/jsx-runtime").JSX.Element;
30
+ export { styles as proStatPageStyles };