listpage-next 0.0.231 → 0.0.232

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.
@@ -5,7 +5,25 @@ import { styled } from "styled-components";
5
5
  import { CloseOutlined } from "@ant-design/icons";
6
6
  import { AsyncButton } from "../../../AsyncButton/index.js";
7
7
  function useActions(props) {
8
- const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions } = props;
8
+ const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions, closable = true } = props;
9
+ const closeButton = useMemo(()=>{
10
+ if (true === closable) return /*#__PURE__*/ jsx(Button, {
11
+ type: "text",
12
+ icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
13
+ onClick: onCancel
14
+ });
15
+ if (false === closable) return null;
16
+ const { closeIcon, disabled } = closable;
17
+ return /*#__PURE__*/ jsx(Button, {
18
+ type: "text",
19
+ disabled: disabled,
20
+ icon: closeIcon || /*#__PURE__*/ jsx(CloseOutlined, {}),
21
+ onClick: onCancel
22
+ });
23
+ }, [
24
+ closable,
25
+ onCancel
26
+ ]);
9
27
  const actions = 'none' === actionPosition ? null : /*#__PURE__*/ jsxs(Fragment, {
10
28
  children: [
11
29
  /*#__PURE__*/ jsx(Button, {
@@ -24,9 +42,9 @@ function useActions(props) {
24
42
  ]
25
43
  });
26
44
  const footer = useMemo(()=>{
27
- if ('bottom' === actionPosition) return /*#__PURE__*/ jsxs(Fragment, {
45
+ if ('bottom' === actionPosition) return /*#__PURE__*/ jsxs(ExtraContainer, {
28
46
  children: [
29
- /*#__PURE__*/ jsx(FlexContainer, {
47
+ /*#__PURE__*/ jsx(Fragment, {
30
48
  children: extraActions
31
49
  }),
32
50
  /*#__PURE__*/ jsx(Fragment, {
@@ -49,7 +67,7 @@ function useActions(props) {
49
67
  title
50
68
  ]
51
69
  }),
52
- /*#__PURE__*/ jsxs(FlexContainer, {
70
+ /*#__PURE__*/ jsxs(ExtraContainer, {
53
71
  children: [
54
72
  extraActions,
55
73
  actions
@@ -65,14 +83,10 @@ function useActions(props) {
65
83
  title
66
84
  ]
67
85
  }),
68
- /*#__PURE__*/ jsxs(FlexContainer, {
86
+ /*#__PURE__*/ jsxs(ExtraContainer, {
69
87
  children: [
70
88
  extraActions,
71
- /*#__PURE__*/ jsx(Button, {
72
- type: "text",
73
- icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
74
- onClick: onCancel
75
- })
89
+ closeButton
76
90
  ]
77
91
  })
78
92
  ]
@@ -84,10 +98,12 @@ function useActions(props) {
84
98
  ]
85
99
  });
86
100
  }, [
101
+ actionPosition,
87
102
  icon,
88
103
  title,
89
104
  actions,
90
- extraActions
105
+ extraActions,
106
+ closeButton
91
107
  ]);
92
108
  return {
93
109
  footer,
@@ -96,6 +112,7 @@ function useActions(props) {
96
112
  }
97
113
  const FlexContainer = styled.div`
98
114
  flex-grow: 1;
115
+ flex-shrink: 1;
99
116
  display: flex;
100
117
  align-items: center;
101
118
  gap: 4px;
@@ -104,4 +121,12 @@ const HeaderContainer = styled.div`
104
121
  display: flex;
105
122
  align-items: center;
106
123
  `;
124
+ const ExtraContainer = styled.div`
125
+ flex-grow: 0;
126
+ flex-shrink: 0;
127
+ display: flex;
128
+ align-items: center;
129
+ gap: 4px;
130
+ justify-content: flex-end;
131
+ `;
107
132
  export { useActions };
@@ -6,7 +6,7 @@ export interface ListPageProps<FilterValue = any, RecordValue extends Record<str
6
6
  page?: React.CSSProperties;
7
7
  table?: React.CSSProperties;
8
8
  };
9
- pageRef?: React.RefObject<ListPageContext<FilterValue, RecordValue>>;
9
+ pageRef?: React.RefObject<ListPageContext<FilterValue, RecordValue> | null>;
10
10
  request: ListPageRequest<FilterValue, RecordValue>;
11
11
  storageKey?: string;
12
12
  initialValues?: StateValue<FilterValue>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.231",
3
+ "version": "0.0.232",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",