@zat-design/sisyphus-react 3.3.1 → 3.3.2

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.
Files changed (81) hide show
  1. package/dist/index.esm.css +32 -9
  2. package/es/ProDownload/utils.js +2 -0
  3. package/es/ProEditTable/components/RenderField/index.js +7 -6
  4. package/es/ProEditTable/index.js +19 -1
  5. package/es/ProEditTable/style/index.less +5 -0
  6. package/es/ProEnum/hooks/useEnumRequest.js +13 -1
  7. package/es/ProForm/components/combination/Group/index.js +3 -4
  8. package/es/ProForm/components/combination/Group/style/index.less +38 -21
  9. package/es/ProForm/components/combination/Group/utils.d.ts +0 -2
  10. package/es/ProForm/components/combination/Group/utils.js +0 -13
  11. package/es/ProForm/components/combination/ProModalSelect/index.js +2 -2
  12. package/es/ProForm/components/render/Render.js +15 -9
  13. package/es/ProForm/components/render/RenderFields.js +2 -1
  14. package/es/ProForm/style/index.less +5 -4
  15. package/es/ProForm/utils/contrastOriginal.d.ts +0 -1
  16. package/es/ProForm/utils/contrastOriginal.js +0 -1
  17. package/es/ProForm/utils/useChanged.d.ts +7 -14
  18. package/es/ProForm/utils/useChanged.js +13 -20
  19. package/es/ProForm/utils/useListChanged.d.ts +16 -0
  20. package/es/ProForm/utils/useListChanged.js +81 -0
  21. package/es/ProForm/utils/useShouldUpdate.js +17 -3
  22. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
  23. package/es/ProLayout/components/Layout/Menu/index.js +13 -10
  24. package/es/ProLayout/propTypes.d.ts +2 -0
  25. package/es/ProTable/style/index.less +1 -0
  26. package/es/ProTooltip/index.js +5 -3
  27. package/es/ProTreeModal/components/Trigger.d.ts +1 -0
  28. package/es/ProTreeModal/components/Trigger.js +17 -8
  29. package/es/ProTreeModal/index.js +12 -2
  30. package/es/ProUpload/components/DragRender.js +1 -2
  31. package/es/ProUpload/components/ImageRender.js +17 -7
  32. package/es/locale/en_US.d.ts +2 -0
  33. package/es/locale/en_US.js +3 -1
  34. package/es/locale/zh_CN.d.ts +3 -0
  35. package/es/locale/zh_CN.js +4 -1
  36. package/lib/ProEditTable/components/RenderField/index.js +9 -6
  37. package/lib/ProEditTable/index.js +18 -0
  38. package/lib/ProEditTable/style/index.less +5 -0
  39. package/lib/ProEnum/hooks/useEnumRequest.js +13 -1
  40. package/lib/ProForm/components/base/RangePicker/index.js +1 -1
  41. package/lib/ProForm/components/combination/Group/index.js +2 -3
  42. package/lib/ProForm/components/combination/Group/style/index.less +38 -21
  43. package/lib/ProForm/components/combination/Group/utils.d.ts +0 -2
  44. package/lib/ProForm/components/combination/Group/utils.js +1 -14
  45. package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
  46. package/lib/ProForm/components/old/InputRange/index.js +0 -1
  47. package/lib/ProForm/components/old/ProCertValidity/index.js +1 -1
  48. package/lib/ProForm/components/render/Render.js +16 -9
  49. package/lib/ProForm/components/render/RenderFields.js +2 -1
  50. package/lib/ProForm/style/index.less +5 -4
  51. package/lib/ProForm/utils/contrastOriginal.d.ts +0 -1
  52. package/lib/ProForm/utils/contrastOriginal.js +0 -1
  53. package/lib/ProForm/utils/useChanged.d.ts +7 -14
  54. package/lib/ProForm/utils/useChanged.js +13 -20
  55. package/lib/ProForm/utils/useListChanged.d.ts +16 -0
  56. package/lib/ProForm/utils/useListChanged.js +86 -0
  57. package/lib/ProForm/utils/useShouldUpdate.js +17 -3
  58. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
  59. package/lib/ProLayout/components/Layout/Menu/index.js +13 -10
  60. package/lib/ProLayout/propTypes.d.ts +2 -0
  61. package/lib/ProTable/components/TableResizable/index.js +8 -0
  62. package/lib/ProTable/style/index.less +1 -0
  63. package/lib/ProTabs/index.js +1 -0
  64. package/lib/ProThemeTools/index.js +1 -0
  65. package/lib/ProTooltip/index.js +4 -2
  66. package/lib/ProTree/components/Tree.js +7 -0
  67. package/lib/ProTree/index.js +0 -1
  68. package/lib/ProTreeModal/components/Tree.js +1 -0
  69. package/lib/ProTreeModal/components/Trigger.d.ts +1 -0
  70. package/lib/ProTreeModal/components/Trigger.js +16 -7
  71. package/lib/ProTreeModal/index.js +12 -2
  72. package/lib/ProUpload/components/DragRender.js +1 -2
  73. package/lib/ProUpload/components/ImageRender.js +16 -6
  74. package/lib/ProUpload/index.js +7 -0
  75. package/lib/ProViewer/index.js +1 -0
  76. package/lib/locale/en_US.d.ts +2 -0
  77. package/lib/locale/en_US.js +3 -1
  78. package/lib/locale/zh_CN.d.ts +3 -0
  79. package/lib/locale/zh_CN.js +4 -1
  80. package/lib/old/ProCertValidity/index.js +1 -1
  81. package/package.json +1 -1
@@ -0,0 +1,16 @@
1
+ import { FormInstance } from 'antd';
2
+ import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
3
+ interface Params {
4
+ name?: NamePath;
5
+ names?: NamePath[];
6
+ namesStr?: NamePath;
7
+ originalName?: NamePath;
8
+ originalNames?: NamePath[];
9
+ originalNameStr?: NamePath;
10
+ originalValues: any;
11
+ form: FormInstance;
12
+ rowKeyPath?: InternalNamePath;
13
+ equalWith?: (originalValue: any, currentValue: any) => boolean;
14
+ }
15
+ export declare const useListChanged: (params: Params) => any[];
16
+ export {};
@@ -0,0 +1,81 @@
1
+ import "antd/es/form/style";
2
+ import _Form from "antd/es/form";
3
+ import { get } from 'lodash';
4
+ import { contrastOriginal } from './contrastOriginal';
5
+ var toNamePath = function toNamePath(name) {
6
+ if (Array.isArray(name)) {
7
+ return name;
8
+ }
9
+ return [name];
10
+ };
11
+ var toNamePaths = function toNamePaths(names) {
12
+ return names.map(function (name) {
13
+ return toNamePath(name);
14
+ });
15
+ };
16
+ var getOriginalValue = function getOriginalValue(_ref) {
17
+ var namePath = _ref.namePath,
18
+ originalName = _ref.originalName,
19
+ originalNames = _ref.originalNames,
20
+ originalValues = _ref.originalValues,
21
+ rowKeyPath = _ref.rowKeyPath,
22
+ form = _ref.form;
23
+ if (!originalValues) {
24
+ return undefined;
25
+ }
26
+ if (rowKeyPath) {
27
+ var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
28
+ var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
29
+ var rowValue = form.getFieldValue(rowValueNamePath);
30
+ var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
31
+ if (!keyValue) return undefined;
32
+ var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
33
+ var originalValueRow = originalValueList.find(function (item) {
34
+ return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
35
+ });
36
+ var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
37
+ return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
38
+ }) : get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
39
+ return originalValue;
40
+ }
41
+ return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
42
+ return get(originalValues, originalName);
43
+ }) : get(originalValues, originalName);
44
+ };
45
+ export var useListChanged = function useListChanged(params) {
46
+ var name = params.name,
47
+ names = params.names,
48
+ namesStr = params.namesStr,
49
+ _params$originalName = params.originalName,
50
+ originalName = _params$originalName === void 0 ? name : _params$originalName,
51
+ _params$originalNames = params.originalNames,
52
+ originalNames = _params$originalNames === void 0 ? names : _params$originalNames,
53
+ originalValues = params.originalValues,
54
+ form = params.form,
55
+ equalWith = params.equalWith,
56
+ rowKeyPath = params.rowKeyPath;
57
+ // let _form = form;
58
+ var namePath = toNamePath(namesStr || name);
59
+ var originalNamePath = toNamePath(originalName);
60
+ var originalNamePaths = originalNames && toNamePaths(originalNames);
61
+ var originalValue = getOriginalValue({
62
+ namePath: namePath,
63
+ originalName: originalNamePath,
64
+ originalNames: originalNamePaths,
65
+ originalValues: originalValues,
66
+ rowKeyPath: rowKeyPath,
67
+ form: form
68
+ });
69
+ var notWatch = !originalValues || originalValue === undefined;
70
+ // @ts-ignore
71
+ // if (notWatch) _form = [];
72
+ var value = _Form.useWatch(namePath, form);
73
+ if (notWatch) return [false];
74
+ var changed = contrastOriginal({
75
+ value: value,
76
+ originalValue: originalValue,
77
+ form: form,
78
+ equalWith: equalWith
79
+ });
80
+ return [changed, originalValue];
81
+ };
@@ -13,7 +13,8 @@ var useShouldUpdate = function useShouldUpdate(props) {
13
13
  required = props.required,
14
14
  fieldProps = props.fieldProps,
15
15
  component = props.component,
16
- originComponent = props.originComponent;
16
+ originComponent = props.originComponent,
17
+ type = props.type;
17
18
  var _shouldUpdate = formItemProps.shouldUpdate,
18
19
  name = formItemProps.name,
19
20
  clearNotShow = formItemProps.clearNotShow,
@@ -60,11 +61,24 @@ var useShouldUpdate = function useShouldUpdate(props) {
60
61
  showRef.current = show;
61
62
  }
62
63
  if (isFunction(disabled)) {
63
- disabledRef.current = Boolean(disabled(values, {
64
+ // RangePicker返回数组时,特殊处理
65
+ if (type === 'RangePicker' && Array.isArray(disabled(values, {
64
66
  form: form,
65
67
  index: index,
66
68
  namePath: namePath
67
- }));
69
+ }))) {
70
+ disabledRef.current = disabled(values, {
71
+ form: form,
72
+ index: index,
73
+ namePath: namePath
74
+ });
75
+ } else {
76
+ disabledRef.current = Boolean(disabled(values, {
77
+ form: form,
78
+ index: index,
79
+ namePath: namePath
80
+ }));
81
+ }
68
82
  } else {
69
83
  disabledRef.current = disabled;
70
84
  }
@@ -26,7 +26,8 @@ var FoldMenu = function FoldMenu(props) {
26
26
  'pro-layout-menu-tooltip-nav-open': collapsed
27
27
  });
28
28
  var _useContext = useContext(LayoutContext),
29
- selectedPath = _useContext.selectedPath;
29
+ selectedPath = _useContext.selectedPath,
30
+ onSelected = _useContext.onSelected;
30
31
  return _jsx("div", {
31
32
  className: "pro-layout-menu-fold",
32
33
  style: _objectSpread({}, style),
@@ -94,10 +95,17 @@ var FoldMenu = function FoldMenu(props) {
94
95
  }, "".concat(id, "-").concat(name)) : !collapsed ? _jsx(_Tooltip, {
95
96
  placement: "right",
96
97
  title: name,
97
- children: _jsx(Link, {
98
- to: toPath,
99
- children: LiNode
100
- }, toPath)
98
+ children: _jsx("span", {
99
+ onClick: function onClick() {
100
+ onSelected({
101
+ selectedPath: toPath
102
+ });
103
+ },
104
+ children: _jsx(Link, {
105
+ to: toPath,
106
+ children: LiNode
107
+ }, toPath)
108
+ })
101
109
  }, toPath) : _jsx(Link, {
102
110
  to: toPath,
103
111
  children: LiNode
@@ -3,14 +3,17 @@ import classnames from 'classnames';
3
3
  import OpenMenu from './OpenMenu';
4
4
  import FoldMenu from './FoldMenu'; // 折叠后菜单
5
5
  var Menu = function Menu(props) {
6
- var headerHeight = props.headerHeight,
7
- dataSource = props.dataSource,
8
- iconfontUrl = props.iconfontUrl,
9
- collapsed = props.collapsed,
10
- notice = props.notice,
11
- onToggle = props.onToggle,
12
- pure = props.pure,
13
- theme = props.theme;
6
+ var _ref = props || {},
7
+ headerHeight = _ref.headerHeight,
8
+ dataSource = _ref.dataSource,
9
+ iconfontUrl = _ref.iconfontUrl,
10
+ collapsed = _ref.collapsed,
11
+ notice = _ref.notice,
12
+ onToggle = _ref.onToggle,
13
+ pure = _ref.pure,
14
+ theme = _ref.theme,
15
+ sideMenuFooterRender = _ref.sideMenuFooterRender,
16
+ sideMenuHeaderRender = _ref.sideMenuHeaderRender;
14
17
  var menus = [];
15
18
  var menuCls = classnames({
16
19
  'pro-layout-menu': true,
@@ -29,7 +32,7 @@ var Menu = function Menu(props) {
29
32
  style: {
30
33
  top: notice ? 80 + headerHeight - 48 : headerHeight
31
34
  },
32
- children: [_jsx(OpenMenu, {
35
+ children: [sideMenuHeaderRender, _jsx(OpenMenu, {
33
36
  dataSource: {
34
37
  menus: menus,
35
38
  iconfontUrl: iconfontUrl,
@@ -52,7 +55,7 @@ var Menu = function Menu(props) {
52
55
  display: collapsed ? 'none' : 'block',
53
56
  height: "calc(100vh - ".concat(headerHeight + (notice ? 32 : 0) + 48 || 0, "px)")
54
57
  }
55
- }), _jsx("div", {
58
+ }), sideMenuFooterRender || _jsx("div", {
56
59
  className: "pro-layout-menu-collapsed",
57
60
  onClick: onToggle,
58
61
  children: _jsx("div", {
@@ -36,6 +36,8 @@ export interface ProLayoutProps {
36
36
  rightContentRender?: ReactNode;
37
37
  headerContentRender?: ReactNode;
38
38
  headerTitleRender?: ReactNode;
39
+ sideMenuHeaderRender?: ReactNode;
40
+ sideMenuFooterRender?: ReactNode;
39
41
  headerNotice?: ReactNode | string;
40
42
  notice?: ReactNode | string;
41
43
  title?: string;
@@ -69,6 +69,7 @@
69
69
 
70
70
  td {
71
71
  background: #d2fff4 !important;
72
+ border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
72
73
  }
73
74
  }
74
75
 
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
7
  var _excluded = ["text", "mode", "width", "line", "isResponsiveWidth", "className", "style", "lineHeight"];
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- import { useSize, useSetState, useDebounce } from 'ahooks';
9
+ import { useSize, useSetState, useDebounce, useDebounceEffect } from 'ahooks';
10
10
  import { useEffect, useRef } from 'react';
11
11
  import classnames from 'classnames';
12
12
  import './style/index.less';
@@ -135,7 +135,7 @@ var ProTooltip = function ProTooltip(props) {
135
135
  }
136
136
  return line > 1 ? _jsx(AutoMixinMulti, {}) : _jsx(AutoMixinSingle, {});
137
137
  };
138
- useEffect(function () {
138
+ useDebounceEffect(function () {
139
139
  if (isResponsiveWidth && parentElement) {
140
140
  var cWidth = parentElement.clientWidth - 32;
141
141
  var contentDom = childRef.current;
@@ -149,7 +149,9 @@ var ProTooltip = function ProTooltip(props) {
149
149
  localWidth: _width
150
150
  });
151
151
  }
152
- }, [isResponsiveWidth, size]);
152
+ }, [isResponsiveWidth, size], {
153
+ wait: 300
154
+ });
153
155
  useEffect(function () {
154
156
  if (mode === 'auto' && line === 1) {
155
157
  var localDom = ref.current;
@@ -2,6 +2,7 @@ import { CSSProperties } from 'react';
2
2
  interface TriggerProps {
3
3
  checkedValues: any[];
4
4
  value: any;
5
+ label?: React.ReactNode;
5
6
  disabled?: boolean;
6
7
  isView?: boolean;
7
8
  checkAll?: boolean;
@@ -1,8 +1,8 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import "antd/es/input/style";
3
2
  import _Input from "antd/es/input";
4
3
  import "antd/es/select/style";
5
4
  import _Select from "antd/es/select";
5
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
6
  import "antd/es/space/style";
7
7
  import _Space from "antd/es/space";
8
8
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
@@ -17,6 +17,7 @@ import viewSvg from '../../assets/view.svg';
17
17
  function Trigger(props) {
18
18
  var _locale$ProTreeModal2, _locale$ProTreeModal3;
19
19
  var value = props.value,
20
+ label = props.label,
20
21
  disabled = props.disabled,
21
22
  isView = props.isView,
22
23
  triggerStyle = props.triggerStyle,
@@ -34,7 +35,7 @@ function Trigger(props) {
34
35
  state = _useSetState2[0],
35
36
  setState = _useSetState2[1];
36
37
  useEffect(function () {
37
- if (checkAll && appoint) {
38
+ if (allValue === value && appoint) {
38
39
  setState({
39
40
  mode: 'all'
40
41
  });
@@ -51,7 +52,9 @@ function Trigger(props) {
51
52
  return _jsxs("div", {
52
53
  className: "pro-tree-modal-isView",
53
54
  children: [_jsx("div", {
54
- children: checkedValues.length === 0 ? '-' : checkAll ? locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.checkAll : formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal = locale.ProTreeModal) === null || _locale$ProTreeModal === void 0 ? void 0 : _locale$ProTreeModal.checkNumber, {
55
+ children: checkedValues.length === 0 ? '-' : state.mode === 'all' ? formatMessage(locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.checkAll1, {
56
+ all: label
57
+ }) : formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal = locale.ProTreeModal) === null || _locale$ProTreeModal === void 0 ? void 0 : _locale$ProTreeModal.checkNumber, {
55
58
  num: checkedValues.length
56
59
  })
57
60
  }), _jsx("div", {
@@ -78,7 +81,11 @@ function Trigger(props) {
78
81
  if (appoint) {
79
82
  return _jsxs(_Space.Compact, {
80
83
  block: true,
84
+ style: _objectSpread({}, triggerStyle),
81
85
  children: [_jsxs(_Select, {
86
+ style: {
87
+ width: 'auto'
88
+ },
82
89
  disabled: disabled,
83
90
  className: classNames(disabled ? 'trigger-no-hover' : '', appoint ? 'pro-tree-modal-input-appoint' : ''),
84
91
  defaultValue: "appoint",
@@ -86,10 +93,10 @@ function Trigger(props) {
86
93
  onChange: onAppointChange,
87
94
  children: [_jsx(_Select.Option, {
88
95
  value: "all",
89
- children: "\u5168\u90E8"
96
+ children: locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.specifyMode[0]
90
97
  }), _jsx(_Select.Option, {
91
98
  value: "appoint",
92
- children: "\u6307\u5B9A"
99
+ children: locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.specifyMode[1]
93
100
  })]
94
101
  }), props.children]
95
102
  });
@@ -100,10 +107,12 @@ function Trigger(props) {
100
107
  children: _jsx(_Input, {
101
108
  className: classNames(disabled ? 'trigger-no-hover' : '', appoint ? 'pro-tree-modal-input-appoint' : ''),
102
109
  onClick: handleClick,
103
- value: checkedValues.length === 0 ? null : checkAll ? locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.checkAll : formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal2 = locale.ProTreeModal) === null || _locale$ProTreeModal2 === void 0 ? void 0 : _locale$ProTreeModal2.checkNumber, {
110
+ value: checkedValues.length === 0 ? null : state.mode === 'all' ? formatMessage(locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.checkAll1, {
111
+ all: label
112
+ }) : formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal2 = locale.ProTreeModal) === null || _locale$ProTreeModal2 === void 0 ? void 0 : _locale$ProTreeModal2.checkNumber, {
104
113
  num: checkedValues.length
105
114
  }),
106
- addonAfter: _jsxs("div", {
115
+ addonAfter: state.mode === 'all' ? null : _jsxs("div", {
107
116
  className: "pro-enum-input-addonAfter",
108
117
  children: [checkedValues.length > 0 && !disabled && _jsx("span", {
109
118
  className: "close-icon",
@@ -117,7 +126,7 @@ function Trigger(props) {
117
126
  })]
118
127
  }),
119
128
  placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal3 = locale.ProTreeModal) === null || _locale$ProTreeModal3 === void 0 ? void 0 : _locale$ProTreeModal3.select,
120
- disabled: disabled || appoint && value === allValue,
129
+ disabled: disabled || state.mode === 'all',
121
130
  style: _objectSpread({}, triggerStyle)
122
131
  })
123
132
  });
@@ -42,7 +42,6 @@ var ProTreeModal = function ProTreeModal(props) {
42
42
  _props$title = props.title,
43
43
  title = _props$title === void 0 ? locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal = locale.ProTreeModal) === null || _locale$ProTreeModal === void 0 ? void 0 : _locale$ProTreeModal.select : _props$title,
44
44
  useRequest = props.useRequest,
45
- allValue = props.allValue,
46
45
  _props$showCodeName = props.showCodeName,
47
46
  showCodeName = _props$showCodeName === void 0 ? false : _props$showCodeName,
48
47
  _props$checkStrictly = props.checkStrictly,
@@ -72,9 +71,14 @@ var ProTreeModal = function ProTreeModal(props) {
72
71
  optionRender = props.optionRender,
73
72
  openChange = props.openChange,
74
73
  maxMessage = props.maxMessage;
74
+ var allValue = props.allValue;
75
75
  var modeType = mode.toUpperCase();
76
76
  var fieldNameLabel = fieldNames.label;
77
77
  var fieldNameValue = fieldNames.value;
78
+ if (appoint && !allValue) {
79
+ console.error('allValue must be input');
80
+ allValue = 'all';
81
+ }
78
82
  var _useSetState = useSetState({
79
83
  open: false,
80
84
  checkedValues: [],
@@ -217,8 +221,11 @@ var ProTreeModal = function ProTreeModal(props) {
217
221
  */
218
222
  var handleFinish = function handleFinish() {
219
223
  // 全选的时候返回 allValue 标记即可
224
+ // 3.3.2 版本全选的时候返回所有值的合集 list
220
225
  if (allValue !== undefined && state.checkAll && !draggable) {
221
- onChange === null || onChange === void 0 ? void 0 : onChange(allValue);
226
+ onChange === null || onChange === void 0 ? void 0 : onChange(state.flatTreeData.map(function (item) {
227
+ return item[fieldNameValue];
228
+ }));
222
229
  } else if (draggable && span) {
223
230
  var _listRef$current;
224
231
  // 开启 draggable 使用拖拽后的顺序
@@ -269,6 +276,7 @@ var ProTreeModal = function ProTreeModal(props) {
269
276
  treeViewData: [],
270
277
  checkAll: false
271
278
  });
279
+ onChange === null || onChange === void 0 ? void 0 : onChange(_checkedValues);
272
280
  };
273
281
  /**
274
282
  * Drawer close
@@ -493,6 +501,7 @@ var ProTreeModal = function ProTreeModal(props) {
493
501
  * @returns
494
502
  */
495
503
  var TriggerComponent = useMemo(function () {
504
+ var _props$otherProps3;
496
505
  if (trigger && /*#__PURE__*/React.isValidElement(trigger)) {
497
506
  return _jsx("div", {
498
507
  onClick: handleClick,
@@ -508,6 +517,7 @@ var ProTreeModal = function ProTreeModal(props) {
508
517
  isView: isView,
509
518
  appoint: appoint,
510
519
  allValue: allValue,
520
+ label: props === null || props === void 0 ? void 0 : (_props$otherProps3 = props.otherProps) === null || _props$otherProps3 === void 0 ? void 0 : _props$otherProps3.label,
511
521
  handleClick: handleClick,
512
522
  handleClearAll: handleClearAll,
513
523
  appointChange: appointChange
@@ -52,8 +52,7 @@ var DragRender = function DragRender(props) {
52
52
  */
53
53
  var handleReSelect = function handleReSelect(file) {
54
54
  if (disabled) return;
55
- // handleDelFile(file);
56
- setFileList([]);
55
+ handleDelFile(file);
57
56
  setTimeout(function () {
58
57
  refReSelect.current.click();
59
58
  }, 1);
@@ -17,12 +17,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
17
17
  * @Author: wangshengqiang
18
18
  * @Date: 2023-07-27 20:13:07
19
19
  * @LastEditors: wangshengqiang
20
- * @LastEditTime: 2023-11-21 15:24:56
20
+ * @LastEditTime: 2023-11-29 19:33:04
21
21
  * @Description: 图片类型
22
22
  *
23
23
  */
24
24
 
25
- import { useState } from 'react';
25
+ import { useRef, useState } from 'react';
26
26
  import { DndContext } from '@dnd-kit/core';
27
27
  import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
28
28
  import { ReactSVG } from 'react-svg';
@@ -34,6 +34,9 @@ import lookSvg from '../../assets/look.svg';
34
34
  import deleteSvg from '../../assets/delete.svg';
35
35
  import downloadSvg from '../../assets/download.svg';
36
36
  import locale from '../../locale';
37
+ var isImgage = function isImgage(_fileExt) {
38
+ return ['.PNG', '.JPG', '.JPEG', '.GIF', '.BMP', '.JPE'].includes(_fileExt.toLocaleUpperCase());
39
+ };
37
40
  /* 按钮类型 */
38
41
  var ImageRender = function ImageRender(props) {
39
42
  var _locale$ProUpload4;
@@ -41,6 +44,7 @@ var ImageRender = function ImageRender(props) {
41
44
  _useState2 = _slicedToArray(_useState, 2),
42
45
  previewImg = _useState2[0],
43
46
  setPreviewImg = _useState2[1];
47
+ var proViewerRef = useRef(null);
44
48
  var isView = props.isView,
45
49
  disabled = props.disabled,
46
50
  headerRender = props.headerRender,
@@ -67,7 +71,13 @@ var ImageRender = function ImageRender(props) {
67
71
  if (onPreview) {
68
72
  onPreview(file);
69
73
  } else {
70
- setPreviewImg(file);
74
+ var _file$url;
75
+ var _fileExt = getFileExt(file.name || (file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('?')[0]));
76
+ if (isImgage(_fileExt)) {
77
+ setPreviewImg(file);
78
+ } else {
79
+ window.open(file.url, '_blank');
80
+ }
71
81
  }
72
82
  };
73
83
  /**
@@ -96,12 +106,12 @@ var ImageRender = function ImageRender(props) {
96
106
  openFileDialogOnClick: !showDraggerSingleRender,
97
107
  disabled: disabled || isView,
98
108
  itemRender: function itemRender(originNode, file, fileList, actions) {
99
- var _file$url, _locale$ProUpload, _locale$ProUpload2, _locale$ProUpload3;
109
+ var _file$url2, _locale$ProUpload, _locale$ProUpload2, _locale$ProUpload3;
100
110
  var _isShowDownload = !!onDownload && file.status === 'done';
101
- var _fileExt = getFileExt(file.name || (file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('?')[0]));
111
+ var _fileExt = getFileExt(file.name || (file === null || file === void 0 ? void 0 : (_file$url2 = file.url) === null || _file$url2 === void 0 ? void 0 : _file$url2.split('?')[0]));
102
112
  var _fileIcon = getFileIcon(_fileExt);
103
- var isImg = ['.PNG', '.JPG', '.JPEG', '.GIF', '.BMP', '.JPE'].includes(_fileExt.toLocaleUpperCase());
104
- var _showPreview = isImg;
113
+ var isImg = isImgage(_fileExt);
114
+ var _showPreview = isImg || file.status === 'done';
105
115
  return _jsx(DraggableUploadListItem, {
106
116
  file: file,
107
117
  children: _jsxs("div", {
@@ -127,10 +127,12 @@ declare const _default: {
127
127
  selectMax: string;
128
128
  noCheck: string;
129
129
  checkAll: string;
130
+ checkAll1: string;
130
131
  check: string;
131
132
  clearAll: string;
132
133
  checkNumber: string;
133
134
  noFinal: string;
135
+ specifyMode: string[];
134
136
  };
135
137
  ProTimeLimit: {
136
138
  foreverText: string;
@@ -127,10 +127,12 @@ export default {
127
127
  selectMax: 'Select at most {max} items',
128
128
  noCheck: 'None selected yet',
129
129
  checkAll: 'Select all',
130
+ checkAll1: 'Select all {all}',
130
131
  check: 'selected',
131
132
  clearAll: 'Clear all',
132
133
  checkNumber: '{num} items selected',
133
- noFinal: 'Oops, the content you are looking for is not found.'
134
+ noFinal: 'Oops, the content you are looking for is not found.',
135
+ specifyMode: ['all', 'specify']
134
136
  },
135
137
  ProTimeLimit: {
136
138
  foreverText: 'long term'
@@ -127,9 +127,12 @@ declare const _default: {
127
127
  selectMax: string;
128
128
  noCheck: string;
129
129
  checkAll: string;
130
+ checkAll1: string;
130
131
  check: string;
131
132
  clearAll: string;
132
133
  checkNumber: string;
134
+ noFinal: string;
135
+ specifyMode: string[];
133
136
  };
134
137
  ProTimeLimit: {
135
138
  foreverText: string;
@@ -127,9 +127,12 @@ export default {
127
127
  selectMax: '最多选择{max}个',
128
128
  noCheck: '暂无已选',
129
129
  checkAll: '全选',
130
+ checkAll1: '全部{all}',
130
131
  check: '已选',
131
132
  clearAll: '清空全部',
132
- checkNumber: '已选择{num}项'
133
+ checkNumber: '已选择{num}项',
134
+ noFinal: '哎呀,你要找的内容没有找到。',
135
+ specifyMode: ['全部', '指定']
133
136
  },
134
137
  ProTimeLimit: {
135
138
  foreverText: '长期'
@@ -25,11 +25,13 @@ var componentMap = _interopRequireWildcard(require("../../../ProForm/components"
25
25
  var _Container = _interopRequireDefault(require("../../../ProForm/components/Container"));
26
26
  var _transformNames = _interopRequireDefault(require("../../../ProForm/utils/transformNames"));
27
27
  var _useFieldProps = require("../../../ProForm/utils/useFieldProps");
28
- var _useChanged3 = require("../../../ProForm/utils/useChanged");
28
+ var _useListChanged3 = require("../../../ProForm/utils/useListChanged");
29
29
  var _useRules = _interopRequireDefault(require("../../../ProForm/utils/useRules"));
30
30
  var _utils = require("../../../ProForm/utils");
31
31
  var _locale = _interopRequireDefault(require("../../../locale"));
32
32
  var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className"];
33
+ /* eslint-disable prefer-destructuring */
34
+ /* eslint-disable prefer-const */
33
35
  var RenderField = function RenderField(_ref) {
34
36
  var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _formItemChildProps$p, _TargetComponent4, _classNames;
35
37
  var value = _ref.text,
@@ -130,7 +132,7 @@ var RenderField = function RenderField(_ref) {
130
132
  names: names,
131
133
  label: label,
132
134
  labelRequired: labelRequired,
133
- required: _required,
135
+ required: !isView && _required,
134
136
  rules: isEditing ? _rules : [],
135
137
  isSelect: (0, _utils.isSelect)({
136
138
  dataSource: (_fieldProps4 = _fieldProps) === null || _fieldProps4 === void 0 ? void 0 : _fieldProps4.dataSource,
@@ -453,19 +455,20 @@ var RenderField = function RenderField(_ref) {
453
455
  };
454
456
  }();
455
457
  // 判断当前字段是否变更
456
- var _useChanged = (0, _useChanged3.useChanged)({
458
+ var _useListChanged = (0, _useListChanged3.useListChanged)({
457
459
  name: cellName,
458
460
  names: names,
459
461
  namesStr: [].concat((0, _toConsumableArray2.default)(baseName), [index, dataIndex]),
462
+ rowKeyPath: [].concat((0, _toConsumableArray2.default)(baseName), [index, 'rowKey']),
460
463
  originalName: originalName,
461
464
  originalNames: originalNames,
462
465
  originalValues: originalValues,
463
466
  form: form,
464
467
  equalWith: equalWith
465
468
  }),
466
- _useChanged2 = (0, _slicedToArray2.default)(_useChanged, 2),
467
- changed = _useChanged2[0],
468
- originalValue = _useChanged2[1];
469
+ _useListChanged2 = (0, _slicedToArray2.default)(_useListChanged, 2),
470
+ changed = _useListChanged2[0],
471
+ originalValue = _useListChanged2[1];
469
472
  var componentProps = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
470
473
  form: form,
471
474
  name: cellName,
@@ -109,6 +109,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
109
109
  }
110
110
  return key;
111
111
  };
112
+ var IsNew = function IsNew(preArr, record) {
113
+ var _preArr$find;
114
+ if (!(preArr === null || preArr === void 0 ? void 0 : preArr.length)) {
115
+ return false;
116
+ }
117
+ return !(preArr === null || preArr === void 0 ? void 0 : (_preArr$find = preArr.find) === null || _preArr$find === void 0 ? void 0 : _preArr$find.call(preArr, function (item) {
118
+ return getRowKey(item) === getRowKey(record);
119
+ }));
120
+ };
112
121
  var config = {
113
122
  form: form,
114
123
  mode: mode,
@@ -145,6 +154,10 @@ var ProEditTable = function ProEditTable(_ref, ref) {
145
154
  var _rowClassName = function _rowClassName(record) {
146
155
  var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
147
156
  var className = isEdit ? 'is-editing' : '';
157
+ var originalArr = (0, _lodash.get)(originalValues, name);
158
+ if (!isEdit && IsNew(originalArr, record)) {
159
+ return "is-new-row ".concat(className);
160
+ }
148
161
  return className;
149
162
  };
150
163
  // 复选框
@@ -249,11 +262,16 @@ var ProEditTable = function ProEditTable(_ref, ref) {
249
262
  var _value$;
250
263
  // 初始化默认生成row-key
251
264
  if ((value === null || value === void 0 ? void 0 : value.length) && !(value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey)) {
265
+ var _originalArr$forEach;
252
266
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
253
267
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
254
268
  rowKey: getRowKey(item)
255
269
  });
256
270
  });
271
+ var originalArr = (0, _lodash.get)(originalValues, name);
272
+ originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$forEach = originalArr.forEach) === null || _originalArr$forEach === void 0 ? void 0 : _originalArr$forEach.call(originalArr, function (item) {
273
+ item.rowKey = getRowKey(item);
274
+ });
257
275
  onChange(nextValues);
258
276
  if (virtualKey) {
259
277
  form.setFieldValue(virtualRowName, nextValues);
@@ -296,6 +296,11 @@
296
296
  }
297
297
  }
298
298
 
299
+ .is-new-row, .is-new-row.@{ant-prefix}-table-row:hover {
300
+ td, .@{ant-prefix}-table-cell-row-hover {
301
+ background: var(--ant-primary-2) !important;
302
+ }
303
+ }
299
304
  }
300
305
 
301
306
  .pro-edit-table-header {