@fe-free/core 2.8.3 → 2.8.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 2.8.5
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: InfiniteListBase
8
+ - @fe-free/tool@2.8.5
9
+
10
+ ## 2.8.4
11
+
12
+ ### Patch Changes
13
+
14
+ - feat: add ProFormListBoolean
15
+ - @fe-free/tool@2.8.4
16
+
3
17
  ## 2.8.3
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "2.8.3",
3
+ "version": "2.8.5",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -39,9 +39,10 @@
39
39
  "react-syntax-highlighter": "^15.5.0",
40
40
  "rehype-raw": "^7.0.0",
41
41
  "remark-gfm": "^4.0.1",
42
+ "safe-stable-stringify": "^2.5.0",
42
43
  "vanilla-jsoneditor": "^0.23.1",
43
44
  "zustand": "^4.5.4",
44
- "@fe-free/tool": "2.8.3"
45
+ "@fe-free/tool": "2.8.5"
45
46
  },
46
47
  "peerDependencies": {
47
48
  "@ant-design/pro-components": "2.8.9",
@@ -5,6 +5,7 @@ import {
5
5
  ProFormImageUploadDragger,
6
6
  ProFormJSON,
7
7
  ProFormJavascript,
8
+ ProFormListBoolean,
8
9
  ProFormListNumber,
9
10
  ProFormListText,
10
11
  ProFormRecord,
@@ -143,6 +144,14 @@ export const ProFormListNumberComponent: Story = {
143
144
  ),
144
145
  };
145
146
 
147
+ export const ProFormListBooleanComponent: Story = {
148
+ render: () => (
149
+ <ProFormBase>
150
+ <ProFormListBoolean name="listBoolean" label="listBoolean" />
151
+ </ProFormBase>
152
+ ),
153
+ };
154
+
146
155
  function customRequest(option: any) {
147
156
  const { file, onProgress, onSuccess } = option;
148
157
 
@@ -1,6 +1,6 @@
1
1
  import type { ProFormItemProps } from '@ant-design/pro-components';
2
2
  import { ProForm } from '@ant-design/pro-components';
3
- import { Input, InputNumber } from 'antd';
3
+ import { Input, InputNumber, Switch } from 'antd';
4
4
 
5
5
  import { ProFormListHelper } from './form_list_helper';
6
6
 
@@ -71,6 +71,21 @@ function ListNumber(props: ListNumberProps) {
71
71
  );
72
72
  }
73
73
 
74
+ interface ListBooleanProps {
75
+ value?: boolean[];
76
+ onChange?: (value: boolean[]) => void;
77
+ }
78
+
79
+ function ListBoolean(props: ListBooleanProps) {
80
+ return (
81
+ <ProFormListHelper value={props.value} onChange={props.onChange} getAdd={() => false}>
82
+ {({ item, onItemChange }) => {
83
+ return <Switch {...props} value={item} onChange={(checked) => onItemChange(checked)} />;
84
+ }}
85
+ </ProFormListHelper>
86
+ );
87
+ }
88
+
74
89
  function ProFormListBase(props) {
75
90
  const { fieldProps, ...rest } = props;
76
91
 
@@ -124,4 +139,13 @@ function ProFormListNumber(props: ProFormItemProps<ListNumberProps>) {
124
139
  );
125
140
  }
126
141
 
127
- export { ProFormListNumber, ProFormListText };
142
+ function ProFormListBoolean(props: ProFormItemProps<ListBooleanProps>) {
143
+ const { fieldProps, ...rest } = props;
144
+ return (
145
+ <ProFormListBase {...rest}>
146
+ <ListBoolean {...fieldProps} />
147
+ </ProFormListBase>
148
+ );
149
+ }
150
+
151
+ export { ProFormListBoolean, ProFormListNumber, ProFormListText };
@@ -1,4 +1,4 @@
1
- export { ProFormListNumber, ProFormListText } from './form_list/form_list';
1
+ export { ProFormListBoolean, ProFormListNumber, ProFormListText } from './form_list/form_list';
2
2
  export { ProFormListHelper } from './form_list/form_list_helper';
3
3
  export { ProFormListModalHelper } from './form_list/form_list_modal_helper';
4
4
  export { ProFormEditor } from './pro_form_editor';
package/src/index.ts CHANGED
@@ -27,6 +27,7 @@ export {
27
27
  ProFormImageUploadDragger,
28
28
  ProFormJSON,
29
29
  ProFormJavascript,
30
+ ProFormListBoolean,
30
31
  ProFormListHelper,
31
32
  ProFormListModalHelper,
32
33
  ProFormListNumber,
@@ -2,6 +2,7 @@ import { Spin } from 'antd';
2
2
  import classNames from 'classnames';
3
3
  import type { ReactNode } from 'react';
4
4
  import { useImperativeHandle, useRef, useState } from 'react';
5
+ import stringify from 'safe-stable-stringify';
5
6
  import { useGlobalInfiniteScroll } from '../ahooks/use_global_infinite_scroll';
6
7
 
7
8
  interface ActionType {
@@ -60,6 +61,7 @@ const InfiniteListBase = <D, P>({
60
61
  {
61
62
  target: ref,
62
63
  isNoMore: (d) => d?.nextId === undefined,
64
+ reloadDeps: [stringify(params || {})],
63
65
  },
64
66
  );
65
67