listpage-next 0.0.113 → 0.0.114

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.
@@ -24,6 +24,8 @@ const Title = styled_components.div`
24
24
  const FilterSection = styled_components.div`
25
25
  background: #fff;
26
26
  padding: 16px;
27
+ border-radius: 8px;
28
+ border: 0.5px solid #f0f0f0;
27
29
  `;
28
30
  const ToolbarSection = styled_components.div``;
29
31
  const BodySection = styled_components.div`
@@ -1,14 +1,13 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { TableProps } from 'antd';
3
- import { ListPageStore, TableRequest } from '../../context/listpage';
3
+ import { FloatRender, ListPageStore, TableRequest } from '../../context/listpage';
4
4
  import { FilterFormOption } from '../../../FilterGroup';
5
5
  import { DataTableColumns } from '../../../DataTable';
6
- import { FloatComponentProps } from '../../../../context';
7
6
  export interface ListPageProps<FilterValue = any, RecordValue extends Record<string, any> = any> {
8
7
  request: TableRequest<FilterValue, RecordValue>;
9
8
  floats?: {
10
9
  key: string;
11
- render: (props: FloatComponentProps<RecordValue>) => ReactNode;
10
+ render: FloatRender<RecordValue>;
12
11
  }[];
13
12
  initialValues?: {
14
13
  filterValues?: FilterValue;
@@ -2,12 +2,13 @@ import { JSX, ReactNode } from 'react';
2
2
  import { FloatComponentProps } from '../../../context';
3
3
  import { BaseQueryParams, PaginationData } from '../../../http-client/types';
4
4
  export type TableRequest<FilterValue = any, RecordValue = any> = (pageParams: BaseQueryParams, filterValues: FilterValue) => Promise<PaginationData<RecordValue>>;
5
+ export type FloatRender<RecordValue extends Record<string, any> = any> = (props: FloatComponentProps<RecordValue>) => JSX.Element;
5
6
  export declare class ListPageStore<FilterValue = any, RecordValue extends Record<string, any> = any> {
6
7
  filters: FilterValue;
7
8
  tableDataRequest: TableRequest<FilterValue, RecordValue>;
8
9
  floats: {
9
10
  key: string;
10
- render: (props: FloatComponentProps<RecordValue>) => JSX.Element | ReactNode;
11
+ render: FloatRender<RecordValue>;
11
12
  }[];
12
13
  visibleFloat?: {
13
14
  key: string;
@@ -23,7 +24,7 @@ export declare class ListPageStore<FilterValue = any, RecordValue extends Record
23
24
  };
24
25
  constructor(initialValues: any | undefined, request: TableRequest<FilterValue, RecordValue>, floats: {
25
26
  key: string;
26
- render: (props: FloatComponentProps<RecordValue>) => ReactNode;
27
+ render: FloatRender<RecordValue>;
27
28
  }[]);
28
29
  submitFiltersChange(value?: FilterValue): void;
29
30
  showFloat(key: string, record: any, onCloseCallback?: () => void): void;
@@ -41,7 +42,7 @@ export declare const ListPageProvider: ({ children, initialValues, request, floa
41
42
  };
42
43
  floats?: {
43
44
  key: string;
44
- render: (props: FloatComponentProps<any>) => ReactNode;
45
+ render: FloatRender<any>;
45
46
  }[];
46
47
  request: TableRequest<any, any>;
47
48
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare function useFloat(): import("react").ReactNode | import("react").JSX.Element;
1
+ export declare function useFloat(): false | import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
+ import { jsx } from "react/jsx-runtime";
1
2
  import { useMemo } from "react";
2
3
  import { useListPageStore } from "../context/listpage.js";
3
4
  function useFloat() {
4
5
  const store = useListPageStore();
5
6
  const visibleFloat = store.visibleFloat;
6
7
  const floatEle = useMemo(()=>{
7
- const render = store.floats.find((f)=>f.key === visibleFloat?.key)?.render;
8
+ const Component = store.floats.find((f)=>f.key === visibleFloat?.key)?.render;
8
9
  const props = {
9
10
  record: visibleFloat?.record,
10
11
  onClose: ()=>{
@@ -13,7 +14,10 @@ function useFloat() {
13
14
  },
14
15
  visible: true
15
16
  };
16
- return render?.(props);
17
+ if (!Component) return false;
18
+ return /*#__PURE__*/ jsx(Component, {
19
+ ...props
20
+ });
17
21
  }, [
18
22
  visibleFloat,
19
23
  store
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.113",
3
+ "version": "0.0.114",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",