@teamix/pro 1.1.35 → 1.1.39

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 (43) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +956 -333
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog.d.ts +9 -0
  6. package/es/actions/dialog.js +96 -26
  7. package/es/actions/index.scss +31 -0
  8. package/es/actions/link.js +4 -2
  9. package/es/actions/request.d.ts +1 -1
  10. package/es/actions/request.js +2 -2
  11. package/es/form/Components/ProField/index.d.ts +1 -84
  12. package/es/form/typing.d.ts +5 -5
  13. package/es/index.d.ts +1 -1
  14. package/es/index.js +1 -1
  15. package/es/info/components/InfoValueItem/index.js +3 -0
  16. package/es/info/components/baseInfo/index.js +29 -10
  17. package/es/info/index.js +31 -10
  18. package/es/info/typing.d.ts +3 -1
  19. package/es/page-header/index.d.ts +9 -5
  20. package/es/page-header/index.js +21 -6
  21. package/es/table/components/Filter/index.js +7 -2
  22. package/es/table/components/Filter/index.scss +1 -1
  23. package/es/table/typing.d.ts +2 -0
  24. package/lib/actions/dialog.d.ts +9 -0
  25. package/lib/actions/dialog.js +99 -25
  26. package/lib/actions/index.scss +31 -0
  27. package/lib/actions/link.js +5 -2
  28. package/lib/actions/request.d.ts +1 -1
  29. package/lib/actions/request.js +2 -2
  30. package/lib/form/Components/ProField/index.d.ts +1 -84
  31. package/lib/form/typing.d.ts +5 -5
  32. package/lib/index.d.ts +1 -1
  33. package/lib/index.js +1 -1
  34. package/lib/info/components/InfoValueItem/index.js +3 -0
  35. package/lib/info/components/baseInfo/index.js +29 -10
  36. package/lib/info/index.js +32 -11
  37. package/lib/info/typing.d.ts +3 -1
  38. package/lib/page-header/index.d.ts +9 -5
  39. package/lib/page-header/index.js +21 -6
  40. package/lib/table/components/Filter/index.js +7 -2
  41. package/lib/table/components/Filter/index.scss +1 -1
  42. package/lib/table/typing.d.ts +2 -0
  43. package/package.json +1 -1
@@ -1,14 +1,23 @@
1
1
  import React from 'react';
2
2
  import { QuickShowConfig } from '@alicloudfe/components/types/dialog';
3
3
  import { quickShowDrawerProps } from '@alicloudfe/components/types/drawer';
4
+ import { IFormSchema, IFormSchemaItem } from '../form';
4
5
  import { RequestAction } from './request';
5
6
  export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | 'onOk' | 'onCancel' | 'onError'> {
7
+ /** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
6
8
  url?: string;
9
+ /** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
7
10
  dialogType?: 'dialog' | 'drawer';
11
+ /** 弹窗快捷调用类型 */
8
12
  dialogQuickShowType?: 'alert' | 'confirm';
13
+ /** 弹窗消息类型 */
9
14
  messageType?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading';
15
+ /** 位于弹窗内容上方的自定义内容区 */
10
16
  beforeContent?: React.ReactNode;
17
+ /** 位于弹窗内容下方的自定义内容区 */
11
18
  afterContent?: React.ReactNode;
19
+ /** 弹窗页脚描述区,位于按钮组的对面 */
20
+ footerDescription?: React.ReactNode | IFormSchema | IFormSchemaItem;
12
21
  }
13
22
  export declare function useDialogAction(action: DialogAction, context?: any): {
14
23
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -1,20 +1,21 @@
1
1
  var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
2
- _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent"];
2
+ _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "footerDescription", "footerAlign", "overlayProps"],
3
+ _excluded3 = ["className"];
3
4
 
4
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5
6
 
6
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7
8
 
8
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
-
10
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
-
12
9
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13
10
 
14
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
12
 
16
13
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
14
 
15
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
+
17
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
+
18
19
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
20
 
20
21
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -27,10 +28,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
27
28
 
28
29
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
30
 
30
- import React, { useState } from 'react';
31
+ import React, { useState, useEffect, useRef } from 'react';
32
+ import classnames from 'classnames';
31
33
  import { useHistory } from 'react-router-dom';
32
34
  import { Dialog, Drawer } from '@alicloudfe/components';
33
35
  import { getTargetValue, uuid, goToLink } from '@teamix/utils';
36
+ import ProForm, { createForm } from '../form';
34
37
  import { eventHandler } from './base';
35
38
  import { doRequest } from './request';
36
39
 
@@ -40,6 +43,27 @@ function addContextForReactNode(content, context) {
40
43
  }
41
44
 
42
45
  return content;
46
+ }
47
+
48
+ var FooterForm = function FooterForm(props) {
49
+ var schema = props.schema,
50
+ context = props.context,
51
+ formRef = props.formRef;
52
+ var form = createForm();
53
+ useEffect(function () {
54
+ formRef.current = form;
55
+ }, []);
56
+ return /*#__PURE__*/React.createElement(ProForm, {
57
+ layout: "inline",
58
+ feedbackLayout: "none",
59
+ form: form,
60
+ schema: getTargetValue(schema, context)
61
+ });
62
+ };
63
+
64
+ function getFooterAlignClass(isDrawer, align) {
65
+ var footerAlign = align ? align : isDrawer ? 'left' : 'right';
66
+ return "footer-align-".concat(footerAlign);
43
67
  } // 弹窗 -> 请求(点击确认,发送数据请求)
44
68
 
45
69
 
@@ -49,8 +73,10 @@ export function useDialogAction(action, context) {
49
73
  loading = _useState2[0],
50
74
  setLoading = _useState2[1];
51
75
 
76
+ var footerDescriptionRef = useRef();
52
77
  var history = useHistory();
53
- return _objectSpread({}, eventHandler(action, function () {
78
+
79
+ var onActionStart = function onActionStart() {
54
80
  var url = action.url,
55
81
  method = action.method,
56
82
  params = action.params,
@@ -79,19 +105,54 @@ export function useDialogAction(action, context) {
79
105
  link = _getTargetValue.link,
80
106
  beforeContent = _getTargetValue.beforeContent,
81
107
  afterContent = _getTargetValue.afterContent,
82
- dialogOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
108
+ footerDescription = _getTargetValue.footerDescription,
109
+ footerAlign = _getTargetValue.footerAlign,
110
+ _getTargetValue$overl = _getTargetValue.overlayProps,
111
+ overlayProps = _getTargetValue$overl === void 0 ? {} : _getTargetValue$overl,
112
+ containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
113
+
114
+ var isDrawer = dialogType === 'drawer';
115
+ var container = isDrawer ? Drawer : Dialog;
83
116
 
84
- var dialogMethod = dialogType === 'drawer' ? Drawer : Dialog;
85
- var dialogProps = dialogType === 'drawer' ? {} : {
117
+ var overlayClassName = overlayProps.className,
118
+ overlayOtherProps = _objectWithoutProperties(overlayProps, _excluded3);
119
+
120
+ var dialogOnlyProps = {
86
121
  type: dialogQuickShowType,
87
122
  messageProps: {
88
123
  type: messageType
124
+ },
125
+ overlayProps: _objectSpread({
126
+ className: classnames('teamix-pro-action-dialog', overlayClassName, {
127
+ 'has-footer-description': !!footerDescription
128
+ })
129
+ }, overlayOtherProps)
130
+ };
131
+ var containerOtherProps = isDrawer ? {} : dialogOnlyProps;
132
+
133
+ var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
134
+ if (footer instanceof Array || footer.component) {
135
+ var _schema = footer instanceof Array ? footer : [footer];
136
+
137
+ return /*#__PURE__*/React.createElement(FooterForm, {
138
+ formRef: footerDescriptionRef,
139
+ context: context,
140
+ schema: [{
141
+ component: 'FormFlex',
142
+ children: _schema
143
+ }]
144
+ });
89
145
  }
146
+
147
+ return footer;
90
148
  };
91
149
 
92
150
  var onOk = function onOk() {
93
151
  return new Promise( /*#__PURE__*/function () {
94
152
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve) {
153
+ var _footerDescriptionRef;
154
+
155
+ var footerDescriptionValues, requestContext;
95
156
  return regeneratorRuntime.wrap(function _callee$(_context) {
96
157
  while (1) {
97
158
  switch (_context.prev = _context.next) {
@@ -111,29 +172,33 @@ export function useDialogAction(action, context) {
111
172
 
112
173
  case 5:
113
174
  setLoading(true);
114
- _context.prev = 6;
115
- _context.next = 9;
116
- return doRequest(action, context, history);
117
-
118
- case 9:
175
+ footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
176
+ _context.prev = 7;
177
+ requestContext = Object.assign({
178
+ footer: footerDescriptionValues
179
+ }, context);
180
+ _context.next = 11;
181
+ return doRequest(action, requestContext, history, footerDescriptionValues);
182
+
183
+ case 11:
119
184
  onFinish && onFinish();
120
185
  resolve(true);
121
- _context.next = 18;
186
+ _context.next = 20;
122
187
  break;
123
188
 
124
- case 13:
125
- _context.prev = 13;
126
- _context.t0 = _context["catch"](6);
189
+ case 15:
190
+ _context.prev = 15;
191
+ _context.t0 = _context["catch"](7);
127
192
  setLoading(false);
128
193
  resolve(false);
129
194
  return _context.abrupt("return");
130
195
 
131
- case 18:
196
+ case 20:
132
197
  case "end":
133
198
  return _context.stop();
134
199
  }
135
200
  }
136
- }, _callee, null, [[6, 13]]);
201
+ }, _callee, null, [[7, 15]]);
137
202
  }));
138
203
 
139
204
  return function (_x) {
@@ -157,7 +222,7 @@ export function useDialogAction(action, context) {
157
222
  var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({
158
223
  key: uuid()
159
224
  }, componentProps)) : addContextForReactNode(content, dialogContext);
160
- var ret = dialogMethod.show(_objectSpread(_objectSpread({
225
+ var ret = container.show(_objectSpread(_objectSpread({
161
226
  // @ts-ignore
162
227
  onOk: onOk,
163
228
  title: addContextForReactNode(title, dialogContext),
@@ -165,10 +230,15 @@ export function useDialogAction(action, context) {
165
230
  className: "teamix-pro-dialog-before-content"
166
231
  }, beforeContent), dialogContent, afterContent && /*#__PURE__*/React.createElement("div", {
167
232
  className: "teamix-pro-dialog-after-content"
168
- }, afterContent)),
169
- closeable: !loading
170
- }, dialogProps), dialogOtherProps));
233
+ }, afterContent), footerDescription && /*#__PURE__*/React.createElement("div", {
234
+ className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
235
+ }, renderDialogFooterDescription(footerDescription))),
236
+ closeable: !loading,
237
+ footerAlign: footerAlign
238
+ }, containerOtherProps), containerProps));
171
239
  store.hide = ret.hide;
172
- }));
240
+ };
241
+
242
+ return _objectSpread({}, eventHandler(action, onActionStart));
173
243
  }
174
244
  export default useDialogAction;
@@ -29,6 +29,31 @@
29
29
  }
30
30
  }
31
31
 
32
+ .teamix-pro-dialog-footer-description {
33
+ position: absolute;
34
+ z-index: 5;
35
+ display: flex;
36
+ align-items: center;
37
+ bottom: var(--dialog-footer-padding-top, 16px);
38
+ height: var(--btn-size-m-height, 32px);
39
+
40
+ &.footer-align-right {
41
+ left: var(--dialog-footer-padding-left-right, 20px);
42
+ }
43
+ &.footer-align-center {
44
+ left: var(--dialog-footer-padding-left-right, 20px);
45
+ }
46
+ &.footer-align-left {
47
+ right: var(--dialog-footer-padding-left-right, 20px);
48
+ }
49
+ }
50
+
51
+ .teamix-pro-action-dialog.has-footer-description {
52
+ .next-message {
53
+ position: static;
54
+ }
55
+ }
56
+
32
57
  .teamix-pro-dialog-before-content {
33
58
  margin-bottom: var(--s-2);
34
59
  }
@@ -40,3 +65,9 @@
40
65
  .next-menu-divider + .next-menu-divider {
41
66
  display: none;
42
67
  }
68
+
69
+ .next-dialog-body {
70
+ .teamix-pro-form {
71
+ margin-bottom: -20px;
72
+ }
73
+ }
@@ -5,11 +5,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import { getTargetValue, goToLink } from '@teamix/utils';
8
+ import { useHistory } from 'react-router-dom';
8
9
  import { eventHandler } from './base';
9
10
  export function useLinkAction(action, context) {
10
- var linkAction = getTargetValue(action, context);
11
+ var history = useHistory();
11
12
  return _objectSpread({}, eventHandler(action, function () {
12
- goToLink(linkAction);
13
+ var linkAction = getTargetValue(action, context);
14
+ goToLink(linkAction, history);
13
15
  }));
14
16
  }
15
17
  export default useLinkAction;
@@ -2,7 +2,7 @@ import { CommonRequestConfig } from '@teamix/utils';
2
2
  import { BaseAction } from './base';
3
3
  export interface RequestAction extends CommonRequestConfig, BaseAction {
4
4
  }
5
- export declare function doRequest(action: RequestAction, context?: any, history?: any): Promise<unknown>;
5
+ export declare function doRequest(action: RequestAction, context?: any, history?: any, extraParams?: any): Promise<unknown>;
6
6
  export declare function useRequestAction(action: RequestAction, context?: any): {
7
7
  loading: boolean;
8
8
  };
@@ -28,14 +28,14 @@ import { useHistory } from 'react-router-dom';
28
28
  import { doCommonRequest } from '@teamix/utils';
29
29
  import { eventHandler } from './base'; // action 里的数据请求都默认是 post 类型
30
30
 
31
- export function doRequest(action, context, history) {
31
+ export function doRequest(action, context, history, extraParams) {
32
32
  var _action$method = action.method,
33
33
  method = _action$method === void 0 ? 'post' : _action$method,
34
34
  others = _objectWithoutProperties(action, _excluded);
35
35
 
36
36
  return doCommonRequest(_objectSpread({
37
37
  method: method
38
- }, others), context, history);
38
+ }, others), context, history, extraParams);
39
39
  }
40
40
  export function useRequestAction(action, context) {
41
41
  var _useState = useState(false),
@@ -1,162 +1,79 @@
1
1
  import React from 'react';
2
2
  declare const _default: React.ForwardRefExoticComponent<(Partial<import("@teamix/pro-field/lib/components/FieldText").IProFieldText & {
3
3
  type: "text";
4
- } & {
5
- children?: React.ReactNode;
6
4
  }> | Partial<import("@teamix/pro-field/lib/components/FieldTextArea").IProFieldTextArea & {
7
5
  type: "textarea";
8
- } & {
9
- children?: React.ReactNode;
10
6
  }> | Partial<import("@teamix/pro-field/lib/components/FieldMoney").IProFieldMoney & {
11
7
  type: "money";
12
- } & {
13
- children?: React.ReactNode;
14
8
  }> | Partial<import("@teamix/pro-field/lib/components/FieldCheckBox").IProFieldCheckBox & {
15
9
  type: "checkbox";
16
- } & {
17
- children?: React.ReactNode;
18
10
  }> | Partial<import("@teamix/pro-field/lib/components/FieldRadio").IProFieldRadio & {
19
11
  type: "radio";
20
- } & {
21
- children?: React.ReactNode;
22
12
  }> | Partial<import("@teamix/pro-field/lib/components/FieldSelect").IProFieldSelect & {
23
13
  type: "select";
24
- } & {
25
- children?: React.ReactNode;
26
14
  }> | Partial<import("@teamix/pro-field/lib/components/FieldMultipleSelect").IProFieldMultipleSelect & {
27
15
  type: "multipleSelect";
28
- } & {
29
- children?: React.ReactNode;
30
16
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDate & {
31
17
  type: "date";
32
- } & {
33
- children?: React.ReactNode;
34
18
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateWeek & {
35
19
  type: "dateWeek";
36
- } & {
37
- children?: React.ReactNode;
38
20
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateMonth & {
39
21
  type: "dateMonth";
40
- } & {
41
- children?: React.ReactNode;
42
22
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateYear & {
43
23
  type: "dateYear";
44
- } & {
45
- children?: React.ReactNode;
46
24
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateQuarter & {
47
25
  type: "dateQuarter";
48
- } & {
49
- children?: React.ReactNode;
50
26
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateRange & {
51
27
  type: "dateRange";
52
- } & {
53
- children?: React.ReactNode;
54
28
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateWeekRange & {
55
29
  type: "dateWeekRange";
56
- } & {
57
- children?: React.ReactNode;
58
30
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateMonthRange & {
59
31
  type: "dateMonthRange";
60
- } & {
61
- children?: React.ReactNode;
62
32
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateYearRange & {
63
33
  type: "dateYearRange";
64
- } & {
65
- children?: React.ReactNode;
66
34
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateQuarterRange & {
67
35
  type: "dateQuarterRange";
68
- } & {
69
- children?: React.ReactNode;
70
36
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateTime & {
71
37
  type: "dateTime";
72
- } & {
73
- children?: React.ReactNode;
74
38
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldDateTimeRange & {
75
39
  type: "dateTimeRange";
76
- } & {
77
- children?: React.ReactNode;
78
40
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldTime & {
79
41
  type: "time";
80
- } & {
81
- children?: React.ReactNode;
82
42
  }> | Partial<import("@teamix/pro-field/lib/components/FieldDate").IProFieldTimeRange & {
83
43
  type: "timeRange";
84
- } & {
85
- children?: React.ReactNode;
86
44
  }> | Partial<import("@teamix/pro-field/lib/components/FieldNumber").IProFieldNumber & {
87
45
  type: "number";
88
- } & {
89
- children?: React.ReactNode;
90
46
  }> | Partial<import("@teamix/pro-field/lib/components/FieldPercent").IProFieldPercent & {
91
47
  type: "percent";
92
- } & {
93
- children?: React.ReactNode;
94
48
  }> | Partial<import("@teamix/pro-field/lib/components/FieldCascader").IProFieldCascader & {
95
49
  type: "cascader";
96
- } & {
97
- children?: React.ReactNode;
98
50
  }> | Partial<import("@teamix/pro-field/lib/components/FieldCascader").IProFieldMultipleCascader & {
99
51
  type: "multipleCascader";
100
- } & {
101
- children?: React.ReactNode;
102
52
  }> | Partial<import("@teamix/pro-field/lib/components/FieldCascader").IProFieldArbitraryCascader & {
103
53
  type: "arbitraryCascader";
104
- } & {
105
- children?: React.ReactNode;
106
54
  }> | Partial<import("@teamix/pro-field/lib/components/FieldSwitch").IProFieldSwitch & {
107
55
  type: "switch";
108
- } & {
109
- children?: React.ReactNode;
110
56
  }> | Partial<import("@teamix/pro-field/lib/components/FieldColor").IProFieldColor & {
111
57
  type: "color" | "colorSwatches" | "colorRadio" | "colorTwitter";
112
- } & {
113
- children?: React.ReactNode;
114
58
  }> | Partial<import("@teamix/pro-field/lib/components/FieldIcon").IProFieldIcon & {
115
59
  type: "icon";
116
- } & {
117
- children?: React.ReactNode;
118
60
  }> | Partial<import("@teamix/pro-field/lib/components/FieldTreeSelect").IProFieldTreeSelect & {
119
61
  type: "treeSelect";
120
- } & {
121
- children?: React.ReactNode;
122
62
  }> | Partial<import("@teamix/pro-field/lib/components/FieldJson").IProFieldJson & {
123
63
  type: "json";
124
- } & {
125
- children?: React.ReactNode;
126
64
  }> | Partial<import("@teamix/pro-field/lib/components/FieldTransfer").IProFieldTransfer & {
127
65
  type: "transfer";
128
- } & {
129
- children?: React.ReactNode;
130
66
  }> | Partial<import("@teamix/pro-field/lib/components/FieldRange").IProFieldRange & {
131
67
  type: "range";
132
- } & {
133
- children?: React.ReactNode;
134
68
  }> | Partial<import("@teamix/pro-field/lib/components/FieldPassword").IProFieldPassword & {
135
69
  type: "password";
136
- } & {
137
- children?: React.ReactNode;
138
70
  }> | Partial<import("@teamix/pro-field/lib/components/FieldSearch").IProFieldSearch & {
139
71
  type: "search";
140
- } & {
141
- children?: React.ReactNode;
142
72
  }> | Partial<import("@teamix/pro-field/lib/components/FieldTagFilter").IProFieldTagFilter & {
143
73
  type: "tagFilter";
144
- } & {
145
- children?: React.ReactNode;
146
74
  }> | Partial<import("@teamix/pro-field/lib/components/FieldTagFilter").IProFieldMultipleTagFilter & {
147
75
  type: "multipleTagPicker";
148
- } & {
149
- children?: React.ReactNode;
150
76
  }> | Partial<import("@teamix/pro-field/lib/components/FieldMenuSelect").IProFieldMenuSelect & {
151
77
  type: "menuSelect";
152
- } & {
153
- children?: React.ReactNode;
154
- }> | Pick<Partial<{
155
- [key: string]: any;
156
- type: string;
157
- value?: any;
158
- initValue?: any;
159
- } & import("@teamix/pro-field").IProBaseField & {
160
- children?: React.ReactNode;
161
- }>, string | number>) & React.RefAttributes<unknown>>;
78
+ }> | Pick<Partial<import("@teamix/pro-field").IProFieldCustom>, keyof import("@teamix/pro-field").IProFieldCustom>) & React.RefAttributes<unknown>>;
162
79
  export default _default;
@@ -33,11 +33,11 @@ export interface IFormSchemaItem {
33
33
  tooltip?: string;
34
34
  required?: boolean;
35
35
  display?: FieldDisplayTypes;
36
- visible?: boolean;
37
- hidden?: boolean;
38
- disabled?: boolean;
39
- readOnly?: boolean;
40
- readPretty?: boolean;
36
+ visible?: boolean | string;
37
+ hidden?: boolean | string;
38
+ disabled?: boolean | string;
39
+ readOnly?: boolean | string;
40
+ readPretty?: boolean | string;
41
41
  pattern?: FieldPatternTypes;
42
42
  default?: any;
43
43
  request?: IRequestConfig;
package/es/index.d.ts CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
21
21
  export * from './page-header';
22
22
  export * from './skeleton';
23
23
  export * from './table';
24
- declare const version = "1.1.34";
24
+ declare const version = "1.1.38";
25
25
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -25,6 +25,6 @@ export * from './page-container';
25
25
  export * from './page-header';
26
26
  export * from './skeleton';
27
27
  export * from './table';
28
- var version = '1.1.34';
28
+ var version = '1.1.38';
29
29
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
30
30
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils };
@@ -131,6 +131,9 @@ var InfoValueItem = function InfoValueItem(props) {
131
131
  type: "text",
132
132
  style: {
133
133
  marginLeft: '8px'
134
+ },
135
+ context: {
136
+ record: record
134
137
  }
135
138
  });
136
139
  }
@@ -19,28 +19,47 @@ var ProBaseInfo = function ProBaseInfo(props) {
19
19
  actionRef = props.actionRef,
20
20
  layout = props.layout,
21
21
  size = props.size;
22
- var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列的布局参数
22
+ var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列内的布局参数
23
+
24
+ var getFormItemLayout = function getFormItemLayout(colspan) {
25
+ var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
23
26
 
24
- var getFormItemLayout = function getFormItemLayout() {
25
27
  if (layout) {
26
28
  var _layout$labelCol, _layout$wrapperCol;
27
29
 
28
- return {
29
- labelCol: (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol,
30
- wrapperCol: (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol
31
- };
30
+ var labelCol = (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
31
+ var wrapperCol = (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
32
+ formItemLayout.labelCol = labelCol;
33
+ formItemLayout.wrapperCol = wrapperCol;
34
+ }
35
+
36
+ var newLabelSpan = formItemLayout.labelCol.span;
37
+ var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
38
+
39
+ if (colspan) {
40
+ newLabelSpan = newLabelSpan / colspan;
41
+ newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
32
42
  }
33
43
 
34
- return defaultLayout.formItemLayout;
44
+ var newFormItemLayout = {
45
+ labelCol: {
46
+ span: newLabelSpan
47
+ },
48
+ wrapperCol: {
49
+ span: newWrapperSpan
50
+ }
51
+ };
52
+ return Object.assign(formItemLayout, newFormItemLayout);
35
53
  };
36
54
 
37
55
  var renderContent = function renderContent() {
38
56
  return columns.map(function (item, index) {
39
- var _layout$span, _item$title, _item$valueType, _ref;
57
+ var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
40
58
 
41
59
  var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
60
+ var layoutSpan = item.colSpan ? ((_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : span) * item.colSpan : (_layout$span2 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span2 !== void 0 ? _layout$span2 : span;
42
61
  return /*#__PURE__*/React.createElement(Col, {
43
- span: (_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : span,
62
+ span: layoutSpan,
44
63
  key: index
45
64
  }, /*#__PURE__*/React.createElement(ProInfoItem, {
46
65
  label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
@@ -54,7 +73,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
54
73
  record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
55
74
  actionRef: actionRef
56
75
  }),
57
- baseInfoLayout: getFormItemLayout(),
76
+ baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
58
77
  tooltip: item.tooltip,
59
78
  tooltipIcon: item.tooltipIcon
60
79
  }));