ls-pro-common 1.1.3 → 3.0.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/dist/common.css +420 -108
- package/dist/common.js +1 -1
- package/dist/common.less +1 -0
- package/dist/common.min.css +420 -108
- package/dist/common.min.js +1 -1
- package/es/components/DtlLayout.d.ts +5 -3
- package/es/components/DtlLayout.js +29 -24
- package/es/components/GroupTip.d.ts +10 -0
- package/es/components/GroupTip.js +31 -0
- package/es/components/Permission.js +5 -2
- package/es/components/antd-custom.less +207 -0
- package/es/components/common.less +153 -159
- package/es/hooks/useSingle/index.js +1 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/utils/index.d.ts +3 -3
- package/es/utils/index.js +6 -0
- package/lib/components/DtlLayout.d.ts +5 -3
- package/lib/components/DtlLayout.js +28 -23
- package/lib/components/GroupTip.d.ts +10 -0
- package/lib/components/GroupTip.js +39 -0
- package/lib/components/Permission.js +5 -2
- package/lib/components/antd-custom.less +207 -0
- package/lib/components/common.less +153 -159
- package/lib/hooks/useSingle/index.js +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +7 -0
- package/lib/utils/index.d.ts +3 -3
- package/lib/utils/index.js +6 -0
- package/package.json +5 -4
|
@@ -6,15 +6,17 @@ export declare type DtlLyaoutProps = Record<string, any> & {
|
|
|
6
6
|
onExit: (visible?: boolean) => void;
|
|
7
7
|
/** 保存方法 */
|
|
8
8
|
onSave?: () => void;
|
|
9
|
-
/**
|
|
9
|
+
/** 自定义按钮方法,defaultBtn 默认有三个按钮,btnBack=返回,btnSave=保存,btnAudit=审核 */
|
|
10
10
|
renderButton?: (defaultBtn: JSX.Element[]) => JSX.Element[];
|
|
11
11
|
/** 审核方法 */
|
|
12
12
|
onAudit?: () => void;
|
|
13
13
|
/**按钮状态 */
|
|
14
14
|
btnStatus?: (btnKey: string) => boolean | void;
|
|
15
|
-
/**
|
|
15
|
+
/** 保存按钮文本,默认为‘保存’,传入''时不展示 */
|
|
16
16
|
btnSaveText?: string;
|
|
17
|
-
/**
|
|
17
|
+
/** 审核按钮文本,默认为‘审核’,传入''时不展示 */
|
|
18
|
+
btnAuditText?: string;
|
|
19
|
+
/** 返回按钮文本,默认为'返回' */
|
|
18
20
|
btnExitText?: string;
|
|
19
21
|
/** 标题 */
|
|
20
22
|
title?: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
1
3
|
import "antd/es/button/style";
|
|
2
4
|
import _Button from "antd/es/button";
|
|
3
5
|
import React, { useMemo } from 'react';
|
|
4
6
|
import classNames from 'classnames';
|
|
5
|
-
import {
|
|
7
|
+
import { SaveOutlined, AuditOutlined, ArrowLeftOutlined } from '@ant-design/icons';
|
|
6
8
|
import './common.less';
|
|
7
9
|
import usePermission from '../hooks/usePermission';
|
|
8
10
|
function DtlLayout(props) {
|
|
@@ -20,6 +22,8 @@ function DtlLayout(props) {
|
|
|
20
22
|
btnSaveText = _props$btnSaveText === void 0 ? '保存' : _props$btnSaveText,
|
|
21
23
|
_props$btnExitText = props.btnExitText,
|
|
22
24
|
btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText,
|
|
25
|
+
_props$btnAuditText = props.btnAuditText,
|
|
26
|
+
btnAuditText = _props$btnAuditText === void 0 ? '审核' : _props$btnAuditText,
|
|
23
27
|
btnStatus = props.btnStatus,
|
|
24
28
|
statusField = props.statusField,
|
|
25
29
|
auditStatus = props.auditStatus,
|
|
@@ -47,18 +51,17 @@ function DtlLayout(props) {
|
|
|
47
51
|
return isAudit();
|
|
48
52
|
};
|
|
49
53
|
var btns = useMemo(function () {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var b = [];
|
|
54
|
+
var back = /*#__PURE__*/React.createElement(_Button, {
|
|
55
|
+
key: "btnBack",
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
return props.onExit(false);
|
|
58
|
+
},
|
|
59
|
+
icon: /*#__PURE__*/React.createElement(ArrowLeftOutlined, null)
|
|
60
|
+
}, btnExitText);
|
|
61
|
+
var btnList = [back];
|
|
59
62
|
// 有新增或更改权限且未审核,开放出保存按钮
|
|
60
|
-
if ((checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
|
|
61
|
-
|
|
63
|
+
if (btnSaveText && (checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
|
|
64
|
+
btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
|
|
62
65
|
key: "btnSave",
|
|
63
66
|
onClick: function onClick() {
|
|
64
67
|
var _formRef$current;
|
|
@@ -72,8 +75,8 @@ function DtlLayout(props) {
|
|
|
72
75
|
}, btnSaveText));
|
|
73
76
|
}
|
|
74
77
|
// 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
|
|
75
|
-
if (props.onAudit && checkRight(64) && !isAudit() && !isView) {
|
|
76
|
-
|
|
78
|
+
if (btnAuditText && props.onAudit && checkRight(64) && !isAudit() && !isView) {
|
|
79
|
+
btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
|
|
77
80
|
key: "btnAudit",
|
|
78
81
|
disabled: btnDisabled('btnAudit'),
|
|
79
82
|
onClick: function onClick() {
|
|
@@ -81,10 +84,16 @@ function DtlLayout(props) {
|
|
|
81
84
|
props.onAudit();
|
|
82
85
|
},
|
|
83
86
|
icon: /*#__PURE__*/React.createElement(AuditOutlined, null)
|
|
84
|
-
},
|
|
87
|
+
}, btnAuditText));
|
|
85
88
|
}
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
// 如果用户直接返回空,还是需要把返回按钮加上。
|
|
90
|
+
if (props.renderButton) {
|
|
91
|
+
btnList = props.renderButton(btnList);
|
|
92
|
+
if (!btnList || !btnList.length) {
|
|
93
|
+
btnList = [back];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return btnList;
|
|
88
97
|
}, [props]);
|
|
89
98
|
return /*#__PURE__*/React.createElement("div", {
|
|
90
99
|
className: "dtl-layout"
|
|
@@ -92,16 +101,12 @@ function DtlLayout(props) {
|
|
|
92
101
|
className: classNames('dtl-header', headerClass),
|
|
93
102
|
style: headerStyle
|
|
94
103
|
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className: "dtl-back"
|
|
96
|
-
}, /*#__PURE__*/React.createElement(LeftOutlined, {
|
|
97
|
-
onClick: function onClick() {
|
|
98
|
-
return props.onExit(false);
|
|
99
|
-
}
|
|
100
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
101
104
|
className: "dtl-title"
|
|
102
105
|
}, dtlTitle), /*#__PURE__*/React.createElement("div", {
|
|
103
106
|
className: "dtl-btns"
|
|
104
|
-
},
|
|
107
|
+
}, /*#__PURE__*/React.createElement(_Space, {
|
|
108
|
+
size: 8
|
|
109
|
+
}, btns))), /*#__PURE__*/React.createElement("div", {
|
|
105
110
|
className: classNames('dtl-body', bodyClass),
|
|
106
111
|
style: bodyStyle
|
|
107
112
|
}, children));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './common.less';
|
|
3
|
+
export declare type GroupTitleProps = {
|
|
4
|
+
text: React.ReactNode | string;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
isInner?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const GroupTip: React.FC<GroupTitleProps>;
|
|
10
|
+
export default GroupTip;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import './common.less';
|
|
5
|
+
var GroupTip = function GroupTip(_ref) {
|
|
6
|
+
var children = _ref.children,
|
|
7
|
+
className = _ref.className,
|
|
8
|
+
text = _ref.text,
|
|
9
|
+
_ref$style = _ref.style,
|
|
10
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
11
|
+
_ref$isInner = _ref.isInner,
|
|
12
|
+
isInner = _ref$isInner === void 0 ? true : _ref$isInner;
|
|
13
|
+
var cls = classNames('ls-group-tip', className);
|
|
14
|
+
var styles = isInner ? {} : {
|
|
15
|
+
paddingTop: '12px',
|
|
16
|
+
paddingLeft: '20px',
|
|
17
|
+
borderTopLeftRadius: '8px',
|
|
18
|
+
borderTopRightRadius: '8px'
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: cls,
|
|
22
|
+
style: _objectSpread(_objectSpread({}, styles), style)
|
|
23
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: "ls-group-divider"
|
|
25
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: "ls-group-text"
|
|
27
|
+
}, text), children && /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "flex"
|
|
29
|
+
}, children));
|
|
30
|
+
};
|
|
31
|
+
export default GroupTip;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
var _excluded = ["children", "rightValue"];
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import usePermission from "../hooks/usePermission";
|
|
3
5
|
var Permission = function Permission(_ref) {
|
|
4
6
|
var children = _ref.children,
|
|
5
|
-
rightValue = _ref.rightValue
|
|
7
|
+
rightValue = _ref.rightValue,
|
|
8
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
6
9
|
var _usePermission = usePermission(),
|
|
7
10
|
checkRight = _usePermission.checkRight;
|
|
8
|
-
return checkRight(rightValue) ? /*#__PURE__*/React.createElement(React.Fragment,
|
|
11
|
+
return checkRight(rightValue) ? /*#__PURE__*/React.createElement(React.Fragment, rest, children) : null;
|
|
9
12
|
};
|
|
10
13
|
export default Permission;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
.ant-timeline-item-tail {
|
|
2
|
+
border-left: 2px dotted var(--ant-primary-color);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ant-timeline-item-head-blue {
|
|
6
|
+
background: var(--ant-primary-color);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ant-row {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ant-popover {
|
|
14
|
+
max-width: min-content !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
.ant-input-has-value:hover {
|
|
20
|
+
.ant-input-clear-icon {
|
|
21
|
+
visibility: visible;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ant-modal-confirm-body {
|
|
26
|
+
.ant-modal-confirm-content {
|
|
27
|
+
max-height: 60vh;
|
|
28
|
+
overflow : auto;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ant-message-notice-content {
|
|
33
|
+
border-radius: 4px !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ant-modal-content {
|
|
37
|
+
border-radius: 8px !important;
|
|
38
|
+
// box-shadow : 0px 4px 6px rgba(0, 0, 0, 0.05) !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ant-input-number,
|
|
42
|
+
.ant-input-affix-wrapper,
|
|
43
|
+
.ant-picker,
|
|
44
|
+
.ant-select-selector {
|
|
45
|
+
border-radius: 4px !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ant-picker-range-separator {
|
|
49
|
+
padding: 0 2px !important;
|
|
50
|
+
|
|
51
|
+
.ant-picker-separator {
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
.ant-btn {
|
|
58
|
+
height : 32px;
|
|
59
|
+
background-color: #EAEEF2;
|
|
60
|
+
border-color : transparent;
|
|
61
|
+
color : #595959;
|
|
62
|
+
border-radius : 4px;
|
|
63
|
+
|
|
64
|
+
&:hover,
|
|
65
|
+
&:focus {
|
|
66
|
+
background-color: #D2D6DD;
|
|
67
|
+
border-color : transparent;
|
|
68
|
+
color : #000;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:active {
|
|
72
|
+
background-color: #B5BBC5;
|
|
73
|
+
border-color : transparent;
|
|
74
|
+
color : #141414;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&[disabled],
|
|
78
|
+
&[disabled]:hover,
|
|
79
|
+
&[disabled]:focus,
|
|
80
|
+
&[disabled]:active {
|
|
81
|
+
background-color: #D2D6DD;
|
|
82
|
+
border-color : transparent;
|
|
83
|
+
color : #BFBFBF;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ant-btn-primary {
|
|
88
|
+
background-color: var(--ant-primary-color);
|
|
89
|
+
border-color : transparent;
|
|
90
|
+
color : #fff;
|
|
91
|
+
|
|
92
|
+
&:hover,
|
|
93
|
+
&:focus {
|
|
94
|
+
background-color: var(--ant-primary-color-hover);
|
|
95
|
+
border-color : transparent;
|
|
96
|
+
color : #fff;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:active {
|
|
100
|
+
background-color: var(--ant-primary-color-active);
|
|
101
|
+
border-color : transparent;
|
|
102
|
+
color : #fff;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&[disabled],
|
|
106
|
+
&[disabled]:hover,
|
|
107
|
+
&[disabled]:focus,
|
|
108
|
+
&[disabled]:active {
|
|
109
|
+
background-color: rgba(24, 105, 237, 0.4);
|
|
110
|
+
border-color : transparent;
|
|
111
|
+
color : #fff;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ant-btn-dangerous {
|
|
116
|
+
background-color: #FFCCC7;
|
|
117
|
+
border-color : transparent;
|
|
118
|
+
color : #F5222D;
|
|
119
|
+
|
|
120
|
+
&:hover,
|
|
121
|
+
&:focus {
|
|
122
|
+
background-color: #FFF1F0;
|
|
123
|
+
border-color : transparent;
|
|
124
|
+
color : #F5222D;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:active {
|
|
128
|
+
background-color: #FFA39E;
|
|
129
|
+
border-color : transparent;
|
|
130
|
+
color : #F5222D;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&[disabled],
|
|
134
|
+
&[disabled]:hover,
|
|
135
|
+
&[disabled]:focus,
|
|
136
|
+
&[disabled]:active {
|
|
137
|
+
background-color: #FFCCC7;
|
|
138
|
+
border-color : transparent;
|
|
139
|
+
color : #FFA39E;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ant-btn-link {
|
|
144
|
+
background-color: transparent;
|
|
145
|
+
border-color : transparent;
|
|
146
|
+
color : var(--ant-primary-color);
|
|
147
|
+
padding : 4px 8px;
|
|
148
|
+
|
|
149
|
+
&[disabled],
|
|
150
|
+
&[disabled]:hover,
|
|
151
|
+
&[disabled]:focus,
|
|
152
|
+
&[disabled]:active,
|
|
153
|
+
&:hover,
|
|
154
|
+
&:focus,
|
|
155
|
+
&:active {
|
|
156
|
+
background-color: transparent;
|
|
157
|
+
border-color : transparent;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&:hover,
|
|
161
|
+
&:focus {
|
|
162
|
+
color: var(--ant-primary-color-hover);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&:active {
|
|
166
|
+
color: var(--ant-primary-color-active);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&[disabled],
|
|
170
|
+
&[disabled]:hover,
|
|
171
|
+
&[disabled]:focus,
|
|
172
|
+
&[disabled]:active {
|
|
173
|
+
color: #A7B5CC;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.ant-btn-text {
|
|
178
|
+
background-color: transparent;
|
|
179
|
+
border-color : transparent;
|
|
180
|
+
color : #8C8C8C;
|
|
181
|
+
padding : 4px 8px;
|
|
182
|
+
|
|
183
|
+
&[disabled],
|
|
184
|
+
&[disabled]:hover,
|
|
185
|
+
&[disabled]:focus,
|
|
186
|
+
&[disabled]:active,
|
|
187
|
+
&:hover,
|
|
188
|
+
&:focus,
|
|
189
|
+
&:active {
|
|
190
|
+
background-color: transparent;
|
|
191
|
+
border-color : transparent;
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&:hover,
|
|
196
|
+
&:active,
|
|
197
|
+
&:focus {
|
|
198
|
+
color: var(--ant-primary-color-hover);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
&[disabled],
|
|
202
|
+
&[disabled]:hover,
|
|
203
|
+
&[disabled]:focus,
|
|
204
|
+
&[disabled]:active {
|
|
205
|
+
color: #d9d9d9;
|
|
206
|
+
}
|
|
207
|
+
}
|