@fe-free/core 3.0.16 → 3.0.17

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,12 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 3.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: upload
8
+ - @fe-free/tool@3.0.17
9
+
3
10
  ## 3.0.16
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "3.0.16",
3
+ "version": "3.0.17",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -41,7 +41,7 @@
41
41
  "safe-stable-stringify": "^2.5.0",
42
42
  "vanilla-jsoneditor": "^0.23.1",
43
43
  "zustand": "^4.5.4",
44
- "@fe-free/tool": "3.0.16"
44
+ "@fe-free/tool": "3.0.17"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@ant-design/pro-components": "2.8.9",
package/src/crud/crud.tsx CHANGED
@@ -5,11 +5,11 @@ import classNames from 'classnames';
5
5
  import { isString } from 'lodash-es';
6
6
  import { useCallback, useImperativeHandle, useMemo, useRef } from 'react';
7
7
  import { Link } from 'react-router-dom';
8
- import type { TableProps } from '../table';
9
- import { getTableScroll, Table } from '../table';
10
8
  import { OperateDelete } from './crud_delete';
11
9
  import { CRUDDetail } from './crud_detail';
12
10
  import './style.scss';
11
+ import type { TableProps } from './table';
12
+ import { getTableScroll, Table } from './table';
13
13
  import type { CRUDProps } from './types';
14
14
  import { useRowSelection } from './use_row_selection';
15
15
  import { useTips } from './use_tips';
@@ -1,6 +1,6 @@
1
1
  import type { ActionType, ProFormInstance } from '@ant-design/pro-components';
2
2
  import type { MouseEvent, ReactNode, Ref, RefObject } from 'react';
3
- import type { TableProps } from '../table';
3
+ import type { TableProps } from './table';
4
4
 
5
5
  /**
6
6
  * create 创建
@@ -243,7 +243,8 @@ export const ProFormUploadComponent: Story = {
243
243
  label="knowledge_files_dragger"
244
244
  name="knowledge_files_dragger"
245
245
  fieldProps={{
246
- accept: '.doc,.docx,.pdf,.ppt,.jpg, jpeg,.png,.mp3,.mp4,.txt,.markdown,.excel',
246
+ directory: true,
247
+ accept: '.doc,.docx,.pdf,.ppt,.jpg,.jpeg,.png,.mp3,.mp4,.txt,.markdown,.excel',
247
248
  multiple: true,
248
249
  maxCount: 100,
249
250
  customRequest,
package/src/index.ts CHANGED
@@ -57,8 +57,6 @@ export type { RecordArrayProps, RecordProps } from './record';
57
57
  export { routeTool } from './route';
58
58
  export { NumberSlider, PercentageSlider } from './slider';
59
59
  export type { NumberSliderProps, PercentageSliderProps } from './slider';
60
- export { Table } from './table';
61
- export type { TableProps } from './table';
62
60
  export { Tabs } from './tabs';
63
61
  export type { TabsProps } from './tabs';
64
62
  export { themeVariables } from './theme';
@@ -16,6 +16,7 @@ interface UploadBaseProps {
16
16
  customRequest?: AntdUploadProps['customRequest'];
17
17
  listType?: AntdUploadProps['listType'];
18
18
  accept?: string;
19
+ directory?: AntdUploadProps['directory'];
19
20
  }
20
21
 
21
22
  interface UploadProps extends UploadBaseProps {
@@ -92,7 +93,8 @@ function useUpload(
92
93
  }
93
94
 
94
95
  function Upload(props: ImageUploadProps) {
95
- const { multiple, maxCount, showCount, action, customRequest, listType, accept } = props;
96
+ const { multiple, maxCount, showCount, action, customRequest, listType, accept, directory } =
97
+ props;
96
98
  const { onChange, beforeUpload, isDisabled, fileList } = useUpload(props);
97
99
 
98
100
  return (
@@ -106,6 +108,7 @@ function Upload(props: ImageUploadProps) {
106
108
  maxCount={multiple ? maxCount : 1}
107
109
  multiple={multiple}
108
110
  beforeUpload={beforeUpload}
111
+ directory={directory}
109
112
  // 不可,否则会没法删除
110
113
  // disabled={isDisabled}
111
114
  >
@@ -140,6 +143,7 @@ function UploadDragger(props: UploadDraggerProps) {
140
143
  title,
141
144
  description,
142
145
  showStatus,
146
+ directory,
143
147
  } = props;
144
148
  const { onChange, beforeUpload, isDisabled, fileList, successList } = useUpload(props);
145
149
 
@@ -174,6 +178,7 @@ function UploadDragger(props: UploadDraggerProps) {
174
178
  maxCount={multiple ? maxCount : 1}
175
179
  multiple={multiple}
176
180
  beforeUpload={beforeUpload}
181
+ directory={directory}
177
182
  // 不可,否则会没法删除
178
183
  // disabled={isDisabled}
179
184
  className={classNames('fec-upload-dragger', {
@@ -1,95 +0,0 @@
1
- import type { ProColumns } from '@ant-design/pro-components';
2
- import { Table } from '@fe-free/core';
3
- import type { Meta, StoryObj } from '@storybook/react-vite';
4
- import { fakeData } from '../crud/demo/data';
5
-
6
- const meta: Meta<typeof Table> = {
7
- title: '@fe-free/core/Table',
8
- component: Table,
9
- tags: ['autodocs'],
10
- parameters: {
11
- docs: {
12
- description: {
13
- component: `Table 基于 ProTable 做了一些封装:<br>
14
- - props column 需要显示的提供 search: true;
15
- - 列宽默认 120,和滚动条
16
- - 搜索样式做了默认设置,具体见代码
17
- - 页码做了默认设置,具体见代码
18
- `,
19
- },
20
- },
21
- },
22
- };
23
-
24
- export default meta;
25
- type Story = StoryObj<typeof Table>;
26
-
27
- // 定义列配置
28
- const columns: ProColumns[] = [
29
- {
30
- title: 'id',
31
- dataIndex: 'id',
32
- search: true,
33
- },
34
- {
35
- title: '名字(省略)',
36
- dataIndex: 'name',
37
- search: true,
38
- ellipsis: true,
39
- },
40
- {
41
- title: 'city',
42
- dataIndex: 'city',
43
- },
44
- {
45
- title: 'area',
46
- dataIndex: 'area',
47
- },
48
- ];
49
-
50
- export const Basic: Story = {
51
- render: () => (
52
- <Table
53
- rowKey="id"
54
- columns={columns}
55
- request={async (params) => {
56
- console.log(params);
57
- return {
58
- data: fakeData,
59
- success: true,
60
- total: fakeData.length,
61
- };
62
- }}
63
- />
64
- ),
65
- };
66
-
67
- export const ScrollX: Story = {
68
- render: () => (
69
- <div className="w-[400px]">
70
- <Table
71
- rowKey="id"
72
- columns={[
73
- {
74
- title: 'id',
75
- dataIndex: 'id',
76
- },
77
- {
78
- title: '名字(省略)',
79
- dataIndex: 'name',
80
-
81
- ellipsis: true,
82
- },
83
- {
84
- title: 'city',
85
- dataIndex: 'city',
86
- },
87
- {
88
- title: 'area',
89
- dataIndex: 'area',
90
- },
91
- ]}
92
- />
93
- </div>
94
- ),
95
- };
File without changes
File without changes