zy-react-library 1.0.46 → 1.0.48

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.
@@ -11,7 +11,9 @@ export type TableProProps<DataSource, U, ValueType> = Omit<TableProps, 'columns'
11
11
  /** 是否禁用内容区滚动,默认 false */
12
12
  disabledResizer?: boolean;
13
13
  /** 是否显示索引列,默认 true */
14
- showIndex?: boolean;
14
+ showIndexColumn?: boolean;
15
+ /** 索引列是否固定,默认 left */
16
+ indexColumnFixed?: "left" | "right" | boolean;
15
17
  /** 是否使用居中布局,默认 true */
16
18
  useAlignCenter?: boolean;
17
19
  }
@@ -5,15 +5,16 @@ import "./index.less";
5
5
  function TablePro(props) {
6
6
  const {
7
7
  columns = [],
8
- showIndex = true,
8
+ showIndexColumn = true,
9
9
  useAlignCenter = true,
10
+ indexColumnFixed = "left",
10
11
  rowKey = "id",
11
12
  ...restProps
12
13
  } = props;
13
14
 
14
15
  const storeIndex = props.storeIndex || `${window.process.env.app.antd["ant-prefix"]}_${Math.random().toString(36).substring(2)}`;
15
16
  function calcColumns() {
16
- showIndex && columns.unshift(getIndexColumn(props.pagination));
17
+ showIndexColumn && columns.unshift({...getIndexColumn(props.pagination), fixed: indexColumnFixed});
17
18
  return columns.map(item => ({ align: useAlignCenter ? "center" : "left", ...item }));
18
19
  }
19
20
  return <Table rowKey={rowKey} storeIndex={storeIndex} columns={calcColumns()} {...restProps} />;
@@ -24,12 +24,36 @@ function useDeleteFile(returnType = "object") {
24
24
  throw new Error("请传入有效的 files");
25
25
 
26
26
  // 如果没有文件则直接返回
27
- if (files.length === 0)
27
+ if (files.length === 0) {
28
+ setLoading(false);
28
29
  resolve();
30
+ return;
31
+ }
32
+
33
+ // 单文件并且没有文件路径则直接返回
34
+ if (single) {
35
+ const firstFile = files[0];
36
+ if (!firstFile.filePath) {
37
+ setLoading(false);
38
+ resolve();
39
+ return;
40
+ }
41
+ }
42
+ // 多文件并且没有文件id则直接返回
43
+ else {
44
+ const validFiles = files.filter(f => f.id);
45
+ if (validFiles.length === 0) {
46
+ setLoading(false);
47
+ resolve();
48
+ return;
49
+ }
50
+ }
29
51
 
30
52
  // 发送请求
31
53
  request(
32
- single ? `/basic-info/imgFiles/delete?filePath=${files[0].filePath}` : `/basic-info/imgFiles/ids?ids=${files.map(f => f.id)}`,
54
+ single
55
+ ? `/basic-info/imgFiles/delete?filePath=${files[0].filePath}`
56
+ : `/basic-info/imgFiles/ids?ids=${files.filter(f => f.id).map(f => f.id)}`,
33
57
  "delete",
34
58
  )
35
59
  .then((res) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.46",
4
+ "version": "1.0.48",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",