@1money/component-ui 0.0.68 → 0.0.70

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 (69) hide show
  1. package/es/components/Icons/Wrapper.js +6 -4
  2. package/es/components/Icons/constants.d.ts +11 -0
  3. package/es/components/Icons/constants.js +32 -0
  4. package/es/components/Icons/index.d.ts +2 -0
  5. package/es/components/Icons/index.js +2 -1
  6. package/es/components/Icons/interface.d.ts +8 -1
  7. package/es/components/ProForm/interface.d.ts +3 -1
  8. package/es/components/ProForm/layouts/QueryFilter.js +5 -1
  9. package/es/components/ProTable/ProTable.d.ts +5 -0
  10. package/es/components/ProTable/ProTable.js +309 -0
  11. package/es/components/ProTable/constants.d.ts +12 -0
  12. package/es/components/ProTable/constants.js +12 -0
  13. package/es/components/ProTable/core/genColumns.d.ts +10 -0
  14. package/es/components/ProTable/core/genColumns.js +81 -0
  15. package/es/components/ProTable/core/genSearchFields.d.ts +19 -0
  16. package/es/components/ProTable/core/genSearchFields.js +103 -0
  17. package/es/components/ProTable/core/useAwaitableReload.d.ts +17 -0
  18. package/es/components/ProTable/core/useAwaitableReload.js +39 -0
  19. package/es/components/ProTable/core/utils.d.ts +12 -0
  20. package/es/components/ProTable/core/utils.js +21 -0
  21. package/es/components/ProTable/index.d.ts +4 -0
  22. package/es/components/ProTable/index.js +5 -0
  23. package/es/components/ProTable/interface.d.ts +132 -0
  24. package/es/components/ProTable/interface.js +2 -0
  25. package/es/components/ProTable/style/ProTable.css +47 -0
  26. package/es/components/ProTable/style/css.js +6 -0
  27. package/es/components/ProTable/style/index.d.ts +5 -0
  28. package/es/components/ProTable/style/index.js +6 -0
  29. package/es/components/ProTable/useFetchData.d.ts +48 -0
  30. package/es/components/ProTable/useFetchData.js +270 -0
  31. package/es/index.css +1 -1
  32. package/es/index.d.ts +3 -1
  33. package/es/index.js +2 -1
  34. package/lib/components/Icons/Wrapper.js +6 -4
  35. package/lib/components/Icons/constants.d.ts +11 -0
  36. package/lib/components/Icons/constants.js +38 -0
  37. package/lib/components/Icons/index.d.ts +2 -0
  38. package/lib/components/Icons/index.js +10 -2
  39. package/lib/components/Icons/interface.d.ts +8 -1
  40. package/lib/components/ProForm/interface.d.ts +3 -1
  41. package/lib/components/ProForm/layouts/QueryFilter.js +5 -1
  42. package/lib/components/ProTable/ProTable.d.ts +5 -0
  43. package/lib/components/ProTable/ProTable.js +316 -0
  44. package/lib/components/ProTable/constants.d.ts +12 -0
  45. package/lib/components/ProTable/constants.js +18 -0
  46. package/lib/components/ProTable/core/genColumns.d.ts +10 -0
  47. package/lib/components/ProTable/core/genColumns.js +87 -0
  48. package/lib/components/ProTable/core/genSearchFields.d.ts +19 -0
  49. package/lib/components/ProTable/core/genSearchFields.js +111 -0
  50. package/lib/components/ProTable/core/useAwaitableReload.d.ts +17 -0
  51. package/lib/components/ProTable/core/useAwaitableReload.js +46 -0
  52. package/lib/components/ProTable/core/utils.d.ts +12 -0
  53. package/lib/components/ProTable/core/utils.js +28 -0
  54. package/lib/components/ProTable/index.d.ts +4 -0
  55. package/lib/components/ProTable/index.js +33 -0
  56. package/lib/components/ProTable/interface.d.ts +132 -0
  57. package/lib/components/ProTable/interface.js +6 -0
  58. package/lib/components/ProTable/style/ProTable.css +47 -0
  59. package/lib/components/ProTable/style/css.js +8 -0
  60. package/lib/components/ProTable/style/index.d.ts +5 -0
  61. package/lib/components/ProTable/style/index.js +8 -0
  62. package/lib/components/ProTable/useFetchData.d.ts +48 -0
  63. package/lib/components/ProTable/useFetchData.js +277 -0
  64. package/lib/index.css +1 -1
  65. package/lib/index.d.ts +3 -1
  66. package/lib/index.js +8 -1
  67. package/package.json +6 -1
  68. package/scripts/mcp-server/examples.generated.json +168 -6
  69. package/scripts/mcp-server/index.generated.json +778 -4
@@ -0,0 +1,17 @@
1
+ export interface AwaitableReload {
2
+ /** Include in the fetch effect deps; a change forces the effect to re-run. */
3
+ token: number;
4
+ /** Force a refetch; resolves once `settle()` runs after the triggered fetch completes. */
5
+ request: () => Promise<void>;
6
+ /** Resolve every pending `request()` promise. Call when the triggered fetch settles. */
7
+ settle: () => void;
8
+ }
9
+ /**
10
+ * Bridges imperative, awaitable reloads onto a reactive (effect-driven) fetch.
11
+ *
12
+ * `request()` bumps `token` (which the consuming effect depends on) and returns a
13
+ * promise; the effect calls `settle()` once the fetch it triggered finishes,
14
+ * resolving that promise. This keeps a single, fresh-closure fetch path while
15
+ * still letting callers `await` a reload — no stale refs, no duplicate fetches.
16
+ */
17
+ export declare function useAwaitableReload(): AwaitableReload;
@@ -0,0 +1,39 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useRef } from 'react';
3
+ import { useMemoizedFn, useSafeState } from '@1money/hooks';
4
+ /**
5
+ * Bridges imperative, awaitable reloads onto a reactive (effect-driven) fetch.
6
+ *
7
+ * `request()` bumps `token` (which the consuming effect depends on) and returns a
8
+ * promise; the effect calls `settle()` once the fetch it triggered finishes,
9
+ * resolving that promise. This keeps a single, fresh-closure fetch path while
10
+ * still letting callers `await` a reload — no stale refs, no duplicate fetches.
11
+ */
12
+ export function useAwaitableReload() {
13
+ var _useSafeState = useSafeState(0),
14
+ _useSafeState2 = _slicedToArray(_useSafeState, 2),
15
+ token = _useSafeState2[0],
16
+ setToken = _useSafeState2[1];
17
+ var resolversRef = useRef([]);
18
+ var request = useMemoizedFn(function () {
19
+ return new Promise(function (resolve) {
20
+ resolversRef.current.push(resolve);
21
+ setToken(function (value) {
22
+ return value + 1;
23
+ });
24
+ });
25
+ });
26
+ var settle = useMemoizedFn(function () {
27
+ var resolvers = resolversRef.current;
28
+ resolversRef.current = [];
29
+ resolvers.forEach(function (resolve) {
30
+ return resolve();
31
+ });
32
+ });
33
+ return {
34
+ token: token,
35
+ request: request,
36
+ settle: settle
37
+ };
38
+ }
39
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvU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aWdnZXJlZCBmaW5pc2hlcyxcbiAqIHJlc29sdmluZyB0aGF0IHByb21pc2UuIFRoaXMga2VlcHMgYSBzaW5nbGUsIGZyZXNoLWNsb3N1cmUgZmV0Y2ggcGF0aCB3aGlsZVxuICogc3RpbGwgbGV0dGluZyBjYWxsZXJzIGBhd2FpdGAgYSByZWxvYWQg4oCUIG5vIHN0YWxlIHJlZnMsIG5vIGR1cGxpY2F0ZSBmZXRjaGVzLlxuICovXG5leHBvcnQgZnVuY3Rpb24gdXNlQXdhaXRhYmxlUmVsb2FkKCkge1xuICAgIGNvbnN0IFt0b2tlbiwgc2V0VG9rZW5dID0gdXNlU2FmZVN0YXRlKDApO1xuICAgIGNvbnN0IHJlc29sdmVyc1JlZiA9IHVzZVJlZihbXSk7XG4gICAgY29uc3QgcmVxdWVzdCA9IHVzZU1lbW9pemVkRm4oKCkgPT4gbmV3IFByb21pc2UoKHJlc29sdmUpID0+IHtcbiAgICAgICAgcmVzb2x2ZXJzUmVmLmN1cnJlbnQucHVzaChyZXNvbHZlKTtcbiAgICAgICAgc2V0VG9rZW4oKHZhbHVlKSA9PiB2YWx1ZSArIDEpO1xuICAgIH0pKTtcbiAgICBjb25zdCBzZXR0bGUgPSB1c2VNZW1vaXplZEZuKCgpID0+IHtcbiAgICAgICAgY29uc3QgcmVzb2x2ZXJzID0gcmVzb2x2ZXJzUmVmLmN1cnJlbnQ7XG4gICAgICAgIHJlc29sdmVyc1JlZi5jdXJyZW50ID0gW107XG4gICAgICAgIHJlc29sdmVycy5mb3JFYWNoKChyZXNvbHZlKSA9PiByZXNvbHZlKCkpO1xuICAgIH0pO1xuICAgIHJldHVybiB7IHRva2VuLCByZXF1ZXN0LCBzZXR0bGUgfTtcbn0iXSwic291cmNlUm9vdCI6Ii4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYyJ9
@@ -0,0 +1,12 @@
1
+ import type { TableRecord } from "../../Table";
2
+ import type { ProColumns } from '../interface';
3
+ /**
4
+ * Stable string key for a Pro column. Prefers an explicit `key`, then a string
5
+ * `dataIndex`, then an array `dataIndex` joined by `.`, falling back to the index.
6
+ */
7
+ export declare function getColumnKey<T extends TableRecord>(column: ProColumns<T>, index: number): string;
8
+ /**
9
+ * Name used for the generated search field / request param. Only a flat string
10
+ * key (`key` or string `dataIndex`) can be auto-mapped; otherwise returns null.
11
+ */
12
+ export declare function getColumnSearchName<T extends TableRecord>(column: ProColumns<T>): string | null;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Stable string key for a Pro column. Prefers an explicit `key`, then a string
3
+ * `dataIndex`, then an array `dataIndex` joined by `.`, falling back to the index.
4
+ */
5
+ export function getColumnKey(column, index) {
6
+ if (column.key !== undefined && column.key !== null) return String(column.key);
7
+ var dataIndex = column.dataIndex;
8
+ if (typeof dataIndex === 'string' || typeof dataIndex === 'number') return String(dataIndex);
9
+ if (Array.isArray(dataIndex)) return dataIndex.join('.');
10
+ return "col-".concat(index);
11
+ }
12
+ /**
13
+ * Name used for the generated search field / request param. Only a flat string
14
+ * key (`key` or string `dataIndex`) can be auto-mapped; otherwise returns null.
15
+ */
16
+ export function getColumnSearchName(column) {
17
+ if (column.key !== undefined && column.key !== null) return String(column.key);
18
+ if (typeof column.dataIndex === 'string') return column.dataIndex;
19
+ return null;
20
+ }
21
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvUHJvVGFibGUvc3JjL2NvbXBvbmVudHMvUHJvVGFibGUvY29yZS91dGlscy50cyIsImNvbXBvbmVudHMvUHJvVGFibGUvY29yZS91dGlscy5qcyJdLCJuYW1lcyI6WyJnZXRDb2x1bW5LZXkiLCJjb2x1bW4iLCJpbmRleCIsImtleSIsInVuZGVmaW5lZCIsIlN0cmluZyIsImRhdGFJbmRleCIsIkFycmF5IiwiaXNBcnJheSIsImpvaW4iLCJjb25jYXQiLCJnZXRDb2x1bW5TZWFyY2hOYW1lIl0s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JiBjb2x1bW4ua2V5ICE9PSBudWxsKVxuICAgICAgICByZXR1cm4gU3RyaW5nKGNvbHVtbi5rZXkpO1xuICAgIGlmICh0eXBlb2YgY29sdW1uLmRhdGFJbmRleCA9PT0gJ3N0cmluZycpXG4gICAgICAgIHJldHVybiBjb2x1bW4uZGF0YUluZGV4O1xuICAgIHJldHVybiBudWxsO1xufSJdLCJzb3VyY2VSb290IjoiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjIn0=
@@ -0,0 +1,4 @@
1
+ import ProTable from './ProTable';
2
+ export { ProTable } from './ProTable';
3
+ export default ProTable;
4
+ export * from './interface';
@@ -0,0 +1,5 @@
1
+ import ProTable from './ProTable';
2
+ export { ProTable } from './ProTable';
3
+ export default ProTable;
4
+ export * from './interface';
5
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvc3JjL2NvbXBvbmVudHMvUHJvVGFibGUvaW5kZXgudHMiXSwibmFtZXMiOlsiUHJvVGFibGUiXSwibWFwcGluZ3MiOiJBQUFBLE9BQU9BLFFBQVEsTUFBTSxZQUFZO0FBRWpDLFNBQVNBLFFBQVEsUUFBUSxZQUFZO0FBRXJDLGVBQWVBLFFBQVE7QUFFdkIsY0FBYyxhQUFhIiwiZmlsZSI6ImNvbXBvbmVudHMvUHJvVGFibGUvaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjIn0=
@@ -0,0 +1,132 @@
1
+ import type { ReactNode, Ref } from 'react';
2
+ import type { TableChangeMeta, TableColumn, TableProps, TableRecord, TableRowSelection, TableSize, TableSortOrder } from "../Table";
3
+ import type { ProFormValueEnumObj } from "../ProForm";
4
+ import type { ProTableValueType } from './constants';
5
+ export type { ProTableValueType } from './constants';
6
+ export interface PageInfo {
7
+ current: number;
8
+ pageSize: number;
9
+ total: number;
10
+ }
11
+ /** Shape returned by the `request` prop. */
12
+ export interface RequestData<T> {
13
+ data: T[];
14
+ /** Total record count for server-side pagination. Defaults to `data.length`. */
15
+ total?: number;
16
+ /** `false` marks a soft failure — data is left untouched, no error thrown. */
17
+ success?: boolean;
18
+ }
19
+ export interface ProTablePaginationConfig {
20
+ pageSize?: number;
21
+ current?: number;
22
+ defaultCurrent?: number;
23
+ defaultPageSize?: number;
24
+ }
25
+ /** Sort params handed to `request` — `{ [columnKey]: 'ascend' | 'descend' }`. */
26
+ export type ProTableSortParam = Record<string, Exclude<TableSortOrder, null>>;
27
+ /** Filter params handed to `request`, keyed by column key. */
28
+ export type ProTableFilterParam = Record<string, (string | number | boolean)[] | null>;
29
+ /** Remap a single search-field value into one or more request params. */
30
+ export type SearchTransform = (value: unknown) => Record<string, unknown>;
31
+ /** Extra options passed to `request` — notably an `AbortSignal` for cancellation. */
32
+ export interface ProTableRequestOptions {
33
+ signal?: AbortSignal;
34
+ }
35
+ /** The `request` contract. The 4th `options` arg carries an `AbortSignal`. */
36
+ export type ProTableRequest<T, Params extends Record<string, unknown> = Record<string, unknown>> = (params: Params & {
37
+ current?: number;
38
+ pageSize?: number;
39
+ }, sort: ProTableSortParam, filter: ProTableFilterParam, options?: ProTableRequestOptions) => Promise<RequestData<T>>;
40
+ export interface ProColumnType<T extends TableRecord = TableRecord> extends TableColumn<T> {
41
+ /** Drives the default cell render and the auto-generated search-field type. */
42
+ valueType?: ProTableValueType;
43
+ /** Enum for `select` value type — used for both cell text and field options. */
44
+ valueEnum?: ProFormValueEnumObj;
45
+ /**
46
+ * Include this column in the search form. `false` hides it. Object form lets you
47
+ * remap the submitted value into request params (e.g. a range → `{ start, end }`).
48
+ */
49
+ search?: boolean | {
50
+ transform: SearchTransform;
51
+ };
52
+ /** Omit the column from the rendered table. */
53
+ hideInTable?: boolean;
54
+ /** Omit the column from the search form (alias of `search: false`). */
55
+ hideInSearch?: boolean;
56
+ /** Provide a custom search field — overrides `valueType`. */
57
+ renderFormItem?: () => ReactNode;
58
+ /** Extra props forwarded to the generated search field. */
59
+ fieldProps?: Record<string, unknown>;
60
+ /** Default value for the generated search field. */
61
+ initialValue?: unknown;
62
+ /** Sort order of the field within the search form (ascending). */
63
+ order?: number;
64
+ }
65
+ export type ProColumns<T extends TableRecord = TableRecord> = ProColumnType<T>;
66
+ export type SyncToUrl = boolean | ((values: Record<string, unknown>, type: 'get' | 'set') => Record<string, unknown>);
67
+ export interface SearchConfig {
68
+ defaultCollapsed?: boolean;
69
+ labelWidth?: number | 'auto';
70
+ /** Visible fields before the form collapses. */
71
+ defaultColsNumber?: number;
72
+ searchText?: string;
73
+ resetText?: string;
74
+ /**
75
+ * Sync the search values to the URL query string. `true` mirrors values 1:1;
76
+ * a function maps between form values and URL params (`type` is `'get'` on read,
77
+ * `'set'` on write). Restored URL values also seed the first request.
78
+ */
79
+ syncToUrl?: SyncToUrl;
80
+ }
81
+ export interface ProTableActionRef {
82
+ /** Refetch the current page. */
83
+ reload: () => Promise<void>;
84
+ /** Reset to page 1, then refetch. */
85
+ reloadAndRest: () => Promise<void>;
86
+ /** Reset the search form and pagination to their defaults. */
87
+ reset: () => void;
88
+ setPageInfo: (info: Partial<PageInfo>) => void;
89
+ }
90
+ export interface ProTableProps<T extends TableRecord = TableRecord, Params extends Record<string, unknown> = Record<string, unknown>> extends Pick<TableProps<T>, 'rowKey' | 'rowSelection' | 'variant' | 'bordered' | 'scroll' | 'sticky' | 'expandable' | 'empty' | 'tableLayout' | 'rowClassName' | 'onRow' | 'size' | 'summary' | 'footer'> {
91
+ prefixCls?: string;
92
+ className?: string;
93
+ /**
94
+ * Column definitions. Keep this array referentially stable (module-level or
95
+ * `useMemo`) — a new array each render re-derives the columns and search form.
96
+ */
97
+ columns: ProColumns<T>[];
98
+ /** Server data source. Mutually exclusive with `dataSource`. */
99
+ request?: ProTableRequest<T, Params>;
100
+ /** Extra params merged into every request; a change triggers a refetch (resets to page 1). */
101
+ params?: Params;
102
+ /** Controlled data — when provided, `request` is ignored (presentational mode). */
103
+ dataSource?: T[];
104
+ /** Controlled loading — overrides the internal request loading. */
105
+ loading?: boolean;
106
+ /** Initial data before the first request resolves. */
107
+ defaultData?: T[];
108
+ /** Skip the initial auto request; only fetch after the first search / `reload`. */
109
+ manualRequest?: boolean;
110
+ /** Debounce (ms) applied to every request trigger. */
111
+ debounceTime?: number;
112
+ /** Transform the response rows before they are rendered. */
113
+ postData?: (data: T[]) => T[];
114
+ /** Transform the whole search-param set before it is sent to `request`. */
115
+ beforeSearchSubmit?: (params: Record<string, unknown>) => Record<string, unknown>;
116
+ /** Placeholder rendered for empty cell values (defaults to `'-'`). */
117
+ columnEmptyText?: ReactNode;
118
+ /** Poll interval (ms), or a function of the current rows. `0`/falsy disables. */
119
+ polling?: number | ((data: T[]) => number);
120
+ /** Customize the rendered search form; receives the default QueryFilter node. */
121
+ searchFormRender?: (defaultDom: ReactNode) => ReactNode;
122
+ pagination?: false | ProTablePaginationConfig;
123
+ search?: false | SearchConfig;
124
+ rowSelection?: TableRowSelection<T>;
125
+ size?: TableSize;
126
+ actionRef?: Ref<ProTableActionRef>;
127
+ onLoad?: (data: T[]) => void;
128
+ onLoadingChange?: (loading: boolean) => void;
129
+ onRequestError?: (error: Error) => void;
130
+ /** Forwarded from the base Table (sort/filter changes). */
131
+ onChange?: (meta: TableChangeMeta<T>) => void;
132
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50cy9Qcm9UYWJsZS9pbnRlcmZhY2UuanMiLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMiLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvUHJvVGFibGUvaW50ZXJmYWNlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7fTsiXSwibWFwcGluZ3MiOiJBQUFBIiwiaWdub3JlTGlzdCI6W119
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Retrieves the spacing value for a given token key.
3
+ *
4
+ * @param {string} $key - The spacing token key (e.g., '100', '200').
5
+ * @return {length|null} The computed spacing value or null if the key is invalid.
6
+ * @example
7
+ * .element {
8
+ * padding: om-spacing-token('200'); // Returns 8px if $om-sys-spacing-unit is 4px
9
+ * }
10
+ */
11
+ /**
12
+ * Computes the spacing value based on a token key or a direct length value.
13
+ *
14
+ * @param {string|length} $value - The spacing token key (e.g., '100') or a direct length value (e.g., '16px').
15
+ * @return {length} The computed spacing value.
16
+ * @example
17
+ * .element {
18
+ * margin: om-spacing-value('300'); // Returns 12px if $om-sys-spacing-unit is 4px
19
+ * padding: om-spacing-value(16px); // Returns 16px
20
+ * gap: om-spacing-value(2); // Returns 8px if $om-sys-spacing-unit is 4px
21
+ * }
22
+ */
23
+ .om-component-ui-pro-table {
24
+ box-sizing: border-box;
25
+ width: 100%;
26
+ }
27
+ .om-component-ui-pro-table-search {
28
+ margin-bottom: var(--om-spacing-400, 16px);
29
+ }
30
+ .om-component-ui-pro-table-search .om-component-ui-proform-query-filter {
31
+ display: flex;
32
+ flex-wrap: wrap;
33
+ align-items: center;
34
+ gap: var(--om-spacing-200, 8px);
35
+ }
36
+ .om-component-ui-pro-table-search .om-component-ui-form-item {
37
+ margin-bottom: 0;
38
+ }
39
+ .om-component-ui-pro-table-container {
40
+ position: relative;
41
+ box-sizing: border-box;
42
+ }
43
+ .om-component-ui-pro-table-pagination {
44
+ display: flex;
45
+ justify-content: flex-end;
46
+ padding-block: var(--om-spacing-300, 12px);
47
+ }
@@ -0,0 +1,6 @@
1
+ import '../../Button/style/css';
2
+ import '../../Pagination/style/css';
3
+ import '../../ProForm/style/css';
4
+ import '../../Table/style/css';
5
+ import './ProTable.css';
6
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvUHJvVGFibGUvc3JjL2NvbXBvbmVudHMvUHJvVGFibGUvc3R5bGUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTywyQkFBMkI7QUFDbEMsT0FBTywrQkFBK0I7QUFDdEMsT0FBTyw0QkFBNEI7QUFDbkMsT0FBTywwQkFBMEI7QUFDakMsT0FBTyxpQkFBaUIiLCJmaWxlIjoiY29tcG9uZW50cy9Qcm9UYWJsZS9zdHlsZS9jc3MuanMiLCJzb3VyY2VzQ29udGVudCI6W251bGxdLCJzb3VyY2VSb290IjoiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjIn0=
@@ -0,0 +1,5 @@
1
+ import "../../Button/style";
2
+ import "../../Pagination/style";
3
+ import "../../ProForm/style";
4
+ import "../../Table/style";
5
+ import './ProTable.css';
@@ -0,0 +1,6 @@
1
+ import '../../Button/style';
2
+ import '../../Pagination/style';
3
+ import '../../ProForm/style';
4
+ import '../../Table/style';
5
+ import './ProTable.css';
6
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvUHJvVGFibGUvc3JjL2NvbXBvbmVudHMvUHJvVGFibGUvc3R5bGUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTywyQkFBMkI7QUFDbEMsT0FBTywrQkFBK0I7QUFDdEMsT0FBTyw0QkFBNEI7QUFDbkMsT0FBTywwQkFBMEI7QUFDakMsT0FBTyxpQkFBaUIiLCJmaWxlIjoiY29tcG9uZW50cy9Qcm9UYWJsZS9zdHlsZS9pbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMifQ==
@@ -0,0 +1,48 @@
1
+ import type { PageInfo, ProTableFilterParam, ProTableRequest, ProTableSortParam } from './interface';
2
+ export interface UseFetchDataOptions<T, Params extends Record<string, unknown>> {
3
+ request?: ProTableRequest<T, Params>;
4
+ /** Skip all internal fetching (controlled `dataSource` mode). */
5
+ manual: boolean;
6
+ /** Skip only the initial auto request; later triggers still fetch. */
7
+ manualRequest?: boolean;
8
+ /** Debounce (ms) applied to every request trigger. */
9
+ debounceTime?: number;
10
+ /** Transform the response rows before they are stored. */
11
+ postData?: (data: T[]) => T[];
12
+ /** Poll interval (ms), or a function of the current rows. */
13
+ polling?: number | ((data: T[]) => number);
14
+ params?: Params;
15
+ defaultData?: T[];
16
+ paginated: boolean;
17
+ defaultCurrent: number;
18
+ defaultPageSize: number;
19
+ /** Submitted (and transformed) search-form values. */
20
+ searchParams: Record<string, unknown>;
21
+ sort: ProTableSortParam;
22
+ filter: ProTableFilterParam;
23
+ onLoad?: (data: T[]) => void;
24
+ onLoadingChange?: (loading: boolean) => void;
25
+ onRequestError?: (error: Error) => void;
26
+ }
27
+ export interface UseFetchDataResult<T> {
28
+ dataSource: T[];
29
+ loading: boolean;
30
+ pageInfo: PageInfo;
31
+ setPageInfo: (info: Partial<PageInfo>) => void;
32
+ /** Force a refetch; resolves once the triggered request settles. */
33
+ reload: () => Promise<void>;
34
+ reset: () => void;
35
+ }
36
+ /**
37
+ * Owns the request lifecycle for ProTable: data, loading, and pagination.
38
+ *
39
+ * One effect is the single fetch path. It reads its query inputs from the
40
+ * **render closure** (never a lagging ref), so every state change — search,
41
+ * sort, filter, params, page — refetches with correct values. An awaitable
42
+ * reload signal lets imperative callers force the same effect and `await` it.
43
+ *
44
+ * `runRequest` aborts the previous in-flight request (`AbortController`, exposed
45
+ * to `request` as `{ signal }`), tags itself with a request id, and drops stale
46
+ * or aborted responses.
47
+ */
48
+ export declare function useFetchData<T, Params extends Record<string, unknown>>(options: UseFetchDataOptions<T, Params>): UseFetchDataResult<T>;