listpage-next 0.0.195 → 0.0.196

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.
@@ -0,0 +1,8 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export interface LayoutContentProps {
3
+ children?: ReactNode | ReactNode[];
4
+ title?: ReactNode;
5
+ extra?: ReactNode;
6
+ style?: CSSProperties;
7
+ }
8
+ export declare const LayoutContent: (props: LayoutContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { styled } from "styled-components";
3
+ const LayoutContent = (props)=>{
4
+ const { children, title, extra, style } = props;
5
+ return /*#__PURE__*/ jsxs(LayoutContentStyled, {
6
+ style: style,
7
+ children: [
8
+ (Boolean(title) || Boolean(extra)) && /*#__PURE__*/ jsxs(HeaderSection, {
9
+ children: [
10
+ /*#__PURE__*/ jsx(Title, {
11
+ children: title
12
+ }),
13
+ /*#__PURE__*/ jsx("div", {
14
+ children: extra
15
+ })
16
+ ]
17
+ }),
18
+ children
19
+ ]
20
+ });
21
+ };
22
+ const LayoutContentStyled = styled.div`
23
+ width: 100%;
24
+ height: 100%;
25
+ box-sizing: border-box;
26
+ display: flex;
27
+ gap: 16px;
28
+ flex-direction: column;
29
+ overflow: hidden;
30
+ padding: 16px 24px;
31
+ background-color: #eeeeee;
32
+ `;
33
+ const HeaderSection = styled.div`
34
+ display: flex;
35
+ justify-content: space-between;
36
+ align-items: center;
37
+ flex: 0 0 auto;
38
+ `;
39
+ const Title = styled.div`
40
+ font-size: 20px;
41
+ font-weight: 500;
42
+ color: #333;
43
+ line-height: 1.5;
44
+ `;
45
+ export { LayoutContent };
@@ -1,4 +1,5 @@
1
1
  export { PageLoading } from './components/PageLoading';
2
2
  export { PageLayout } from './components/PageLayout';
3
+ export { LayoutContent, type LayoutContentProps, } from './components/LayoutContent';
3
4
  export type { PageLayoutProps } from './components/PageLayout';
4
5
  export { PageContext, usePageContext } from './components/PageProvider';
@@ -1,4 +1,5 @@
1
1
  import { PageLoading } from "./components/PageLoading/index.js";
2
2
  import { PageLayout } from "./components/PageLayout/index.js";
3
+ import { LayoutContent } from "./components/LayoutContent/index.js";
3
4
  import { PageContext, usePageContext } from "./components/PageProvider/index.js";
4
- export { PageContext, PageLayout, PageLoading, usePageContext };
5
+ export { LayoutContent, PageContext, PageLayout, PageLoading, usePageContext };
@@ -1,24 +1,26 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useImperativeHandle } from "react";
2
3
  import { observer } from "mobx-react-lite";
3
- import { FilterForm } from "../../../../components/FilterGroup/index.js";
4
+ import { LayoutContent } from "../../../../components/index.js";
4
5
  import { ListPageProvider, useListPageStore } from "../../context/index.js";
5
6
  import { useFloat } from "../../hooks/useFloat.js";
6
7
  import { useHeader } from "../../hooks/useHeader.js";
7
- import { FilterSection, ListPageWrapper, ToolbarSection } from "../../styles.js";
8
+ import { FilterSection, ToolbarSection } from "../../styles.js";
8
9
  import { DataTable } from "../DataTable/index.js";
9
- import { useImperativeHandle } from "react";
10
+ import { FilterForm } from "../../../../components/FilterGroup/index.js";
10
11
  const ListPageContainerComponent = observer((props)=>{
11
12
  const { styles, header, filter, toolbar, table, pageRef } = props;
12
13
  const store = useListPageStore();
13
- const headerEle = useHeader(header);
14
+ const { title, extra } = useHeader(header);
14
15
  const floatEle = useFloat();
15
16
  useImperativeHandle(pageRef, ()=>store, [
16
17
  store
17
18
  ]);
18
- return /*#__PURE__*/ jsxs(ListPageWrapper, {
19
+ return /*#__PURE__*/ jsxs(LayoutContent, {
19
20
  style: styles?.page,
21
+ title: title,
22
+ extra: extra,
20
23
  children: [
21
- headerEle,
22
24
  filter && /*#__PURE__*/ jsx(FilterSection, {
23
25
  children: /*#__PURE__*/ jsx(FilterForm, {
24
26
  labelInline: filter.labelInline,
@@ -1,2 +1,8 @@
1
1
  import { ListPageHeaderProps } from '../types';
2
- export declare function useHeader(props?: ListPageHeaderProps): false | import("react/jsx-runtime").JSX.Element;
2
+ export declare function useHeader(props?: ListPageHeaderProps): {
3
+ title?: undefined;
4
+ extra?: undefined;
5
+ } | {
6
+ title: import("react").ReactNode;
7
+ extra: import("react").ReactNode;
8
+ };
@@ -1,20 +1,12 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
1
  import { useListPageStore } from "../context/index.js";
3
- import { HeaderSection, Title } from "../styles.js";
4
2
  function useHeader(props) {
5
3
  const store = useListPageStore();
6
- if (!props) return false;
4
+ if (!props) return {};
7
5
  const { title, extra } = props;
8
6
  const extraEle = 'function' == typeof extra ? extra(store) : extra;
9
- return /*#__PURE__*/ jsxs(HeaderSection, {
10
- children: [
11
- /*#__PURE__*/ jsx(Title, {
12
- children: title
13
- }),
14
- /*#__PURE__*/ jsx("div", {
15
- children: extraEle
16
- })
17
- ]
18
- });
7
+ return {
8
+ title,
9
+ extra: extraEle
10
+ };
19
11
  }
20
12
  export { useHeader };
@@ -1,6 +1,3 @@
1
- export declare const ListPageWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const HeaderSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
1
  export declare const FilterSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
2
  export declare const ToolbarSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
3
  export declare const BodySection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,27 +1,4 @@
1
1
  import styled_components from "styled-components";
2
- const ListPageWrapper = styled_components.div`
3
- width: 100%;
4
- height: 100%;
5
- box-sizing: border-box;
6
- display: flex;
7
- gap: 16px;
8
- flex-direction: column;
9
- overflow: hidden;
10
- padding: 16px 24px;
11
- background-color: #eeeeee;
12
- `;
13
- const HeaderSection = styled_components.div`
14
- display: flex;
15
- justify-content: space-between;
16
- align-items: center;
17
- flex: 0 0 auto;
18
- `;
19
- const Title = styled_components.div`
20
- font-size: 20px;
21
- font-weight: 500;
22
- color: #333;
23
- line-height: 1.5;
24
- `;
25
2
  const FilterSection = styled_components.div`
26
3
  background: #fff;
27
4
  padding: 24px 32px;
@@ -47,4 +24,4 @@ const TableContainer = styled_components.div`
47
24
  }
48
25
  }
49
26
  `;
50
- export { BodySection, FilterSection, HeaderSection, ListPageWrapper, PaginationContainer, TableContainer, Title, ToolbarSection };
27
+ export { BodySection, FilterSection, PaginationContainer, TableContainer, ToolbarSection };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.195",
3
+ "version": "0.0.196",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",