zmdms-webui 0.0.67 → 0.0.70

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.
@@ -6,7 +6,7 @@ interface IFormItem extends FormItemProps {
6
6
  /**
7
7
  * 是否显示
8
8
  */
9
- isDisplay?: boolean | string;
9
+ isDisplay?: boolean | string | ((formInstance: FormInstance<any>) => boolean);
10
10
  /**
11
11
  * 是否必填
12
12
  */
@@ -17,6 +17,12 @@ var FormItem = function (props) {
17
17
  if (isDisplay === false || isDisplay === "0") {
18
18
  return null;
19
19
  }
20
+ if (typeof isDisplay === "function") {
21
+ var isD = isDisplay(form);
22
+ if (!isD) {
23
+ return null;
24
+ }
25
+ }
20
26
  // 是否必填
21
27
  if (isRequired !== undefined) {
22
28
  var isRequireBoolean = !!isRequired;
@@ -34,7 +34,7 @@ var EnhanceCell = function (props) {
34
34
  onEditableSave(__assign(__assign({}, record), (_a = {}, _a[dataIndex] = val, _a)), index, dataIndex);
35
35
  };
36
36
  // 如果开启编辑 那么内部直接代理
37
- if (editable) {
37
+ if (typeof editable === "function" ? editable(record) : editable) {
38
38
  var _d = editableConfig || {
39
39
  type: "input",
40
40
  }, type = _d.type, max = _d.max, min = _d.min, maxHandle = _d.maxHandle, minHandle = _d.minHandle, resetEditableConfigProps = __rest(_d, ["type", "max", "min", "maxHandle", "minHandle"]);
@@ -39,7 +39,7 @@ interface IColumnType<RecordType> extends ColumnType<RecordType> {
39
39
  /**
40
40
  * 是否开启编辑功能
41
41
  */
42
- editable?: boolean;
42
+ editable?: ((record: any) => boolean) | boolean;
43
43
  editableConfig?: IEditableConfig;
44
44
  /**
45
45
  * 开启验证
@@ -1,7 +1,7 @@
1
1
  import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
2
2
  import { useCallback, useState, useEffect, useMemo } from 'react';
3
3
  import { flushSync } from 'react-dom';
4
- import { getFileExtension, isImageExtension, createUploadFileLink, getToken, exactRound, times, divide } from 'zmdms-utils';
4
+ import { getFileExtension, isImageExtension, createDownloadLink, createUploadFileLink, getToken, exactRound, times, divide } from 'zmdms-utils';
5
5
  import MemoUploadList from './uploadList.js';
6
6
  import { message } from 'antd';
7
7
 
@@ -55,13 +55,23 @@ function useBeforeUpload(props) {
55
55
  * 文件改变触发事件
56
56
  */
57
57
  function useOnChange(props) {
58
- var onChange = props.onChange, userName = props.userName, fileList = props.fileList;
58
+ var onChange = props.onChange, userName = props.userName, fileList = props.fileList, isImage = props.isImage, isPublic = props.isPublic, API_BASEURL = props.API_BASEURL;
59
59
  var _a = useState(), innerFileList = _a[0], setInnerFileList = _a[1];
60
60
  useEffect(function () {
61
61
  if (fileList) {
62
- setInnerFileList(fileList);
62
+ if (isImage) {
63
+ setInnerFileList(fileList.map(function (i) {
64
+ return __assign(__assign({}, i), { url: createDownloadLink(i.attachId, {
65
+ API_BASEURL: API_BASEURL,
66
+ open: isPublic,
67
+ }) });
68
+ }));
69
+ }
70
+ else {
71
+ setInnerFileList(fileList);
72
+ }
63
73
  }
64
- }, [fileList]);
74
+ }, [fileList, isImage, API_BASEURL]);
65
75
  var onChangeHandle = useCallback(function (info) {
66
76
  var _a, _b, _c, _d;
67
77
  var file = info.file, fileList = info.fileList;
@@ -45,6 +45,9 @@ var UploadList = function (props, ref) {
45
45
  onChange: onChange,
46
46
  userName: userName,
47
47
  fileList: fileList,
48
+ isImage: isImage,
49
+ isPublic: isPublic,
50
+ API_BASEURL: API_BASEURL,
48
51
  }), onChangeHandle = _h.onChangeHandle, innerFileList = _h.innerFileList, setInnerFileList = _h.setInnerFileList;
49
52
  // 基础参数
50
53
  var _j = useBasicInfo({