@fe-free/core 2.2.5 → 2.2.7

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.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: crud
8
+ - @fe-free/tool@2.2.7
9
+
10
+ ## 2.2.6
11
+
12
+ ### Patch Changes
13
+
14
+ - chore: republish
15
+ - @fe-free/tool@2.2.6
16
+
3
17
  ## 2.2.5
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.2.5",
3
+ "version": "2.2.7",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -39,7 +39,7 @@
39
39
  "remark-gfm": "^4.0.1",
40
40
  "vanilla-jsoneditor": "^0.23.1",
41
41
  "zustand": "^4.5.4",
42
- "@fe-free/tool": "2.2.5"
42
+ "@fe-free/tool": "2.2.7"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@ant-design/pro-components": "2.8.9",
@@ -1,5 +1,5 @@
1
+ import { Copy } from '@fe-free/core';
1
2
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Copy } from './index';
3
3
 
4
4
  const meta: Meta<typeof Copy> = {
5
5
  title: '@fe-free/core/Copy',
@@ -42,3 +42,4 @@ const Copy: React.FC<CopyProps> = ({ value, showIcon, hoverIcon, children, onCop
42
42
  };
43
43
 
44
44
  export { Copy };
45
+ export type { CopyProps };
@@ -494,6 +494,9 @@ export const RowSelection: Story = {
494
494
  },
495
495
  ],
496
496
  request: fakeRequest,
497
+ rowSelection: {
498
+ alwaysShowAlert: true,
499
+ },
497
500
  }}
498
501
  batchActions={[
499
502
  {
package/src/crud/crud.tsx CHANGED
@@ -118,7 +118,7 @@ function CRUDComponent<
118
118
  const disabled = readProps?.operateIsDisabled?.(record) || false;
119
119
  if (disabled) {
120
120
  btns.push(
121
- <span key="read" className="text-desc cursor-not-allowed">
121
+ <span key="read" className="cursor-not-allowed text-desc">
122
122
  {readProps?.operateText || '查看'}
123
123
  </span>,
124
124
  );
@@ -144,7 +144,7 @@ function CRUDComponent<
144
144
  const disabled = readProps?.operateIsDisabled?.(record) || false;
145
145
  if (disabled) {
146
146
  btns.push(
147
- <span key="read" className="text-desc cursor-not-allowed">
147
+ <span key="read" className="cursor-not-allowed text-desc">
148
148
  {readProps?.operateText || '查看'}
149
149
  </span>,
150
150
  );
@@ -169,7 +169,7 @@ function CRUDComponent<
169
169
 
170
170
  if (disabled) {
171
171
  btns.push(
172
- <span key="update" className="text-desc cursor-not-allowed">
172
+ <span key="update" className="cursor-not-allowed text-desc">
173
173
  {updateProps?.operateText || '编辑'}
174
174
  </span>,
175
175
  );
@@ -284,6 +284,7 @@ function CRUDComponent<
284
284
  DataSource,
285
285
  Key
286
286
  >({
287
+ rowSelection: tableProps.rowSelection,
287
288
  batchActions,
288
289
  actionRef,
289
290
  });
@@ -6,13 +6,20 @@ import { LoadingButton } from '../button';
6
6
  import type { CRUDProps } from './types';
7
7
 
8
8
  function useRowSelection<DataSource, Key>({
9
+ rowSelection: originRowSelection,
9
10
  batchActions,
10
11
  actionRef,
11
12
  }: {
13
+ rowSelection?: CRUDProps<DataSource, Key>['tableProps']['rowSelection'];
12
14
  batchActions?: CRUDProps<DataSource, Key>['batchActions'];
13
15
  actionRef?: MutableRefObject<ActionType | undefined>;
14
16
  }) {
15
- const rowSelection = useMemo(() => ({}), []);
17
+ const rowSelection = useMemo(
18
+ () => ({
19
+ ...originRowSelection,
20
+ }),
21
+ [originRowSelection],
22
+ );
16
23
 
17
24
  const tableAlertRender = useCallback(({ selectedRowKeys, onCleanSelected }) => {
18
25
  return (
@@ -30,13 +37,14 @@ function useRowSelection<DataSource, Key>({
30
37
  const tableAlertOptionRender = useCallback(
31
38
  ({ selectedRowKeys, selectedRows }) => {
32
39
  return (
33
- <div className="flex gap-2 items-center">
40
+ <div className="flex items-center gap-2">
34
41
  {batchActions?.map((action) => (
35
42
  <LoadingButton
36
43
  key={action.btnText}
37
44
  type="link"
38
45
  danger={action.danger}
39
46
  className="!px-0"
47
+ disabled={selectedRowKeys.length === 0}
40
48
  onClick={async (event) => {
41
49
  if (action.danger) {
42
50
  await new Promise((resolve) => {
package/src/index.ts CHANGED
@@ -3,6 +3,8 @@ import './style.scss';
3
3
  export { useGlobalInfiniteScroll } from './ahooks/use_global_infinite_scroll';
4
4
  export { useGlobalRequest } from './ahooks/use_global_request';
5
5
  export { LoadingButton } from './button';
6
+ export { Copy } from './copy';
7
+ export type { CopyProps } from './copy';
6
8
  export { CRUD, CRUDDetail, CRUDOfSimple, OperateDelete, useDelete } from './crud';
7
9
  export type { CRUDDetailProps, CRUDMethods, CRUDOfSimpleProps, CRUDProps } from './crud';
8
10
  export { Editor } from './editor';