ls-pro-common 3.0.13 → 3.0.15
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/CHANGELOG.md +746 -0
- package/es/components/404.d.ts +3 -0
- package/es/components/404.jpg +0 -0
- package/es/components/404.js +9 -0
- package/es/components/AreaCascader.d.ts +4 -0
- package/es/components/AreaCascader.js +76 -0
- package/es/components/AreaCascaderPanel.d.ts +5 -0
- package/es/components/AreaCascaderPanel.js +230 -0
- package/es/components/DescritionCard.d.ts +11 -0
- package/es/components/DescritionCard.js +79 -0
- package/es/components/DtlLayout.d.ts +44 -0
- package/es/components/DtlLayout.js +116 -0
- package/es/components/GroupTip.d.ts +10 -0
- package/es/components/GroupTip.js +31 -0
- package/es/components/IconBack.d.ts +3 -0
- package/es/components/IconBack.js +20 -0
- package/es/components/IconBell.d.ts +3 -0
- package/es/components/IconBell.js +22 -0
- package/es/components/IconQuestion.d.ts +3 -0
- package/es/components/IconQuestion.js +26 -0
- package/es/components/IconSearch.d.ts +3 -0
- package/es/components/IconSearch.js +22 -0
- package/es/components/IconSelector.d.ts +14 -0
- package/es/components/IconSelector.js +222 -0
- package/es/components/IconText.d.ts +3 -0
- package/es/components/IconText.js +30 -0
- package/es/components/ImageSelector.d.ts +31 -0
- package/es/components/ImageSelector.js +437 -0
- package/es/components/InputMultiLine.d.ts +46 -0
- package/es/components/InputMultiLine.js +139 -0
- package/es/components/InputTable.d.ts +106 -0
- package/es/components/InputTable.js +473 -0
- package/es/components/Loading.d.ts +8 -0
- package/es/components/Loading.js +20 -0
- package/es/components/Permission.d.ts +6 -0
- package/es/components/Permission.js +13 -0
- package/es/components/antd-custom.less +356 -0
- package/es/components/common.less +474 -0
- package/es/hooks/useDtl/index.d.ts +47 -0
- package/es/hooks/useDtl/index.js +949 -0
- package/es/hooks/useGetState.d.ts +1 -0
- package/es/hooks/useGetState.js +17 -0
- package/es/hooks/usePermission/index.d.ts +15 -0
- package/es/hooks/usePermission/index.js +58 -0
- package/es/hooks/useSingle/index.d.ts +54 -0
- package/es/hooks/useSingle/index.js +662 -0
- package/es/http/index.d.ts +53 -0
- package/es/http/index.js +309 -0
- package/es/index.d.ts +32 -0
- package/es/index.js +26 -0
- package/es/service/BaseService.d.ts +24 -0
- package/es/service/BaseService.js +214 -0
- package/es/typing.d.ts +53 -0
- package/es/typing.js +1 -0
- package/es/utils/index.d.ts +258 -0
- package/es/utils/index.js +682 -0
- package/lib/components/404.d.ts +3 -0
- package/lib/components/404.jpg +0 -0
- package/lib/components/404.js +17 -0
- package/lib/components/AreaCascader.d.ts +4 -0
- package/lib/components/AreaCascader.js +85 -0
- package/lib/components/AreaCascaderPanel.d.ts +5 -0
- package/lib/components/AreaCascaderPanel.js +239 -0
- package/lib/components/DescritionCard.d.ts +11 -0
- package/lib/components/DescritionCard.js +88 -0
- package/lib/components/DtlLayout.d.ts +44 -0
- package/lib/components/DtlLayout.js +125 -0
- package/lib/components/GroupTip.d.ts +10 -0
- package/lib/components/GroupTip.js +39 -0
- package/lib/components/IconBack.d.ts +3 -0
- package/lib/components/IconBack.js +28 -0
- package/lib/components/IconBell.d.ts +3 -0
- package/lib/components/IconBell.js +30 -0
- package/lib/components/IconQuestion.d.ts +3 -0
- package/lib/components/IconQuestion.js +34 -0
- package/lib/components/IconSearch.d.ts +3 -0
- package/lib/components/IconSearch.js +30 -0
- package/lib/components/IconSelector.d.ts +14 -0
- package/lib/components/IconSelector.js +230 -0
- package/lib/components/IconText.d.ts +3 -0
- package/lib/components/IconText.js +38 -0
- package/lib/components/ImageSelector.d.ts +31 -0
- package/lib/components/ImageSelector.js +445 -0
- package/lib/components/InputMultiLine.d.ts +46 -0
- package/lib/components/InputMultiLine.js +148 -0
- package/lib/components/InputTable.d.ts +106 -0
- package/lib/components/InputTable.js +482 -0
- package/lib/components/Loading.d.ts +8 -0
- package/lib/components/Loading.js +28 -0
- package/lib/components/Permission.d.ts +6 -0
- package/lib/components/Permission.js +21 -0
- package/lib/components/antd-custom.less +356 -0
- package/lib/components/common.less +474 -0
- package/lib/hooks/useDtl/index.d.ts +47 -0
- package/lib/hooks/useDtl/index.js +957 -0
- package/lib/hooks/useGetState.d.ts +1 -0
- package/lib/hooks/useGetState.js +24 -0
- package/lib/hooks/usePermission/index.d.ts +15 -0
- package/lib/hooks/usePermission/index.js +65 -0
- package/lib/hooks/useSingle/index.d.ts +54 -0
- package/lib/hooks/useSingle/index.js +670 -0
- package/lib/http/index.d.ts +53 -0
- package/lib/http/index.js +323 -0
- package/lib/index.d.ts +32 -0
- package/lib/service/BaseService.d.ts +24 -0
- package/lib/service/BaseService.js +222 -0
- package/lib/typing.d.ts +53 -0
- package/lib/typing.js +5 -0
- package/lib/utils/index.d.ts +258 -0
- package/lib/utils/index.js +779 -0
- package/package.json +5 -13
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import './common.less';
|
|
3
|
+
export default (function () {
|
|
4
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5
|
+
className: "page404"
|
|
6
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
7
|
+
src: require('./404.jpg')
|
|
8
|
+
}), " \u60A8\u8BBF\u95EE\u7684\u8D44\u6E90\u4E0D\u5B58\u5728~~");
|
|
9
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "antd/es/cascader/style";
|
|
2
|
+
import _Cascader from "antd/es/cascader";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
8
|
+
import { httpGet } from '../http';
|
|
9
|
+
import { getCache, setCache, treeEach } from '../utils';
|
|
10
|
+
var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
11
|
+
var _useState = useState([]),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
options = _useState2[0],
|
|
14
|
+
setOptions = _useState2[1];
|
|
15
|
+
var areaRef = useRef();
|
|
16
|
+
useImperativeHandle(ref, function () {
|
|
17
|
+
return areaRef.current;
|
|
18
|
+
});
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
initOptions();
|
|
21
|
+
}, []);
|
|
22
|
+
var initOptions = /*#__PURE__*/function () {
|
|
23
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
24
|
+
var cacheItems, api, result, opts;
|
|
25
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
cacheItems = getCache("areaOptions", true);
|
|
29
|
+
if (!(cacheItems && Array.isArray(cacheItems))) {
|
|
30
|
+
_context.next = 4;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
setOptions(cacheItems);
|
|
34
|
+
return _context.abrupt("return");
|
|
35
|
+
case 4:
|
|
36
|
+
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
37
|
+
_context.next = 7;
|
|
38
|
+
return httpGet(api, {}, false);
|
|
39
|
+
case 7:
|
|
40
|
+
result = _context.sent;
|
|
41
|
+
opts = result.rows || [];
|
|
42
|
+
treeEach(opts, function (item) {
|
|
43
|
+
item.label = item.name;
|
|
44
|
+
item.value = item.id;
|
|
45
|
+
if (item.level === 'district') {
|
|
46
|
+
delete item.children;
|
|
47
|
+
}
|
|
48
|
+
delete item.name;
|
|
49
|
+
delete item.id;
|
|
50
|
+
delete item.level;
|
|
51
|
+
delete item.parentId;
|
|
52
|
+
});
|
|
53
|
+
setCache('areaOptions', opts, true);
|
|
54
|
+
setOptions(opts);
|
|
55
|
+
case 12:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context.stop();
|
|
58
|
+
}
|
|
59
|
+
}, _callee);
|
|
60
|
+
}));
|
|
61
|
+
return function initOptions() {
|
|
62
|
+
return _ref.apply(this, arguments);
|
|
63
|
+
};
|
|
64
|
+
}();
|
|
65
|
+
return /*#__PURE__*/React.createElement(_Cascader, _extends({
|
|
66
|
+
options: options,
|
|
67
|
+
style: {
|
|
68
|
+
width: '100%'
|
|
69
|
+
},
|
|
70
|
+
changeOnSelect: true,
|
|
71
|
+
placeholder: "\u8BF7\u9009\u62E9"
|
|
72
|
+
}, props, {
|
|
73
|
+
ref: areaRef
|
|
74
|
+
}));
|
|
75
|
+
});
|
|
76
|
+
export default AreaCascader;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import "antd/es/cascader/style";
|
|
2
|
+
import _Cascader from "antd/es/cascader";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import "antd/es/button/style";
|
|
5
|
+
import _Button from "antd/es/button";
|
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
+
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
11
|
+
import { httpGet } from '../http';
|
|
12
|
+
import { getCache, setCache, treeEach } from '../utils';
|
|
13
|
+
import './common.less';
|
|
14
|
+
var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
|
+
var propsConfig = _objectSpread({
|
|
16
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
17
|
+
var _document;
|
|
18
|
+
return (_document = document) === null || _document === void 0 ? void 0 : _document.body;
|
|
19
|
+
},
|
|
20
|
+
placeholder: "请选择"
|
|
21
|
+
}, props);
|
|
22
|
+
var _useState = useState(getCache('areaOptionsPanel', true) || []),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
options = _useState2[0],
|
|
25
|
+
setOptions = _useState2[1];
|
|
26
|
+
//显示数据
|
|
27
|
+
var _useState3 = useState(getCache('areaOptionsPanel', true) || []),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
showData = _useState4[0],
|
|
30
|
+
setShowData = _useState4[1];
|
|
31
|
+
//暂存值
|
|
32
|
+
var _useState5 = useState([]),
|
|
33
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
|
+
listData = _useState6[0],
|
|
35
|
+
setListData = _useState6[1];
|
|
36
|
+
//省市区实际值
|
|
37
|
+
var _useState7 = useState(props.value || []),
|
|
38
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
39
|
+
actualData = _useState8[0],
|
|
40
|
+
setActualData = _useState8[1];
|
|
41
|
+
//标题显示值
|
|
42
|
+
var _useState9 = useState('province'),
|
|
43
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
44
|
+
areaTitle = _useState10[0],
|
|
45
|
+
setAreaTitle = _useState10[1];
|
|
46
|
+
var areaRef = useRef();
|
|
47
|
+
useImperativeHandle(ref, function () {
|
|
48
|
+
return areaRef.current;
|
|
49
|
+
});
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
initOptions();
|
|
52
|
+
}, []);
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
if (actualData.length !== 0) {
|
|
55
|
+
var _props$onChange;
|
|
56
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, actualData, listData);
|
|
57
|
+
} else {
|
|
58
|
+
setAreaTitle('province');
|
|
59
|
+
}
|
|
60
|
+
}, [actualData]);
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
var _props$value;
|
|
63
|
+
if (!options.length || !((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.length)) return;
|
|
64
|
+
var _props$value2 = _slicedToArray(props.value, 3),
|
|
65
|
+
pKey = _props$value2[0],
|
|
66
|
+
cKey = _props$value2[1],
|
|
67
|
+
dKey = _props$value2[2];
|
|
68
|
+
var province = pKey ? options.find(function (o) {
|
|
69
|
+
return o.value === pKey;
|
|
70
|
+
}) : false;
|
|
71
|
+
var city = province && cKey ? province.children.find(function (o) {
|
|
72
|
+
return o.value === cKey;
|
|
73
|
+
}) : false;
|
|
74
|
+
var district = city && dKey ? city.children.find(function (o) {
|
|
75
|
+
return o.value === dKey;
|
|
76
|
+
}) : false;
|
|
77
|
+
var area = [province, city, district].filter(Boolean);
|
|
78
|
+
setListData(area);
|
|
79
|
+
setAreaTitle(area.length === 3 ? 'district' : area.length === 2 ? 'city' : 'province');
|
|
80
|
+
setShowData(area.length === 3 ? city.children : area.length === 2 ? province.children : options);
|
|
81
|
+
}, [options]);
|
|
82
|
+
var initOptions = /*#__PURE__*/function () {
|
|
83
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
84
|
+
var cacheItems, api, result, opts;
|
|
85
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
86
|
+
while (1) switch (_context.prev = _context.next) {
|
|
87
|
+
case 0:
|
|
88
|
+
cacheItems = getCache('areaOptionsPanel', true);
|
|
89
|
+
if (!(cacheItems && Array.isArray(cacheItems) && cacheItems.length)) {
|
|
90
|
+
_context.next = 3;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
return _context.abrupt("return");
|
|
94
|
+
case 3:
|
|
95
|
+
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
96
|
+
_context.next = 6;
|
|
97
|
+
return httpGet(api, {}, false);
|
|
98
|
+
case 6:
|
|
99
|
+
result = _context.sent;
|
|
100
|
+
opts = result.rows || [];
|
|
101
|
+
treeEach(opts, function (item) {
|
|
102
|
+
item.label = item.name;
|
|
103
|
+
item.value = item.id;
|
|
104
|
+
if (item.level === 'district') {
|
|
105
|
+
delete item.children;
|
|
106
|
+
}
|
|
107
|
+
delete item.name;
|
|
108
|
+
delete item.id;
|
|
109
|
+
delete item.parentId;
|
|
110
|
+
});
|
|
111
|
+
setCache('areaOptionsPanel', opts, true);
|
|
112
|
+
setOptions(opts);
|
|
113
|
+
setShowData(opts);
|
|
114
|
+
case 12:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
117
|
+
}
|
|
118
|
+
}, _callee);
|
|
119
|
+
}));
|
|
120
|
+
return function initOptions() {
|
|
121
|
+
return _ref.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
}();
|
|
124
|
+
var dropdownRender = function dropdownRender(menus) {
|
|
125
|
+
var _listData$, _listData$3;
|
|
126
|
+
var title = /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: "ls-area-cascaded-header"
|
|
128
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: "ls-word-box-display"
|
|
130
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
|
131
|
+
type: "text",
|
|
132
|
+
onClick: function onClick() {
|
|
133
|
+
setAreaTitle('province');
|
|
134
|
+
setShowData(options);
|
|
135
|
+
setListData(function (val) {
|
|
136
|
+
return val.length ? [val[0]] : [];
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
140
|
+
className: 'ls-myself-select-title-style'
|
|
141
|
+
}, listData[0] ? (_listData$ = listData[0]) === null || _listData$ === void 0 ? void 0 : _listData$.label : '省/直辖市'))), /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: "ls-word-box-display"
|
|
143
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
|
144
|
+
type: "text",
|
|
145
|
+
disabled: listData.length < 2,
|
|
146
|
+
onClick: function onClick() {
|
|
147
|
+
var _listData$2;
|
|
148
|
+
setAreaTitle('city');
|
|
149
|
+
setShowData((_listData$2 = listData[0]) === null || _listData$2 === void 0 ? void 0 : _listData$2.children);
|
|
150
|
+
setListData(function (val) {
|
|
151
|
+
return val.filter(function (o, i) {
|
|
152
|
+
return i < 2;
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
157
|
+
className: 'ls-myself-select-title-style'
|
|
158
|
+
}, areaTitle !== 'province' && listData[1] ? (_listData$3 = listData[1]) === null || _listData$3 === void 0 ? void 0 : _listData$3.label : '市'))), /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "ls-word-box-display"
|
|
160
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
|
161
|
+
type: "text",
|
|
162
|
+
disabled: listData.length < 3
|
|
163
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
164
|
+
className: 'ls-myself-select-title-style'
|
|
165
|
+
}, listData[2] ? listData[2].label : '区'))));
|
|
166
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: "ls-area-cascaded-box"
|
|
168
|
+
}, title, /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: "ls-area-cascaded-body"
|
|
170
|
+
}, showData.map(function (item) {
|
|
171
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
172
|
+
className: "ls-area-cascaded-span ".concat(actualData.find(function (o) {
|
|
173
|
+
return o === item.value;
|
|
174
|
+
}) ? ' ls-area-selected' : ''),
|
|
175
|
+
title: item.label,
|
|
176
|
+
onClick: function onClick(e) {
|
|
177
|
+
var _areaRef$current;
|
|
178
|
+
switch ((item === null || item === void 0 ? void 0 : item.level) || '') {
|
|
179
|
+
case 'province':
|
|
180
|
+
setShowData(item === null || item === void 0 ? void 0 : item.children);
|
|
181
|
+
setActualData([item === null || item === void 0 ? void 0 : item.value]);
|
|
182
|
+
setListData(function (val) {
|
|
183
|
+
return [item];
|
|
184
|
+
});
|
|
185
|
+
//面板标题指向市
|
|
186
|
+
setAreaTitle('city');
|
|
187
|
+
break;
|
|
188
|
+
case 'city':
|
|
189
|
+
setShowData(item === null || item === void 0 ? void 0 : item.children);
|
|
190
|
+
setActualData(function (val) {
|
|
191
|
+
return [val[0], item === null || item === void 0 ? void 0 : item.value];
|
|
192
|
+
});
|
|
193
|
+
setListData(function (val) {
|
|
194
|
+
return [val[0], item];
|
|
195
|
+
});
|
|
196
|
+
setAreaTitle('district');
|
|
197
|
+
break;
|
|
198
|
+
case 'district':
|
|
199
|
+
setActualData(function (val) {
|
|
200
|
+
return [val[0], val[1], item === null || item === void 0 ? void 0 : item.value];
|
|
201
|
+
});
|
|
202
|
+
setListData(function (val) {
|
|
203
|
+
return [val[0], val[1], item];
|
|
204
|
+
});
|
|
205
|
+
(_areaRef$current = areaRef.current) === null || _areaRef$current === void 0 ? void 0 : _areaRef$current.blur();
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, item.label);
|
|
212
|
+
})));
|
|
213
|
+
};
|
|
214
|
+
return /*#__PURE__*/React.createElement(_Cascader, _extends({
|
|
215
|
+
options: options,
|
|
216
|
+
style: {
|
|
217
|
+
width: '100%'
|
|
218
|
+
},
|
|
219
|
+
className: 'ls-area-box-position',
|
|
220
|
+
changeOnSelect: true,
|
|
221
|
+
ref: areaRef,
|
|
222
|
+
onClear: function onClear() {
|
|
223
|
+
setActualData([]);
|
|
224
|
+
setListData([]);
|
|
225
|
+
setShowData(options);
|
|
226
|
+
},
|
|
227
|
+
dropdownRender: dropdownRender
|
|
228
|
+
}, propsConfig));
|
|
229
|
+
});
|
|
230
|
+
export default AreaPicker;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ProCardProps } from 'ls-pro-card';
|
|
3
|
+
import type { ProDescriptionsProps } from 'ls-pro-descriptions';
|
|
4
|
+
import './common.less';
|
|
5
|
+
export declare type DescritionCardProps = ProCardProps & {
|
|
6
|
+
hasBackground?: boolean;
|
|
7
|
+
desc?: ProDescriptionsProps;
|
|
8
|
+
collapseTitle?: string;
|
|
9
|
+
};
|
|
10
|
+
declare function DescritionCard(props: DescritionCardProps): JSX.Element;
|
|
11
|
+
export default DescritionCard;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["title", "extra", "className", "collapsible", "defaultCollapsed", "desc", "hasBackground", "collapseTitle"];
|
|
5
|
+
import React, { useMemo, useState } from 'react';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { UpOutlined } from '@ant-design/icons';
|
|
8
|
+
import ProCard from 'ls-pro-card';
|
|
9
|
+
import ProDescriptions from 'ls-pro-descriptions';
|
|
10
|
+
import './common.less';
|
|
11
|
+
function DescritionCard(props) {
|
|
12
|
+
var title = props.title,
|
|
13
|
+
extra = props.extra,
|
|
14
|
+
className = props.className,
|
|
15
|
+
_props$collapsible = props.collapsible,
|
|
16
|
+
collapsible = _props$collapsible === void 0 ? true : _props$collapsible,
|
|
17
|
+
_props$defaultCollaps = props.defaultCollapsed,
|
|
18
|
+
defaultCollapsed = _props$defaultCollaps === void 0 ? false : _props$defaultCollaps,
|
|
19
|
+
desc = props.desc,
|
|
20
|
+
hasBackground = props.hasBackground,
|
|
21
|
+
_props$collapseTitle = props.collapseTitle,
|
|
22
|
+
collapseTitle = _props$collapseTitle === void 0 ? '展开/收起' : _props$collapseTitle,
|
|
23
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
24
|
+
var _useState = useState(defaultCollapsed),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
collapsed = _useState2[0],
|
|
27
|
+
setCollapsed = _useState2[1];
|
|
28
|
+
var titleLayout = useMemo(function () {
|
|
29
|
+
if (typeof title === 'string') {
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: 'description-card-title'
|
|
32
|
+
}, /*#__PURE__*/React.createElement("span", null, title));
|
|
33
|
+
} else {
|
|
34
|
+
return title;
|
|
35
|
+
}
|
|
36
|
+
}, [title]);
|
|
37
|
+
var collapsedDom = useMemo(function () {
|
|
38
|
+
if (!collapsible) return null;
|
|
39
|
+
return /*#__PURE__*/React.createElement(UpOutlined, {
|
|
40
|
+
rotate: !!collapsed ? 180 : undefined,
|
|
41
|
+
style: {
|
|
42
|
+
margin: 'auto',
|
|
43
|
+
marginLeft: '24px',
|
|
44
|
+
fontSize: '16px',
|
|
45
|
+
color: 'var(--ant-primary-color, #4997e6)'
|
|
46
|
+
},
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
setCollapsed(!collapsed);
|
|
49
|
+
},
|
|
50
|
+
title: collapseTitle || undefined
|
|
51
|
+
});
|
|
52
|
+
}, [collapsed, collapsible]);
|
|
53
|
+
var extraDom = useMemo(function () {
|
|
54
|
+
if (extra && collapsedDom) {
|
|
55
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, extra, collapsedDom);
|
|
56
|
+
} else if (extra) {
|
|
57
|
+
return extra;
|
|
58
|
+
} else if (collapsedDom) {
|
|
59
|
+
return collapsedDom;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}, [extra, collapsedDom]);
|
|
63
|
+
return desc ? /*#__PURE__*/React.createElement(ProCard, _extends({
|
|
64
|
+
className: classNames('description-card', {
|
|
65
|
+
'has-background': hasBackground
|
|
66
|
+
}, className),
|
|
67
|
+
title: titleLayout,
|
|
68
|
+
extra: extraDom,
|
|
69
|
+
collapsed: collapsed
|
|
70
|
+
}, rest), /*#__PURE__*/React.createElement(ProDescriptions, desc)) : /*#__PURE__*/React.createElement(ProCard, _extends({
|
|
71
|
+
className: classNames('description-card', {
|
|
72
|
+
'has-background': hasBackground
|
|
73
|
+
}, className),
|
|
74
|
+
title: titleLayout,
|
|
75
|
+
extra: extraDom,
|
|
76
|
+
collapsed: collapsed
|
|
77
|
+
}, rest));
|
|
78
|
+
}
|
|
79
|
+
export default DescritionCard;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ProFormInstance } from 'ls-pro-form';
|
|
3
|
+
import './common.less';
|
|
4
|
+
export declare type DtlLyaoutProps = Record<string, any> & {
|
|
5
|
+
/** 返回方法 */
|
|
6
|
+
onExit: (visible?: boolean) => void;
|
|
7
|
+
/** 保存方法 */
|
|
8
|
+
onSave?: () => void;
|
|
9
|
+
/** 自定义按钮方法,defaultBtn 默认有三个按钮,btnBack=返回,btnSave=保存,btnAudit=审核 */
|
|
10
|
+
renderButton?: (defaultBtn: JSX.Element[]) => JSX.Element[];
|
|
11
|
+
/** 审核方法 */
|
|
12
|
+
onAudit?: () => void;
|
|
13
|
+
/**按钮状态 */
|
|
14
|
+
btnStatus?: (btnKey: string) => boolean | void;
|
|
15
|
+
/** 保存按钮文本,默认为‘保存’,传入''时不展示 */
|
|
16
|
+
btnSaveText?: string;
|
|
17
|
+
/** 审核按钮文本,默认为‘审核’,传入''时不展示 */
|
|
18
|
+
btnAuditText?: string;
|
|
19
|
+
/** 返回按钮文本,默认为'返回' */
|
|
20
|
+
btnExitText?: string;
|
|
21
|
+
/** 标题 */
|
|
22
|
+
title?: JSX.Element | string;
|
|
23
|
+
/** 主表对象 */
|
|
24
|
+
masterObject?: any;
|
|
25
|
+
/** 主表主键字段 */
|
|
26
|
+
keyField?: string;
|
|
27
|
+
/** body类 */
|
|
28
|
+
bodyClass?: string;
|
|
29
|
+
/** header 类 */
|
|
30
|
+
headerClass?: string;
|
|
31
|
+
/** body样式 */
|
|
32
|
+
bodyStyle?: React.CSSProperties;
|
|
33
|
+
/** header样式 */
|
|
34
|
+
headerStyle?: React.CSSProperties;
|
|
35
|
+
/** 表单ref */
|
|
36
|
+
formRef?: React.MutableRefObject<ProFormInstance | undefined>;
|
|
37
|
+
/**状态字段 */
|
|
38
|
+
statusField?: string;
|
|
39
|
+
/** 审核状态值 */
|
|
40
|
+
auditStatus?: number;
|
|
41
|
+
isView?: boolean;
|
|
42
|
+
};
|
|
43
|
+
declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
|
|
44
|
+
export default DtlLayout;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/button/style";
|
|
4
|
+
import _Button from "antd/es/button";
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { SaveOutlined, AuditOutlined } from '@ant-design/icons';
|
|
8
|
+
import './common.less';
|
|
9
|
+
import usePermission from '../hooks/usePermission';
|
|
10
|
+
import IconBack from './IconBack';
|
|
11
|
+
function DtlLayout(props) {
|
|
12
|
+
var title = props.title,
|
|
13
|
+
_props$keyField = props.keyField,
|
|
14
|
+
keyField = _props$keyField === void 0 ? 'id' : _props$keyField,
|
|
15
|
+
masterObject = props.masterObject,
|
|
16
|
+
children = props.children,
|
|
17
|
+
headerClass = props.headerClass,
|
|
18
|
+
headerStyle = props.headerStyle,
|
|
19
|
+
bodyClass = props.bodyClass,
|
|
20
|
+
bodyStyle = props.bodyStyle,
|
|
21
|
+
formRef = props.formRef,
|
|
22
|
+
_props$btnSaveText = props.btnSaveText,
|
|
23
|
+
btnSaveText = _props$btnSaveText === void 0 ? '保存' : _props$btnSaveText,
|
|
24
|
+
_props$btnExitText = props.btnExitText,
|
|
25
|
+
btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText,
|
|
26
|
+
_props$btnAuditText = props.btnAuditText,
|
|
27
|
+
btnAuditText = _props$btnAuditText === void 0 ? '审核' : _props$btnAuditText,
|
|
28
|
+
btnStatus = props.btnStatus,
|
|
29
|
+
statusField = props.statusField,
|
|
30
|
+
auditStatus = props.auditStatus,
|
|
31
|
+
_props$isView = props.isView,
|
|
32
|
+
isView = _props$isView === void 0 ? false : _props$isView;
|
|
33
|
+
var _usePermission = usePermission(),
|
|
34
|
+
checkRight = _usePermission.checkRight;
|
|
35
|
+
var dtlTitle = useMemo(function () {
|
|
36
|
+
if (title) return title;
|
|
37
|
+
if (!masterObject) return '';
|
|
38
|
+
return masterObject[keyField] ? '编辑' : '新增';
|
|
39
|
+
}, [title, masterObject, keyField]);
|
|
40
|
+
var isAudit = function isAudit() {
|
|
41
|
+
if (masterObject && statusField && auditStatus) {
|
|
42
|
+
return Number(masterObject[statusField] || 0) >= auditStatus;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
var btnDisabled = function btnDisabled(btnKey) {
|
|
47
|
+
if (isView) return true;
|
|
48
|
+
// 优先处理自定义的状态
|
|
49
|
+
if (btnStatus && typeof btnStatus(btnKey) === 'boolean') {
|
|
50
|
+
return btnStatus(btnKey) || false;
|
|
51
|
+
}
|
|
52
|
+
return isAudit();
|
|
53
|
+
};
|
|
54
|
+
var btns = useMemo(function () {
|
|
55
|
+
var back = /*#__PURE__*/React.createElement(_Button, {
|
|
56
|
+
key: "btnBack",
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return props.onExit(false);
|
|
59
|
+
},
|
|
60
|
+
className: "ant-btn-gray",
|
|
61
|
+
icon: /*#__PURE__*/React.createElement(IconBack, null)
|
|
62
|
+
}, btnExitText);
|
|
63
|
+
var btnList = [back];
|
|
64
|
+
// 有新增或更改权限且未审核,开放出保存按钮
|
|
65
|
+
if (btnSaveText && (checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
|
|
66
|
+
btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
|
|
67
|
+
key: "btnSave",
|
|
68
|
+
onClick: function onClick() {
|
|
69
|
+
var _formRef$current;
|
|
70
|
+
if (props.onSave) {
|
|
71
|
+
return props.onSave();
|
|
72
|
+
}
|
|
73
|
+
formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.submit();
|
|
74
|
+
},
|
|
75
|
+
disabled: btnDisabled('btnSave'),
|
|
76
|
+
icon: /*#__PURE__*/React.createElement(SaveOutlined, null)
|
|
77
|
+
}, btnSaveText));
|
|
78
|
+
}
|
|
79
|
+
// 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
|
|
80
|
+
if (btnAuditText && props.onAudit && checkRight(64) && !isAudit() && !isView) {
|
|
81
|
+
btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
|
|
82
|
+
key: "btnAudit",
|
|
83
|
+
disabled: btnDisabled('btnAudit'),
|
|
84
|
+
onClick: function onClick() {
|
|
85
|
+
if (!props.onAudit) return;
|
|
86
|
+
props.onAudit();
|
|
87
|
+
},
|
|
88
|
+
icon: /*#__PURE__*/React.createElement(AuditOutlined, null)
|
|
89
|
+
}, btnAuditText));
|
|
90
|
+
}
|
|
91
|
+
// 如果用户直接返回空,还是需要把返回按钮加上。
|
|
92
|
+
if (props.renderButton) {
|
|
93
|
+
btnList = props.renderButton(btnList);
|
|
94
|
+
if (!btnList || !btnList.length) {
|
|
95
|
+
btnList = [back];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return btnList;
|
|
99
|
+
}, [props]);
|
|
100
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "dtl-layout"
|
|
102
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: classNames('dtl-header', headerClass),
|
|
104
|
+
style: headerStyle
|
|
105
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "dtl-title"
|
|
107
|
+
}, dtlTitle), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "dtl-btns"
|
|
109
|
+
}, /*#__PURE__*/React.createElement(_Space, {
|
|
110
|
+
size: 8
|
|
111
|
+
}, btns))), /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: classNames('dtl-body', bodyClass),
|
|
113
|
+
style: bodyStyle
|
|
114
|
+
}, children));
|
|
115
|
+
}
|
|
116
|
+
export default DtlLayout;
|
|
@@ -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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Icon from '@ant-design/icons';
|
|
4
|
+
var Svg = function Svg() {
|
|
5
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
6
|
+
width: "1em",
|
|
7
|
+
height: "1em",
|
|
8
|
+
viewBox: "0 0 18 18",
|
|
9
|
+
fill: "currentColor",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
12
|
+
d: "M16 10.4575C16 9.17825 15.4505 7.97554 14.4516 7.07099C13.4883 6.19867 12.2047 5.69905 10.8409 5.66883C10.8276 5.66883 10.8142 5.66883 10.8009 5.66681H4.5228L6.26474 4.08939C6.5406 3.83958 6.5406 3.43263 6.26474 3.18282C5.98888 2.93301 5.54171 2.93502 5.26363 3.18282L2.2069 5.95087C1.93103 6.20068 1.93103 6.60763 2.2069 6.85744L5.2614 9.62348C5.53726 9.87329 5.98665 9.87329 6.26251 9.62348C6.53615 9.37568 6.53615 8.96874 6.26251 8.71691L4.40267 7.03473H10.7119C12.7964 7.03473 14.4917 8.56985 14.4917 10.4575C14.4917 12.3452 12.7964 13.8803 10.7119 13.8803H5.4505C5.03448 13.8803 4.69633 14.1865 4.69633 14.5633C4.69633 14.94 5.03448 15.2462 5.4505 15.2462H10.7364C12.1379 15.2402 13.4594 14.7426 14.4538 13.8441C15.4505 12.9395 16 11.7368 16 10.4575V10.4575Z"
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
var IconBack = function IconBack(props) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({
|
|
17
|
+
component: Svg
|
|
18
|
+
}, props));
|
|
19
|
+
};
|
|
20
|
+
export default IconBack;
|