@teamix/pro 1.1.37 → 1.2.0
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/README.md +14 -10
- package/dist/pro.css +1 -1
- package/dist/pro.js +2486 -3754
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +5 -5
- package/es/actions/dialog-form.js +1 -5
- package/es/actions/dialog.d.ts +12 -0
- package/es/actions/dialog.js +104 -27
- package/es/actions/index.d.ts +54 -47
- package/es/actions/index.js +28 -22
- package/es/actions/index.scss +48 -2
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/card/index.d.ts +17 -5
- package/es/card/index.js +16 -11
- package/es/form/Components/ProField/index.d.ts +1 -161
- package/es/form/Components/ProField/index.js +34 -40
- package/es/form/Filter/index.js +2 -2
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +1 -6
- package/es/form/ProForm/index.scss +19 -1
- package/es/form/ProForm/useFieldRequest.d.ts +5 -0
- package/es/form/ProForm/useFieldRequest.js +26 -0
- package/es/form/SchemaForm/adapterDecorator.js +2 -2
- package/es/form/SchemaForm/index.d.ts +2 -2
- package/es/form/SchemaForm/index.js +12 -21
- package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.js +44 -16
- package/es/form/SchemaForm/reactions.d.ts +5 -5
- package/es/form/SchemaForm/reactions.js +20 -18
- package/es/form/fieldTypeMap.d.ts +4 -0
- package/es/form/fieldTypeMap.js +41 -0
- package/es/form/index.d.ts +92 -4
- package/es/form/index.js +18 -5
- package/es/form/schemaNameMap.js +3 -0
- package/es/form/typing.d.ts +49 -26
- package/es/form/utils.d.ts +3 -1
- package/es/form/utils.js +38 -1
- package/es/form/warning.d.ts +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoGroup/index.js +73 -15
- package/es/info/components/InfoGroup/index.scss +45 -3
- package/es/info/components/InfoValueItem/index.js +9 -4
- package/es/info/components/InfoValueItem/index.scss +5 -1
- package/es/info/components/ProInfoItem/index.js +3 -3
- package/es/info/components/ProInfoItem/index.scss +1 -0
- package/es/info/components/baseInfo/index.d.ts +2 -3
- package/es/info/components/baseInfo/index.js +29 -10
- package/es/info/components/headerInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.js +2 -2
- package/es/info/index.js +75 -51
- package/es/info/typing.d.ts +54 -36
- package/es/info/utils/index.d.ts +2 -2
- package/es/info/utils/utils.d.ts +1 -1
- package/es/nocode/pages/renderer.js +2 -2
- package/es/page-header/index.d.ts +34 -21
- package/es/page-header/index.js +39 -30
- package/es/page-header/index.scss +2 -1
- package/es/table/components/EmptyContent/index.d.ts +2 -0
- package/es/table/components/EmptyContent/index.js +11 -0
- package/es/table/components/Filter/index.d.ts +2 -2
- package/es/table/components/Filter/index.js +23 -10
- package/es/table/components/Filter/index.scss +1 -1
- package/es/table/components/Layout/index.js +2 -2
- package/es/table/components/QuickAction/index.d.ts +2 -2
- package/es/table/components/QuickAction/index.js +3 -3
- package/es/table/components/ToolBar/Fullscreen.js +1 -0
- package/es/table/index.js +76 -14
- package/es/table/index.scss +4 -0
- package/es/table/typing.d.ts +29 -14
- package/es/table/utils/columnRender.d.ts +3 -3
- package/es/table/utils/columnRender.js +2 -2
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +1 -1
- package/es/table/utils/index.js +33 -11
- package/es/templates/List/index.d.ts +2 -2
- package/es/utils/message.d.ts +3 -0
- package/es/utils/message.js +19 -0
- package/lib/actions/dialog-form.d.ts +5 -5
- package/lib/actions/dialog-form.js +1 -5
- package/lib/actions/dialog.d.ts +12 -0
- package/lib/actions/dialog.js +108 -26
- package/lib/actions/index.d.ts +54 -47
- package/lib/actions/index.js +37 -30
- package/lib/actions/index.scss +48 -2
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/card/index.d.ts +17 -5
- package/lib/card/index.js +18 -12
- package/lib/form/Components/ProField/index.d.ts +1 -161
- package/lib/form/Components/ProField/index.js +32 -38
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +1 -7
- package/lib/form/ProForm/index.scss +19 -1
- package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
- package/lib/form/ProForm/useFieldRequest.js +37 -0
- package/lib/form/SchemaForm/adapterDecorator.js +4 -2
- package/lib/form/SchemaForm/index.d.ts +2 -2
- package/lib/form/SchemaForm/index.js +11 -22
- package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +1 -1
- package/lib/form/SchemaForm/initializeRules.js +41 -13
- package/lib/form/SchemaForm/reactions.d.ts +5 -5
- package/lib/form/SchemaForm/reactions.js +22 -20
- package/lib/form/fieldTypeMap.d.ts +4 -0
- package/lib/form/fieldTypeMap.js +48 -0
- package/lib/form/index.d.ts +92 -4
- package/lib/form/index.js +17 -31
- package/lib/form/schemaNameMap.js +3 -0
- package/lib/form/typing.d.ts +49 -26
- package/lib/form/utils.d.ts +3 -1
- package/lib/form/utils.js +43 -1
- package/lib/form/warning.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoGroup/index.js +76 -14
- package/lib/info/components/InfoGroup/index.scss +45 -3
- package/lib/info/components/InfoValueItem/index.js +8 -3
- package/lib/info/components/InfoValueItem/index.scss +5 -1
- package/lib/info/components/ProInfoItem/index.js +2 -2
- package/lib/info/components/ProInfoItem/index.scss +1 -0
- package/lib/info/components/baseInfo/index.d.ts +2 -3
- package/lib/info/components/baseInfo/index.js +29 -10
- package/lib/info/components/headerInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.js +1 -1
- package/lib/info/index.js +73 -49
- package/lib/info/typing.d.ts +54 -36
- package/lib/info/utils/index.d.ts +2 -2
- package/lib/info/utils/utils.d.ts +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/page-header/index.d.ts +34 -21
- package/lib/page-header/index.js +37 -28
- package/lib/page-header/index.scss +2 -1
- package/lib/table/components/EmptyContent/index.d.ts +2 -0
- package/lib/table/components/EmptyContent/index.js +25 -0
- package/lib/table/components/Filter/index.d.ts +2 -2
- package/lib/table/components/Filter/index.js +23 -10
- package/lib/table/components/Filter/index.scss +1 -1
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/QuickAction/index.d.ts +2 -2
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/components/ToolBar/Fullscreen.js +1 -0
- package/lib/table/index.js +77 -14
- package/lib/table/index.scss +4 -0
- package/lib/table/typing.d.ts +29 -14
- package/lib/table/utils/columnRender.d.ts +3 -3
- package/lib/table/utils/columnRender.js +1 -1
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +2 -2
- package/lib/table/utils/index.js +33 -11
- package/lib/templates/List/index.d.ts +2 -2
- package/lib/utils/message.d.ts +3 -0
- package/lib/utils/message.js +32 -0
- package/package.json +4 -4
- package/es/form/Components/Search/index.d.ts +0 -11
- package/es/form/Components/Search/index.js +0 -89
- package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
- package/es/form/SchemaForm/initializeProField.d.ts +0 -5
- package/es/form/SchemaForm/initializeProField.js +0 -70
- package/es/info/utils/useInfoRequest.d.ts +0 -14
- package/es/info/utils/useInfoRequest.js +0 -76
- package/lib/form/Components/Search/index.d.ts +0 -11
- package/lib/form/Components/Search/index.js +0 -103
- package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
- package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
- package/lib/form/SchemaForm/initializeProField.js +0 -77
- package/lib/info/utils/useInfoRequest.d.ts +0 -14
- package/lib/info/utils/useInfoRequest.js +0 -85
|
@@ -15,37 +15,99 @@ var _hooks = require("@teamix/hooks");
|
|
|
15
15
|
|
|
16
16
|
require("./index.scss");
|
|
17
17
|
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
20
|
+
var _ = _interopRequireDefault(require("../.."));
|
|
21
|
+
|
|
22
|
+
var _excluded = ["children", "url", "method", "params", "formatResult", "onSuccess", "onError", "formatParams", "beforeRequest", "extendParams", "className", "compacted", "divider", "style", "backgroundColor"];
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
18
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
27
|
|
|
20
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
29
|
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
22
40
|
var ProInfoGroup = function ProInfoGroup(props) {
|
|
23
41
|
var children = props.children,
|
|
24
42
|
url = props.url,
|
|
25
43
|
method = props.method,
|
|
26
44
|
params = props.params,
|
|
27
|
-
formatResult = props.formatResult
|
|
45
|
+
formatResult = props.formatResult,
|
|
46
|
+
onSuccess = props.onSuccess,
|
|
47
|
+
onError = props.onError,
|
|
48
|
+
formatParams = props.formatParams,
|
|
49
|
+
beforeRequest = props.beforeRequest,
|
|
50
|
+
extendParams = props.extendParams,
|
|
51
|
+
_props$className = props.className,
|
|
52
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
53
|
+
_props$compacted = props.compacted,
|
|
54
|
+
compacted = _props$compacted === void 0 ? true : _props$compacted,
|
|
55
|
+
_props$divider = props.divider,
|
|
56
|
+
divider = _props$divider === void 0 ? true : _props$divider,
|
|
57
|
+
style = props.style,
|
|
58
|
+
_props$backgroundColo = props.backgroundColor,
|
|
59
|
+
backgroundColor = _props$backgroundColo === void 0 ? '' : _props$backgroundColo,
|
|
60
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
61
|
+
|
|
28
62
|
var ref = (0, _react.useRef)();
|
|
29
63
|
var size = (0, _hooks.useSize)(ref);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
formatResult: formatResult
|
|
64
|
+
var infoType = 'infoDom';
|
|
65
|
+
|
|
66
|
+
if (Array.isArray(children)) {
|
|
67
|
+
if ( /*#__PURE__*/(0, _react.isValidElement)(children === null || children === void 0 ? void 0 : children[0])) {
|
|
68
|
+
infoType = 'infoDomGroup';
|
|
69
|
+
} else {
|
|
70
|
+
infoType = 'infoPropsGroup';
|
|
38
71
|
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var providerValue = {
|
|
75
|
+
visible: true,
|
|
76
|
+
size: size,
|
|
77
|
+
url: url,
|
|
78
|
+
method: method,
|
|
79
|
+
params: params,
|
|
80
|
+
formatResult: formatResult,
|
|
81
|
+
onSuccess: onSuccess,
|
|
82
|
+
onError: onError,
|
|
83
|
+
formatParams: formatParams,
|
|
84
|
+
beforeRequest: beforeRequest,
|
|
85
|
+
extendParams: extendParams
|
|
86
|
+
};
|
|
87
|
+
var proInfoClassName = (0, _classnames.default)({
|
|
88
|
+
'teamix-pro-info-group-item': true,
|
|
89
|
+
'teamix-pro-info-group-item-divider': divider
|
|
90
|
+
});
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(_utils.ProInfoGroupContext.Provider, {
|
|
92
|
+
value: providerValue
|
|
39
93
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
-
className: "teamix-pro-info-group",
|
|
94
|
+
className: "teamix-pro-info-group ".concat(backgroundColor, " ").concat(className),
|
|
95
|
+
style: style,
|
|
41
96
|
ref: ref
|
|
42
|
-
},
|
|
97
|
+
}, infoType === 'infoDomGroup' && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
|
|
43
98
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
-
className:
|
|
99
|
+
className: proInfoClassName,
|
|
45
100
|
key: index
|
|
46
101
|
}, item);
|
|
47
|
-
})),
|
|
48
|
-
|
|
102
|
+
})), infoType === 'infoPropsGroup' && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
className: proInfoClassName,
|
|
105
|
+
key: index
|
|
106
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, _objectSpread({
|
|
107
|
+
compacted: compacted
|
|
108
|
+
}, item)));
|
|
109
|
+
})), infoType === 'infoDom' && /*#__PURE__*/_react.default.createElement("div", {
|
|
110
|
+
className: proInfoClassName
|
|
49
111
|
}, children)));
|
|
50
112
|
};
|
|
51
113
|
|
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
.teamix-pro-info-group {
|
|
2
2
|
&-item {
|
|
3
|
+
|
|
3
4
|
margin-top: 16px;
|
|
4
|
-
|
|
5
|
-
margin-bottom: 16px;
|
|
5
|
+
margin-bottom: 0;
|
|
6
6
|
|
|
7
7
|
.teamix-pro-info {
|
|
8
|
-
padding-bottom:
|
|
8
|
+
padding-bottom: 0;
|
|
9
|
+
|
|
10
|
+
.teamix-pro-card-content {
|
|
11
|
+
padding-bottom: calc(var(--card-body-padding-bottom, 16px) - 8px)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.compacted {
|
|
15
|
+
margin-bottom: -8px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-divider {
|
|
20
|
+
border-bottom: 1px solid var(--color-line1-1, #eaeaea);
|
|
21
|
+
margin-bottom: 16px;
|
|
22
|
+
.teamix-pro-info {
|
|
23
|
+
padding-bottom: 16px;
|
|
24
|
+
}
|
|
9
25
|
}
|
|
10
26
|
|
|
11
27
|
}
|
|
28
|
+
|
|
29
|
+
|
|
12
30
|
.teamix-pro-info-group-item:last-child {
|
|
13
31
|
border-bottom: 0;
|
|
14
32
|
margin-bottom: 0;
|
|
@@ -19,4 +37,28 @@
|
|
|
19
37
|
.teamix-pro-info-group-item:first-child {
|
|
20
38
|
margin-top: 0;
|
|
21
39
|
}
|
|
40
|
+
|
|
41
|
+
&.blue {
|
|
42
|
+
background-color: var(--color-notice-1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.orange {
|
|
46
|
+
background-color: var(--color-warning-1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.yellow {
|
|
50
|
+
background-color: var(--color-help-1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.red {
|
|
54
|
+
background-color: var(--color-error-1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.green {
|
|
58
|
+
background-color: var(--color-success-1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.grey {
|
|
62
|
+
background-color: var(--color-fill1-2);
|
|
63
|
+
}
|
|
22
64
|
}
|
|
@@ -94,7 +94,9 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
|
94
94
|
var _processRenderFunctio;
|
|
95
95
|
|
|
96
96
|
if (typeof render === 'function') {
|
|
97
|
-
return
|
|
97
|
+
return function () {
|
|
98
|
+
render(value, record);
|
|
99
|
+
};
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
var newRender = processBuriedPoint((_processRenderFunctio = processRenderFunction(render !== null && render !== void 0 ? render : {}, value, record)) !== null && _processRenderFunctio !== void 0 ? _processRenderFunctio : {}, value, record);
|
|
@@ -150,11 +152,14 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
|
150
152
|
|
|
151
153
|
var renderAction = function renderAction() {
|
|
152
154
|
if (actions) {
|
|
153
|
-
return /*#__PURE__*/_react.default.createElement(_actions.
|
|
155
|
+
return /*#__PURE__*/_react.default.createElement(_actions.ProActionGroup, {
|
|
154
156
|
actions: actions,
|
|
155
157
|
type: "text",
|
|
156
158
|
style: {
|
|
157
159
|
marginLeft: '8px'
|
|
160
|
+
},
|
|
161
|
+
context: {
|
|
162
|
+
record: record
|
|
158
163
|
}
|
|
159
164
|
});
|
|
160
165
|
}
|
|
@@ -328,7 +333,7 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
|
328
333
|
}
|
|
329
334
|
|
|
330
335
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
331
|
-
className: cls()
|
|
336
|
+
className: cls('item-value')
|
|
332
337
|
}, /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread({
|
|
333
338
|
type: type,
|
|
334
339
|
value: value,
|
|
@@ -49,7 +49,7 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
|
49
49
|
className: cls('value')
|
|
50
50
|
}, loading && /*#__PURE__*/_react.default.createElement("div", {
|
|
51
51
|
className: cls('base-skeleton-box')
|
|
52
|
-
}, /*#__PURE__*/_react.default.createElement(_.
|
|
52
|
+
}, /*#__PURE__*/_react.default.createElement(_.ProSkeletonRaw.Info.Item, null)), !loading && /*#__PURE__*/_react.default.createElement("div", null, value))));
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (headerInfoLayout) {
|
|
@@ -70,7 +70,7 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
|
70
70
|
}
|
|
71
71
|
}, loading && /*#__PURE__*/_react.default.createElement("div", {
|
|
72
72
|
className: cls('base-skeleton-box')
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement(_.
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_.ProSkeletonRaw.Info.Item, null)), !loading && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value))));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ProInfoBaseProps, ProInfoTransparentBase } from '../../typing';
|
|
2
|
+
import { ProInfoBaseProps, ProInfoTransparentBase, ProInfoTransRequestResult } from '../../typing';
|
|
3
3
|
import './index.scss';
|
|
4
|
-
|
|
5
|
-
declare type ProBaseInfoProps = ProInfoBaseProps & IUseInfoRequestResult & ProInfoTransparentBase & {
|
|
4
|
+
declare type ProBaseInfoProps = ProInfoBaseProps & ProInfoTransRequestResult & ProInfoTransparentBase & {
|
|
6
5
|
size?: any;
|
|
7
6
|
};
|
|
8
7
|
declare const ProBaseInfo: React.FC<ProBaseInfoProps>;
|
|
@@ -37,29 +37,48 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
|
37
37
|
layout = props.layout,
|
|
38
38
|
size = props.size;
|
|
39
39
|
|
|
40
|
-
var defaultLayout = _layout.default[(0, _utils.getLayout)((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; //
|
|
40
|
+
var defaultLayout = _layout.default[(0, _utils.getLayout)((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列内的布局参数
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var getFormItemLayout = function getFormItemLayout() {
|
|
43
|
+
var getFormItemLayout = function getFormItemLayout(colspan) {
|
|
44
|
+
var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
|
|
45
|
+
|
|
44
46
|
if (layout) {
|
|
45
47
|
var _layout$labelCol, _layout$wrapperCol;
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
var labelCol = (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
|
|
50
|
+
var wrapperCol = (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
|
|
51
|
+
formItemLayout.labelCol = labelCol;
|
|
52
|
+
formItemLayout.wrapperCol = wrapperCol;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var newLabelSpan = formItemLayout.labelCol.span;
|
|
56
|
+
var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
|
|
57
|
+
|
|
58
|
+
if (colspan) {
|
|
59
|
+
newLabelSpan = newLabelSpan / colspan;
|
|
60
|
+
newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
|
|
51
61
|
}
|
|
52
62
|
|
|
53
|
-
|
|
63
|
+
var newFormItemLayout = {
|
|
64
|
+
labelCol: {
|
|
65
|
+
span: newLabelSpan
|
|
66
|
+
},
|
|
67
|
+
wrapperCol: {
|
|
68
|
+
span: newWrapperSpan
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return Object.assign(formItemLayout, newFormItemLayout);
|
|
54
72
|
};
|
|
55
73
|
|
|
56
74
|
var renderContent = function renderContent() {
|
|
57
75
|
return columns.map(function (item, index) {
|
|
58
|
-
var _layout$span, _item$title, _item$valueType, _ref;
|
|
76
|
+
var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
|
|
59
77
|
|
|
60
78
|
var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
|
|
79
|
+
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;
|
|
61
80
|
return /*#__PURE__*/_react.default.createElement(Col, {
|
|
62
|
-
span:
|
|
81
|
+
span: layoutSpan,
|
|
63
82
|
key: index
|
|
64
83
|
}, /*#__PURE__*/_react.default.createElement(_ProInfoItem.default, {
|
|
65
84
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
|
@@ -73,7 +92,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
|
73
92
|
record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
|
|
74
93
|
actionRef: actionRef
|
|
75
94
|
}),
|
|
76
|
-
baseInfoLayout: getFormItemLayout(),
|
|
95
|
+
baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
|
|
77
96
|
tooltip: item.tooltip,
|
|
78
97
|
tooltipIcon: item.tooltipIcon
|
|
79
98
|
}));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IProHeaderInfo, ProInfoTransparentBase } from '../../typing';
|
|
3
|
-
import { IUseInfoRequestResult } from '../../utils/useInfoRequest';
|
|
2
|
+
import { IProHeaderInfo, ProInfoTransparentBase, ProInfoTransRequestResult } from '../../typing';
|
|
4
3
|
import './index.scss';
|
|
5
|
-
declare type ProHeaderInfoProps = IProHeaderInfo &
|
|
4
|
+
declare type ProHeaderInfoProps = IProHeaderInfo & ProInfoTransRequestResult & ProInfoTransparentBase & {
|
|
6
5
|
size?: any;
|
|
7
6
|
};
|
|
8
7
|
declare const ProHeaderInfo: React.FC<ProHeaderInfoProps>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.scss';
|
|
3
|
-
import { IProTableInfo, ProInfoTransparentBase } from '../../typing';
|
|
3
|
+
import { IProTableInfo, ProInfoTransparentBase, ProInfoTransRequestResult } from '../../typing';
|
|
4
4
|
import './index.scss';
|
|
5
|
-
|
|
6
|
-
declare type ProTableInfoProps = IProTableInfo & IUseInfoRequestResult & ProInfoTransparentBase;
|
|
5
|
+
declare type ProTableInfoProps = IProTableInfo & ProInfoTransRequestResult & ProInfoTransparentBase;
|
|
7
6
|
declare const ProTableInfo: React.FC<ProTableInfoProps>;
|
|
8
7
|
export default ProTableInfo;
|
|
@@ -128,7 +128,7 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
|
128
128
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
|
129
129
|
tooltip: item.tooltip,
|
|
130
130
|
icon: item.tooltipIcon
|
|
131
|
-
})), _defineProperty(_data, "value_".concat(index), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, loading && /*#__PURE__*/_react.default.createElement(_2.
|
|
131
|
+
})), _defineProperty(_data, "value_".concat(index), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, loading && /*#__PURE__*/_react.default.createElement(_2.ProSkeletonRaw.Info.Item, null), !loading && getInfoValueItem(item))), _data);
|
|
132
132
|
|
|
133
133
|
if (item.colSpan) {
|
|
134
134
|
data['formatter'] = {
|
package/lib/info/index.js
CHANGED
|
@@ -41,7 +41,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError", "className", "style", "columns", "layout", "dataSource"];
|
|
44
|
+
var _excluded = ["type", "url", "method", "formatResult", "formatParams", "params", "actionRef", "header", "onSuccess", "onError", "beforeRequest", "extendParams", "className", "style", "columns", "layout", "dataSource", "loading", "extra"];
|
|
45
45
|
|
|
46
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
47
|
|
|
@@ -72,22 +72,30 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
72
72
|
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; }
|
|
73
73
|
|
|
74
74
|
var ProInfo = function ProInfo(props) {
|
|
75
|
+
var _ref;
|
|
76
|
+
|
|
75
77
|
var _props$type = props.type,
|
|
76
78
|
type = _props$type === void 0 ? 'base' : _props$type,
|
|
77
79
|
url = props.url,
|
|
78
80
|
_props$method = props.method,
|
|
79
81
|
method = _props$method === void 0 ? 'post' : _props$method,
|
|
80
82
|
formatResult = props.formatResult,
|
|
83
|
+
formatParams = props.formatParams,
|
|
81
84
|
params = props.params,
|
|
82
85
|
propsActionRef = props.actionRef,
|
|
83
86
|
_props$header = props.header,
|
|
84
87
|
header = _props$header === void 0 ? {} : _props$header,
|
|
85
|
-
|
|
88
|
+
onSuccess = props.onSuccess,
|
|
89
|
+
onError = props.onError,
|
|
90
|
+
beforeRequest = props.beforeRequest,
|
|
91
|
+
extendParams = props.extendParams,
|
|
86
92
|
className = props.className,
|
|
87
93
|
style = props.style,
|
|
88
94
|
columns = props.columns,
|
|
89
95
|
layout = props.layout,
|
|
90
96
|
dataSource = props.dataSource,
|
|
97
|
+
userLoading = props.loading,
|
|
98
|
+
extra = props.extra,
|
|
91
99
|
others = _objectWithoutProperties(props, _excluded);
|
|
92
100
|
|
|
93
101
|
var _useContext = (0, _react.useContext)(_utils.ProInfoGroupContext),
|
|
@@ -96,62 +104,59 @@ var ProInfo = function ProInfo(props) {
|
|
|
96
104
|
contextParams = _useContext.params,
|
|
97
105
|
contextFormatResult = _useContext.formatResult,
|
|
98
106
|
contextVisible = _useContext.visible,
|
|
99
|
-
contextSize = _useContext.size
|
|
107
|
+
contextSize = _useContext.size,
|
|
108
|
+
contextOnSuccess = _useContext.onSuccess,
|
|
109
|
+
contextOnError = _useContext.onError,
|
|
110
|
+
contextFormatParams = _useContext.formatParams,
|
|
111
|
+
contextBeforeRequest = _useContext.beforeRequest,
|
|
112
|
+
contextExtendParams = _useContext.extendParams; // 获取容器宽度
|
|
100
113
|
|
|
101
114
|
|
|
102
115
|
var ref = (0, _react.useRef)();
|
|
103
|
-
var size = contextVisible ? contextSize : (0, _hooks.useSize)(ref);
|
|
116
|
+
var size = contextVisible ? contextSize : (0, _hooks.useSize)(ref);
|
|
104
117
|
|
|
105
118
|
var _useState = (0, _react.useState)(false),
|
|
106
119
|
_useState2 = _slicedToArray(_useState, 2),
|
|
107
120
|
loading = _useState2[0],
|
|
108
|
-
setLoading = _useState2[1]; //
|
|
121
|
+
setLoading = _useState2[1]; // 请求数据
|
|
109
122
|
|
|
110
123
|
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
} else if (formatResult) {
|
|
116
|
-
return (0, _utils2.getDeepValue)(formatResult.data, result);
|
|
117
|
-
} else {
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return result;
|
|
123
|
-
};
|
|
124
|
+
var _useState3 = (0, _react.useState)(),
|
|
125
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
126
|
+
data = _useState4[0],
|
|
127
|
+
setData = _useState4[1];
|
|
124
128
|
|
|
125
129
|
var requestDataKey = (contextMethod !== null && contextMethod !== void 0 ? contextMethod : method).toLowerCase() === 'get' ? 'params' : 'data';
|
|
130
|
+
|
|
131
|
+
var requestConfig = _defineProperty({
|
|
132
|
+
url: (_ref = contextUrl !== null && contextUrl !== void 0 ? contextUrl : url) !== null && _ref !== void 0 ? _ref : '',
|
|
133
|
+
method: contextMethod !== null && contextMethod !== void 0 ? contextMethod : method,
|
|
134
|
+
formatResult: contextFormatResult !== null && contextFormatResult !== void 0 ? contextFormatResult : formatResult,
|
|
135
|
+
onSuccess: contextOnSuccess !== null && contextOnSuccess !== void 0 ? contextOnSuccess : onSuccess,
|
|
136
|
+
onError: contextOnError !== null && contextOnError !== void 0 ? contextOnError : onError,
|
|
137
|
+
formatParams: contextFormatParams !== null && contextFormatParams !== void 0 ? contextFormatParams : formatParams,
|
|
138
|
+
beforeRequest: contextBeforeRequest !== null && contextBeforeRequest !== void 0 ? contextBeforeRequest : beforeRequest,
|
|
139
|
+
extendParams: contextExtendParams !== null && contextExtendParams !== void 0 ? contextExtendParams : extendParams
|
|
140
|
+
}, requestDataKey, contextParams !== null && contextParams !== void 0 ? contextParams : params);
|
|
141
|
+
|
|
126
142
|
(0, _react.useEffect)(function () {
|
|
127
143
|
if (url || contextUrl) {
|
|
128
144
|
setLoading(false);
|
|
129
|
-
|
|
145
|
+
request();
|
|
130
146
|
} else {
|
|
131
147
|
setLoading(false);
|
|
132
148
|
}
|
|
133
|
-
}, []);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}, requestDataKey, contextParams !== null && contextParams !== void 0 ? contextParams : params);
|
|
141
|
-
}, {
|
|
142
|
-
// 使用 request 方法代替 fetch
|
|
143
|
-
requestMethod: function requestMethod(params) {
|
|
144
|
-
return (0, _utils2.request)(params);
|
|
145
|
-
},
|
|
146
|
-
manual: true,
|
|
147
|
-
onSuccess: function onSuccess(result) {
|
|
148
|
-
props.onSuccess && props.onSuccess(result);
|
|
149
|
-
},
|
|
150
|
-
onError: function onError(error) {
|
|
149
|
+
}, []); // 获取数据
|
|
150
|
+
|
|
151
|
+
var request = function request() {
|
|
152
|
+
setLoading(true);
|
|
153
|
+
(0, _utils2.doCommonRequest)(requestConfig).then(function (resp) {
|
|
154
|
+
setData(resp);
|
|
155
|
+
}).finally(function () {
|
|
151
156
|
setLoading(false);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
|
|
155
160
|
var actionRef = (0, _react.useRef)(); // 将 Actions 绑定到传入的 propsActionRef 中
|
|
156
161
|
|
|
157
162
|
if (propsActionRef) {
|
|
@@ -161,39 +166,58 @@ var ProInfo = function ProInfo(props) {
|
|
|
161
166
|
|
|
162
167
|
(0, _utils.useActionType)(actionRef, {
|
|
163
168
|
refresh: function refresh() {
|
|
164
|
-
|
|
169
|
+
request();
|
|
165
170
|
}
|
|
166
171
|
});
|
|
172
|
+
|
|
173
|
+
var getExtra = function getExtra() {
|
|
174
|
+
if (!extra) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if ( /*#__PURE__*/(0, _react.isValidElement)(extra)) {
|
|
179
|
+
return extra;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return _objectSpread(_objectSpread({}, extra), {}, {
|
|
183
|
+
context: {
|
|
184
|
+
record: dataSource !== null && dataSource !== void 0 ? dataSource : data
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
|
|
167
189
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
168
190
|
ref: ref,
|
|
169
191
|
className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
|
|
170
192
|
style: style
|
|
171
|
-
}, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread({
|
|
193
|
+
}, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread(_objectSpread({
|
|
172
194
|
compacted: true,
|
|
173
195
|
hoveredShadow: false,
|
|
174
196
|
bordered: false,
|
|
175
197
|
backgroundColor: "transparent"
|
|
176
|
-
}, header), others),
|
|
198
|
+
}, header), others), {}, {
|
|
199
|
+
extra: getExtra()
|
|
200
|
+
}), type === 'table' && /*#__PURE__*/_react.default.createElement(_tableInfo.default, {
|
|
177
201
|
dataSource: dataSource,
|
|
178
202
|
columns: columns,
|
|
179
|
-
loading:
|
|
180
|
-
result:
|
|
203
|
+
loading: userLoading || loading,
|
|
204
|
+
result: data,
|
|
181
205
|
actionRef: actionRef,
|
|
182
206
|
layout: layout
|
|
183
207
|
}), type === 'header' && /*#__PURE__*/_react.default.createElement(_headerInfo.default, {
|
|
184
208
|
dataSource: dataSource,
|
|
185
209
|
columns: columns,
|
|
186
210
|
header: header,
|
|
187
|
-
loading:
|
|
188
|
-
result:
|
|
211
|
+
loading: userLoading || loading,
|
|
212
|
+
result: data,
|
|
189
213
|
actionRef: actionRef,
|
|
190
214
|
layout: layout,
|
|
191
215
|
size: size
|
|
192
216
|
}), type === 'base' && /*#__PURE__*/_react.default.createElement(_baseInfo.default, {
|
|
193
217
|
dataSource: dataSource,
|
|
194
218
|
columns: columns,
|
|
195
|
-
loading:
|
|
196
|
-
result:
|
|
219
|
+
loading: userLoading || loading,
|
|
220
|
+
result: data,
|
|
197
221
|
actionRef: actionRef,
|
|
198
222
|
layout: layout,
|
|
199
223
|
size: size
|