@zat-design/sisyphus-react 3.13.13-beta.2 → 3.13.13-beta.4
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/index.esm.css +0 -38
- package/dist/less.esm.css +0 -38
- package/es/ProForm/components/combination/FormList/index.js +2 -11
- package/es/ProForm/components/combination/FormList/propsType.d.ts +0 -1
- package/es/ProForm/components/combination/FormList/style/index.less +0 -23
- package/es/ProForm/components/combination/ProTimeLimit/index.js +1 -6
- package/es/ProForm/utils/index.js +4 -0
- package/es/locale/en_US.d.ts +0 -1
- package/es/locale/en_US.js +2 -3
- package/es/locale/zh_CN.d.ts +0 -1
- package/es/locale/zh_CN.js +2 -3
- package/lib/ProForm/components/combination/FormList/index.js +2 -11
- package/lib/ProForm/components/combination/FormList/propsType.d.ts +0 -1
- package/lib/ProForm/components/combination/FormList/style/index.less +0 -23
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +1 -6
- package/lib/ProForm/utils/index.js +4 -0
- package/lib/locale/en_US.d.ts +0 -1
- package/lib/locale/en_US.js +2 -3
- package/lib/locale/zh_CN.d.ts +0 -1
- package/lib/locale/zh_CN.js +2 -3
- package/package.json +6 -2
- package/es/ProForm/components/combination/FormList/components/Empty.d.ts +0 -13
- package/es/ProForm/components/combination/FormList/components/Empty.js +0 -90
- package/lib/ProForm/components/combination/FormList/components/Empty.d.ts +0 -13
- package/lib/ProForm/components/combination/FormList/components/Empty.js +0 -97
package/dist/index.esm.css
CHANGED
@@ -2405,44 +2405,6 @@ div.pro-textarea-view::after {
|
|
2405
2405
|
.pro-form-list-action .ant-btn-text:hover {
|
2406
2406
|
background: transparent;
|
2407
2407
|
}
|
2408
|
-
.pro-form-list-empty {
|
2409
|
-
display: -webkit-box;
|
2410
|
-
display: -webkit-flex;
|
2411
|
-
display: -ms-flexbox;
|
2412
|
-
display: flex;
|
2413
|
-
-webkit-box-orient: vertical;
|
2414
|
-
-webkit-box-direction: normal;
|
2415
|
-
-webkit-flex-direction: column;
|
2416
|
-
-ms-flex-direction: column;
|
2417
|
-
flex-direction: column;
|
2418
|
-
-webkit-box-align: center;
|
2419
|
-
-webkit-align-items: center;
|
2420
|
-
-ms-flex-align: center;
|
2421
|
-
align-items: center;
|
2422
|
-
-webkit-box-pack: center;
|
2423
|
-
-webkit-justify-content: center;
|
2424
|
-
-ms-flex-pack: center;
|
2425
|
-
justify-content: center;
|
2426
|
-
}
|
2427
|
-
.pro-form-list-empty .pro-form-list-empty-img {
|
2428
|
-
width: 80px;
|
2429
|
-
height: 80px;
|
2430
|
-
}
|
2431
|
-
.pro-form-list-empty .pro-form-list-empty-content {
|
2432
|
-
display: -webkit-box;
|
2433
|
-
display: -webkit-flex;
|
2434
|
-
display: -ms-flexbox;
|
2435
|
-
display: flex;
|
2436
|
-
-webkit-box-pack: center;
|
2437
|
-
-webkit-justify-content: center;
|
2438
|
-
-ms-flex-pack: center;
|
2439
|
-
justify-content: center;
|
2440
|
-
margin-top: var(--zaui-space-size-md, 16px);
|
2441
|
-
color: var(--zaui-aide-text, #909090);
|
2442
|
-
}
|
2443
|
-
.pro-form-list-empty .pro-form-list-empty-content .ant-btn-link {
|
2444
|
-
padding: 0;
|
2445
|
-
}
|
2446
2408
|
.ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input {
|
2447
2409
|
border-color: var(--ant-error-color);
|
2448
2410
|
}
|
package/dist/less.esm.css
CHANGED
@@ -2405,44 +2405,6 @@ div.pro-textarea-view::after {
|
|
2405
2405
|
.pro-form-list-action .ant-btn-text:hover {
|
2406
2406
|
background: transparent;
|
2407
2407
|
}
|
2408
|
-
.pro-form-list-empty {
|
2409
|
-
display: -webkit-box;
|
2410
|
-
display: -webkit-flex;
|
2411
|
-
display: -ms-flexbox;
|
2412
|
-
display: flex;
|
2413
|
-
-webkit-box-orient: vertical;
|
2414
|
-
-webkit-box-direction: normal;
|
2415
|
-
-webkit-flex-direction: column;
|
2416
|
-
-ms-flex-direction: column;
|
2417
|
-
flex-direction: column;
|
2418
|
-
-webkit-box-align: center;
|
2419
|
-
-webkit-align-items: center;
|
2420
|
-
-ms-flex-align: center;
|
2421
|
-
align-items: center;
|
2422
|
-
-webkit-box-pack: center;
|
2423
|
-
-webkit-justify-content: center;
|
2424
|
-
-ms-flex-pack: center;
|
2425
|
-
justify-content: center;
|
2426
|
-
}
|
2427
|
-
.pro-form-list-empty .pro-form-list-empty-img {
|
2428
|
-
width: 80px;
|
2429
|
-
height: 80px;
|
2430
|
-
}
|
2431
|
-
.pro-form-list-empty .pro-form-list-empty-content {
|
2432
|
-
display: -webkit-box;
|
2433
|
-
display: -webkit-flex;
|
2434
|
-
display: -ms-flexbox;
|
2435
|
-
display: flex;
|
2436
|
-
-webkit-box-pack: center;
|
2437
|
-
-webkit-justify-content: center;
|
2438
|
-
-ms-flex-pack: center;
|
2439
|
-
justify-content: center;
|
2440
|
-
margin-top: var(--zaui-space-size-md, 16px);
|
2441
|
-
color: var(--zaui-aide-text, #909090);
|
2442
|
-
}
|
2443
|
-
.pro-form-list-empty .pro-form-list-empty-content .ant-btn-link {
|
2444
|
-
padding: 0;
|
2445
|
-
}
|
2446
2408
|
.ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input {
|
2447
2409
|
border-color: var(--ant-error-color);
|
2448
2410
|
}
|
@@ -12,7 +12,6 @@ import { namesPathTransform } from './utils';
|
|
12
12
|
import ToolbarButton from './components/ToolbarButton';
|
13
13
|
import BlockFields from './components/BlockFields';
|
14
14
|
import LineFields from './components/LineFields';
|
15
|
-
import Empty from './components/Empty';
|
16
15
|
import ProForm from '../../../../ProForm';
|
17
16
|
import { useProConfig } from '../../../../ProConfigProvider';
|
18
17
|
var FormList = function FormList(props, ref) {
|
@@ -27,8 +26,7 @@ var FormList = function FormList(props, ref) {
|
|
27
26
|
meta = props.meta,
|
28
27
|
_props$span = props.span,
|
29
28
|
span = _props$span === void 0 ? 8 : _props$span,
|
30
|
-
disabled = props.disabled
|
31
|
-
emptyBtnText = props.emptyBtnText;
|
29
|
+
disabled = props.disabled;
|
32
30
|
var _fields = fields.map(function (item) {
|
33
31
|
return _objectSpread(_objectSpread({}, item), {}, {
|
34
32
|
key: String(item.key)
|
@@ -127,16 +125,9 @@ var FormList = function FormList(props, ref) {
|
|
127
125
|
form: form,
|
128
126
|
diffConfig: _diffConfig
|
129
127
|
}), field.key);
|
130
|
-
}), _fields.length === 0 && _jsx(Empty, {
|
131
|
-
disabled: disabled,
|
132
|
-
toolbarProps: toolbarProps,
|
133
|
-
operation: operation,
|
134
|
-
form: form,
|
135
|
-
namePath: _namePath,
|
136
|
-
emptyBtnText: emptyBtnText
|
137
128
|
}), _jsx(_Form.ErrorList, {
|
138
129
|
errors: errors
|
139
|
-
}), toolbarProps !== false &&
|
130
|
+
}), toolbarProps !== false && _jsx(ToolbarButton, {
|
140
131
|
disabled: disabled,
|
141
132
|
isView: isView,
|
142
133
|
min: min,
|
@@ -70,26 +70,3 @@
|
|
70
70
|
background: transparent;
|
71
71
|
}
|
72
72
|
}
|
73
|
-
|
74
|
-
.pro-form-list-empty {
|
75
|
-
display: flex;
|
76
|
-
flex-direction: column;
|
77
|
-
align-items: center;
|
78
|
-
justify-content: center;
|
79
|
-
|
80
|
-
.pro-form-list-empty-img {
|
81
|
-
width: 80px;
|
82
|
-
height: 80px;
|
83
|
-
}
|
84
|
-
|
85
|
-
.pro-form-list-empty-content {
|
86
|
-
display: flex;
|
87
|
-
justify-content: center;
|
88
|
-
margin-top: var(--zaui-space-size-md, 16px);
|
89
|
-
color: @zaui-aide-text;
|
90
|
-
|
91
|
-
.@{ant-prefix}-btn-link {
|
92
|
-
padding: 0;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
@@ -93,11 +93,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
93
93
|
if (checkedForever) {
|
94
94
|
onChange(moment(foreverString, format));
|
95
95
|
} else {
|
96
|
-
|
97
|
-
onChange(moment());
|
98
|
-
setTimeout(function () {
|
99
|
-
onChange(null);
|
100
|
-
}, 0);
|
96
|
+
onChange(null);
|
101
97
|
}
|
102
98
|
};
|
103
99
|
if (isView) {
|
@@ -133,7 +129,6 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
133
129
|
compact: true,
|
134
130
|
className: "pro-time-limit",
|
135
131
|
children: [_jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({
|
136
|
-
defaultPickerValue: moment(),
|
137
132
|
disabled: disabled || isForever
|
138
133
|
}, initialConfig), _omit(_rest, ['placeholder'])), {}, {
|
139
134
|
format: _format,
|
@@ -285,6 +285,10 @@ export function initialValuesToNames() {
|
|
285
285
|
values[key] = formInitialValue;
|
286
286
|
}
|
287
287
|
}
|
288
|
+
// 给FormList默认增加一行
|
289
|
+
if (item.type === 'FormList' && !item.initialValue && !_get(values, item.name)) {
|
290
|
+
item.initialValue = [{}];
|
291
|
+
}
|
288
292
|
});
|
289
293
|
return values;
|
290
294
|
}
|
package/es/locale/en_US.d.ts
CHANGED
package/es/locale/en_US.js
CHANGED
@@ -34,9 +34,8 @@ export default {
|
|
34
34
|
ruleText: 'correct',
|
35
35
|
completeText: 'enter in full',
|
36
36
|
halfRuleText: 'Enter the value of ({total})',
|
37
|
-
formListActions: ['Add', 'Delete', 'Copy', 'Move up', 'Move down', 'Add a new line'
|
38
|
-
formListConfirmMessage: 'Are you sure delete it?'
|
39
|
-
noData: 'No data'
|
37
|
+
formListActions: ['Add', 'Delete', 'Copy', 'Move up', 'Move down', 'Add a new line'],
|
38
|
+
formListConfirmMessage: 'Are you sure delete it?'
|
40
39
|
},
|
41
40
|
ProAction: {
|
42
41
|
errorMessage: 'The configuration config for ProAction must be data',
|
package/es/locale/zh_CN.d.ts
CHANGED
package/es/locale/zh_CN.js
CHANGED
@@ -34,9 +34,8 @@ export default {
|
|
34
34
|
ruleText: '正确的',
|
35
35
|
completeText: '请完整输入',
|
36
36
|
halfRuleText: '请输入第({total})个表单的值',
|
37
|
-
formListActions: ['新增', '删除', '复制', '上移', '下移', '新增一行'
|
38
|
-
formListConfirmMessage: '确认删除吗?'
|
39
|
-
noData: '暂无数据'
|
37
|
+
formListActions: ['新增', '删除', '复制', '上移', '下移', '新增一行'],
|
38
|
+
formListConfirmMessage: '确认删除吗?'
|
40
39
|
},
|
41
40
|
ProAction: {
|
42
41
|
errorMessage: 'ProAction 配置 config 必须为数据',
|
@@ -19,7 +19,6 @@ var _utils2 = require("./utils");
|
|
19
19
|
var _ToolbarButton = _interopRequireDefault(require("./components/ToolbarButton"));
|
20
20
|
var _BlockFields = _interopRequireDefault(require("./components/BlockFields"));
|
21
21
|
var _LineFields = _interopRequireDefault(require("./components/LineFields"));
|
22
|
-
var _Empty = _interopRequireDefault(require("./components/Empty"));
|
23
22
|
var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
|
24
23
|
var _ProConfigProvider = require("../../../../ProConfigProvider");
|
25
24
|
var FormList = function FormList(props, ref) {
|
@@ -34,8 +33,7 @@ var FormList = function FormList(props, ref) {
|
|
34
33
|
meta = props.meta,
|
35
34
|
_props$span = props.span,
|
36
35
|
span = _props$span === void 0 ? 8 : _props$span,
|
37
|
-
disabled = props.disabled
|
38
|
-
emptyBtnText = props.emptyBtnText;
|
36
|
+
disabled = props.disabled;
|
39
37
|
var _fields = fields.map(function (item) {
|
40
38
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
41
39
|
key: String(item.key)
|
@@ -134,16 +132,9 @@ var FormList = function FormList(props, ref) {
|
|
134
132
|
form: form,
|
135
133
|
diffConfig: _diffConfig
|
136
134
|
}), field.key);
|
137
|
-
}), _fields.length === 0 && (0, _jsxRuntime.jsx)(_Empty.default, {
|
138
|
-
disabled: disabled,
|
139
|
-
toolbarProps: toolbarProps,
|
140
|
-
operation: operation,
|
141
|
-
form: form,
|
142
|
-
namePath: _namePath,
|
143
|
-
emptyBtnText: emptyBtnText
|
144
135
|
}), (0, _jsxRuntime.jsx)(_form.default.ErrorList, {
|
145
136
|
errors: errors
|
146
|
-
}), toolbarProps !== false &&
|
137
|
+
}), toolbarProps !== false && (0, _jsxRuntime.jsx)(_ToolbarButton.default, {
|
147
138
|
disabled: disabled,
|
148
139
|
isView: isView,
|
149
140
|
min: min,
|
@@ -70,26 +70,3 @@
|
|
70
70
|
background: transparent;
|
71
71
|
}
|
72
72
|
}
|
73
|
-
|
74
|
-
.pro-form-list-empty {
|
75
|
-
display: flex;
|
76
|
-
flex-direction: column;
|
77
|
-
align-items: center;
|
78
|
-
justify-content: center;
|
79
|
-
|
80
|
-
.pro-form-list-empty-img {
|
81
|
-
width: 80px;
|
82
|
-
height: 80px;
|
83
|
-
}
|
84
|
-
|
85
|
-
.pro-form-list-empty-content {
|
86
|
-
display: flex;
|
87
|
-
justify-content: center;
|
88
|
-
margin-top: var(--zaui-space-size-md, 16px);
|
89
|
-
color: @zaui-aide-text;
|
90
|
-
|
91
|
-
.@{ant-prefix}-btn-link {
|
92
|
-
padding: 0;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
@@ -100,11 +100,7 @@ var ProTimeLimit = exports.ProTimeLimit = function ProTimeLimit(props) {
|
|
100
100
|
if (checkedForever) {
|
101
101
|
onChange((0, _moment.default)(foreverString, format));
|
102
102
|
} else {
|
103
|
-
|
104
|
-
onChange((0, _moment.default)());
|
105
|
-
setTimeout(function () {
|
106
|
-
onChange(null);
|
107
|
-
}, 0);
|
103
|
+
onChange(null);
|
108
104
|
}
|
109
105
|
};
|
110
106
|
if (isView) {
|
@@ -140,7 +136,6 @@ var ProTimeLimit = exports.ProTimeLimit = function ProTimeLimit(props) {
|
|
140
136
|
compact: true,
|
141
137
|
className: "pro-time-limit",
|
142
138
|
children: [(0, _jsxRuntime.jsx)(_datePicker.default, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
143
|
-
defaultPickerValue: (0, _moment.default)(),
|
144
139
|
disabled: disabled || isForever
|
145
140
|
}, initialConfig), (0, _omit2.default)(_rest, ['placeholder'])), {}, {
|
146
141
|
format: _format,
|
@@ -299,6 +299,10 @@ function initialValuesToNames() {
|
|
299
299
|
values[key] = formInitialValue;
|
300
300
|
}
|
301
301
|
}
|
302
|
+
// 给FormList默认增加一行
|
303
|
+
if (item.type === 'FormList' && !item.initialValue && !(0, _get2.default)(values, item.name)) {
|
304
|
+
item.initialValue = [{}];
|
305
|
+
}
|
302
306
|
});
|
303
307
|
return values;
|
304
308
|
}
|
package/lib/locale/en_US.d.ts
CHANGED
package/lib/locale/en_US.js
CHANGED
@@ -40,9 +40,8 @@ var _default = exports.default = {
|
|
40
40
|
ruleText: 'correct',
|
41
41
|
completeText: 'enter in full',
|
42
42
|
halfRuleText: 'Enter the value of ({total})',
|
43
|
-
formListActions: ['Add', 'Delete', 'Copy', 'Move up', 'Move down', 'Add a new line'
|
44
|
-
formListConfirmMessage: 'Are you sure delete it?'
|
45
|
-
noData: 'No data'
|
43
|
+
formListActions: ['Add', 'Delete', 'Copy', 'Move up', 'Move down', 'Add a new line'],
|
44
|
+
formListConfirmMessage: 'Are you sure delete it?'
|
46
45
|
},
|
47
46
|
ProAction: {
|
48
47
|
errorMessage: 'The configuration config for ProAction must be data',
|
package/lib/locale/zh_CN.d.ts
CHANGED
package/lib/locale/zh_CN.js
CHANGED
@@ -40,9 +40,8 @@ var _default = exports.default = {
|
|
40
40
|
ruleText: '正确的',
|
41
41
|
completeText: '请完整输入',
|
42
42
|
halfRuleText: '请输入第({total})个表单的值',
|
43
|
-
formListActions: ['新增', '删除', '复制', '上移', '下移', '新增一行'
|
44
|
-
formListConfirmMessage: '确认删除吗?'
|
45
|
-
noData: '暂无数据'
|
43
|
+
formListActions: ['新增', '删除', '复制', '上移', '下移', '新增一行'],
|
44
|
+
formListConfirmMessage: '确认删除吗?'
|
46
45
|
},
|
47
46
|
ProAction: {
|
48
47
|
errorMessage: 'ProAction 配置 config 必须为数据',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
3
|
-
"version": "3.13.13-beta.
|
3
|
+
"version": "3.13.13-beta.4",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -50,9 +50,13 @@
|
|
50
50
|
"iOS >= 7",
|
51
51
|
"Android >= 4"
|
52
52
|
],
|
53
|
+
"overrides": {
|
54
|
+
"react-draggable": "<4.5.0"
|
55
|
+
},
|
53
56
|
"resolutions": {
|
54
57
|
"@types/react": "^17.0.53",
|
55
|
-
"mockjs/commander": "9.2.0"
|
58
|
+
"mockjs/commander": "9.2.0",
|
59
|
+
"react-draggable": "<4.5.0"
|
56
60
|
},
|
57
61
|
"dependencies": {
|
58
62
|
"@ant-design/icons": "^4.2.2",
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import type { FormInstance, FormListOperation } from 'antd';
|
2
|
-
import type { InternalNamePath } from 'antd/es/form/interface';
|
3
|
-
import type { ToolbarActionType } from '../propsType';
|
4
|
-
interface EmptyProps {
|
5
|
-
disabled?: boolean;
|
6
|
-
toolbarProps?: ToolbarActionType[] | false;
|
7
|
-
operation?: FormListOperation;
|
8
|
-
form?: FormInstance;
|
9
|
-
namePath?: InternalNamePath;
|
10
|
-
emptyBtnText?: string;
|
11
|
-
}
|
12
|
-
declare const Empty: ({ disabled, toolbarProps, operation, form, namePath, emptyBtnText }: EmptyProps) => import("react/jsx-runtime").JSX.Element;
|
13
|
-
export default Empty;
|
@@ -1,90 +0,0 @@
|
|
1
|
-
import "antd/es/button/style";
|
2
|
-
import _Button from "antd/es/button";
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
4
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
5
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
6
|
-
import EmptyImg from '../../../../../assets/empty.png';
|
7
|
-
import locale from '../../../../../locale';
|
8
|
-
// 空列表状态
|
9
|
-
var Empty = function Empty(_ref) {
|
10
|
-
var disabled = _ref.disabled,
|
11
|
-
toolbarProps = _ref.toolbarProps,
|
12
|
-
operation = _ref.operation,
|
13
|
-
form = _ref.form,
|
14
|
-
namePath = _ref.namePath,
|
15
|
-
emptyBtnText = _ref.emptyBtnText;
|
16
|
-
// 找到type为'add'的配置
|
17
|
-
var addConfig = Array.isArray(toolbarProps) ? toolbarProps.find(function (item) {
|
18
|
-
return item.type === 'add';
|
19
|
-
}) : null;
|
20
|
-
var handleAddClick = /*#__PURE__*/function () {
|
21
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
22
|
-
var _addConfig$onClick;
|
23
|
-
var value, data;
|
24
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
25
|
-
while (1) switch (_context.prev = _context.next) {
|
26
|
-
case 0:
|
27
|
-
if (!(!operation || !form || !namePath)) {
|
28
|
-
_context.next = 2;
|
29
|
-
break;
|
30
|
-
}
|
31
|
-
return _context.abrupt("return");
|
32
|
-
case 2:
|
33
|
-
value = form.getFieldValue(namePath);
|
34
|
-
_context.next = 5;
|
35
|
-
return addConfig === null || addConfig === void 0 ? void 0 : (_addConfig$onClick = addConfig.onClick) === null || _addConfig$onClick === void 0 ? void 0 : _addConfig$onClick.call(addConfig, value, {
|
36
|
-
operation: operation,
|
37
|
-
form: form,
|
38
|
-
namePath: namePath
|
39
|
-
});
|
40
|
-
case 5:
|
41
|
-
data = _context.sent;
|
42
|
-
if (!(!(addConfig === null || addConfig === void 0 ? void 0 : addConfig.onClick) || data === true)) {
|
43
|
-
_context.next = 9;
|
44
|
-
break;
|
45
|
-
}
|
46
|
-
operation.add({});
|
47
|
-
return _context.abrupt("return");
|
48
|
-
case 9:
|
49
|
-
if (data) {
|
50
|
-
operation.add(data);
|
51
|
-
}
|
52
|
-
case 10:
|
53
|
-
case "end":
|
54
|
-
return _context.stop();
|
55
|
-
}
|
56
|
-
}, _callee);
|
57
|
-
}));
|
58
|
-
return function handleAddClick() {
|
59
|
-
return _ref2.apply(this, arguments);
|
60
|
-
};
|
61
|
-
}();
|
62
|
-
// 获取按钮文案
|
63
|
-
var getBtnText = function getBtnText() {
|
64
|
-
return emptyBtnText || (addConfig === null || addConfig === void 0 ? void 0 : addConfig.label) || locale.ProForm.formListActions[6];
|
65
|
-
};
|
66
|
-
return _jsxs("div", {
|
67
|
-
className: "pro-form-list-empty",
|
68
|
-
children: [_jsx("img", {
|
69
|
-
className: "pro-form-list-empty-img",
|
70
|
-
src: EmptyImg,
|
71
|
-
alt: "Empty"
|
72
|
-
}), _jsx("div", {
|
73
|
-
className: "pro-form-list-empty-content",
|
74
|
-
children: disabled ? locale.ProForm.noData : _jsxs(_Fragment, {
|
75
|
-
children: [locale.ProForm.noData, !disabled && _jsxs(_Fragment, {
|
76
|
-
children: ["\uFF0C", _jsx(_Button, {
|
77
|
-
type: "link",
|
78
|
-
onClick: handleAddClick,
|
79
|
-
style: {
|
80
|
-
padding: 0,
|
81
|
-
height: 'auto'
|
82
|
-
},
|
83
|
-
children: getBtnText()
|
84
|
-
})]
|
85
|
-
})]
|
86
|
-
})
|
87
|
-
})]
|
88
|
-
});
|
89
|
-
};
|
90
|
-
export default Empty;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import type { FormInstance, FormListOperation } from 'antd';
|
2
|
-
import type { InternalNamePath } from 'antd/es/form/interface';
|
3
|
-
import type { ToolbarActionType } from '../propsType';
|
4
|
-
interface EmptyProps {
|
5
|
-
disabled?: boolean;
|
6
|
-
toolbarProps?: ToolbarActionType[] | false;
|
7
|
-
operation?: FormListOperation;
|
8
|
-
form?: FormInstance;
|
9
|
-
namePath?: InternalNamePath;
|
10
|
-
emptyBtnText?: string;
|
11
|
-
}
|
12
|
-
declare const Empty: ({ disabled, toolbarProps, operation, form, namePath, emptyBtnText }: EmptyProps) => import("react/jsx-runtime").JSX.Element;
|
13
|
-
export default Empty;
|
@@ -1,97 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
5
|
-
value: true
|
6
|
-
});
|
7
|
-
exports.default = void 0;
|
8
|
-
require("antd/es/button/style");
|
9
|
-
var _button = _interopRequireDefault(require("antd/es/button"));
|
10
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
11
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
13
|
-
var _empty = _interopRequireDefault(require("../../../../../assets/empty.png"));
|
14
|
-
var _locale = _interopRequireDefault(require("../../../../../locale"));
|
15
|
-
// 空列表状态
|
16
|
-
var Empty = function Empty(_ref) {
|
17
|
-
var disabled = _ref.disabled,
|
18
|
-
toolbarProps = _ref.toolbarProps,
|
19
|
-
operation = _ref.operation,
|
20
|
-
form = _ref.form,
|
21
|
-
namePath = _ref.namePath,
|
22
|
-
emptyBtnText = _ref.emptyBtnText;
|
23
|
-
// 找到type为'add'的配置
|
24
|
-
var addConfig = Array.isArray(toolbarProps) ? toolbarProps.find(function (item) {
|
25
|
-
return item.type === 'add';
|
26
|
-
}) : null;
|
27
|
-
var handleAddClick = /*#__PURE__*/function () {
|
28
|
-
var _ref2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
29
|
-
var _addConfig$onClick;
|
30
|
-
var value, data;
|
31
|
-
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
32
|
-
while (1) switch (_context.prev = _context.next) {
|
33
|
-
case 0:
|
34
|
-
if (!(!operation || !form || !namePath)) {
|
35
|
-
_context.next = 2;
|
36
|
-
break;
|
37
|
-
}
|
38
|
-
return _context.abrupt("return");
|
39
|
-
case 2:
|
40
|
-
value = form.getFieldValue(namePath);
|
41
|
-
_context.next = 5;
|
42
|
-
return addConfig === null || addConfig === void 0 ? void 0 : (_addConfig$onClick = addConfig.onClick) === null || _addConfig$onClick === void 0 ? void 0 : _addConfig$onClick.call(addConfig, value, {
|
43
|
-
operation: operation,
|
44
|
-
form: form,
|
45
|
-
namePath: namePath
|
46
|
-
});
|
47
|
-
case 5:
|
48
|
-
data = _context.sent;
|
49
|
-
if (!(!(addConfig === null || addConfig === void 0 ? void 0 : addConfig.onClick) || data === true)) {
|
50
|
-
_context.next = 9;
|
51
|
-
break;
|
52
|
-
}
|
53
|
-
operation.add({});
|
54
|
-
return _context.abrupt("return");
|
55
|
-
case 9:
|
56
|
-
if (data) {
|
57
|
-
operation.add(data);
|
58
|
-
}
|
59
|
-
case 10:
|
60
|
-
case "end":
|
61
|
-
return _context.stop();
|
62
|
-
}
|
63
|
-
}, _callee);
|
64
|
-
}));
|
65
|
-
return function handleAddClick() {
|
66
|
-
return _ref2.apply(this, arguments);
|
67
|
-
};
|
68
|
-
}();
|
69
|
-
// 获取按钮文案
|
70
|
-
var getBtnText = function getBtnText() {
|
71
|
-
return emptyBtnText || (addConfig === null || addConfig === void 0 ? void 0 : addConfig.label) || _locale.default.ProForm.formListActions[6];
|
72
|
-
};
|
73
|
-
return (0, _jsxRuntime.jsxs)("div", {
|
74
|
-
className: "pro-form-list-empty",
|
75
|
-
children: [(0, _jsxRuntime.jsx)("img", {
|
76
|
-
className: "pro-form-list-empty-img",
|
77
|
-
src: _empty.default,
|
78
|
-
alt: "Empty"
|
79
|
-
}), (0, _jsxRuntime.jsx)("div", {
|
80
|
-
className: "pro-form-list-empty-content",
|
81
|
-
children: disabled ? _locale.default.ProForm.noData : (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
82
|
-
children: [_locale.default.ProForm.noData, !disabled && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
83
|
-
children: ["\uFF0C", (0, _jsxRuntime.jsx)(_button.default, {
|
84
|
-
type: "link",
|
85
|
-
onClick: handleAddClick,
|
86
|
-
style: {
|
87
|
-
padding: 0,
|
88
|
-
height: 'auto'
|
89
|
-
},
|
90
|
-
children: getBtnText()
|
91
|
-
})]
|
92
|
-
})]
|
93
|
-
})
|
94
|
-
})]
|
95
|
-
});
|
96
|
-
};
|
97
|
-
var _default = exports.default = Empty;
|