@teamix/pro 1.3.4 → 1.3.7

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 (105) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +57871 -57067
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.d.ts +2 -0
  6. package/es/actions/dialog-form.js +5 -2
  7. package/es/actions/index.d.ts +5 -1
  8. package/es/actions/index.js +30 -9
  9. package/es/card/index.d.ts +1 -1
  10. package/es/card/index.js +9 -1
  11. package/es/card/index.scss +4 -0
  12. package/es/form/Filter/useSpecialProps.js +2 -2
  13. package/es/form/ProForm/index.js +5 -3
  14. package/es/form/ProForm/index.scss +16 -8
  15. package/es/form/SchemaForm/reactions.js +2 -2
  16. package/es/form/docs/ActionResponse.d.ts +7 -0
  17. package/es/form/docs/ActionResponse.js +11 -0
  18. package/es/form/docs/ActionResponse.less +25 -0
  19. package/es/form/index.d.ts +1 -1
  20. package/es/form/typing.d.ts +1 -0
  21. package/es/index.d.ts +4 -2
  22. package/es/index.js +5 -5
  23. package/es/info/components/ProInfoItem/index.js +1 -1
  24. package/es/info/components/ProInfoItem/index.scss +0 -1
  25. package/es/info/components/baseInfo/index.scss +0 -3
  26. package/es/sidebar/components/sidebar-container/index.js +114 -9
  27. package/es/sidebar/components/sidebar-container/index.scss +53 -5
  28. package/es/sidebar/components/tree/index.d.ts +2 -0
  29. package/es/sidebar/components/tree/index.js +222 -76
  30. package/es/sidebar/components/tree/index.scss +10 -0
  31. package/es/sidebar/components/tree-node/components/HoverTooltip/index.d.ts +15 -0
  32. package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +62 -0
  33. package/es/sidebar/components/tree-node/components/HoverTooltip/index.scss +7 -0
  34. package/es/sidebar/components/tree-node/components/IconAction/index.d.ts +12 -0
  35. package/es/sidebar/components/tree-node/components/IconAction/index.js +105 -0
  36. package/es/sidebar/components/tree-node/components/IconAction/index.scss +7 -0
  37. package/es/sidebar/components/tree-node/components/IconSwitch/index.d.ts +23 -0
  38. package/es/sidebar/components/tree-node/components/IconSwitch/index.js +73 -0
  39. package/es/sidebar/components/tree-node/components/IconSwitch/index.scss +7 -0
  40. package/es/sidebar/components/tree-node/index.d.ts +7 -0
  41. package/es/sidebar/components/tree-node/index.js +225 -0
  42. package/es/sidebar/components/tree-node/index.scss +58 -0
  43. package/es/sidebar/index.d.ts +2 -0
  44. package/es/sidebar/index.js +147 -12
  45. package/es/sidebar/index.scss +24 -1
  46. package/es/sidebar/typing.d.ts +83 -13
  47. package/es/sidebar/utils/action-ref.d.ts +3 -0
  48. package/es/sidebar/utils/action-ref.js +15 -0
  49. package/es/sidebar/utils/index.d.ts +71 -0
  50. package/es/sidebar/utils/index.js +228 -0
  51. package/es/table/components/Pagination/index.js +4 -4
  52. package/es/table/components/ToolBar/FilterColumnIcon.js +5 -1
  53. package/es/table/index.js +9 -4
  54. package/es/table/typing.d.ts +3 -1
  55. package/lib/actions/dialog-form.d.ts +2 -0
  56. package/lib/actions/dialog-form.js +5 -2
  57. package/lib/actions/index.d.ts +5 -1
  58. package/lib/actions/index.js +29 -7
  59. package/lib/card/index.d.ts +1 -1
  60. package/lib/card/index.js +10 -1
  61. package/lib/card/index.scss +4 -0
  62. package/lib/form/Filter/useSpecialProps.js +1 -1
  63. package/lib/form/ProForm/index.js +5 -3
  64. package/lib/form/ProForm/index.scss +16 -8
  65. package/lib/form/SchemaForm/reactions.js +1 -1
  66. package/lib/form/docs/ActionResponse.d.ts +7 -0
  67. package/lib/form/docs/ActionResponse.js +24 -0
  68. package/lib/form/docs/ActionResponse.less +25 -0
  69. package/lib/form/index.d.ts +1 -1
  70. package/lib/form/typing.d.ts +1 -0
  71. package/lib/index.d.ts +4 -2
  72. package/lib/index.js +22 -2
  73. package/lib/info/components/ProInfoItem/index.js +1 -1
  74. package/lib/info/components/ProInfoItem/index.scss +0 -1
  75. package/lib/info/components/baseInfo/index.scss +0 -3
  76. package/lib/sidebar/components/sidebar-container/index.js +120 -8
  77. package/lib/sidebar/components/sidebar-container/index.scss +53 -5
  78. package/lib/sidebar/components/tree/index.d.ts +2 -0
  79. package/lib/sidebar/components/tree/index.js +230 -76
  80. package/lib/sidebar/components/tree/index.scss +10 -0
  81. package/lib/sidebar/components/tree-node/components/HoverTooltip/index.d.ts +15 -0
  82. package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +80 -0
  83. package/lib/sidebar/components/tree-node/components/HoverTooltip/index.scss +7 -0
  84. package/lib/sidebar/components/tree-node/components/IconAction/index.d.ts +12 -0
  85. package/lib/sidebar/components/tree-node/components/IconAction/index.js +127 -0
  86. package/lib/sidebar/components/tree-node/components/IconAction/index.scss +7 -0
  87. package/lib/sidebar/components/tree-node/components/IconSwitch/index.d.ts +23 -0
  88. package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +94 -0
  89. package/lib/sidebar/components/tree-node/components/IconSwitch/index.scss +7 -0
  90. package/lib/sidebar/components/tree-node/index.d.ts +7 -0
  91. package/lib/sidebar/components/tree-node/index.js +252 -0
  92. package/lib/sidebar/components/tree-node/index.scss +58 -0
  93. package/lib/sidebar/index.d.ts +2 -0
  94. package/lib/sidebar/index.js +173 -10
  95. package/lib/sidebar/index.scss +24 -1
  96. package/lib/sidebar/typing.d.ts +83 -13
  97. package/lib/sidebar/utils/action-ref.d.ts +3 -0
  98. package/lib/sidebar/utils/action-ref.js +22 -0
  99. package/lib/sidebar/utils/index.d.ts +71 -0
  100. package/lib/sidebar/utils/index.js +247 -0
  101. package/lib/table/components/Pagination/index.js +3 -3
  102. package/lib/table/components/ToolBar/FilterColumnIcon.js +5 -1
  103. package/lib/table/index.js +8 -3
  104. package/lib/table/typing.d.ts +3 -1
  105. package/package.json +18 -4
@@ -20,6 +20,8 @@ export interface DialogFormAction extends DialogAction {
20
20
  schema: ProFormSchema | Omit<ProFormProps, 'form'>;
21
21
  /** 外部传来的 formRef,用于获取内置 form 实例 */
22
22
  formRef?: React.MutableRefObject<ProFormType | undefined>;
23
+ /** 是否开启懒惰校验,只校验第一个非法规则,默认开启 */
24
+ validateFirst?: boolean;
23
25
  }
24
26
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
25
27
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
@@ -90,14 +90,17 @@ var DialogForm = function DialogForm(props) {
90
90
  formProps = props.formProps,
91
91
  context = props.context,
92
92
  formRef = props.formRef,
93
- innerFormRef = props.innerFormRef;
93
+ innerFormRef = props.innerFormRef,
94
+ _props$validateFirst = props.validateFirst,
95
+ validateFirst = _props$validateFirst === void 0 ? true : _props$validateFirst;
94
96
 
95
97
  var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
96
98
  formSchema = _getSchemaAndFormProp.schema,
97
99
  others = _objectWithoutProperties(_getSchemaAndFormProp, _excluded);
98
100
 
99
101
  var form = createForm({
100
- initialValues: getTargetValue(initialValues, context)
102
+ initialValues: getTargetValue(initialValues, context),
103
+ validateFirst: validateFirst
101
104
  });
102
105
 
103
106
  var _useState = useState(false),
@@ -1,6 +1,7 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { ButtonProps } from '@alicloudfe/components/types/button';
3
3
  import { MenuButtonProps } from '@alicloudfe/components/types/menu-button';
4
+ import { TooltipProps } from '@alicloudfe/components/types/balloon';
4
5
  import { LinkAction } from './link';
5
6
  import { RequestAction } from './request';
6
7
  import { DialogAction } from './dialog';
@@ -29,7 +30,10 @@ export declare function useAction(config?: ProActionConfig, context?: any): any;
29
30
  export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
30
31
  config?: ProActionConfig;
31
32
  disabled?: any;
33
+ tooltip?: ReactNode;
34
+ disabledTooltip?: ReactNode;
32
35
  icon?: string;
36
+ tooltipProps?: TooltipProps;
33
37
  onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
34
38
  }
35
39
  export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["type"],
2
- _excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "onClick"],
2
+ _excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "disabled", "onClick", "tooltip", "disabledTooltip", "tooltipProps"],
3
3
  _excluded3 = ["loading"],
4
4
  _excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type", "className", "noArrow"],
5
5
  _excluded5 = ["context", "text"],
@@ -31,9 +31,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
31
31
 
32
32
  import React from 'react';
33
33
  import cls from 'classnames';
34
- import { Button, MenuButton, Menu, Divider } from '@alicloudfe/components';
34
+ import { Button, MenuButton, Menu, Divider, Balloon } from '@alicloudfe/components';
35
35
  import Icon from '@teamix/icon';
36
- import { getTargetValue, getMessage } from '@teamix/utils';
36
+ import { getTargetValue, getMessage, usePrefixCls } from '@teamix/utils';
37
37
  import { useLinkAction } from './link';
38
38
  import { useRequestAction } from './request';
39
39
  import { useDialogAction } from './dialog';
@@ -165,18 +165,39 @@ export var ProActionButton = function ProActionButton(props) {
165
165
  context = props.context,
166
166
  children = props.children,
167
167
  visible = props.visible,
168
+ disabled = props.disabled,
168
169
  _onClick = props.onClick,
170
+ tooltip = props.tooltip,
171
+ disabledTooltip = props.disabledTooltip,
172
+ tooltipProps = props.tooltipProps,
169
173
  others = _objectWithoutProperties(props, _excluded2);
170
174
 
171
175
  var actionProps = useAction(config, context);
172
- var buttonProps = _onClick ? _objectSpread(_objectSpread(_objectSpread({}, actionProps), others), {}, {
176
+ var buttonProps = _onClick ? _objectSpread(_objectSpread(_objectSpread({
177
+ disabled: disabled
178
+ }, actionProps), others), {}, {
173
179
  onClick: function onClick(e) {
174
180
  return _onClick(e, context);
175
181
  }
176
- }) : _objectSpread(_objectSpread({}, actionProps), others);
177
- return /*#__PURE__*/React.createElement(Button, _objectSpread({
182
+ }) : _objectSpread(_objectSpread({
183
+ disabled: disabled
184
+ }, actionProps), others);
185
+ var content = /*#__PURE__*/React.createElement(Button, _objectSpread({
178
186
  type: type
179
187
  }, buttonProps), buttonContent(children, icon, iconSize, context));
188
+
189
+ var baseToolTipProps = _objectSpread({
190
+ triggerType: 'hover',
191
+ align: 't',
192
+ trigger: content
193
+ }, tooltipProps);
194
+
195
+ if (tooltip || disabledTooltip) {
196
+ var showToolTip = disabled ? disabledTooltip : tooltip;
197
+ content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), showToolTip);
198
+ }
199
+
200
+ return content;
180
201
  };
181
202
 
182
203
  var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
@@ -202,9 +223,7 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
202
223
  }
203
224
  }) : _objectSpread({}, menuItemProps);
204
225
  return /*#__PURE__*/React.createElement("div", _objectSpread({
205
- className: cls('teamix-pro-action-menu-item', 'next-menu-item', {
206
- 'next-disabled': disabled
207
- })
226
+ className: cls('teamix-pro-action-menu-item', "".concat(usePrefixCls(), "menu-item"), _defineProperty({}, "".concat(usePrefixCls(), "disabled"), disabled))
208
227
  }, buttonProps), buttonContent(children, icon, undefined, context));
209
228
  };
210
229
 
@@ -363,6 +382,8 @@ function getActionConfig(action, index, context) {
363
382
  key: getKey(index, _key),
364
383
  actions: actions.map(function (a, j) {
365
384
  return getActionConfig(a, j, context);
385
+ }).filter(function (action) {
386
+ return action.visible !== false;
366
387
  })
367
388
  }, getTargetValue(_others, context));
368
389
  }
@@ -90,7 +90,7 @@ export declare const ProCard: {
90
90
  Selectable: {
91
91
  (props: import("./selectable").ProCardSelectableProps): JSX.Element;
92
92
  defaultProps: {
93
- hoveredShadow: boolean; /** 标签组 */
93
+ hoveredShadow: boolean;
94
94
  };
95
95
  isProCard: boolean;
96
96
  };
package/es/card/index.js CHANGED
@@ -37,6 +37,7 @@ import ProCardDivider from './divider';
37
37
  import ProCardSelectable from './selectable';
38
38
  import ProCardTab from './tab';
39
39
  import './index.scss';
40
+ import ProField from '@teamix/pro-field';
40
41
  export * from './card-container';
41
42
  var cls = baseClass('teamix-pro-card');
42
43
 
@@ -219,7 +220,14 @@ export var ProCard = function ProCard(props) {
219
220
  trigger: tooltipTrigger
220
221
  }, tooltip)), tags && renderTags(tags, 'small'), description && /*#__PURE__*/React.createElement("div", {
221
222
  className: cls('title-description')
222
- }, description));
223
+ }, /*#__PURE__*/React.createElement(ProField, {
224
+ value: description,
225
+ type: "text",
226
+ render: {
227
+ ellipsis: true,
228
+ tooltip: description
229
+ }
230
+ })));
223
231
  };
224
232
 
225
233
  return /*#__PURE__*/React.createElement(BasicCard, _objectSpread({
@@ -52,6 +52,10 @@
52
52
  }
53
53
  }
54
54
 
55
+ &-name{
56
+ flex-shrink: 0;
57
+ }
58
+
55
59
  &-collapse {
56
60
  cursor: pointer;
57
61
 
@@ -1,4 +1,4 @@
1
- import { isUsable, isStr, isPureObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
1
+ import { isUsable, isStr, isPlainObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
2
2
 
3
3
  var useSpecialProps = function useSpecialProps(props) {
4
4
  var initialValues = props.initialValues,
@@ -16,7 +16,7 @@ var useSpecialProps = function useSpecialProps(props) {
16
16
  dataSource = item.dataSource,
17
17
  children = item.children; // 字符串变量配置default值会触发onChange
18
18
 
19
- hasChangeDefault = hasChangeDefault || !!(isPureObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
19
+ hasChangeDefault = hasChangeDefault || !!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
20
20
  hasDefault = hasDefault || isUsable(value);
21
21
  hasRequired = hasRequired || required || !!rules;
22
22
 
@@ -1,4 +1,4 @@
1
- var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "onInitialComplete", "className"];
1
+ var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst"];
2
2
 
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
 
@@ -43,11 +43,12 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
43
43
  onSubmitFailed = _ref.onSubmitFailed,
44
44
  onInitialComplete = _ref.onInitialComplete,
45
45
  className = _ref.className,
46
+ validateFirst = _ref.validateFirst,
46
47
  otherProps = _objectWithoutProperties(_ref, _excluded);
47
48
 
48
49
  var form = useMemo(function () {
49
50
  return outerForm || createForm({
50
- validateFirst: true
51
+ validateFirst: validateFirst
51
52
  });
52
53
  }, []);
53
54
  var prefixCls = usePrefixCls('', {
@@ -119,6 +120,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
119
120
  });
120
121
  ProForm.defaultProps = {
121
122
  colon: false,
122
- labelAlign: 'left'
123
+ labelAlign: 'left',
124
+ validateFirst: true
123
125
  };
124
126
  export default ProForm;
@@ -197,14 +197,15 @@
197
197
  margin-right: 4px;
198
198
  }
199
199
  }
200
- // 数组类ArrayItem Icon 居中(移除,通过align:center配置)
201
- // .#{$form-array}-items-item-inner {
202
- // .#{$css-prefix}space-item {
203
- // > .#{$css-prefix}formily-icon {
204
- // margin-top: 9px;
205
- // }
206
- // }
207
- // }
200
+ // 数组类ArrayItem Icon text 居中
201
+ .#{$form-array}-items-item-inner {
202
+ .#{$css-prefix}space-item {
203
+ > .#{$css-prefix}formily-icon.#{$css-prefix}btn-text {
204
+ line-height: inherit !important;
205
+ margin-right: 0;
206
+ }
207
+ }
208
+ }
208
209
 
209
210
  // Editable预览态行高
210
211
  .#{$css-prefix}formily-editable-content {
@@ -212,6 +213,13 @@
212
213
  }
213
214
 
214
215
  // 折叠面板
216
+ .#{$css-prefix}formily-collapse {
217
+ .#{$css-prefix}collapse-panel-title {
218
+ .#{$css-prefix}badge-count {
219
+ transform: translateX(4px);
220
+ }
221
+ }
222
+ }
215
223
  .#{$css-prefix}formily-collapse,
216
224
  .#{$form-array}-collapse-item {
217
225
  .#{$css-prefix}collapse-panel-hidden {
@@ -10,7 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
 
11
11
  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; }
12
12
 
13
- import { isFn, isPureObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
13
+ import { isFn, isPlainObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
14
14
 
15
15
  var $request = function $request(field, _ref, context, type) {
16
16
  var _field$data;
@@ -29,7 +29,7 @@ var $request = function $request(field, _ref, context, type) {
29
29
  // 触发所有配置的请求
30
30
 
31
31
  var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
32
- var refreshResult = isPureObj(refresh) ? refresh : {};
32
+ var refreshResult = isPlainObj(refresh) ? refresh : {};
33
33
  return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
34
34
  params: _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult),
35
35
  beforeRequest: function beforeRequest() {
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './ActionResponse.less';
3
+ declare type ActionResponseProps = {
4
+ response?: React.ReactNode;
5
+ };
6
+ export declare const ActionResponse: React.FC<ActionResponseProps>;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import './ActionResponse.less';
3
+ export var ActionResponse = function ActionResponse(props) {
4
+ return /*#__PURE__*/React.createElement("div", {
5
+ className: "as-wrapper"
6
+ }, /*#__PURE__*/React.createElement("div", {
7
+ className: "as-actions"
8
+ }, props.children), props.response && /*#__PURE__*/React.createElement("div", {
9
+ className: "as-response"
10
+ }, "Response\uFF1A", props.response));
11
+ };
@@ -0,0 +1,25 @@
1
+ .as-wrapper {
2
+ .as-actions {
3
+ & button {
4
+ margin-right: 5px;
5
+ background-color: #fff;
6
+ border: 2px solid #d4bbbb;
7
+ border-radius: 6px;
8
+ outline: none;
9
+ padding: 8px 20px;
10
+ cursor: pointer;
11
+ transition: all 0.15s ease-in-out;
12
+ &:hover {
13
+ border: 2px solid #9db8f3;
14
+ }
15
+ }
16
+ }
17
+
18
+ .as-response {
19
+ border: 2px dashed #f0bdbd;
20
+ font-size: 14px;
21
+ border-radius: 6px;
22
+ padding: 8px 20px;
23
+ margin-top: 10px;
24
+ }
25
+ }
@@ -91,7 +91,7 @@ declare const formilyReact: {
91
91
  }>>;
92
92
  connect<T_2 extends originalFormilyReact.JSXComponent>(target: T_2, ...args: originalFormilyReact.IComponentMapper<T_2>[]): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Partial<import("react").ComponentProps<T_2>>> & import("react").RefAttributes<unknown>>;
93
93
  observer: typeof originalFormilyReact.observer;
94
- Observer: import("react").MemoExoticComponent<import("react").FunctionComponent<import("_@formily_reactive-react@2.0.11@@formily/reactive-react").IObserverProps>>;
94
+ Observer: import("react").MemoExoticComponent<import("react").FunctionComponent<import("@formily/reactive-react").IObserverProps>>;
95
95
  useForm: <T_3 extends object = any>() => import("@formily/core").Form<T_3>;
96
96
  useField: <T_4 = import("@formily/core").GeneralField>() => T_4;
97
97
  useParentForm: () => import("@formily/core").Form<any> | import("@formily/core").ObjectField<any, any>;
@@ -66,6 +66,7 @@ export interface ProFormProps extends IFormLayoutProps {
66
66
  initialValues?: AnyObject;
67
67
  initialRequest?: ProFormRequestConfig;
68
68
  previewTextPlaceholder?: ReactNode;
69
+ validateFirst?: boolean;
69
70
  onChange?: (values: any, fieldValue?: any, fieldName?: any) => any;
70
71
  onSubmit?: ((values: any) => any) | CommonRequestConfig;
71
72
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
package/es/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import ProPageHeader from './page-header';
9
9
  import ProTable from './table';
10
10
  import ProSkeleton from './skeleton';
11
11
  import utils from './utils';
12
+ import ProSidebar from './sidebar';
12
13
  import { ProTimeline } from './timeline';
13
14
  import * as nocode from './nocode';
14
15
  import * as templates from './templates';
@@ -22,7 +23,8 @@ export * from './page-container';
22
23
  export * from './page-header';
23
24
  export * from './skeleton';
24
25
  export * from './table';
26
+ export * from './sidebar';
25
27
  export * from './utils';
26
28
  export * from './timeline';
27
- declare const version = "1.3.4";
28
- export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProTimeline, hooks, nocode, templates, utils, };
29
+ declare const version = "1.3.7";
30
+ export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -9,8 +9,8 @@ import ProPageContainer from './page-container';
9
9
  import ProPageHeader from './page-header';
10
10
  import ProTable from './table';
11
11
  import ProSkeleton from './skeleton';
12
- import utils from './utils'; // import ProSidebar from './sidebar'
13
-
12
+ import utils from './utils';
13
+ import ProSidebar from './sidebar';
14
14
  import { ProTimeline } from './timeline';
15
15
  import * as nocode from './nocode';
16
16
  import * as templates from './templates';
@@ -27,10 +27,10 @@ export * from './page-container';
27
27
  export * from './page-header';
28
28
  export * from './skeleton';
29
29
  export * from './table';
30
+ export * from './sidebar';
30
31
  export * from './utils'; // export * from './sidebar';
31
32
 
32
33
  export * from './timeline';
33
- var version = '1.3.4';
34
+ var version = '1.3.7';
34
35
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
35
- ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
36
- ProTimeline, hooks, nocode, templates, utils };
36
+ ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils };
@@ -20,7 +20,7 @@ var ProInfoItem = function ProInfoItem(prop) {
20
20
  var labelCol = baseInfoLayout.labelCol,
21
21
  wrapperCol = baseInfoLayout.wrapperCol;
22
22
  return /*#__PURE__*/React.createElement("div", {
23
- className: cls()
23
+ className: cls('')
24
24
  }, /*#__PURE__*/React.createElement(Row, {
25
25
  gutter: 10,
26
26
  className: cls('base-row')
@@ -17,7 +17,6 @@ $item-padding-bottom: 8px;
17
17
  .teamix-pro-field-info-form-item {
18
18
  width: 100%;
19
19
  padding-bottom: $item-padding-bottom;
20
-
21
20
  &-header-row {
22
21
  display: flex;
23
22
  align-items: center;
@@ -1,6 +1,3 @@
1
- $item-padding-bottom: -8px;
2
- // /** 消除 baseInfo 被其他组件包裹后没有居中的问题*/
3
1
  .teamix-pro-info {
4
2
  width: 100%;
5
- margin-bottom: $item-padding-bottom;
6
3
  }
@@ -1,4 +1,12 @@
1
- var _excluded = ["children", "searchPlaceholder", "showSearch", "searchProps", "customSearch", "searchOnChange", "message", "messageProps", "customMessage"];
1
+ var _excluded = ["children", "searchPlaceholder", "showSearch", "searchProps", "customSearch", "searchOnChange", "message", "messageProps", "customMessage", "scrollArea", "showExpandAll", "showExpandLevel", "onExpandAllChange", "onExpandLevelChange", "expandLevel", "isTree"];
2
+
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+
5
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2
10
 
3
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
12
 
@@ -6,16 +14,29 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
14
 
7
15
  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; }
8
16
 
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
+
19
+ 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."); }
20
+
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+
23
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
24
+
25
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
26
+
27
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
+
9
29
  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; }
10
30
 
11
31
  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; }
12
32
 
13
- import { Message } from '@alicloudfe/components';
33
+ import { Button, MenuButton, Message } from '@alicloudfe/components';
14
34
  import { ProCard } from '../../../card';
15
35
  import ProField from '@teamix/pro-field';
16
36
  import { baseClass } from '@teamix/utils';
17
- import React from 'react';
37
+ import React, { useEffect, useRef, useState } from 'react';
18
38
  import './index.scss';
39
+ import TeamixIcon from '@teamix/icon';
19
40
  var cls = baseClass('teamix-pro-sidebar-container');
20
41
 
21
42
  var ProSidebarContainer = function ProSidebarContainer(props) {
@@ -31,8 +52,47 @@ var ProSidebarContainer = function ProSidebarContainer(props) {
31
52
  _props$messageProps = props.messageProps,
32
53
  messageProps = _props$messageProps === void 0 ? {} : _props$messageProps,
33
54
  customMessage = props.customMessage,
34
- others = _objectWithoutProperties(props, _excluded); // 渲染搜索区域
55
+ scrollArea = props.scrollArea,
56
+ showExpandAll = props.showExpandAll,
57
+ showExpandLevel = props.showExpandLevel,
58
+ onExpandAllChange = props.onExpandAllChange,
59
+ onExpandLevelChange = props.onExpandLevelChange,
60
+ _props$expandLevel = props.expandLevel,
61
+ expandLevel = _props$expandLevel === void 0 ? 1 : _props$expandLevel,
62
+ isTree = props.isTree,
63
+ others = _objectWithoutProperties(props, _excluded);
64
+
65
+ var ref = useRef();
66
+
67
+ var _useState = useState('auto'),
68
+ _useState2 = _slicedToArray(_useState, 2),
69
+ treeHeight = _useState2[0],
70
+ setTreeHeight = _useState2[1]; // 展开全部状态
71
+
35
72
 
73
+ var _useState3 = useState(false),
74
+ _useState4 = _slicedToArray(_useState3, 2),
75
+ expandAllState = _useState4[0],
76
+ setExpandAllState = _useState4[1]; // 展开层级状态
77
+
78
+
79
+ var _useState5 = useState(1),
80
+ _useState6 = _slicedToArray(_useState5, 2),
81
+ expandLevelState = _useState6[0],
82
+ setExpandLevelState = _useState6[1];
83
+
84
+ useEffect(function () {
85
+ // 设置滚动区域
86
+ if (scrollArea === 'tree') {
87
+ var _ref$current$offsetTo, _ref$current;
88
+
89
+ var remainHeight = (_ref$current$offsetTo = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetTop) !== null && _ref$current$offsetTo !== void 0 ? _ref$current$offsetTo : 0 + 40;
90
+
91
+ if (remainHeight > 0) {
92
+ setTreeHeight("calc(100% - ".concat(remainHeight, "px + 16px)"));
93
+ }
94
+ }
95
+ }, []); // 渲染搜索区域
36
96
 
37
97
  var renderSearch = function renderSearch() {
38
98
  if (customSearch || showSearch) {
@@ -55,22 +115,67 @@ var ProSidebarContainer = function ProSidebarContainer(props) {
55
115
  if (message || customMessage) {
56
116
  return /*#__PURE__*/React.createElement("div", {
57
117
  className: cls('notice')
58
- }, message && /*#__PURE__*/React.createElement(Message, _objectSpread({
118
+ }, message && /*#__PURE__*/React.createElement(Message, _objectSpread(_objectSpread({
59
119
  type: "notice",
60
120
  closeable: true
61
- }, messageProps), message), !!customMessage && customMessage);
121
+ }, messageProps), {}, {
122
+ onClose: function onClose() {
123
+ var _ref$current$offsetTo2, _ref$current2;
124
+
125
+ var remainHeight = (_ref$current$offsetTo2 = ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.offsetTop) !== null && _ref$current$offsetTo2 !== void 0 ? _ref$current$offsetTo2 : 0 + 40;
126
+ setTreeHeight("calc(100% - ".concat(remainHeight, "px + 56px)"));
127
+ }
128
+ }), message), !!customMessage && customMessage);
62
129
  }
63
130
 
64
131
  return null;
132
+ }; // 渲染折叠区
133
+
134
+
135
+ var renderFold = function renderFold() {
136
+ if (showExpandAll || showExpandLevel) {
137
+ return /*#__PURE__*/React.createElement("div", {
138
+ className: cls('fold')
139
+ }, showExpandAll && /*#__PURE__*/React.createElement(Button, {
140
+ type: "primary",
141
+ text: true,
142
+ onClick: function onClick() {
143
+ var visible = !expandAllState;
144
+ setExpandAllState(visible);
145
+ onExpandAllChange === null || onExpandAllChange === void 0 ? void 0 : onExpandAllChange(visible);
146
+ }
147
+ }, /*#__PURE__*/React.createElement(TeamixIcon, {
148
+ type: expandAllState ? 'menu-unfold-line' : 'menu-fold-line'
149
+ }), expandAllState ? '全部收起' : '全部展开'), showExpandLevel && /*#__PURE__*/React.createElement(MenuButton, {
150
+ text: true,
151
+ type: "secondary",
152
+ label: "\u5C55\u793A".concat(expandLevelState, "\u7EA7"),
153
+ onItemClick: function onItemClick(key) {
154
+ setExpandLevelState(key);
155
+ onExpandLevelChange === null || onExpandLevelChange === void 0 ? void 0 : onExpandLevelChange(key);
156
+ }
157
+ }, _toConsumableArray(new Array(expandLevel)).fill(1).map(function (item, index) {
158
+ return /*#__PURE__*/React.createElement(MenuButton.Item, {
159
+ key: index + 1
160
+ }, "\u5C55\u793A", index + 1, "\u7EA7");
161
+ })));
162
+ }
65
163
  };
66
164
 
67
165
  return /*#__PURE__*/React.createElement("div", {
68
- className: cls()
166
+ className: cls({
167
+ '': true,
168
+ 'not-is-tree': !isTree
169
+ })
69
170
  }, /*#__PURE__*/React.createElement(ProCard, _objectSpread({
70
171
  bordered: false,
71
172
  compacted: true
72
- }, others), renderSearch(), renderNotice(), /*#__PURE__*/React.createElement("div", {
73
- className: cls('context')
173
+ }, others), renderSearch(), renderNotice(), renderFold(), /*#__PURE__*/React.createElement("div", {
174
+ className: cls('context'),
175
+ ref: ref,
176
+ style: {
177
+ height: treeHeight
178
+ }
74
179
  }, children)));
75
180
  };
76
181