listpage-next 0.0.229 → 0.0.231

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.
@@ -1,5 +1,4 @@
1
1
  function detectActiveMenu(pathname, menus) {
2
- debugger;
3
2
  const activeMenu = menus.filter((item)=>item && pathname.startsWith(item.key)).sort((a, b)=>b.key.length - a.key.length)?.[0];
4
3
  if (!activeMenu) return;
5
4
  if (!activeMenu.children?.length) return activeMenu.key;
@@ -1,8 +1,9 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "antd";
3
- import { AsyncButton } from "../../../AsyncButton/index.js";
4
3
  import { useMemo } from "react";
5
4
  import { styled } from "styled-components";
5
+ import { CloseOutlined } from "@ant-design/icons";
6
+ import { AsyncButton } from "../../../AsyncButton/index.js";
6
7
  function useActions(props) {
7
8
  const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions } = props;
8
9
  const actions = 'none' === actionPosition ? null : /*#__PURE__*/ jsxs(Fragment, {
@@ -28,7 +29,7 @@ function useActions(props) {
28
29
  /*#__PURE__*/ jsx(FlexContainer, {
29
30
  children: extraActions
30
31
  }),
31
- /*#__PURE__*/ jsx("div", {
32
+ /*#__PURE__*/ jsx(Fragment, {
32
33
  children: actions
33
34
  })
34
35
  ]
@@ -48,7 +49,7 @@ function useActions(props) {
48
49
  title
49
50
  ]
50
51
  }),
51
- /*#__PURE__*/ jsxs("div", {
52
+ /*#__PURE__*/ jsxs(FlexContainer, {
52
53
  children: [
53
54
  extraActions,
54
55
  actions
@@ -56,6 +57,26 @@ function useActions(props) {
56
57
  })
57
58
  ]
58
59
  });
60
+ if ('none' === actionPosition) return /*#__PURE__*/ jsxs(HeaderContainer, {
61
+ children: [
62
+ /*#__PURE__*/ jsxs(FlexContainer, {
63
+ children: [
64
+ icon,
65
+ title
66
+ ]
67
+ }),
68
+ /*#__PURE__*/ jsxs(FlexContainer, {
69
+ children: [
70
+ extraActions,
71
+ /*#__PURE__*/ jsx(Button, {
72
+ type: "text",
73
+ icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
74
+ onClick: onCancel
75
+ })
76
+ ]
77
+ })
78
+ ]
79
+ });
59
80
  return /*#__PURE__*/ jsxs(FlexContainer, {
60
81
  children: [
61
82
  icon,
@@ -7,15 +7,17 @@ import { useSelectionTools } from "../../hooks/useSelectionTools.js";
7
7
  import { useListPageStore } from "../../context/index.js";
8
8
  import { TableContainer } from "../../styles.js";
9
9
  const DataTable = observer((props)=>{
10
- const { title, extra, columns = [], rowTitleKey, rowSelectionType, tableProps } = props;
10
+ const { title, extra, columns = [], rowTitleKey, rowSelectionType, tableProps, variant, style } = props;
11
11
  const store = useListPageStore();
12
12
  const paginationEle = usePagination(tableProps?.pagination);
13
13
  const newColumns = useColumns(columns);
14
14
  const extraEle = 'function' == typeof extra ? extra(store) : extra;
15
15
  const selectionToolEle = useSelectionTools(rowTitleKey);
16
16
  return /*#__PURE__*/ jsxs(Card, {
17
+ variant: variant,
17
18
  title: selectionToolEle || title,
18
19
  extra: extraEle,
20
+ style: style,
19
21
  styles: {
20
22
  body: {
21
23
  padding: 0
@@ -1,6 +1,6 @@
1
1
  import { TableProps, TagProps, TypographyProps } from 'antd';
2
2
  import { ColumnType } from 'antd/es/table';
3
- import { HTMLAttributeAnchorTarget, ReactNode } from 'react';
3
+ import { CSSProperties, HTMLAttributeAnchorTarget, ReactNode } from 'react';
4
4
  import { ListPageStore } from '../../context';
5
5
  export type ComponentType = 'text' | 'time' | 'tag' | 'link' | 'switch';
6
6
  export type ComponentProps<RecordValue extends Record<string, any> = any> = {
@@ -34,6 +34,8 @@ export interface DataTableProps<FilterValue = any, RecordValue extends Record<st
34
34
  rowSelectionType?: 'checkbox' | 'radio';
35
35
  rowTitleKey?: string;
36
36
  columns?: ListPageTableColumn<FilterValue, RecordValue>[];
37
+ variant?: 'borderless' | 'outlined';
38
+ style?: CSSProperties;
37
39
  tableProps?: Omit<TableProps<RecordValue>, 'dataSource' | 'title' | 'columns'>;
38
40
  }
39
41
  export type ColumnRender<Type extends ComponentType, R extends Record<string, any> = any, K extends string = any> = (value: R[K], record: R, index: number, props: ComponentProps<R>[Type]) => ReactNode;
@@ -4,6 +4,7 @@ import { ListPageContext } from '../..';
4
4
  export interface ListPageProps<FilterValue = any, RecordValue extends Record<string, any> = any> {
5
5
  styles?: {
6
6
  page?: React.CSSProperties;
7
+ table?: React.CSSProperties;
7
8
  };
8
9
  pageRef?: React.RefObject<ListPageContext<FilterValue, RecordValue>>;
9
10
  request: ListPageRequest<FilterValue, RecordValue>;
@@ -41,7 +41,11 @@ const ListPageContainerComponent = observer((props)=>{
41
41
  children: toolbar.render(store)
42
42
  }),
43
43
  /*#__PURE__*/ jsx(DataTable, {
44
- ...table
44
+ ...table,
45
+ style: {
46
+ ...styles?.table,
47
+ ...table.style
48
+ }
45
49
  }),
46
50
  floatEle
47
51
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.229",
3
+ "version": "0.0.231",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",