@teamix/pro 1.3.6 → 1.3.9
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.
- package/dist/pro.css +1 -1
- package/dist/pro.js +3664 -10438
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +0 -9
- package/es/actions/dialog-form.d.ts +2 -0
- package/es/actions/dialog-form.js +5 -2
- package/es/actions/dialog.js +8 -3
- package/es/actions/index.d.ts +5 -1
- package/es/actions/index.js +30 -9
- package/es/form/Components/LightFilter/index.js +8 -6
- package/es/form/Filter/LightFilter.js +12 -2
- package/es/form/Filter/useSpecialProps.js +2 -2
- package/es/form/ProForm/index.js +20 -10
- package/es/form/ProForm/index.scss +16 -8
- package/es/form/SchemaForm/index.js +18 -26
- package/es/form/SchemaForm/reactions.js +2 -2
- package/es/form/typing.d.ts +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/ProInfoItem/index.js +2 -6
- package/es/info/components/ProInfoItem/index.scss +0 -4
- package/es/info/components/baseInfo/index.js +15 -8
- package/es/info/typing.d.ts +1 -2
- package/es/info/utils/index.d.ts +0 -8
- package/es/info/utils/index.js +1 -28
- package/es/sidebar/components/tree/index.js +17 -13
- package/es/sidebar/components/tree-node/components/IconSwitch/index.js +1 -1
- package/es/sidebar/index.js +5 -4
- package/es/sidebar/utils/index.d.ts +12 -0
- package/es/sidebar/utils/index.js +58 -0
- package/es/table/components/Pagination/index.js +4 -4
- package/es/table/components/ToolBar/FilterColumnIcon.js +5 -1
- package/es/table/index.js +9 -4
- package/es/table/typing.d.ts +3 -1
- package/lib/actions/dialog-form.d.ts +2 -0
- package/lib/actions/dialog-form.js +5 -2
- package/lib/actions/dialog.js +8 -3
- package/lib/actions/index.d.ts +5 -1
- package/lib/actions/index.js +29 -7
- package/lib/form/Components/LightFilter/index.js +5 -3
- package/lib/form/Filter/LightFilter.js +14 -2
- package/lib/form/Filter/useSpecialProps.js +1 -1
- package/lib/form/ProForm/index.js +19 -9
- package/lib/form/ProForm/index.scss +16 -8
- package/lib/form/SchemaForm/index.js +17 -26
- package/lib/form/SchemaForm/reactions.js +1 -1
- package/lib/form/typing.d.ts +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/ProInfoItem/index.js +2 -6
- package/lib/info/components/ProInfoItem/index.scss +0 -4
- package/lib/info/components/baseInfo/index.js +14 -7
- package/lib/info/typing.d.ts +1 -2
- package/lib/info/utils/index.d.ts +0 -8
- package/lib/info/utils/index.js +1 -32
- package/lib/sidebar/components/tree/index.js +19 -16
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +1 -1
- package/lib/sidebar/index.js +6 -4
- package/lib/sidebar/utils/index.d.ts +12 -0
- package/lib/sidebar/utils/index.js +60 -0
- package/lib/table/components/Pagination/index.js +3 -3
- package/lib/table/components/ToolBar/FilterColumnIcon.js +5 -1
- package/lib/table/index.js +8 -3
- package/lib/table/typing.d.ts +3 -1
- package/package.json +18 -4
@@ -26,15 +26,6 @@ object-assign
|
|
26
26
|
|
27
27
|
/*! js-cookie v3.0.1 | MIT */
|
28
28
|
|
29
|
-
/**
|
30
|
-
* @license
|
31
|
-
* Lodash <https://lodash.com/>
|
32
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
33
|
-
* Released under MIT license <https://lodash.com/license>
|
34
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
35
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
36
|
-
*/
|
37
|
-
|
38
29
|
/** @license React v16.13.1
|
39
30
|
* react-is.production.min.js
|
40
31
|
*
|
@@ -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),
|
package/es/actions/dialog.js
CHANGED
@@ -174,17 +174,22 @@ export function useDialogAction(action, actionContext) {
|
|
174
174
|
case 6:
|
175
175
|
onFinish && onFinish();
|
176
176
|
resolve(true);
|
177
|
-
_context.next =
|
177
|
+
_context.next = 16;
|
178
178
|
break;
|
179
179
|
|
180
180
|
case 10:
|
181
181
|
_context.prev = 10;
|
182
182
|
_context.t0 = _context["catch"](2);
|
183
|
-
setLoading(false);
|
183
|
+
setLoading(false); // 如果 beforeRequest 中返回了 false,则直接关闭弹窗
|
184
|
+
|
185
|
+
if (beforeRequest) {
|
186
|
+
resolve(true);
|
187
|
+
}
|
188
|
+
|
184
189
|
resolve(false);
|
185
190
|
return _context.abrupt("return");
|
186
191
|
|
187
|
-
case
|
192
|
+
case 16:
|
188
193
|
case "end":
|
189
194
|
return _context.stop();
|
190
195
|
}
|
package/es/actions/index.d.ts
CHANGED
@@ -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;
|
package/es/actions/index.js
CHANGED
@@ -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({
|
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({
|
177
|
-
|
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',
|
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
|
}
|
@@ -16,12 +16,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
16
16
|
|
17
17
|
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; }
|
18
18
|
|
19
|
-
import React, { useState, useCallback } from 'react';
|
20
|
-
import { observer, useFieldSchema, RecursionField } from '@formily/react';
|
19
|
+
import React, { useState, useCallback, useContext } from 'react';
|
20
|
+
import { observer, useFieldSchema, RecursionField, SchemaExpressionScopeContext } from '@formily/react';
|
21
21
|
import { Select, Button } from '@alicloudfe/components';
|
22
22
|
import TeamixIcon from '@teamix/icon';
|
23
23
|
import cls from 'classnames';
|
24
|
-
import { usePrefixCls } from '@teamix/utils';
|
24
|
+
import { usePrefixCls, getTargetValue } from '@teamix/utils';
|
25
25
|
import { componentMap, inputCategory } from './componentMap';
|
26
26
|
import './index.scss';
|
27
27
|
|
@@ -56,13 +56,14 @@ var useMain = function useMain(active) {
|
|
56
56
|
}; // 筛选项数据
|
57
57
|
|
58
58
|
|
59
|
-
var useFilterItems = function useFilterItems(filterValues) {
|
59
|
+
var useFilterItems = function useFilterItems(filterValues, scope) {
|
60
60
|
var schema = useFieldSchema();
|
61
61
|
var filterItems = [];
|
62
62
|
schema.mapProperties(function (schema, name) {
|
63
63
|
if (!filterValues || filterValues && filterValues.includes(schema.name)) {
|
64
|
+
var label = /{{.*}}/.test(schema.title) ? getTargetValue(schema.title, scope) : schema.title;
|
64
65
|
filterItems.push({
|
65
|
-
label:
|
66
|
+
label: label,
|
66
67
|
value: schema.name
|
67
68
|
});
|
68
69
|
}
|
@@ -85,7 +86,8 @@ var LightFilter = observer(function (props) {
|
|
85
86
|
onFilterChange = props.onFilterChange,
|
86
87
|
filterProps = props.filterProps,
|
87
88
|
buttonProps = props.buttonProps;
|
88
|
-
var
|
89
|
+
var scope = useContext(SchemaExpressionScopeContext);
|
90
|
+
var filterItems = useFilterItems(filterValues, scope);
|
89
91
|
|
90
92
|
var _useState = useState(defaultFilterValue || ((_filterItems$ = filterItems[0]) === null || _filterItems$ === void 0 ? void 0 : _filterItems$.value)),
|
91
93
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -12,8 +12,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
12
12
|
|
13
13
|
import React, { memo, useMemo, useCallback, useRef, useEffect } from 'react';
|
14
14
|
import cls from 'classnames';
|
15
|
+
import { observable } from '@formily/reactive';
|
15
16
|
import { usePrefixCls } from '@teamix/utils';
|
16
17
|
import ProForm from '../ProForm';
|
18
|
+
var lightFilterObs = observable({
|
19
|
+
onFilter: function onFilter() {}
|
20
|
+
});
|
17
21
|
/**
|
18
22
|
* 轻量筛选
|
19
23
|
*/
|
@@ -69,7 +73,7 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
69
73
|
filterValues: filterValues,
|
70
74
|
onFilterChange: onFilterChange,
|
71
75
|
buttonProps: {
|
72
|
-
onClick: onFilter
|
76
|
+
onClick: "{{lightFilterObs.onFilter}}"
|
73
77
|
}
|
74
78
|
},
|
75
79
|
children: schema
|
@@ -81,8 +85,14 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
81
85
|
}
|
82
86
|
}
|
83
87
|
}];
|
84
|
-
}, [schema,
|
88
|
+
}, [schema, onFilterChange, defaultFilterValue]);
|
89
|
+
useEffect(function () {
|
90
|
+
lightFilterObs.onFilter = onFilter;
|
91
|
+
}, [onChange]);
|
85
92
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
93
|
+
scope: _objectSpread(_objectSpread({}, otherProps === null || otherProps === void 0 ? void 0 : otherProps.scope), {}, {
|
94
|
+
lightFilterObs: lightFilterObs
|
95
|
+
}),
|
86
96
|
form: form,
|
87
97
|
className: cls(prefixCls, props.className),
|
88
98
|
schema: LightSchema,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isUsable, isStr,
|
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 || !!(
|
19
|
+
hasChangeDefault = hasChangeDefault || !!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
|
20
20
|
hasDefault = hasDefault || isUsable(value);
|
21
21
|
hasRequired = hasRequired || required || !!rules;
|
22
22
|
|
package/es/form/ProForm/index.js
CHANGED
@@ -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
|
|
@@ -15,7 +15,7 @@ import cls from 'classnames';
|
|
15
15
|
import { createForm, onFieldValueChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
16
16
|
import { toJS } from '@formily/reactive';
|
17
17
|
import { Form } from '@teamix/formily';
|
18
|
-
import { usePrefixCls, getLanguage } from '@teamix/utils';
|
18
|
+
import { usePrefixCls, getLanguage, getGlobalConfig } from '@teamix/utils';
|
19
19
|
import SchemaForm from '../SchemaForm';
|
20
20
|
import { mergeArrayValue } from '../utils';
|
21
21
|
import useAutoSubmit from './useAutoSubmit';
|
@@ -43,21 +43,30 @@ 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
|
|
49
|
+
// 获取全局配置
|
50
|
+
var _ref2 = getGlobalConfig('ProForm') || {},
|
51
|
+
globalComponents = _ref2.components,
|
52
|
+
globalScope = _ref2.scope;
|
53
|
+
|
48
54
|
var form = useMemo(function () {
|
49
55
|
return outerForm || createForm({
|
50
|
-
validateFirst:
|
56
|
+
validateFirst: validateFirst
|
51
57
|
});
|
52
58
|
}, []);
|
53
59
|
var prefixCls = usePrefixCls('', {
|
54
60
|
prefix: 'teamix-pro-form'
|
55
61
|
});
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
|
63
|
+
var mergedScope = _objectSpread(_objectSpread(_objectSpread({}, globalScope), scope), {}, {
|
64
|
+
context: context
|
65
|
+
}); // context需要实名不能解构
|
66
|
+
|
67
|
+
|
68
|
+
var mergedComponents = _objectSpread(_objectSpread({}, globalComponents), components);
|
69
|
+
|
61
70
|
var onAutoSubmit = useAutoSubmit(onSubmit); // todo 需要formily支持断点下的属性更新
|
62
71
|
|
63
72
|
var getTeamixLayout = useMemo(function () {
|
@@ -114,11 +123,12 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
114
123
|
}), /*#__PURE__*/React.createElement(SchemaForm, {
|
115
124
|
schema: schema,
|
116
125
|
scope: mergedScope,
|
117
|
-
components:
|
126
|
+
components: mergedComponents
|
118
127
|
}), children);
|
119
128
|
});
|
120
129
|
ProForm.defaultProps = {
|
121
130
|
colon: false,
|
122
|
-
labelAlign: 'left'
|
131
|
+
labelAlign: 'left',
|
132
|
+
validateFirst: true
|
123
133
|
};
|
124
134
|
export default ProForm;
|
@@ -197,14 +197,15 @@
|
|
197
197
|
margin-right: 4px;
|
198
198
|
}
|
199
199
|
}
|
200
|
-
// 数组类ArrayItem Icon
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
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 {
|
@@ -30,7 +30,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
30
30
|
|
31
31
|
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; }
|
32
32
|
|
33
|
-
import React, { memo, useCallback, useMemo } from 'react';
|
33
|
+
import React, { memo, useCallback, useRef, useMemo } from 'react';
|
34
34
|
import { createSchemaField } from '@formily/react';
|
35
35
|
import { Affix } from '@alicloudfe/components';
|
36
36
|
import { Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
@@ -59,22 +59,16 @@ import initializeSelectTable from './initializeSelectTable';
|
|
59
59
|
import { $request, $common, $dataSource, $validator } from './reactions';
|
60
60
|
import fieldTypeMap from '../fieldTypeMap';
|
61
61
|
import { getFieldName, mapSchemaName } from '../utils';
|
62
|
-
import { getGlobalConfig } from '@teamix/utils';
|
63
62
|
import warning from '../warning';
|
64
63
|
export default /*#__PURE__*/memo(function (_ref) {
|
65
64
|
var schema = _ref.schema,
|
66
65
|
scope = _ref.scope,
|
67
66
|
components = _ref.components;
|
68
|
-
|
69
|
-
// 获取全局配置
|
70
|
-
var _ref2 = getGlobalConfig('ProForm') || {},
|
71
|
-
globalComponents = _ref2.components,
|
72
|
-
globalScope = _ref2.scope; // 创建 SchemaField
|
73
|
-
|
67
|
+
var schemaScopeRef = useRef({}); // 创建 SchemaField,添加内置组件
|
74
68
|
|
75
69
|
var SchemaField = useMemo(function () {
|
76
70
|
return createSchemaField({
|
77
|
-
components: _objectSpread(_objectSpread(
|
71
|
+
components: _objectSpread(_objectSpread({}, ProFieldComponents), {}, {
|
78
72
|
FormLayout: FormLayout,
|
79
73
|
FormItem: FormItem,
|
80
74
|
ArrayCollapse: ArrayCollapse,
|
@@ -103,16 +97,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
103
97
|
Text: Text
|
104
98
|
})
|
105
99
|
});
|
106
|
-
}, []); //
|
107
|
-
|
108
|
-
var mergedScope = useMemo(function () {
|
109
|
-
return _objectSpread(_objectSpread(_objectSpread({}, globalScope), scope), {}, {
|
110
|
-
$request: $request,
|
111
|
-
$common: $common,
|
112
|
-
$dataSource: $dataSource,
|
113
|
-
$validator: $validator
|
114
|
-
});
|
115
|
-
}, [scope]); // 格式化 schema
|
100
|
+
}, []); // 格式化 schema
|
116
101
|
|
117
102
|
var formatSchema = useCallback(function (schema) {
|
118
103
|
var parentSuffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
@@ -231,12 +216,12 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
231
216
|
|
232
217
|
var defaultReactions = initializeReactions(reactions, [].concat(_toConsumableArray(requestReactions), _toConsumableArray(dataSourceReactions))); // 合并scope
|
233
218
|
|
234
|
-
Object.entries(_objectSpread(_objectSpread(_objectSpread({}, requestScope), dataSourceScope), rulesScope)).map(function (
|
235
|
-
var
|
236
|
-
k =
|
237
|
-
v =
|
219
|
+
Object.entries(_objectSpread(_objectSpread(_objectSpread({}, requestScope), dataSourceScope), rulesScope)).map(function (_ref2) {
|
220
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
221
|
+
k = _ref3[0],
|
222
|
+
v = _ref3[1];
|
238
223
|
|
239
|
-
|
224
|
+
schemaScopeRef.current[k] = v;
|
240
225
|
});
|
241
226
|
var formatParam = mapSchemaName(_objectSpread(_objectSpread({}, otherProps), {}, {
|
242
227
|
type: defaultType,
|
@@ -261,13 +246,20 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
261
246
|
schemaProperties[name] = _objectSpread(_objectSpread(_objectSpread({}, formatParam), recursiveProperties), recursiveItems);
|
262
247
|
});
|
263
248
|
return schemaProperties;
|
264
|
-
}, [
|
249
|
+
}, []);
|
265
250
|
var formilySchema = useMemo(function () {
|
266
251
|
return {
|
267
252
|
type: 'object',
|
268
253
|
properties: formatSchema(schema)
|
269
254
|
};
|
270
|
-
}, [schema]);
|
255
|
+
}, [schema]);
|
256
|
+
|
257
|
+
var mergedScope = _objectSpread(_objectSpread({}, scope), {}, {
|
258
|
+
$request: $request,
|
259
|
+
$common: $common,
|
260
|
+
$dataSource: $dataSource,
|
261
|
+
$validator: $validator
|
262
|
+
}, schemaScopeRef.current);
|
271
263
|
|
272
264
|
return /*#__PURE__*/React.createElement(SchemaField, {
|
273
265
|
schema: formilySchema,
|
@@ -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,
|
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 =
|
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() {
|
package/es/form/typing.d.ts
CHANGED
@@ -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
@@ -26,5 +26,5 @@ export * from './table';
|
|
26
26
|
export * from './sidebar';
|
27
27
|
export * from './utils';
|
28
28
|
export * from './timeline';
|
29
|
-
declare const version = "1.3.
|
29
|
+
declare const version = "1.3.9";
|
30
30
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -31,6 +31,6 @@ export * from './sidebar';
|
|
31
31
|
export * from './utils'; // export * from './sidebar';
|
32
32
|
|
33
33
|
export * from './timeline';
|
34
|
-
var version = '1.3.
|
34
|
+
var version = '1.3.9';
|
35
35
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
36
36
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils };
|
@@ -14,17 +14,13 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
14
14
|
headerInfoLayout = prop.headerInfoLayout,
|
15
15
|
loading = prop.loading,
|
16
16
|
tooltip = prop.tooltip,
|
17
|
-
tooltipIcon = prop.tooltipIcon
|
18
|
-
_isLastRow = prop._isLastRow;
|
17
|
+
tooltipIcon = prop.tooltipIcon;
|
19
18
|
|
20
19
|
if (baseInfoLayout) {
|
21
20
|
var labelCol = baseInfoLayout.labelCol,
|
22
21
|
wrapperCol = baseInfoLayout.wrapperCol;
|
23
22
|
return /*#__PURE__*/React.createElement("div", {
|
24
|
-
className: cls(
|
25
|
-
'': true,
|
26
|
-
isLastRow: _isLastRow
|
27
|
-
})
|
23
|
+
className: cls('')
|
28
24
|
}, /*#__PURE__*/React.createElement(Row, {
|
29
25
|
gutter: 10,
|
30
26
|
className: cls('base-row')
|
@@ -5,7 +5,7 @@ import './index.scss';
|
|
5
5
|
import { getLayout } from '../../utils/utils';
|
6
6
|
import defaultLayoutMap from '../../utils/layout';
|
7
7
|
import InfoValueItem from '../InfoValueItem';
|
8
|
-
import { getDataIndexValue
|
8
|
+
import { getDataIndexValue } from '../../utils';
|
9
9
|
var Row = Grid.Row,
|
10
10
|
Col = Grid.Col;
|
11
11
|
|
@@ -26,23 +26,33 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
26
26
|
var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
|
27
27
|
|
28
28
|
if (layout) {
|
29
|
-
var _layout$labelCol, _layout$wrapperCol;
|
29
|
+
var _layout$labelCol, _layout$wrapperCol, _layout$span;
|
30
30
|
|
31
31
|
var labelCol = (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
|
32
32
|
var wrapperCol = (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
|
33
|
+
var span = (_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : defaultLayout.span;
|
34
|
+
|
35
|
+
if ((layout === null || layout === void 0 ? void 0 : layout.colNum) && layout.colNum > 0 && layout.colNum <= 4) {
|
36
|
+
span = 24 / layout.colNum;
|
37
|
+
}
|
38
|
+
|
39
|
+
formItemLayout.span = span;
|
33
40
|
formItemLayout.labelCol = labelCol;
|
34
41
|
formItemLayout.wrapperCol = wrapperCol;
|
35
42
|
}
|
36
43
|
|
44
|
+
var newSpan = formItemLayout.span;
|
37
45
|
var newLabelSpan = formItemLayout.labelCol.span;
|
38
46
|
var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
|
39
47
|
|
40
48
|
if (colspan) {
|
49
|
+
newSpan = newSpan * (colspan !== null && colspan !== void 0 ? colspan : 1);
|
41
50
|
newLabelSpan = newLabelSpan / colspan;
|
42
51
|
newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
|
43
52
|
}
|
44
53
|
|
45
54
|
var newFormItemLayout = {
|
55
|
+
span: newSpan,
|
46
56
|
labelCol: {
|
47
57
|
span: newLabelSpan
|
48
58
|
},
|
@@ -55,17 +65,14 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
55
65
|
|
56
66
|
var renderContent = function renderContent() {
|
57
67
|
return columns.map(function (item, index) {
|
58
|
-
var
|
68
|
+
var _getFormItemLayout, _item$colSpan, _item$title, _item$valueType, _ref, _item$colSpan2;
|
59
69
|
|
60
|
-
var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
|
61
|
-
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;
|
62
70
|
return /*#__PURE__*/React.createElement(Col, {
|
63
|
-
span:
|
71
|
+
span: (_getFormItemLayout = getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0)) === null || _getFormItemLayout === void 0 ? void 0 : _getFormItemLayout.span,
|
64
72
|
key: index
|
65
73
|
}, /*#__PURE__*/React.createElement(ProInfoItem, {
|
66
74
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
67
75
|
loading: loading,
|
68
|
-
_isLastRow: !!isLastRow(columns.length, layoutSpan, index),
|
69
76
|
value: /*#__PURE__*/React.createElement(InfoValueItem, {
|
70
77
|
type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
|
71
78
|
value: getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}),
|
@@ -77,7 +84,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
77
84
|
context: context,
|
78
85
|
props: item.props
|
79
86
|
}),
|
80
|
-
baseInfoLayout: getFormItemLayout((_item$
|
87
|
+
baseInfoLayout: getFormItemLayout((_item$colSpan2 = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan2 !== void 0 ? _item$colSpan2 : 0),
|
81
88
|
tooltip: item.tooltip,
|
82
89
|
tooltipIcon: item.tooltipIcon
|
83
90
|
}));
|
package/es/info/typing.d.ts
CHANGED
@@ -113,8 +113,6 @@ export declare type IProProInfoItem = {
|
|
113
113
|
headerInfoLayout?: ProHeaderInfoLayoutProps;
|
114
114
|
/** loading 状态 */
|
115
115
|
loading?: boolean;
|
116
|
-
/** isLastRow 是否是最后一行的元素 */
|
117
|
-
_isLastRow?: boolean;
|
118
116
|
} & Pick<ProInfoColumnsProps, 'tooltip' | 'tooltipIcon'>;
|
119
117
|
/** header info 定义 */
|
120
118
|
export declare type IProHeaderInfo = {
|
@@ -137,6 +135,7 @@ export declare type ProInfoProps = {
|
|
137
135
|
export declare type IProHeaderInfoItem = {};
|
138
136
|
export declare type BaseInfoLayoutProps = ProBaseInfoLayoutProps;
|
139
137
|
export declare type ProBaseInfoLayoutProps = {
|
138
|
+
colNum?: number;
|
140
139
|
span?: number;
|
141
140
|
labelCol?: {
|
142
141
|
span: number;
|
package/es/info/utils/index.d.ts
CHANGED
@@ -10,11 +10,3 @@ export declare const ProInfoGroupContext: React.Context<ProInfoGroupContextProps
|
|
10
10
|
* @returns
|
11
11
|
*/
|
12
12
|
export declare function getDataIndexValue(dataIndex: ProInfoColumnsProps['dataIndex'], dataSource: object): any;
|
13
|
-
/**
|
14
|
-
* 是否是最后一样的元素
|
15
|
-
* @param columnsLength
|
16
|
-
* @param layoutSpan
|
17
|
-
* @params itemIndex
|
18
|
-
* @returns
|
19
|
-
*/
|
20
|
-
export declare const isLastRow: (columnsLength: number, layoutSpan: number, itemIndex: number) => boolean | undefined;
|