@zat-design/sisyphus-react 3.2.1 → 3.2.2-beta.1

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 (140) hide show
  1. package/dist/index.esm.css +63 -35
  2. package/es/ProDrawerForm/style/index.less +59 -59
  3. package/es/ProEditTable/components/RenderField/index.js +66 -21
  4. package/es/ProEditTable/index.js +11 -4
  5. package/es/ProEditTable/propsType.d.ts +11 -1
  6. package/es/ProForm/components/base/Checkbox/index.d.ts +1 -0
  7. package/es/ProForm/components/base/Checkbox/index.js +5 -3
  8. package/es/ProForm/components/base/DatePicker/index.js +3 -2
  9. package/es/ProForm/components/base/Input/index.js +4 -2
  10. package/es/ProForm/components/base/Input/propsType.d.ts +1 -0
  11. package/es/ProForm/components/base/InputNumber/index.d.ts +1 -0
  12. package/es/ProForm/components/base/InputNumber/index.js +5 -3
  13. package/es/ProForm/components/base/ProCascader/index.js +6 -6
  14. package/es/ProForm/components/base/Radio/index.d.ts +1 -0
  15. package/es/ProForm/components/base/Radio/index.js +4 -2
  16. package/es/ProForm/components/base/RangePicker/index.d.ts +1 -0
  17. package/es/ProForm/components/base/RangePicker/index.js +5 -3
  18. package/es/ProForm/components/base/Select/index.d.ts +1 -0
  19. package/es/ProForm/components/base/Select/index.js +4 -2
  20. package/es/ProForm/components/base/Switch/index.d.ts +1 -0
  21. package/es/ProForm/components/base/Switch/index.js +4 -2
  22. package/es/ProForm/components/base/SwitchCheckbox/index.d.ts +1 -0
  23. package/es/ProForm/components/base/SwitchCheckbox/index.js +4 -2
  24. package/es/ProForm/components/base/TextArea/index.d.ts +1 -0
  25. package/es/ProForm/components/base/TextArea/index.js +4 -3
  26. package/es/ProForm/components/base/TimePicker/index.d.ts +1 -0
  27. package/es/ProForm/components/base/TimePicker/index.js +4 -2
  28. package/es/ProForm/components/combination/Container/index.js +7 -5
  29. package/es/ProForm/components/combination/FormList/index.js +6 -5
  30. package/es/ProForm/components/combination/FormList/style/index.less +15 -22
  31. package/es/ProForm/components/combination/Group/index.js +6 -3
  32. package/es/ProForm/components/combination/ProAddressBar/index.js +29 -30
  33. package/es/ProForm/components/combination/ProCombination/index.js +11 -11
  34. package/es/ProForm/components/combination/ProModalSelect/index.js +4 -5
  35. package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
  36. package/es/ProForm/components/combination/ProNumberRange/index.d.ts +1 -1
  37. package/es/ProForm/components/combination/ProNumberRange/index.js +7 -7
  38. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -0
  39. package/es/ProForm/components/combination/ProRangeLimit/index.js +4 -2
  40. package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -0
  41. package/es/ProForm/components/combination/ProTimeLimit/index.js +4 -2
  42. package/es/ProForm/components/render/Render.js +54 -20
  43. package/es/ProForm/components/render/RenderFields.d.ts +1 -0
  44. package/es/ProForm/components/render/RenderFields.js +12 -11
  45. package/es/ProForm/index.js +5 -2
  46. package/es/ProForm/propsType.d.ts +1 -0
  47. package/es/ProForm/style/index.less +49 -42
  48. package/es/ProForm/utils/contrastOriginal.d.ts +10 -1
  49. package/es/ProForm/utils/contrastOriginal.js +15 -18
  50. package/es/ProForm/utils/useChanged.d.ts +15 -1
  51. package/es/ProForm/utils/useChanged.js +27 -8
  52. package/es/ProLayout/components/ProFooter/style/index.less +8 -7
  53. package/es/ProLayout/components/ProHeader/index.js +1 -0
  54. package/es/ProLayout/components/ProHeader/style/index.less +7 -0
  55. package/es/ProSelect/index.js +6 -3
  56. package/es/ProStep/components/Item/index.js +1 -4
  57. package/es/ProTable/components/RenderColumn/index.js +1 -1
  58. package/es/ProTable/style/index.less +6 -0
  59. package/es/ProTabs/style/index.less +16 -17
  60. package/es/ProThemeTools/component/PrdTools/index.js +21 -20
  61. package/es/ProThemeTools/index.js +2 -1
  62. package/es/ProTree/components/Tree.js +43 -42
  63. package/es/ProTree/style/index.less +0 -6
  64. package/es/ProTreeModal/index.js +14 -3
  65. package/es/ProTreeSelect/index.js +3 -2
  66. package/es/locale/en_US.d.ts +15 -1
  67. package/es/locale/en_US.js +17 -3
  68. package/es/locale/zh_CN.d.ts +15 -1
  69. package/es/locale/zh_CN.js +15 -1
  70. package/es/style/theme/antd.less +126 -117
  71. package/lib/ProDrawerForm/style/index.less +59 -59
  72. package/lib/ProEditTable/components/RenderField/index.js +61 -20
  73. package/lib/ProEditTable/index.js +12 -4
  74. package/lib/ProEditTable/propsType.d.ts +11 -1
  75. package/lib/ProForm/components/base/Checkbox/index.d.ts +1 -0
  76. package/lib/ProForm/components/base/Checkbox/index.js +5 -3
  77. package/lib/ProForm/components/base/DatePicker/index.js +3 -2
  78. package/lib/ProForm/components/base/Input/index.js +4 -2
  79. package/lib/ProForm/components/base/Input/propsType.d.ts +1 -0
  80. package/lib/ProForm/components/base/InputNumber/index.d.ts +1 -0
  81. package/lib/ProForm/components/base/InputNumber/index.js +5 -3
  82. package/lib/ProForm/components/base/ProCascader/index.js +6 -6
  83. package/lib/ProForm/components/base/Radio/index.d.ts +1 -0
  84. package/lib/ProForm/components/base/Radio/index.js +4 -2
  85. package/lib/ProForm/components/base/RangePicker/index.d.ts +1 -0
  86. package/lib/ProForm/components/base/RangePicker/index.js +5 -3
  87. package/lib/ProForm/components/base/Select/index.d.ts +1 -0
  88. package/lib/ProForm/components/base/Select/index.js +4 -2
  89. package/lib/ProForm/components/base/Switch/index.d.ts +1 -0
  90. package/lib/ProForm/components/base/Switch/index.js +4 -2
  91. package/lib/ProForm/components/base/SwitchCheckbox/index.d.ts +1 -0
  92. package/lib/ProForm/components/base/SwitchCheckbox/index.js +4 -2
  93. package/lib/ProForm/components/base/TextArea/index.d.ts +1 -0
  94. package/lib/ProForm/components/base/TextArea/index.js +4 -3
  95. package/lib/ProForm/components/base/TimePicker/index.d.ts +1 -0
  96. package/lib/ProForm/components/base/TimePicker/index.js +4 -2
  97. package/lib/ProForm/components/combination/Container/index.js +7 -5
  98. package/lib/ProForm/components/combination/FormList/index.js +6 -5
  99. package/lib/ProForm/components/combination/FormList/style/index.less +15 -22
  100. package/lib/ProForm/components/combination/Group/index.js +6 -3
  101. package/lib/ProForm/components/combination/ProAddressBar/index.js +29 -30
  102. package/lib/ProForm/components/combination/ProCombination/index.js +11 -11
  103. package/lib/ProForm/components/combination/ProModalSelect/index.js +4 -5
  104. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
  105. package/lib/ProForm/components/combination/ProNumberRange/index.d.ts +1 -1
  106. package/lib/ProForm/components/combination/ProNumberRange/index.js +7 -7
  107. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -0
  108. package/lib/ProForm/components/combination/ProRangeLimit/index.js +4 -2
  109. package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -0
  110. package/lib/ProForm/components/combination/ProTimeLimit/index.js +4 -2
  111. package/lib/ProForm/components/render/Render.js +53 -21
  112. package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
  113. package/lib/ProForm/components/render/RenderFields.js +12 -11
  114. package/lib/ProForm/index.js +5 -2
  115. package/lib/ProForm/propsType.d.ts +1 -0
  116. package/lib/ProForm/style/index.less +49 -42
  117. package/lib/ProForm/utils/contrastOriginal.d.ts +10 -1
  118. package/lib/ProForm/utils/contrastOriginal.js +14 -17
  119. package/lib/ProForm/utils/useChanged.d.ts +15 -1
  120. package/lib/ProForm/utils/useChanged.js +27 -8
  121. package/lib/ProLayout/components/ProFooter/style/index.less +8 -7
  122. package/lib/ProLayout/components/ProHeader/index.js +1 -0
  123. package/lib/ProLayout/components/ProHeader/style/index.less +7 -0
  124. package/lib/ProSelect/index.js +6 -3
  125. package/lib/ProStep/components/Item/index.js +1 -4
  126. package/lib/ProTable/components/RenderColumn/index.js +1 -1
  127. package/lib/ProTable/style/index.less +6 -0
  128. package/lib/ProTabs/style/index.less +16 -17
  129. package/lib/ProThemeTools/component/PrdTools/index.js +21 -20
  130. package/lib/ProThemeTools/index.js +2 -1
  131. package/lib/ProTree/components/Tree.js +42 -41
  132. package/lib/ProTree/style/index.less +0 -6
  133. package/lib/ProTreeModal/index.js +14 -3
  134. package/lib/ProTreeSelect/index.js +3 -2
  135. package/lib/locale/en_US.d.ts +15 -1
  136. package/lib/locale/en_US.js +17 -3
  137. package/lib/locale/zh_CN.d.ts +15 -1
  138. package/lib/locale/zh_CN.js +15 -1
  139. package/lib/style/theme/antd.less +126 -117
  140. package/package.json +1 -1
@@ -10,7 +10,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
10
10
  import "antd/es/form/style";
11
11
  import _Form from "antd/es/form";
12
12
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
13
- var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination"];
13
+ var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalTip"];
14
14
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
16
16
  import { isArray } from 'lodash';
@@ -20,7 +20,7 @@ import { transformColumns } from './utils';
20
20
  import { getRandom, getNamePath } from './utils/tools';
21
21
  import { DndWrapper, Row, Validator, Summary, RenderToolbar } from './components';
22
22
  import Empty from '../assets/empty.png';
23
- import locale from '../locale';
23
+ import locale, { formatMessage } from '../locale';
24
24
  var ProEditTable = function ProEditTable(_ref, ref) {
25
25
  var _resetProps$id, _resetProps$id$split, _value$2;
26
26
  var value = _ref.value,
@@ -48,6 +48,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
48
48
  max = _ref.max,
49
49
  headerRender = _ref.headerRender,
50
50
  pagination = _ref.pagination,
51
+ originalValues = _ref.originalValues,
52
+ originalTip = _ref.originalTip,
51
53
  resetProps = _objectWithoutProperties(_ref, _excluded);
52
54
  // 上下文form
53
55
  var contentForm = _Form.useFormInstance();
@@ -134,7 +136,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
134
136
  tableRef: tableRef,
135
137
  max: max,
136
138
  tableLength: value === null || value === void 0 ? void 0 : value.length,
137
- page: page
139
+ page: page,
140
+ originalValues: originalValues,
141
+ originalTip: originalTip
138
142
  };
139
143
  // 判断是否禁止添加、批量删除
140
144
  var isForbiddenBtn = useCallback(function (type) {
@@ -290,8 +294,11 @@ var ProEditTable = function ProEditTable(_ref, ref) {
290
294
  showQuickJumper: true,
291
295
  total: value.length,
292
296
  showTotal: function showTotal(total) {
297
+ var _locale$ProEditTable;
293
298
  if (!total) return;
294
- return "\u5171".concat(total, "\u6761");
299
+ return formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProEditTable = locale.ProEditTable) === null || _locale$ProEditTable === void 0 ? void 0 : _locale$ProEditTable.total, {
300
+ total: total
301
+ });
295
302
  },
296
303
  onChange: handlePageChange
297
304
  }, pagination) : false,
@@ -121,9 +121,19 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
121
121
  * @default -
122
122
  */
123
123
  form?: FormInstance;
124
+ /**
125
+ * @description 原始数据源,设置后可以对比更新后的数值
126
+ * @default -
127
+ */
128
+ originalValues?: any;
129
+ /**
130
+ * @description 原始数据源,是否tooltip显示
131
+ * @default -
132
+ */
133
+ originalTip?: boolean;
124
134
  /**
125
135
  * @description 可编辑表格的类型,单行、多行、单元格编辑
126
- * @default multiple
136
+ * @default false
127
137
  */
128
138
  mode?: 'single' | 'multiple' | 'cell';
129
139
  /**
@@ -8,6 +8,7 @@ export interface Props extends Omit<CheckboxGroupProps, 'options'> {
8
8
  value: string;
9
9
  };
10
10
  otherProps?: ProFormOtherProps;
11
+ isView?: boolean;
11
12
  }
12
13
  declare const Checkbox: React.FC<Props>;
13
14
  export default Checkbox;
@@ -7,15 +7,17 @@ import { createElement as _createElement } from "react";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import Container from '../../Container';
9
9
  import { useProConfig } from '../../../../ProConfigProvider';
10
+ import ProForm from '../../../index';
10
11
  var Checkbox = function Checkbox(props) {
11
12
  var dataSource = props.dataSource,
12
13
  otherProps = props.otherProps,
13
14
  fieldNames = props.fieldNames,
14
15
  rest = _objectWithoutProperties(props, _excluded);
15
- var _ref = otherProps || {},
16
- isView = _ref.isView,
17
- viewEmpty = _ref.viewEmpty;
18
16
  var initialConfig = useProConfig('Checkbox') || {};
17
+ var _ref = ProForm.useFieldProps() || {},
18
+ isViewCon = _ref.isView,
19
+ viewEmpty = _ref.viewEmpty;
20
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
19
21
  var _fieldNames = fieldNames || initialConfig.fieldNames || {
20
22
  label: 'label',
21
23
  value: 'value'
@@ -17,14 +17,15 @@ var DatePicker = function DatePicker(props) {
17
17
  format = _props$format === void 0 ? 'YYYY-MM-DD' : _props$format,
18
18
  rest = _objectWithoutProperties(props, _excluded);
19
19
  var _ref = ProForm.useFieldProps() || {},
20
- isView = _ref.isView,
20
+ isViewCon = _ref.isView,
21
21
  viewEmpty = _ref.viewEmpty,
22
22
  valueType = _ref.valueType;
23
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
23
24
  var initialConfig = useProConfig('DatePicker');
24
25
  var _className = classNames(_defineProperty({
25
26
  'full-form-item': true
26
27
  }, className, !!className));
27
- if (isView || (props === null || props === void 0 ? void 0 : props.isView)) {
28
+ if (isView) {
28
29
  var value = rest.value;
29
30
  var viewChildren = null;
30
31
  if (!value) {
@@ -8,6 +8,7 @@ import { omit } from 'lodash';
8
8
  import { useProConfig } from '../../../../ProConfigProvider';
9
9
  import Container from '../../Container';
10
10
  import locale from '../../../../locale';
11
+ import ProForm from '../../../index';
11
12
  // 参数优先级
12
13
  // 组件内默认值 < config默认值 < props
13
14
  var Input = function Input(props) {
@@ -17,9 +18,10 @@ var Input = function Input(props) {
17
18
  fieldName = props.fieldName,
18
19
  otherProps = props.otherProps,
19
20
  rest = _objectWithoutProperties(props, _excluded);
20
- var _ref = otherProps || {},
21
- isView = _ref.isView,
21
+ var _ref = ProForm.useFieldProps() || {},
22
+ isViewCon = _ref.isView,
22
23
  viewEmpty = _ref.viewEmpty;
24
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
23
25
  var initialConfig = useProConfig('Input');
24
26
  if (isView) {
25
27
  return _jsx(Container, {
@@ -11,4 +11,5 @@ export interface ProFieldProps<T = any> {
11
11
  }
12
12
  export interface IProps extends InputProps, ProFieldProps {
13
13
  otherProps?: ProFormOtherProps;
14
+ isView?: boolean;
14
15
  }
@@ -5,6 +5,7 @@ export interface Props extends Omit<InputNumberProps, 'onBlur'> {
5
5
  otherProps?: ProFormOtherProps;
6
6
  range?: string;
7
7
  onBlur?: (value?: number, record?: any, object?: any) => void;
8
+ isView?: boolean;
8
9
  }
9
10
  declare const InputNumber: React.FC<Props>;
10
11
  export default InputNumber;
@@ -17,6 +17,7 @@ import { useProConfig } from '../../../../ProConfigProvider';
17
17
  import Container from '../../Container';
18
18
  import { getDecimalDigits } from '../../../utils/index';
19
19
  import locale from '../../../../locale';
20
+ import ProForm from '../../../../ProForm';
20
21
  var calc = tools.calc;
21
22
  var rangeReg = /^[([](-?\d+(\.\d+)?)?,\s*(-?\d+(\.\d+)?)?[)\]]$/;
22
23
  /**
@@ -42,12 +43,13 @@ var InputNumber = function InputNumber(props) {
42
43
  max = props.max,
43
44
  onBlur = props.onBlur,
44
45
  rest = _objectWithoutProperties(props, _excluded);
45
- var _ref2 = otherProps || {},
46
- isView = _ref2.isView,
46
+ var _ref2 = ProForm.useFieldProps() || {},
47
+ isViewCon = _ref2.isView,
47
48
  viewEmpty = _ref2.viewEmpty,
48
- viewType = _ref2.viewType,
49
49
  valueType = _ref2.valueType,
50
+ viewType = _ref2.viewType,
50
51
  label = _ref2.label;
52
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
51
53
  var valueProps = {};
52
54
  if (valueType) {
53
55
  switch (valueType) {
@@ -4,10 +4,11 @@ import _Cascader from "antd/es/cascader";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
- var _excluded = ["useRequest", "isView", "otherProps", "dataSource", "options"];
7
+ var _excluded = ["useRequest", "otherProps", "dataSource", "options"];
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { useRequest } from 'ahooks';
10
10
  import Container from '../../Container';
11
+ import ProForm from '../../../../ProForm';
11
12
  var defaultFieldNames = {
12
13
  value: 'value',
13
14
  label: 'label',
@@ -41,19 +42,18 @@ var findTreeTarget = function findTreeTarget(dataSource, value, fieldNames) {
41
42
  var ProCascader = function ProCascader(props) {
42
43
  var _restProps$fieldNames;
43
44
  var requestProps = props.useRequest,
44
- isView = props.isView,
45
45
  otherProps = props.otherProps,
46
46
  dataSource = props.dataSource,
47
47
  options = props.options,
48
48
  restProps = _objectWithoutProperties(props, _excluded);
49
- var _ref2 = otherProps || {},
50
- formIsView = _ref2.isView;
49
+ var _ref2 = ProForm.useFieldProps() || {},
50
+ isViewCon = _ref2.isView;
51
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
51
52
  var _useRequest = useRequest(requestProps === null || requestProps === void 0 ? void 0 : requestProps.service, requestProps === null || requestProps === void 0 ? void 0 : requestProps.options),
52
53
  data = _useRequest.data;
53
- var _isView = isView || formIsView;
54
54
  var _dataSource = data || dataSource || options;
55
55
  var _fieldNames = (_restProps$fieldNames = restProps.fieldNames) !== null && _restProps$fieldNames !== void 0 ? _restProps$fieldNames : defaultFieldNames;
56
- if (_isView) {
56
+ if (isView) {
57
57
  var valueTarget = findTreeTarget(_dataSource, restProps.value, _fieldNames);
58
58
  var valueName = _fieldNames.value,
59
59
  label = _fieldNames.label;
@@ -9,6 +9,7 @@ export interface Props extends Omit<RadioProps, 'options' | 'onChange'> {
9
9
  value: string;
10
10
  };
11
11
  otherProps?: ProFormOtherProps;
12
+ isView?: boolean;
12
13
  }
13
14
  declare const Radio: React.FC<Props>;
14
15
  export default Radio;
@@ -6,6 +6,7 @@ var _excluded = ["dataSource", "fieldNames", "onChange", "value", "otherProps"];
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { useProConfig } from '../../../../ProConfigProvider';
8
8
  import Container from '../../Container';
9
+ import ProForm from '../../../../ProForm';
9
10
  var Radio = function Radio(props) {
10
11
  var dataSource = props.dataSource,
11
12
  fieldNames = props.fieldNames,
@@ -13,9 +14,10 @@ var Radio = function Radio(props) {
13
14
  value = props.value,
14
15
  otherProps = props.otherProps,
15
16
  rest = _objectWithoutProperties(props, _excluded);
16
- var _ref = otherProps || {},
17
- isView = _ref.isView,
17
+ var _ref = ProForm.useFieldProps() || {},
18
+ isViewCon = _ref.isView,
18
19
  viewEmpty = _ref.viewEmpty;
20
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
19
21
  var initialConfig = useProConfig('Radio') || {};
20
22
  var _fieldNames = fieldNames || initialConfig.fieldNames || {
21
23
  label: 'label',
@@ -5,6 +5,7 @@ export type Props = {
5
5
  otherProps?: ProFormOtherProps;
6
6
  separator?: any;
7
7
  showTime?: any;
8
+ isView?: boolean;
8
9
  } & Omit<RangePickerProps, 'separator'>;
9
10
  declare const RangePicker: React.FC<Props>;
10
11
  export default RangePicker;
@@ -9,6 +9,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { isFunction, isString, omit } from 'lodash';
10
10
  import moment from 'moment';
11
11
  import { useProConfig } from '../../../../ProConfigProvider';
12
+ import ProForm from '../../../../ProForm';
12
13
  import Container from '../../Container';
13
14
  var AntRangePicker = _DatePicker.RangePicker;
14
15
  var RangePicker = function RangePicker(props) {
@@ -18,11 +19,12 @@ var RangePicker = function RangePicker(props) {
18
19
  _props$separator = props.separator,
19
20
  separator = _props$separator === void 0 ? '~' : _props$separator,
20
21
  rest = _objectWithoutProperties(props, _excluded);
21
- var _ref = otherProps || {},
22
- isView = _ref.isView,
22
+ var initialConfig = useProConfig('AntRangePicker');
23
+ var _ref = ProForm.useFieldProps() || {},
24
+ isViewCon = _ref.isView,
23
25
  viewEmpty = _ref.viewEmpty,
24
26
  valueType = _ref.valueType;
25
- var initialConfig = useProConfig('AntRangePicker');
27
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
26
28
  if (isView) {
27
29
  var _props$value = props.value,
28
30
  value = _props$value === void 0 ? [] : _props$value;
@@ -5,6 +5,7 @@ export interface Props extends SelectProps {
5
5
  dataSource?: any[];
6
6
  scrollFollowParent?: boolean;
7
7
  otherProps?: ProFormOtherProps;
8
+ isView?: boolean;
8
9
  }
9
10
  declare const Select: React.FC<Props>;
10
11
  export default Select;
@@ -7,6 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import Container from '../../Container';
8
8
  import { useProConfig } from '../../../../ProConfigProvider';
9
9
  import locale from '../../../../locale';
10
+ import ProForm from '../../../index';
10
11
  var Select = function Select(props) {
11
12
  var _props$dataSource = props.dataSource,
12
13
  dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
@@ -15,9 +16,10 @@ var Select = function Select(props) {
15
16
  _props$scrollFollowPa = props.scrollFollowParent,
16
17
  scrollFollowParent = _props$scrollFollowPa === void 0 ? true : _props$scrollFollowPa,
17
18
  rest = _objectWithoutProperties(props, _excluded);
18
- var _ref = otherProps || {},
19
- isView = _ref.isView,
19
+ var _ref = ProForm.useFieldProps() || {},
20
+ isViewCon = _ref.isView,
20
21
  viewEmpty = _ref.viewEmpty;
22
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
21
23
  var initialConfig = useProConfig('Select') || {};
22
24
  var _fieldNames = fieldNames || initialConfig.fieldNames || {
23
25
  label: 'label',
@@ -4,6 +4,7 @@ import { ProFormOtherProps } from '../../../propsType';
4
4
  export interface Props extends Omit<SwitchProps, 'value'> {
5
5
  value: any;
6
6
  otherProps?: ProFormOtherProps;
7
+ isView?: boolean;
7
8
  }
8
9
  declare const Switch: React.FC<Props>;
9
10
  export default Switch;
@@ -8,14 +8,16 @@ import { isNull, isUndefined } from 'lodash';
8
8
  import { useProConfig } from '../../../../ProConfigProvider';
9
9
  import Container from '../../Container';
10
10
  import locale from '../../../../locale';
11
+ import ProForm from '../../../../ProForm';
11
12
  var Switch = function Switch(props) {
12
13
  var disabled = props.disabled,
13
14
  otherProps = props.otherProps,
14
15
  res = _objectWithoutProperties(props, _excluded);
15
- var _ref = otherProps || {},
16
- isView = _ref.isView,
16
+ var _ref = ProForm.useFieldProps() || {},
17
+ isViewCon = _ref.isView,
17
18
  viewEmpty = _ref.viewEmpty,
18
19
  valueType = _ref.valueType;
20
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
19
21
  var config = useProConfig('Switch');
20
22
  if (isView) {
21
23
  if (isUndefined(res === null || res === void 0 ? void 0 : res.checked) || isNull(res === null || res === void 0 ? void 0 : res.checked) || valueType === 'switch' && isUndefined(res.value)) {
@@ -4,6 +4,7 @@ import { ProFormOtherProps } from '../../../propsType';
4
4
  export interface Props extends CheckboxProps {
5
5
  label?: string;
6
6
  otherProps?: ProFormOtherProps;
7
+ isView?: boolean;
7
8
  }
8
9
  declare const SwitchCheckbox: React.FC<Props>;
9
10
  export default SwitchCheckbox;
@@ -7,16 +7,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  import { isNull, isUndefined } from 'lodash';
8
8
  import { useProConfig } from '../../../../ProConfigProvider';
9
9
  import locale from '../../../../locale';
10
+ import ProForm from '../../../../ProForm';
10
11
  var SwitchCheckbox = function SwitchCheckbox(props) {
11
12
  var onChange = props.onChange,
12
13
  disabled = props.disabled,
13
14
  value = props.value,
14
15
  otherProps = props.otherProps,
15
16
  restProps = _objectWithoutProperties(props, _excluded);
16
- var _ref = otherProps || {},
17
- isView = _ref.isView,
17
+ var _ref = ProForm.useFieldProps() || {},
18
+ isViewCon = _ref.isView,
18
19
  viewEmpty = _ref.viewEmpty,
19
20
  valueType = _ref.valueType;
21
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
20
22
  var initialConfig = useProConfig('SwitchCheckbox');
21
23
  var changeVal = function changeVal(e) {
22
24
  onChange(e.target.checked);
@@ -4,6 +4,7 @@ import { ProFormOtherProps } from '../../../propsType';
4
4
  import './index.less';
5
5
  export interface Props extends TextAreaProps {
6
6
  otherProps?: ProFormOtherProps;
7
+ isView?: boolean;
7
8
  }
8
9
  declare const TextAreaDef: React.FC<Props>;
9
10
  export default TextAreaDef;
@@ -8,6 +8,7 @@ import { omit } from 'lodash';
8
8
  import classnames from 'classnames';
9
9
  import { useProConfig } from '../../../../ProConfigProvider';
10
10
  import locale from '../../../../locale';
11
+ import ProForm from '../../../../ProForm';
11
12
  import './index.less';
12
13
  var TextArea = _Input.TextArea;
13
14
  var TextAreaDef = function TextAreaDef(props) {
@@ -15,10 +16,10 @@ var TextAreaDef = function TextAreaDef(props) {
15
16
  otherProps = props.otherProps,
16
17
  className = props.className,
17
18
  rest = _objectWithoutProperties(props, _excluded);
18
- var _ref = otherProps || {},
19
+ var _ref = ProForm.useFieldProps() || {},
19
20
  label = _ref.label,
20
- isView = _ref.isView,
21
- viewEmpty = _ref.viewEmpty;
21
+ isViewCon = _ref.isView;
22
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
22
23
  var initialConfig = useProConfig('TextArea');
23
24
  var disabled = (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.disabled) || rest.disabled;
24
25
  if (isView) {
@@ -8,6 +8,7 @@ export interface Props {
8
8
  onChange?: (value: string) => void;
9
9
  value?: string;
10
10
  otherProps?: ProFormOtherProps;
11
+ isView?: boolean;
11
12
  }
12
13
  declare const TimePicker: React.FC<Props & TimePickerProps>;
13
14
  export default TimePicker;
@@ -7,6 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import moment from 'moment';
8
8
  import { useProConfig } from '../../../../ProConfigProvider';
9
9
  import Container from '../../Container';
10
+ import ProForm from '../../../../ProForm';
10
11
  import './style/index.less';
11
12
  var TimePicker = function TimePicker(props) {
12
13
  var _props$format = props.format,
@@ -15,11 +16,12 @@ var TimePicker = function TimePicker(props) {
15
16
  value = props.value,
16
17
  otherProps = props.otherProps,
17
18
  rest = _objectWithoutProperties(props, _excluded);
18
- var _ref = otherProps || {},
19
- isView = _ref.isView,
19
+ var _ref = ProForm.useFieldProps() || {},
20
+ isViewCon = _ref.isView,
20
21
  viewEmpty = _ref.viewEmpty,
21
22
  _ref$valueType = _ref.valueType,
22
23
  valueType = _ref$valueType === void 0 ? 'dateTime' : _ref$valueType;
24
+ var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
23
25
  var initialConfig = useProConfig('AntTimePicker');
24
26
  var handleChange = function handleChange(value) {
25
27
  if (valueType === 'dateTime') {
@@ -6,16 +6,18 @@ import { omit } from 'lodash';
6
6
  import classnames from 'classnames';
7
7
  import RenderFields from '../../render/RenderFields';
8
8
  import ProCollapse from '../../../../ProLayout/components/ProCollapse';
9
+ import ProForm from '../../../../ProForm';
9
10
  var Container = function Container(props) {
10
11
  var children = props.children,
11
12
  otherProps = props.otherProps,
12
13
  className = props.className,
13
14
  container = props.container;
14
- var type = otherProps.type,
15
- form = otherProps.form,
16
- show = otherProps.show,
17
- required = otherProps.required,
18
- disabled = otherProps.disabled;
15
+ var _ref = ProForm.useFieldProps() || {},
16
+ type = _ref.type,
17
+ form = _ref.form,
18
+ show = _ref.show,
19
+ required = _ref.required,
20
+ disabled = _ref.disabled;
19
21
  var _className = classnames(_defineProperty({
20
22
  'pro-container': true,
21
23
  'pro-container-diy': type === 'Container'
@@ -11,9 +11,9 @@ import { namesPathTransform } from './utils';
11
11
  import ToolbarButton from './components/ToolbarButton';
12
12
  import BlockFields from './components/BlockFields';
13
13
  import LineFields from './components/LineFields';
14
+ import ProForm from '../../../../ProForm';
14
15
  var FormList = function FormList(props, ref) {
15
16
  var columns = props.columns,
16
- otherProps = props.otherProps,
17
17
  min = props.min,
18
18
  max = props.max,
19
19
  toolbarProps = props.toolbarProps,
@@ -29,10 +29,11 @@ var FormList = function FormList(props, ref) {
29
29
  key: String(item.key)
30
30
  });
31
31
  });
32
- var form = otherProps.form,
33
- name = otherProps.name,
34
- isView = otherProps.isView,
35
- disabled = otherProps.disabled;
32
+ var _ref = ProForm.useFieldProps() || {},
33
+ form = _ref.form,
34
+ name = _ref.name,
35
+ isView = _ref.isView,
36
+ disabled = _ref.disabled;
36
37
  var errors = meta.errors;
37
38
  var _namePath = toArray(name);
38
39
  var processColumns = useCallback(function (fieldName, namePath) {
@@ -1,28 +1,20 @@
1
1
  .pro-form-list-block-title {
2
- height : 14px;
3
- margin : @zaui-space-size-xs 0;
2
+ height: 14px;
3
+ margin: @zaui-space-size-xs 0;
4
4
  padding-left: @zaui-space-size-sm;
5
- font-weight : 600;
6
- line-height : 14px;
7
- border-left : 4px solid @zaui-brand;
5
+ font-weight: 600;
6
+ line-height: 14px;
7
+ border-left: 4px solid @zaui-brand;
8
8
  }
9
9
 
10
10
  .pro-form-list {
11
- display : flex;
11
+ display: flex;
12
12
  padding-bottom: 0;
13
13
 
14
- &.pro-form-list-last {
15
-
16
- .pro-form-list-drag-handle,
17
- .ant-form-item {
18
- margin-bottom: 0 !important;
19
- }
20
- }
21
-
22
14
  .single-delete {
23
- width : 14px !important;
15
+ width: 14px !important;
24
16
  height: 14px !important;
25
- color : @zaui-placeholder;
17
+ color: @zaui-placeholder;
26
18
 
27
19
  &:hover {
28
20
  color: @zaui-aide-text;
@@ -36,24 +28,25 @@
36
28
  .pro-form-list-action {
37
29
  padding-bottom: var(--zaui-height-size-md, 16px);
38
30
 
39
- &>.ant-space-item:first-child>.ant-btn-link {
31
+ & > .ant-space-item:first-child > .ant-btn-link {
40
32
  margin-left: @zaui-space-size-sm;
41
33
  }
42
34
  }
43
35
 
44
36
  .pro-form-list-drag-handle {
45
- display : flex;
46
- align-items : center;
47
- height : 32px;
37
+ display: flex;
38
+ align-items: center;
39
+ height: 32px;
48
40
  margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
49
- padding : 0;
41
+ padding: 0;
50
42
  padding-right: @zaui-space-size-sm;
51
- border : none;
43
+ border: none;
52
44
  }
53
45
  }
54
46
 
55
47
  .pro-form-list-line {
56
48
  padding: var(--zaui-height-size-md, 16px);
49
+ padding-bottom: 0;
57
50
 
58
51
  &:hover {
59
52
  background: rgba(0, 0, 0, 0.018);
@@ -10,6 +10,7 @@ import { omit } from 'lodash';
10
10
  import classnames from 'classnames';
11
11
  import RenderFields from '../../render/RenderFields';
12
12
  import { insertSeparator, parseName } from './utils';
13
+ import ProForm from '../../../../ProForm';
13
14
  var Group = function Group(props) {
14
15
  var columns = props.children,
15
16
  otherProps = props.otherProps,
@@ -19,9 +20,11 @@ var Group = function Group(props) {
19
20
  size: 12
20
21
  } : _props$space,
21
22
  id = props.id;
22
- var name = otherProps.name,
23
- form = otherProps.form;
24
- if (!Array.isArray(otherProps === null || otherProps === void 0 ? void 0 : otherProps.names)) {
23
+ var _ref = ProForm.useFieldProps() || {},
24
+ names = _ref.names,
25
+ name = _ref.name,
26
+ form = _ref.form;
27
+ if (!Array.isArray(names)) {
25
28
  console.error('Warning: Composite form components whose type is Group must be configured with names');
26
29
  }
27
30
  var _parentNames = parseName(id);