fan-standard-comp 3.1.9 → 3.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 +35 -0
- package/dist/fan-standard-comp.umd.js +15 -10
- package/es/ButtonGroup/ButtonList.js +0 -3
- package/es/ButtonGroup/ButtonMenu.js +0 -3
- package/es/ButtonGroup/PopConfirmTitle.js +5 -15
- package/es/ButtonGroup/index.d.ts +2 -0
- package/es/ButtonGroup/index.js +223 -193
- package/es/ButtonGroup/style/index.less +1 -1
- package/es/DragContent/DragBar.js +2 -6
- package/es/DragContent/index.js +44 -75
- package/es/FormComp/ChunkUploader/api.js +6 -10
- package/es/FormComp/ChunkUploader/index.js +105 -171
- package/es/FormComp/ChunkUploader/lib.js +4 -17
- package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
- package/es/FormComp/ChunkUploader/worker.js +0 -3
- package/es/FormComp/EditButton/index.js +24 -49
- package/es/FormComp/FieldComponent/ReUpload.js +18 -38
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +37 -75
- package/es/FormComp/FieldComponent/TitleNode.js +1 -3
- package/es/FormComp/FieldComponent/index.js +38 -74
- package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
- package/es/FormComp/FieldComponent/style/index.less +6 -0
- package/es/FormComp/RenderItemGroup/index.js +46 -74
- package/es/FormComp/Uploader/index.js +36 -77
- package/es/FormComp/Uploader/util.js +0 -6
- package/es/FormComp/VarTemplate/index.js +58 -96
- package/es/NavLeafScroll/index.js +172 -154
- package/es/NavLeafScroll/style/index.less +33 -1
- package/es/RefactorTree/index.js +36 -53
- package/es/RefactorTree/indexTreeNode.js +35 -68
- package/es/RefactorTree/util.js +9 -43
- package/es/SpecIcon/fonts/iconfont.js +7 -12
- package/es/SpecIcon/index.js +16 -25
- package/es/SplitterLayout/Pane.js +2 -5
- package/es/SplitterLayout/index.js +20 -70
- package/es/StandardContent/SplitterLayout/Pane.js +6 -10
- package/es/StandardContent/SplitterLayout/index.js +12 -63
- package/es/StandardContent/SubfieldContent.js +12 -14
- package/es/StandardContent/WrapperContent.js +8 -10
- package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/es/StandardDragModal/ChangeStandardModal.js +493 -0
- package/es/StandardDragModal/DraggableModal.d.ts +7 -0
- package/es/StandardDragModal/DraggableModal.js +31 -0
- package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/es/StandardDragModal/DraggableModalContext.js +5 -0
- package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/es/StandardDragModal/DraggableModalInner.js +114 -0
- package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/es/StandardDragModal/DraggableModalProvider.js +40 -0
- package/es/StandardDragModal/Modal.d.ts +11 -0
- package/es/StandardDragModal/Modal.js +24 -0
- package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/es/StandardDragModal/ResizeHandle.js +8 -0
- package/es/StandardDragModal/clamp.d.ts +1 -0
- package/es/StandardDragModal/clamp.js +3 -0
- package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/es/StandardDragModal/draggableModalReducer.js +157 -0
- package/es/StandardDragModal/getWindowSize.d.ts +4 -0
- package/es/StandardDragModal/getWindowSize.js +6 -0
- package/es/StandardDragModal/index.d.ts +3 -11
- package/es/StandardDragModal/index.js +3 -30
- package/es/StandardDragModal/index.less +65 -0
- package/es/StandardDragModal/useDrag.d.ts +5 -0
- package/es/StandardDragModal/useDrag.js +66 -0
- package/es/StandardDragModal/usePrevious.d.ts +1 -0
- package/es/StandardDragModal/usePrevious.js +8 -0
- package/es/StandardDragModal/useResize.d.ts +7 -0
- package/es/StandardDragModal/useResize.js +74 -0
- package/es/StandardFilter/index.d.ts +1 -0
- package/es/StandardFilter/index.js +32 -70
- package/es/StandardForm/ActionList.js +5 -7
- package/es/StandardForm/StepForm.js +50 -71
- package/es/StandardForm/TabForm.js +58 -70
- package/es/StandardForm/index.js +37 -56
- package/es/StandardModal/UpdateFormRef.js +1 -4
- package/es/StandardModal/index.d.ts +0 -1
- package/es/StandardModal/index.js +115 -159
- package/es/StandardPanel/index.js +19 -35
- package/es/StandardTable/index.js +20 -30
- package/es/components/IconNode/index.js +0 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +15 -14
- package/es/utils/ValueFormat.js +0 -9
- package/es/utils/dictSelectUtil.js +153 -0
- package/es/utils/filterPermission.js +16 -34
- package/es/utils/getParentNodes.js +24 -47
- package/es/utils/index.js +2 -1
- package/lib/ButtonGroup/ButtonList.js +1 -13
- package/lib/ButtonGroup/ButtonMenu.js +1 -8
- package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
- package/lib/ButtonGroup/index.d.ts +2 -0
- package/lib/ButtonGroup/index.js +226 -216
- package/lib/ButtonGroup/style/index.less +1 -1
- package/lib/DragContent/DragBar.js +2 -10
- package/lib/DragContent/index.js +47 -85
- package/lib/FormComp/ChunkUploader/api.js +6 -15
- package/lib/FormComp/ChunkUploader/index.js +107 -185
- package/lib/FormComp/ChunkUploader/lib.js +8 -27
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
- package/lib/FormComp/ChunkUploader/worker.js +1 -5
- package/lib/FormComp/EditButton/index.js +26 -60
- package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +39 -90
- package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
- package/lib/FormComp/FieldComponent/index.js +38 -110
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
- package/lib/FormComp/FieldComponent/style/index.less +6 -0
- package/lib/FormComp/RenderItemGroup/index.js +46 -87
- package/lib/FormComp/Uploader/index.js +38 -95
- package/lib/FormComp/Uploader/util.js +1 -9
- package/lib/FormComp/VarTemplate/index.js +62 -106
- package/lib/FormComp/index.js +0 -2
- package/lib/NavLeafScroll/index.js +174 -165
- package/lib/NavLeafScroll/style/index.less +33 -1
- package/lib/RefactorTree/index.js +36 -67
- package/lib/RefactorTree/indexTreeNode.js +37 -83
- package/lib/RefactorTree/util.js +11 -45
- package/lib/SpecIcon/fonts/iconfont.js +7 -12
- package/lib/SpecIcon/index.js +16 -30
- package/lib/SplitterLayout/Pane.js +0 -7
- package/lib/SplitterLayout/index.js +18 -72
- package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
- package/lib/StandardContent/SplitterLayout/index.js +12 -68
- package/lib/StandardContent/SubfieldContent.js +12 -21
- package/lib/StandardContent/WrapperContent.js +8 -16
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
- package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
- package/lib/StandardDragModal/DraggableModal.js +40 -0
- package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/lib/StandardDragModal/DraggableModalContext.js +15 -0
- package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/lib/StandardDragModal/DraggableModalInner.js +124 -0
- package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
- package/lib/StandardDragModal/Modal.d.ts +11 -0
- package/lib/StandardDragModal/Modal.js +32 -0
- package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/lib/StandardDragModal/ResizeHandle.js +18 -0
- package/lib/StandardDragModal/clamp.d.ts +1 -0
- package/lib/StandardDragModal/clamp.js +10 -0
- package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/lib/StandardDragModal/draggableModalReducer.js +167 -0
- package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
- package/lib/StandardDragModal/getWindowSize.js +13 -0
- package/lib/StandardDragModal/index.d.ts +3 -11
- package/lib/StandardDragModal/index.js +33 -38
- package/lib/StandardDragModal/index.less +65 -0
- package/lib/StandardDragModal/useDrag.d.ts +5 -0
- package/lib/StandardDragModal/useDrag.js +73 -0
- package/lib/StandardDragModal/usePrevious.d.ts +1 -0
- package/lib/StandardDragModal/usePrevious.js +15 -0
- package/lib/StandardDragModal/useResize.d.ts +7 -0
- package/lib/StandardDragModal/useResize.js +81 -0
- package/lib/StandardFilter/index.d.ts +1 -0
- package/lib/StandardFilter/index.js +30 -78
- package/lib/StandardForm/ActionList.js +5 -12
- package/lib/StandardForm/StepForm.js +52 -90
- package/lib/StandardForm/TabForm.js +61 -88
- package/lib/StandardForm/index.js +40 -75
- package/lib/StandardModal/UpdateFormRef.js +4 -12
- package/lib/StandardModal/index.d.ts +0 -1
- package/lib/StandardModal/index.js +117 -184
- package/lib/StandardPanel/index.js +22 -48
- package/lib/StandardTable/index.js +20 -39
- package/lib/components/IconNode/index.js +0 -7
- package/lib/components/index.js +0 -2
- package/lib/data/index.js +4 -7
- package/lib/index.d.ts +1 -0
- package/lib/index.js +50 -68
- package/lib/utils/ValueFormat.js +0 -10
- package/lib/utils/dictSelectUtil.js +161 -0
- package/lib/utils/filterPermission.js +15 -39
- package/lib/utils/getParentNodes.js +25 -52
- package/lib/utils/index.js +24 -9
- package/package.json +6 -5
|
@@ -1,30 +1,20 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
import "antd/es/tree-select/style";
|
|
2
3
|
import _TreeSelect from "antd/es/tree-select";
|
|
3
|
-
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
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; }
|
|
11
|
-
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
|
|
14
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
|
|
16
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
|
|
18
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
-
|
|
20
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
21
|
-
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
|
|
24
16
|
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; }
|
|
25
|
-
|
|
26
17
|
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; }
|
|
27
|
-
|
|
28
18
|
import React, { useRef, useState, useEffect } from "react";
|
|
29
19
|
import './style/index.less';
|
|
30
20
|
import { getParentNodes, getNodePaths } from '../../utils';
|
|
@@ -32,53 +22,44 @@ import { UpOutlined, DownOutlined } from "@ant-design/icons";
|
|
|
32
22
|
var TreeNode = _TreeSelect.TreeNode;
|
|
33
23
|
var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
34
24
|
var _props$treeData = props.treeData,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
25
|
+
treeData = _props$treeData === void 0 ? [] : _props$treeData,
|
|
26
|
+
value = props.value,
|
|
27
|
+
showFullLevel = props.showFullLevel,
|
|
28
|
+
_props$separator = props.separator,
|
|
29
|
+
separator = _props$separator === void 0 ? '/' : _props$separator,
|
|
30
|
+
disabled = props.disabled,
|
|
31
|
+
disabledFields = props.disabledFields,
|
|
32
|
+
fieldStatus = props.fieldStatus,
|
|
33
|
+
_props$treeOptionName = props.treeOptionName,
|
|
34
|
+
treeOptionName = _props$treeOptionName === void 0 ? {
|
|
35
|
+
title: 'title',
|
|
36
|
+
value: 'value',
|
|
37
|
+
children: 'children',
|
|
38
|
+
disabled: 'disabled'
|
|
39
|
+
} : _props$treeOptionName,
|
|
40
|
+
placeholder = props.placeholder,
|
|
41
|
+
protoTreeNode = props.protoTreeNode,
|
|
42
|
+
_onSelect = props.onSelect,
|
|
43
|
+
labelInValue = props.labelInValue,
|
|
44
|
+
otherProps = _objectWithoutProperties(props, ["treeData", "value", "showFullLevel", "separator", "disabled", "disabledFields", "fieldStatus", "treeOptionName", "placeholder", "protoTreeNode", "onSelect", "labelInValue"]);
|
|
56
45
|
var _useState = useState(null),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
fullLevelName = _useState2[0],
|
|
48
|
+
setFullLevelName = _useState2[1];
|
|
61
49
|
var renderTreeNode = function renderTreeNode(data, dataOptionName) {
|
|
62
50
|
var nodeProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
63
51
|
return data.map(function (dataItem) {
|
|
64
52
|
var prevDataItem = _objectSpread({}, dataItem);
|
|
65
|
-
|
|
66
53
|
var item = _extends({}, prevDataItem); // 筛选与禁用字段内值相同的节点进行禁用
|
|
67
|
-
|
|
68
|
-
|
|
69
54
|
var resetByDisabledFields = function resetByDisabledFields(initItem) {
|
|
70
55
|
var oldItem = _objectSpread({}, initItem);
|
|
71
|
-
|
|
72
56
|
var nodeItem = _extends({}, oldItem);
|
|
73
|
-
|
|
74
57
|
Object.keys(nodeItem).forEach(function (itemKeyName) {
|
|
75
58
|
var isMatch = disabledFields.find(function (fItem) {
|
|
76
59
|
return fItem.key === itemKeyName;
|
|
77
60
|
});
|
|
78
|
-
|
|
79
61
|
if (isMatch) {
|
|
80
62
|
var _isMatch$value$split;
|
|
81
|
-
|
|
82
63
|
// 确认是否匹配数据,进行设置 disabled
|
|
83
64
|
if ((_isMatch$value$split = isMatch.value.split(',')) === null || _isMatch$value$split === void 0 ? void 0 : _isMatch$value$split.includes(nodeItem[itemKeyName])) {
|
|
84
65
|
nodeItem.disabled = true;
|
|
@@ -89,11 +70,9 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
89
70
|
});
|
|
90
71
|
return nodeItem;
|
|
91
72
|
};
|
|
92
|
-
|
|
93
73
|
if (disabledFields && Array.isArray(disabledFields)) {
|
|
94
74
|
item = resetByDisabledFields(item);
|
|
95
75
|
}
|
|
96
|
-
|
|
97
76
|
if (item[dataOptionName.children] && item[dataOptionName.children].length > 0) {
|
|
98
77
|
return /*#__PURE__*/React.createElement(TreeNode, _extends({
|
|
99
78
|
title: item[dataOptionName.title],
|
|
@@ -105,7 +84,6 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
105
84
|
disabled: item[(dataOptionName === null || dataOptionName === void 0 ? void 0 : dataOptionName.disabled) || 'disabled']
|
|
106
85
|
}, nodeProps), renderTreeNode(item[dataOptionName.children], dataOptionName));
|
|
107
86
|
}
|
|
108
|
-
|
|
109
87
|
return /*#__PURE__*/React.createElement(TreeNode, _extends({
|
|
110
88
|
title: item[dataOptionName.title],
|
|
111
89
|
key: item[dataOptionName.value],
|
|
@@ -117,7 +95,6 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
117
95
|
}, nodeProps));
|
|
118
96
|
});
|
|
119
97
|
};
|
|
120
|
-
|
|
121
98
|
useEffect(function () {
|
|
122
99
|
if (value) {
|
|
123
100
|
// 获取选中节点相关数据:包括当前完整数据值、当前父节点以上层层级节点数据集合及id集合
|
|
@@ -131,27 +108,22 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
131
108
|
setFullLevelName(null);
|
|
132
109
|
}
|
|
133
110
|
}, [value, treeData, fieldStatus]);
|
|
134
|
-
|
|
135
111
|
var renderParenName = function renderParenName(selectNodeInfo) {
|
|
136
112
|
// 有父级节点,及当前模式是showFullLevel时,渲染名称为完整层级名称,否则为当前节点名称
|
|
137
113
|
var parentItems = selectNodeInfo.nodeParent;
|
|
138
|
-
|
|
139
114
|
if (parentItems.length > 0 && showFullLevel && !otherProps.showCheckedStrategy) {
|
|
140
115
|
// 当前查找到的父级节点拼合当前节点的标题字段值进行显示
|
|
141
116
|
return parentItems.reverse().map(function (item) {
|
|
142
117
|
return item[treeOptionName.title];
|
|
143
118
|
}).concat(selectNodeInfo.matchNode[0][treeOptionName.title]).join(separator);
|
|
144
119
|
}
|
|
145
|
-
|
|
146
120
|
if (Array.isArray(value)) {
|
|
147
121
|
return selectNodeInfo.matchNode.length > 0 ? selectNodeInfo.matchNode.map(function (item) {
|
|
148
122
|
return item[treeOptionName.title] || item[treeOptionName.value];
|
|
149
123
|
}).join(',') : null;
|
|
150
124
|
}
|
|
151
|
-
|
|
152
125
|
return selectNodeInfo.matchNode.length > 0 ? selectNodeInfo.matchNode[0][treeOptionName.title] : null;
|
|
153
126
|
};
|
|
154
|
-
|
|
155
127
|
var renderTreeSelectNode = function renderTreeSelectNode() {
|
|
156
128
|
return /*#__PURE__*/React.createElement(_TreeSelect, _extends({
|
|
157
129
|
placeholder: placeholder,
|
|
@@ -172,24 +144,19 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
172
144
|
}
|
|
173
145
|
}), renderTreeNode(treeData, treeOptionName, protoTreeNode || {}));
|
|
174
146
|
};
|
|
175
|
-
|
|
176
147
|
var _useState3 = useState(false),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
148
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
149
|
+
showAllPath = _useState4[0],
|
|
150
|
+
setShowAllPath = _useState4[1]; // 显示所有树选择路径
|
|
182
151
|
var renderTreeSelectNodePath = function renderTreeSelectNodePath() {
|
|
183
152
|
//获取节点路径
|
|
184
153
|
var pathNodes = getNodePaths(treeData, value, {
|
|
185
154
|
childrenParam: treeOptionName.children,
|
|
186
155
|
keyParam: treeOptionName.value
|
|
187
156
|
}, _objectSpread({}, otherProps));
|
|
188
|
-
|
|
189
157
|
var togglePath = function togglePath() {
|
|
190
158
|
setShowAllPath(!showAllPath);
|
|
191
159
|
};
|
|
192
|
-
|
|
193
160
|
if (pathNodes.length > 0) {
|
|
194
161
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
195
162
|
className: "tree-select-viewonly-list ".concat(showAllPath ? 'collapsed' : '')
|
|
@@ -212,37 +179,32 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
212
179
|
return '-';
|
|
213
180
|
}
|
|
214
181
|
};
|
|
215
|
-
|
|
216
182
|
if (fieldStatus === 'viewOnly') {
|
|
217
183
|
//多选下拉框 详情展示 showCheckedStrategy 有值且显示完整路径时
|
|
218
184
|
if (otherProps.showCheckedStrategy && showFullLevel) {
|
|
219
185
|
return renderTreeSelectNodePath();
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
186
|
+
}
|
|
187
|
+
// 多选状态
|
|
223
188
|
if (otherProps.multiple) {
|
|
224
189
|
if (labelInValue) {
|
|
225
190
|
return value && value.length > 0 ? value.map(function (item) {
|
|
226
191
|
return item[treeOptionName.title] || item['title'] || item['label'];
|
|
227
192
|
}).join(',') : '-';
|
|
228
193
|
}
|
|
229
|
-
|
|
230
194
|
var pathNodes = getNodePaths(treeData, value, {
|
|
231
195
|
childrenParam: treeOptionName.children,
|
|
232
196
|
keyParam: treeOptionName.value
|
|
233
197
|
}, _objectSpread({}, otherProps));
|
|
234
198
|
return pathNodes.length > 0 ? pathNodes.map(function (nItem) {
|
|
235
199
|
var _nItem;
|
|
236
|
-
|
|
237
200
|
return (_nItem = nItem[nItem.length - 1]) === null || _nItem === void 0 ? void 0 : _nItem[treeOptionName.title];
|
|
238
201
|
}).join(',') : '-';
|
|
239
202
|
}
|
|
240
|
-
|
|
241
203
|
return fullLevelName || '-'; // 只读显示时,只返回文本
|
|
242
204
|
}
|
|
243
205
|
|
|
244
206
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showFullLevel && !otherProps.showCheckedStrategy ? /*#__PURE__*/React.createElement("div", {
|
|
245
|
-
className: "refactor-tree-select ".concat(disabled ? 'refactor-disabled' : ''),
|
|
207
|
+
className: "refactor-tree-select ".concat(disabled ? 'refactor-disabled' : '').concat(otherProps.size === 'small' ? ' refactor-tree-select-sm' : ''),
|
|
246
208
|
title: fullLevelName || ''
|
|
247
209
|
}, renderTreeSelectNode(), /*#__PURE__*/React.createElement("span", {
|
|
248
210
|
className: "refactor-tree-select-extra"
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
var TitleNode = function TitleNode(props) {
|
|
4
3
|
var render = props.render,
|
|
5
|
-
|
|
4
|
+
data = props.data;
|
|
6
5
|
return /*#__PURE__*/React.createElement(React.Fragment, null, render ? render(data) : data.title || data.label);
|
|
7
6
|
};
|
|
8
|
-
|
|
9
7
|
export default TitleNode;
|
|
@@ -32,46 +32,44 @@ import { setSelectValue, setUploaderValue, setDatePickerValue, setTimePickerValu
|
|
|
32
32
|
import TitleNode from './TitleNode';
|
|
33
33
|
import ReUpload from './ReUpload';
|
|
34
34
|
var TextArea = _Input.TextArea,
|
|
35
|
-
|
|
35
|
+
Password = _Input.Password;
|
|
36
36
|
var Option = _Select.Option;
|
|
37
37
|
var RangePicker = _DatePicker.RangePicker; // 表单组件类型
|
|
38
|
-
|
|
39
38
|
var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
40
39
|
var type = props.type,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
40
|
+
_onChange = props.onChange,
|
|
41
|
+
value = props.value,
|
|
42
|
+
style = props.style,
|
|
43
|
+
placeholder = props.placeholder,
|
|
44
|
+
protoConfig = props.protoConfig,
|
|
45
|
+
_props$treeData = props.treeData,
|
|
46
|
+
treeData = _props$treeData === void 0 ? [] : _props$treeData,
|
|
47
|
+
filedName = props.filedName,
|
|
48
|
+
_props$selectOptionNa = props.selectOptionName,
|
|
49
|
+
selectOptionName = _props$selectOptionNa === void 0 ? {
|
|
50
|
+
value: 'value',
|
|
51
|
+
label: 'label',
|
|
52
|
+
disabled: 'disabled',
|
|
53
|
+
title: 'title'
|
|
54
|
+
} : _props$selectOptionNa,
|
|
55
|
+
_props$treeOptionName = props.treeOptionName,
|
|
56
|
+
treeOptionName = _props$treeOptionName === void 0 ? {
|
|
57
|
+
title: 'title',
|
|
58
|
+
value: 'value',
|
|
59
|
+
children: 'children',
|
|
60
|
+
disabled: 'disabled'
|
|
61
|
+
} : _props$treeOptionName,
|
|
62
|
+
_props$fieldStatus = props.fieldStatus,
|
|
63
|
+
fieldStatus = _props$fieldStatus === void 0 ? 'default' : _props$fieldStatus,
|
|
64
|
+
_props$size = props.size,
|
|
65
|
+
size = _props$size === void 0 ? 'middle' : _props$size,
|
|
66
|
+
showFullLevel = props.showFullLevel,
|
|
67
|
+
separator = props.separator,
|
|
68
|
+
disabledFields = props.disabledFields,
|
|
69
|
+
selectOptionRender = props.selectOptionRender,
|
|
70
|
+
render = props.render;
|
|
72
71
|
var selectOptions = props.selectOptions;
|
|
73
72
|
var compContent;
|
|
74
|
-
|
|
75
73
|
if (selectOptionName && selectOptions) {
|
|
76
74
|
// 将传值的数据进行转换
|
|
77
75
|
selectOptions = selectOptions.map(function (item) {
|
|
@@ -83,7 +81,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
83
81
|
});
|
|
84
82
|
});
|
|
85
83
|
}
|
|
86
|
-
|
|
87
84
|
var defaultProps = Object.assign({
|
|
88
85
|
style: style,
|
|
89
86
|
onChange: _onChange,
|
|
@@ -92,24 +89,19 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
92
89
|
size: size,
|
|
93
90
|
ref: ref
|
|
94
91
|
}, protoConfig);
|
|
95
|
-
|
|
96
92
|
if (fieldStatus === 'disabled') {
|
|
97
93
|
defaultProps.disabled = true;
|
|
98
94
|
}
|
|
99
|
-
|
|
100
95
|
var sortLimitRule = {}; // 排序字段长度限制
|
|
101
|
-
|
|
102
96
|
if (filedName === 'sorts' || filedName === 'sort' || filedName === 'indexSort' || filedName === 'sorta' || filedName === 'categorySort') {
|
|
103
97
|
sortLimitRule = {
|
|
104
98
|
min: 0,
|
|
105
99
|
max: 999999999,
|
|
106
100
|
maxLength: 9
|
|
107
101
|
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
}
|
|
103
|
+
// 设置纯展示模式下的“下拉树”控件返回值
|
|
111
104
|
var viewOnly = fieldStatus === 'viewOnly'; // 是否纯展示
|
|
112
|
-
|
|
113
105
|
switch (type) {
|
|
114
106
|
case 'input':
|
|
115
107
|
compContent = viewOnly ? value || '-' : /*#__PURE__*/React.createElement(_Input, Object.assign({
|
|
@@ -119,7 +111,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
119
111
|
maxLength: defaultProps.maxLength || 50
|
|
120
112
|
}, defaultProps));
|
|
121
113
|
break;
|
|
122
|
-
|
|
123
114
|
case 'password':
|
|
124
115
|
compContent = viewOnly ? value ? "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF" : '-' : /*#__PURE__*/React.createElement(Password, Object.assign({
|
|
125
116
|
autoComplete: "off",
|
|
@@ -127,7 +118,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
127
118
|
maxLength: defaultProps.maxLength || 50
|
|
128
119
|
}, defaultProps));
|
|
129
120
|
break;
|
|
130
|
-
|
|
131
121
|
case 'textarea':
|
|
132
122
|
compContent = viewOnly ? value || '-' : /*#__PURE__*/React.createElement(TextArea, Object.assign({
|
|
133
123
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入',
|
|
@@ -135,7 +125,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
135
125
|
title: fieldStatus === 'disabled' || defaultProps.disabled ? value : null
|
|
136
126
|
}, defaultProps));
|
|
137
127
|
break;
|
|
138
|
-
|
|
139
128
|
case 'inputNumber':
|
|
140
129
|
compContent = viewOnly ? value || 0 : /*#__PURE__*/React.createElement(_InputNumber, Object.assign({
|
|
141
130
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入数字'
|
|
@@ -145,7 +134,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
145
134
|
}, defaultProps.style)
|
|
146
135
|
}));
|
|
147
136
|
break;
|
|
148
|
-
|
|
149
137
|
case 'select':
|
|
150
138
|
// 重置返回完整字段值
|
|
151
139
|
var resetResultOption = function resetResultOption(Option) {
|
|
@@ -155,13 +143,11 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
155
143
|
return childOpt.value === optItem.value;
|
|
156
144
|
}).length > 0;
|
|
157
145
|
}); // 数据为数组
|
|
158
|
-
|
|
159
146
|
var extraParam = selectOptions.filter(function (childOpt) {
|
|
160
147
|
return childOpt.value === Option.value;
|
|
161
148
|
})[0];
|
|
162
149
|
return Object.assign(Object.assign({}, Option), extraParam);
|
|
163
150
|
};
|
|
164
|
-
|
|
165
151
|
compContent = viewOnly ? setSelectValue(value, {
|
|
166
152
|
selectOptions: selectOptions,
|
|
167
153
|
selectOptionRender: selectOptionRender,
|
|
@@ -188,7 +174,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
188
174
|
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
189
175
|
}));
|
|
190
176
|
break;
|
|
191
|
-
|
|
192
177
|
case 'tree-select':
|
|
193
178
|
compContent = /*#__PURE__*/React.createElement(RefactorTreeSelect, Object.assign({
|
|
194
179
|
treeData: treeData,
|
|
@@ -202,7 +187,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
202
187
|
disabledFields: disabledFields
|
|
203
188
|
}, defaultProps));
|
|
204
189
|
break;
|
|
205
|
-
|
|
206
190
|
case 'checkbox':
|
|
207
191
|
delete defaultProps.ref;
|
|
208
192
|
compContent = viewOnly ? setSelectValue(value, {
|
|
@@ -228,7 +212,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
228
212
|
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
229
213
|
}));
|
|
230
214
|
break;
|
|
231
|
-
|
|
232
215
|
case 'radio':
|
|
233
216
|
delete defaultProps.ref;
|
|
234
217
|
compContent = viewOnly ? setSelectValue(value, {
|
|
@@ -252,7 +235,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
252
235
|
disabled: val.disabled
|
|
253
236
|
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
254
237
|
}
|
|
255
|
-
|
|
256
238
|
return /*#__PURE__*/React.createElement(_Radio, {
|
|
257
239
|
value: val.value,
|
|
258
240
|
key: val.value,
|
|
@@ -265,9 +247,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
265
247
|
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
266
248
|
}));
|
|
267
249
|
break;
|
|
268
|
-
|
|
269
250
|
case 'datePicker': // 使用配置 picker设置其属于week,month,year
|
|
270
|
-
|
|
271
251
|
case 'dateTimePicker':
|
|
272
252
|
compContent = viewOnly ? setDatePickerValue(value, {
|
|
273
253
|
type: type,
|
|
@@ -281,11 +261,9 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
281
261
|
}, defaultProps.style)
|
|
282
262
|
}));
|
|
283
263
|
break;
|
|
284
|
-
|
|
285
264
|
case 'rangePicker':
|
|
286
265
|
case 'rangeTimePicker':
|
|
287
266
|
if (fieldStatus === 'disabled' || defaultProps.disabled) defaultProps.placeholder = ''; // 禁用时,placeHolder不显示
|
|
288
|
-
|
|
289
267
|
compContent = viewOnly ? setDatePickerValue(value, {
|
|
290
268
|
type: type,
|
|
291
269
|
protoConfig: protoConfig
|
|
@@ -297,10 +275,8 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
297
275
|
}, defaultProps.style)
|
|
298
276
|
}));
|
|
299
277
|
break;
|
|
300
|
-
|
|
301
278
|
case 'timePicker':
|
|
302
279
|
if (fieldStatus === 'disabled' || defaultProps.disabled) defaultProps.placeholder = ''; // 禁用时,placeHolder不显示
|
|
303
|
-
|
|
304
280
|
compContent = viewOnly ? setTimePickerValue(value, {
|
|
305
281
|
type: type,
|
|
306
282
|
protoConfig: protoConfig
|
|
@@ -312,11 +288,9 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
312
288
|
})
|
|
313
289
|
}));
|
|
314
290
|
break;
|
|
315
|
-
|
|
316
291
|
case 'timePickerRange':
|
|
317
292
|
if (fieldStatus === 'disabled' || defaultProps.disabled) defaultProps.placeholder = ''; // 禁用时,placeHolder不显示
|
|
318
293
|
// @ts-ignore
|
|
319
|
-
|
|
320
294
|
compContent = viewOnly ? setTimePickerValue(value, {
|
|
321
295
|
type: type,
|
|
322
296
|
protoConfig: protoConfig
|
|
@@ -328,7 +302,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
328
302
|
})
|
|
329
303
|
}));
|
|
330
304
|
break;
|
|
331
|
-
|
|
332
305
|
case 'upload':
|
|
333
306
|
compContent = viewOnly && (!value || value.length === 0) ? '-' : /*#__PURE__*/React.createElement(ReUpload, Object.assign({}, defaultProps, {
|
|
334
307
|
viewOnly: viewOnly,
|
|
@@ -343,14 +316,12 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
343
316
|
name: "upload"
|
|
344
317
|
}), " \u70B9\u51FB\u4E0A\u4F20")));
|
|
345
318
|
break;
|
|
346
|
-
|
|
347
319
|
case 'uploader':
|
|
348
320
|
compContent = viewOnly ? setUploaderValue(value) : /*#__PURE__*/React.createElement(Uploader, Object.assign({}, defaultProps, {
|
|
349
321
|
size: protoConfig === null || protoConfig === void 0 ? void 0 : protoConfig.size
|
|
350
|
-
}));
|
|
351
|
-
|
|
322
|
+
}));
|
|
323
|
+
// compContent = <Uploader {...defaultProps}></Uploader>
|
|
352
324
|
break;
|
|
353
|
-
|
|
354
325
|
case 'cascader':
|
|
355
326
|
compContent = viewOnly ? setCascaderValue(value, {
|
|
356
327
|
selectOptions: selectOptions,
|
|
@@ -363,7 +334,6 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
363
334
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择'
|
|
364
335
|
}, defaultProps));
|
|
365
336
|
break;
|
|
366
|
-
|
|
367
337
|
case 'switch':
|
|
368
338
|
compContent = /*#__PURE__*/React.createElement(_Switch, Object.assign({}, defaultProps, {
|
|
369
339
|
disabled: viewOnly || defaultProps.disabled,
|
|
@@ -371,16 +341,14 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
371
341
|
style: Object.assign(Object.assign({}, defaultProps.style), {
|
|
372
342
|
width: 'auto'
|
|
373
343
|
})
|
|
374
|
-
}));
|
|
375
|
-
|
|
344
|
+
}));
|
|
345
|
+
// compContent = viewOnly ? (String(value) === 'undefined' ? '-' : String(value)) : (<Switch {...defaultProps} checked={value} style={{ ...defaultProps.style, width: 'auto' }} />)
|
|
376
346
|
break;
|
|
377
|
-
|
|
378
347
|
case 'slider':
|
|
379
348
|
compContent = viewOnly ? value : /*#__PURE__*/React.createElement(_Slider, Object.assign({}, defaultProps, {
|
|
380
349
|
style: Object.assign({}, defaultProps.style)
|
|
381
350
|
}));
|
|
382
351
|
break;
|
|
383
|
-
|
|
384
352
|
case 'mentions':
|
|
385
353
|
compContent = viewOnly ? value : /*#__PURE__*/React.createElement(_Mentions, Object.assign({
|
|
386
354
|
placeholder: "\u8BF7\u8F93\u5165 ".concat(defaultProps.prefix || '@', " \u9009\u62E9")
|
|
@@ -391,22 +359,18 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
391
359
|
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
392
360
|
}));
|
|
393
361
|
break;
|
|
394
|
-
|
|
395
362
|
case 'rate':
|
|
396
363
|
compContent = /*#__PURE__*/React.createElement(_Rate, Object.assign({
|
|
397
364
|
disabled: viewOnly || defaultProps.disabled
|
|
398
365
|
}, defaultProps));
|
|
399
366
|
break;
|
|
400
|
-
|
|
401
367
|
case 'custom':
|
|
402
368
|
compContent = defaultProps.render && defaultProps.render(props) || defaultProps.customRender && defaultProps.customRender(props) || null;
|
|
403
369
|
break;
|
|
404
|
-
|
|
405
370
|
default:
|
|
406
371
|
compContent = value;
|
|
407
372
|
break;
|
|
408
373
|
}
|
|
409
|
-
|
|
410
374
|
return compContent;
|
|
411
375
|
});
|
|
412
376
|
export default FieldComponent;
|