fan-standard-comp 3.1.10 → 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 -15
- 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.js +212 -216
- 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 +36 -74
- 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/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.js +30 -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 +113 -157
- package/es/StandardPanel/index.js +19 -35
- package/es/StandardTable/index.js +18 -29
- 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.js +215 -239
- 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 +38 -89
- 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/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.js +28 -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 +115 -182
- package/lib/StandardPanel/index.js +22 -48
- package/lib/StandardTable/index.js +18 -38
- 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 +5 -4
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.filterDictText = filterDictText;
|
|
8
|
+
exports.filterMultiDictText = filterMultiDictText;
|
|
9
|
+
exports.transformDictValue = transformDictValue;
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
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); }
|
|
15
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
16
|
+
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
|
+
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; }
|
|
18
|
+
/**
|
|
19
|
+
* 字典 取值数据
|
|
20
|
+
* author: shomychen
|
|
21
|
+
* date: 2022.12.30
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 字典值替换文本通用方法
|
|
26
|
+
* @param {Array} dictOptions 字典数组
|
|
27
|
+
* @param {String} text 字典值(多个可以用,隔开)
|
|
28
|
+
* @param {Object} optionName 指定字段值(默认 { value: 'value', label: 'label' })
|
|
29
|
+
*
|
|
30
|
+
* @return String
|
|
31
|
+
*/
|
|
32
|
+
function filterDictText(dictOptions, text) {
|
|
33
|
+
var optionName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
34
|
+
value: 'value',
|
|
35
|
+
label: 'label'
|
|
36
|
+
};
|
|
37
|
+
// -- 字典翻译 text 允许逗号分隔 ---
|
|
38
|
+
var dictOptionName = optionName || {
|
|
39
|
+
value: 'value',
|
|
40
|
+
label: 'label'
|
|
41
|
+
};
|
|
42
|
+
if (text != null && Array.isArray(dictOptions)) {
|
|
43
|
+
var result = [];
|
|
44
|
+
// 允许多个逗号分隔,允许传数组对象
|
|
45
|
+
var splitText;
|
|
46
|
+
if (Array.isArray(text)) {
|
|
47
|
+
splitText = text;
|
|
48
|
+
} else {
|
|
49
|
+
splitText = text.toString().trim().split(',');
|
|
50
|
+
}
|
|
51
|
+
var _iterator = _createForOfIteratorHelper(splitText),
|
|
52
|
+
_step;
|
|
53
|
+
try {
|
|
54
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
55
|
+
var txt = _step.value;
|
|
56
|
+
var dictText = txt;
|
|
57
|
+
var _iterator2 = _createForOfIteratorHelper(dictOptions),
|
|
58
|
+
_step2;
|
|
59
|
+
try {
|
|
60
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
61
|
+
var dictItem = _step2.value;
|
|
62
|
+
if (txt.toString() === dictItem[dictOptionName.value || 'value'].toString()) {
|
|
63
|
+
dictText = dictItem[dictOptionName.label || 'label'] || dictItem.text || dictItem.title;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
_iterator2.e(err);
|
|
69
|
+
} finally {
|
|
70
|
+
_iterator2.f();
|
|
71
|
+
}
|
|
72
|
+
result.push(dictText);
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
_iterator.e(err);
|
|
76
|
+
} finally {
|
|
77
|
+
_iterator.f();
|
|
78
|
+
}
|
|
79
|
+
return result.join(',');
|
|
80
|
+
}
|
|
81
|
+
return text;
|
|
82
|
+
// -- 字典翻译 text 允许逗号分隔 ---
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 字典值替换文本通用方法(多选)
|
|
87
|
+
* @param {Array} dictOptions 字典数组
|
|
88
|
+
* @param {String, Array} text 字典值(多个可以用,隔开或者是数组格式)
|
|
89
|
+
* @param {Object} optionName 指定字段值(默认 { value: 'value', label: 'label' })
|
|
90
|
+
*
|
|
91
|
+
* @return String
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
function filterMultiDictText(dictOptions, text) {
|
|
95
|
+
var optionName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
96
|
+
value: 'value',
|
|
97
|
+
label: 'label'
|
|
98
|
+
};
|
|
99
|
+
// js “!text” 认为0为空,所以做提前处理
|
|
100
|
+
var dictOptionName = optionName || {
|
|
101
|
+
value: 'value',
|
|
102
|
+
label: 'label'
|
|
103
|
+
};
|
|
104
|
+
if (text === 0 || text === '0') {
|
|
105
|
+
if (dictOptions) {
|
|
106
|
+
var _iterator3 = _createForOfIteratorHelper(dictOptions),
|
|
107
|
+
_step3;
|
|
108
|
+
try {
|
|
109
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
110
|
+
var dictItem = _step3.value;
|
|
111
|
+
if (text == dictItem[dictOptionName.value || 'value']) {
|
|
112
|
+
return dictItem[dictOptionName.label || 'label'] || dictItem.text || dictItem.title;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} catch (err) {
|
|
116
|
+
_iterator3.e(err);
|
|
117
|
+
} finally {
|
|
118
|
+
_iterator3.f();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!text || text == 'null' || !dictOptions || dictOptions.length == 0) {
|
|
123
|
+
return "";
|
|
124
|
+
}
|
|
125
|
+
var re = "";
|
|
126
|
+
text = text.toString();
|
|
127
|
+
var arr = text.split(",");
|
|
128
|
+
dictOptions.forEach(function (option) {
|
|
129
|
+
if (option) {
|
|
130
|
+
for (var i = 0; i < arr.length; i++) {
|
|
131
|
+
if (arr[i] === option[dictOptionName.value || 'value']) {
|
|
132
|
+
re += (option[dictOptionName.label || 'label'] || option.text || option.title) + ",";
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
if (re == "") {
|
|
139
|
+
return text;
|
|
140
|
+
}
|
|
141
|
+
return re.substring(0, re.length - 1);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 转换数据字典value为整型
|
|
146
|
+
* @param {Array} dictOptions 字典数组
|
|
147
|
+
*
|
|
148
|
+
* @return Array
|
|
149
|
+
* */
|
|
150
|
+
|
|
151
|
+
function transformDictValue(dictOptions) {
|
|
152
|
+
if (Array.isArray(dictOptions)) {
|
|
153
|
+
return dictOptions.map(function (option) {
|
|
154
|
+
return _objectSpread(_objectSpread({}, option), {}, {
|
|
155
|
+
value: Number(option.value)
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
} else {
|
|
159
|
+
return dictOptions;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -3,104 +3,84 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.removeNoPermission = exports.btnIsHide = exports.btnIsDisabled = exports.btnClickFunc = void 0;
|
|
8
7
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
19
|
-
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
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); }
|
|
14
|
+
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); }
|
|
20
15
|
// 按钮方法
|
|
21
16
|
var btnClickFunc = function btnClickFunc(fn) {
|
|
22
17
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
23
18
|
if (!fn) return null;
|
|
24
19
|
var paramsArr = [];
|
|
25
|
-
|
|
26
20
|
if (_typeof(params) === 'object') {
|
|
27
21
|
Object.keys(params).map(function (item) {
|
|
28
22
|
paramsArr.push(params[item]);
|
|
29
23
|
});
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
if (typeof fn === 'function') {
|
|
33
26
|
return fn.apply(void 0, paramsArr); // 表格列返回的是方法
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
return fn;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
};
|
|
31
|
+
// 按钮是否禁用
|
|
40
32
|
exports.btnClickFunc = btnClickFunc;
|
|
41
|
-
|
|
42
33
|
var btnIsDisabled = function btnIsDisabled(isDisabled) {
|
|
43
34
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
35
|
if (!isDisabled) return false;
|
|
45
36
|
var paramsArr = [];
|
|
46
|
-
|
|
47
37
|
if (_typeof(params) === 'object') {
|
|
48
38
|
Object.keys(params).map(function (item) {
|
|
49
39
|
paramsArr.push(params[item]);
|
|
50
40
|
});
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
if (typeof isDisabled === 'function') {
|
|
54
43
|
return isDisabled.apply(void 0, paramsArr); // 表格列返回的是方法
|
|
55
44
|
}
|
|
56
45
|
|
|
57
46
|
return isDisabled;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
};
|
|
48
|
+
// 按钮是否隐藏
|
|
61
49
|
exports.btnIsDisabled = btnIsDisabled;
|
|
62
|
-
|
|
63
50
|
var btnIsHide = function btnIsHide(isHide) {
|
|
64
51
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
65
52
|
if (!isHide) return false;
|
|
66
53
|
var paramsArr = [];
|
|
67
|
-
|
|
68
54
|
if (_typeof(params) === 'object') {
|
|
69
55
|
Object.keys(params).map(function (item) {
|
|
70
56
|
paramsArr.push(params[item]);
|
|
71
57
|
});
|
|
72
58
|
}
|
|
73
|
-
|
|
74
59
|
if (typeof isHide === 'function') {
|
|
75
60
|
return isHide.apply(void 0, paramsArr); // 表格列返回的是方法
|
|
76
61
|
}
|
|
77
62
|
|
|
78
63
|
return isHide;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
|
|
64
|
+
};
|
|
65
|
+
// 重新组合数据(排除不包含在permissionCodes内及isHide数据
|
|
82
66
|
exports.btnIsHide = btnIsHide;
|
|
83
|
-
|
|
84
67
|
var removeNoPermission = function removeNoPermission(array, permissionCodes, codes, params) {
|
|
85
68
|
return Array.isArray(array) && array.filter(function (item) {
|
|
86
69
|
if (item.children) {
|
|
87
70
|
item.children = removeNoPermission(item.children, permissionCodes, codes, params);
|
|
88
71
|
if (item.children.length === 0) return false; // 如果子集合过滤为空时,不返当前数据
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
72
|
+
}
|
|
73
|
+
// permissionCodes未定义,则直接返回不进行过滤
|
|
92
74
|
if (item.hasOwnProperty('code') && permissionCodes) {
|
|
93
75
|
// if (!permissionCodes) return true // permissionCodes未定义,则直接返回不进行过滤
|
|
94
76
|
// 判断是否包含 'code'字段,如果包含则先过滤有在 permissionCodes内的(permissionCodes数组为0时,也不返回数据)
|
|
95
77
|
// 并用是不隐藏的条件
|
|
96
78
|
return permissionCodes.length !== 0 && permissionCodes.includes(item.code) && !btnIsHide(item.isHide, params);
|
|
97
79
|
}
|
|
98
|
-
|
|
99
80
|
if (item.hasOwnProperty('isHide')) {
|
|
100
81
|
// 判断是否包含 'isHide'字段,如果包含则先过滤 isHide 为false
|
|
101
82
|
return !btnIsHide(item.isHide, params);
|
|
102
83
|
}
|
|
103
|
-
|
|
104
84
|
return true;
|
|
105
85
|
}).map(function (resultItem) {
|
|
106
86
|
// 与codes进行对比,相应的 code匹配以对应的name,icon,code返回
|
|
@@ -109,19 +89,15 @@ var removeNoPermission = function removeNoPermission(array, permissionCodes, cod
|
|
|
109
89
|
var matchIndex = _lodash.default.findIndex(codes, function (btnItem) {
|
|
110
90
|
return btnItem.code === resultItem.code;
|
|
111
91
|
});
|
|
112
|
-
|
|
113
92
|
if (matchIndex !== -1) {
|
|
114
93
|
var _codes$matchIndex;
|
|
115
|
-
|
|
116
94
|
// 如果有配置code,则使用func.code.js里面配置的名称
|
|
117
95
|
resultItem = _objectSpread(_objectSpread(_objectSpread({}, resultItem), codes[matchIndex]), {}, {
|
|
118
96
|
icon: resultItem.icon || ((_codes$matchIndex = codes[matchIndex]) === null || _codes$matchIndex === void 0 ? void 0 : _codes$matchIndex.icon)
|
|
119
97
|
});
|
|
120
98
|
}
|
|
121
99
|
}
|
|
122
|
-
|
|
123
100
|
return resultItem;
|
|
124
101
|
});
|
|
125
102
|
};
|
|
126
|
-
|
|
127
103
|
exports.removeNoPermission = removeNoPermission;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.getParentNodes = exports.getNodePaths = exports.getChildrenNodes = void 0;
|
|
8
7
|
/**
|
|
9
8
|
* @description 递归查看父级节点数据集合及当前节点数据
|
|
10
9
|
* @params {Array} list 当前需要过滤查看的数据集合、
|
|
@@ -27,42 +26,34 @@ var getParentNodes = function getParentNodes(list, nodeKey) {
|
|
|
27
26
|
// const childrenParams = ['menuItems', 'menuFuncItems', 'items']
|
|
28
27
|
var matchNode = [];
|
|
29
28
|
var parentKeys = []; // 存储查找到的节点的父节点数据
|
|
30
|
-
|
|
31
29
|
var nodeParent = []; // 存储查找到的节点的父节点数据
|
|
32
30
|
// 移除上一次累加的数据
|
|
33
|
-
|
|
34
31
|
var removePrevIndex = function removePrevIndex(array, item) {
|
|
35
32
|
for (var i = 0; i < array.length; i += 1) {
|
|
36
33
|
if (array[i][params.keyParam] === item[params.keyParam]) {
|
|
37
34
|
return i;
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
return null;
|
|
42
38
|
};
|
|
43
|
-
|
|
44
39
|
var deepFind = function deepFind(array, nodeId) {
|
|
45
40
|
for (var i = 0; i < array.length; i += 1) {
|
|
46
41
|
var node = array[i];
|
|
47
|
-
|
|
48
42
|
if (node[params.keyParam] === nodeId) {
|
|
49
43
|
matchNode.splice(0, 1, node); // 查找到则赋值,且跳出循环
|
|
50
|
-
|
|
51
44
|
break;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
}
|
|
46
|
+
// 如果是单个
|
|
55
47
|
if (node[params.childrenParam] && node[params.childrenParam].length > 0) {
|
|
56
48
|
deepFind(node[params.childrenParam] || node[params.childrenParam], nodeId);
|
|
57
49
|
nodeParent.push(node); // 将当前节点数据存储到父节点数据中
|
|
58
|
-
|
|
59
50
|
if (matchNode.length > 0) {
|
|
60
51
|
break; // 在子节点查找到了,需要跳出
|
|
61
52
|
} else {
|
|
62
53
|
nodeParent.splice(removePrevIndex(nodeParent, node), 1); // 如果在子节点没有查找到,则将原来添加的父节点数据移除
|
|
63
54
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
55
|
+
}
|
|
56
|
+
// 其他条件
|
|
66
57
|
/* else if (node.menuFuncItems && node.menuFuncItems.length > 0) {
|
|
67
58
|
deepFind(node.menuFuncItems, nodeId);
|
|
68
59
|
nodeParent.push(node); // 将当前节点数据存储到父节点数据中
|
|
@@ -90,33 +81,27 @@ var getParentNodes = function getParentNodes(list, nodeKey) {
|
|
|
90
81
|
nodeParent.splice(removePrevIndex(nodeParent, node), 1); // 如果在子节点没有查找到,则将原来添加的父节点数据移除
|
|
91
82
|
}
|
|
92
83
|
}*/
|
|
93
|
-
|
|
94
84
|
}
|
|
95
85
|
|
|
96
86
|
return matchNode; // 返回查找到的节点数据(格式为数组)
|
|
97
|
-
};
|
|
98
|
-
|
|
87
|
+
};
|
|
99
88
|
|
|
89
|
+
// 查找单个节点
|
|
100
90
|
var findMatchItem = function findMatchItem(arrList, key) {
|
|
101
91
|
var matchItem;
|
|
102
|
-
|
|
103
92
|
for (var i = 0; i < arrList.length; i += 1) {
|
|
104
93
|
var node = arrList[i];
|
|
105
|
-
|
|
106
94
|
if (node[params.keyParam] === key) {
|
|
107
95
|
matchItem = node;
|
|
108
96
|
break;
|
|
109
97
|
}
|
|
110
|
-
|
|
111
98
|
if (node[params.childrenParam]) {
|
|
112
99
|
matchItem = findMatchItem(node[params.childrenParam], key);
|
|
113
100
|
}
|
|
114
101
|
}
|
|
115
|
-
|
|
116
102
|
return matchItem;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
|
|
103
|
+
};
|
|
104
|
+
// nodeKey 为数组时返回当前数据(TODO。目前仅返回一级,多级情况未判断,且 nodeParent 值也未调整)
|
|
120
105
|
if (Array.isArray(nodeKey)) {
|
|
121
106
|
// const {showCheckedStrategy} = extraProps;
|
|
122
107
|
// TODO 需要判断 showCheckedStrategy 值为 SHOW_PARENT、 SHOW_CHILD 、SHOW_ALL不同情况展示
|
|
@@ -127,31 +112,30 @@ var getParentNodes = function getParentNodes(list, nodeKey) {
|
|
|
127
112
|
} else {
|
|
128
113
|
deepFind(list, nodeKey);
|
|
129
114
|
}
|
|
130
|
-
|
|
131
115
|
nodeParent.forEach(function (par) {
|
|
132
116
|
return parentKeys.push(par[params.keyParam]);
|
|
133
117
|
}); // 将所有父节点的关键值(keyParam指定字段名)的数据集合在数组内
|
|
134
|
-
|
|
135
118
|
return {
|
|
136
119
|
nodeParent: nodeParent,
|
|
137
120
|
parentKeys: parentKeys,
|
|
138
121
|
matchNode: matchNode
|
|
139
122
|
}; // 最终查找到的父节点数组 // nodeParent.concat(result || []);
|
|
140
123
|
};
|
|
124
|
+
|
|
141
125
|
/**
|
|
142
|
-
* @description
|
|
126
|
+
* @description 递归查找树的所有节点及id
|
|
143
127
|
* @params {Array} childNode 当前需要过滤查看的数据集合、
|
|
144
128
|
* @params {Object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
145
|
-
*
|
|
146
|
-
*
|
|
129
|
+
* @value { String } childrenParam:指当前子集合数据字段名(字符串表示单个,数组表示当前多个子集合字段名)
|
|
130
|
+
* @value { String } keyParam: 指当前匹配标识值字段名)
|
|
147
131
|
*
|
|
148
132
|
* @result {Array} childKeys 所有子项的id
|
|
149
|
-
* @result {Array} nodeChildren
|
|
133
|
+
* @result {Array} nodeChildren 所有节点数据对象集合
|
|
134
|
+
*
|
|
135
|
+
* @usage:
|
|
136
|
+
* getChildrenNodes(childNode, params)
|
|
150
137
|
* */
|
|
151
|
-
|
|
152
|
-
|
|
153
138
|
exports.getParentNodes = getParentNodes;
|
|
154
|
-
|
|
155
139
|
var getChildrenNodes = function getChildrenNodes(childNode) {
|
|
156
140
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
157
141
|
childrenParam: 'children',
|
|
@@ -159,7 +143,6 @@ var getChildrenNodes = function getChildrenNodes(childNode) {
|
|
|
159
143
|
};
|
|
160
144
|
var childKeys = [];
|
|
161
145
|
var nodeChildren = []; // 存储:authId, types
|
|
162
|
-
|
|
163
146
|
var deepFindChild = function deepFindChild(cList) {
|
|
164
147
|
Array.isArray(cList) && cList.forEach(function (item) {
|
|
165
148
|
childKeys.push(item[params.keyParam]);
|
|
@@ -167,51 +150,45 @@ var getChildrenNodes = function getChildrenNodes(childNode) {
|
|
|
167
150
|
if (item[params.childrenParam]) deepFindChild(item[params.childrenParam]);
|
|
168
151
|
});
|
|
169
152
|
};
|
|
170
|
-
|
|
171
153
|
deepFindChild(childNode);
|
|
172
154
|
return {
|
|
173
155
|
childKeys: childKeys,
|
|
174
156
|
nodeChildren: nodeChildren
|
|
175
157
|
};
|
|
176
|
-
};
|
|
177
|
-
|
|
158
|
+
};
|
|
178
159
|
|
|
160
|
+
// 查找节点路径
|
|
179
161
|
exports.getChildrenNodes = getChildrenNodes;
|
|
180
|
-
|
|
181
162
|
var getNodePaths = function getNodePaths(list, nodeKey) {
|
|
182
163
|
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
183
164
|
childrenParam: 'children',
|
|
184
165
|
keyParam: 'value'
|
|
185
166
|
};
|
|
186
167
|
var extraProps = arguments.length > 3 ? arguments[3] : undefined;
|
|
187
|
-
|
|
188
168
|
// 获取指定节点的路径数组
|
|
189
169
|
var getPathByKey = function getPathByKey(value, arr) {
|
|
190
170
|
var findNodePath = function findNodePath(node, value, nodePathArray) {
|
|
191
171
|
// 这里可以自定义push的内容,而不是整个node,而且这里node也包含了children
|
|
192
|
-
nodePathArray.push(node);
|
|
193
|
-
|
|
172
|
+
nodePathArray.push(node);
|
|
173
|
+
// 找到符合条件的节点,通过throw终止掉递归
|
|
194
174
|
if (node[params.keyParam] === value) {
|
|
195
175
|
// 也可以直接使用return;结束循环
|
|
196
176
|
throw "over!";
|
|
197
177
|
}
|
|
198
|
-
|
|
199
178
|
if (node[params.childrenParam] && node[params.childrenParam].length > 0) {
|
|
200
179
|
for (var i = 0; i < node[params.childrenParam].length; i++) {
|
|
201
180
|
findNodePath(node[params.childrenParam][i], value, nodePathArray);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
181
|
+
}
|
|
182
|
+
// 当前节点的子节点遍历完依旧没找到,则删除路径中的该节点
|
|
205
183
|
nodePathArray.pop();
|
|
206
184
|
} else {
|
|
207
185
|
// 找到叶子节点时,删除路径当中的该叶子节点
|
|
208
186
|
nodePathArray.pop();
|
|
209
187
|
}
|
|
210
|
-
};
|
|
211
|
-
|
|
188
|
+
};
|
|
212
189
|
|
|
190
|
+
// 用于存储节点唯一标识值路径数组
|
|
213
191
|
var nodePathArray = [];
|
|
214
|
-
|
|
215
192
|
try {
|
|
216
193
|
for (var i = 0; i < arr.length; i++) {
|
|
217
194
|
findNodePath(arr[i], value, nodePathArray);
|
|
@@ -220,17 +197,13 @@ var getNodePaths = function getNodePaths(list, nodeKey) {
|
|
|
220
197
|
return nodePathArray;
|
|
221
198
|
}
|
|
222
199
|
};
|
|
223
|
-
|
|
224
200
|
var pathNode = [];
|
|
225
|
-
|
|
226
201
|
if (Array.isArray(nodeKey)) {
|
|
227
202
|
nodeKey.map(function (key) {
|
|
228
203
|
var pathItems = getPathByKey(key, list);
|
|
229
204
|
if (pathItems) pathNode.push(pathItems);
|
|
230
205
|
});
|
|
231
206
|
}
|
|
232
|
-
|
|
233
207
|
return pathNode;
|
|
234
208
|
};
|
|
235
|
-
|
|
236
209
|
exports.getNodePaths = getNodePaths;
|
package/lib/utils/index.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
UtilValueFormat: true,
|
|
8
|
+
getParentNodes: true,
|
|
9
|
+
getChildrenNodes: true,
|
|
10
|
+
getNodePaths: true
|
|
11
|
+
};
|
|
6
12
|
Object.defineProperty(exports, "UtilValueFormat", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
9
15
|
return _ValueFormat.default;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
|
-
Object.defineProperty(exports, "getParentNodes", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _getParentNodes.getParentNodes;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
18
|
Object.defineProperty(exports, "getChildrenNodes", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
@@ -27,9 +27,24 @@ Object.defineProperty(exports, "getNodePaths", {
|
|
|
27
27
|
return _getParentNodes.getNodePaths;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
Object.defineProperty(exports, "getParentNodes", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _getParentNodes.getParentNodes;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
31
36
|
var _ValueFormat = _interopRequireDefault(require("./ValueFormat"));
|
|
32
|
-
|
|
33
37
|
var _getParentNodes = require("./getParentNodes");
|
|
34
|
-
|
|
38
|
+
var _dictSelectUtil = require("./dictSelectUtil");
|
|
39
|
+
Object.keys(_dictSelectUtil).forEach(function (key) {
|
|
40
|
+
if (key === "default" || key === "__esModule") return;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
+
if (key in exports && exports[key] === _dictSelectUtil[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _dictSelectUtil[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
35
50
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fan-standard-comp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "FZ standard-comp,basic of antd4.0 and custom component.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -26,22 +26,23 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@ant-design/icons": "^4.3.0",
|
|
28
28
|
"@types/classnames": "^2.2.11",
|
|
29
|
-
"antd": "4.24.
|
|
29
|
+
"antd": "4.24.12",
|
|
30
30
|
"babel-loader": "^8.2.2",
|
|
31
31
|
"babel-plugin-import": "^1.13.3",
|
|
32
32
|
"classnames": "^2.2.6",
|
|
33
33
|
"dumi": "1.1.20",
|
|
34
|
-
"father-build": "^1.
|
|
34
|
+
"father-build": "^1.22.5",
|
|
35
35
|
"lodash": "^4.17.15",
|
|
36
36
|
"react": "^16.11.0",
|
|
37
37
|
"react-dom": "^16.11.0",
|
|
38
38
|
"webpack-cli": "4.3.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"ant-design-draggable-modal": "^1.0.0",
|
|
42
41
|
"css-loader": "3.6.0",
|
|
43
42
|
"file-loader": "6.2.0",
|
|
43
|
+
"gulp-typescript": "5.0.1",
|
|
44
44
|
"less-loader": "5.0.0",
|
|
45
|
+
"react-uid": "^2.3.3",
|
|
45
46
|
"style-loader": "1.3.0",
|
|
46
47
|
"webpack": "4.44.1"
|
|
47
48
|
}
|