@zat-design/sisyphus-react 3.13.22 → 3.13.23-beta.2
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/es/ProForm/components/combination/FormList/components/Empty.js +9 -1
- package/es/ProForm/components/combination/FormList/index.js +3 -2
- package/lib/ProForm/components/combination/FormList/components/Empty.js +9 -1
- package/lib/ProForm/components/combination/FormList/index.js +3 -2
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import "antd/es/button/style";
|
|
|
2
2
|
import _Button from "antd/es/button";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
|
+
import { isFunction } from 'lodash';
|
|
5
6
|
import EmptyImg from "../../../../../assets/empty.png";
|
|
6
7
|
import locale from "../../../../../locale";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -65,6 +66,13 @@ var Empty = _ref => {
|
|
|
65
66
|
var getBtnText = () => {
|
|
66
67
|
return emptyBtnText || (addConfig === null || addConfig === void 0 ? void 0 : addConfig.label) || locale.ProForm.formListActions[6];
|
|
67
68
|
};
|
|
69
|
+
var show = true;
|
|
70
|
+
if ((addConfig === null || addConfig === void 0 ? void 0 : addConfig.show) !== undefined) {
|
|
71
|
+
show = isFunction(addConfig.show) ? addConfig.show(form.getFieldValue(namePath), {
|
|
72
|
+
namePath,
|
|
73
|
+
form
|
|
74
|
+
}) : !!addConfig.show;
|
|
75
|
+
}
|
|
68
76
|
return /*#__PURE__*/_jsxs("div", {
|
|
69
77
|
className: "pro-form-list-empty",
|
|
70
78
|
children: [/*#__PURE__*/_jsx("img", {
|
|
@@ -73,7 +81,7 @@ var Empty = _ref => {
|
|
|
73
81
|
alt: "Empty"
|
|
74
82
|
}), /*#__PURE__*/_jsx("div", {
|
|
75
83
|
className: "pro-form-list-empty-content",
|
|
76
|
-
children: disabled ? locale.ProForm.noData : /*#__PURE__*/_jsxs(_Fragment, {
|
|
84
|
+
children: disabled || !show ? locale.ProForm.noData : /*#__PURE__*/_jsxs(_Fragment, {
|
|
77
85
|
children: [locale.ProForm.noData, !disabled && /*#__PURE__*/_jsxs(_Fragment, {
|
|
78
86
|
children: ["\uFF0C", /*#__PURE__*/_jsx(_Button, {
|
|
79
87
|
type: "link",
|
|
@@ -39,11 +39,12 @@ var FormList = (props, ref) => {
|
|
|
39
39
|
form = _ref.form,
|
|
40
40
|
name = _ref.name,
|
|
41
41
|
isView = _ref.isView,
|
|
42
|
-
diffConfig = _ref.diffConfig
|
|
42
|
+
diffConfig = _ref.diffConfig,
|
|
43
|
+
namePath = _ref.namePath;
|
|
43
44
|
var _useProConfig = useProConfig('ProForm'),
|
|
44
45
|
isDiffAll = _useProConfig.isDiffAll;
|
|
45
46
|
var errors = meta.errors;
|
|
46
|
-
var _namePath = toArray(name);
|
|
47
|
+
var _namePath = namePath ? [...namePath.slice(0, -1), ...toArray(name)] : toArray(name);
|
|
47
48
|
var orgValues = get(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
|
48
49
|
var _diffConfig = _objectSpread(_objectSpread({}, diffConfig), {}, {
|
|
49
50
|
originalValues: diffConfig !== null && diffConfig !== void 0 && diffConfig.originalValues && isDiffAll ? orgValues || [] : orgValues
|
|
@@ -9,6 +9,7 @@ require("antd/es/button/style");
|
|
|
9
9
|
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
10
10
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _lodash = require("lodash");
|
|
12
13
|
var _empty = _interopRequireDefault(require("../../../../../assets/empty.png"));
|
|
13
14
|
var _locale = _interopRequireDefault(require("../../../../../locale"));
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -70,6 +71,13 @@ var Empty = _ref => {
|
|
|
70
71
|
var getBtnText = () => {
|
|
71
72
|
return emptyBtnText || (addConfig === null || addConfig === void 0 ? void 0 : addConfig.label) || _locale.default.ProForm.formListActions[6];
|
|
72
73
|
};
|
|
74
|
+
var show = true;
|
|
75
|
+
if ((addConfig === null || addConfig === void 0 ? void 0 : addConfig.show) !== undefined) {
|
|
76
|
+
show = (0, _lodash.isFunction)(addConfig.show) ? addConfig.show(form.getFieldValue(namePath), {
|
|
77
|
+
namePath,
|
|
78
|
+
form
|
|
79
|
+
}) : !!addConfig.show;
|
|
80
|
+
}
|
|
73
81
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
74
82
|
className: "pro-form-list-empty",
|
|
75
83
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
@@ -78,7 +86,7 @@ var Empty = _ref => {
|
|
|
78
86
|
alt: "Empty"
|
|
79
87
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
80
88
|
className: "pro-form-list-empty-content",
|
|
81
|
-
children: disabled ? _locale.default.ProForm.noData : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
89
|
+
children: disabled || !show ? _locale.default.ProForm.noData : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
82
90
|
children: [_locale.default.ProForm.noData, !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
83
91
|
children: ["\uFF0C", /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
|
|
84
92
|
type: "link",
|
|
@@ -46,11 +46,12 @@ var FormList = (props, ref) => {
|
|
|
46
46
|
form = _ref.form,
|
|
47
47
|
name = _ref.name,
|
|
48
48
|
isView = _ref.isView,
|
|
49
|
-
diffConfig = _ref.diffConfig
|
|
49
|
+
diffConfig = _ref.diffConfig,
|
|
50
|
+
namePath = _ref.namePath;
|
|
50
51
|
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
|
|
51
52
|
isDiffAll = _useProConfig.isDiffAll;
|
|
52
53
|
var errors = meta.errors;
|
|
53
|
-
var _namePath = (0, _utils.toArray)(name);
|
|
54
|
+
var _namePath = namePath ? [...namePath.slice(0, -1), ...(0, _utils.toArray)(name)] : (0, _utils.toArray)(name);
|
|
54
55
|
var orgValues = (0, _lodash.get)(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
|
55
56
|
var _diffConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, diffConfig), {}, {
|
|
56
57
|
originalValues: diffConfig !== null && diffConfig !== void 0 && diffConfig.originalValues && isDiffAll ? orgValues || [] : orgValues
|