fan-standard-comp 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fan-standard-comp.umd.js +293 -285
- package/es/ButtonGroup/ButtonList.js +18 -36
- package/es/ButtonGroup/ButtonMenu.js +14 -27
- package/es/ButtonGroup/PopConfirmTitle.js +5 -16
- package/es/ButtonGroup/index.js +76 -107
- package/es/DragContent/DragBar.js +6 -18
- package/es/DragContent/index.js +12 -30
- package/es/FormComp/ChunkUploader/api.js +8 -21
- package/es/FormComp/ChunkUploader/index.js +27 -46
- package/es/FormComp/ChunkUploader/lib.js +9 -26
- package/es/FormComp/ChunkUploader/upload-queue.class.js +5 -12
- package/es/FormComp/ChunkUploader/worker.js +2 -7
- package/es/FormComp/EditButton/index.js +16 -35
- package/es/FormComp/FieldComponent/ReUpload.js +18 -38
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +26 -49
- package/es/FormComp/FieldComponent/TitleNode.js +3 -13
- package/es/FormComp/FieldComponent/index.js +81 -125
- package/es/FormComp/FieldComponent/setReadonlyValues.js +28 -55
- package/es/FormComp/RenderItemGroup/index.js +34 -55
- package/es/FormComp/Uploader/index.js +38 -64
- package/es/FormComp/Uploader/util.js +2 -11
- package/es/FormComp/VarTemplate/index.js +31 -44
- package/es/FormComp/index.js +1 -15
- package/es/NavLeafScroll/index.js +35 -53
- package/es/RefactorTree/index.js +29 -52
- package/es/RefactorTree/indexTreeNode.js +31 -54
- package/es/RefactorTree/style/index.js +1 -3
- package/es/RefactorTree/util.js +10 -18
- package/es/SpecIcon/fonts/iconfont.js +0 -2
- package/es/SpecIcon/index.js +17 -30
- package/es/SplitterLayout/Pane.js +5 -17
- package/es/SplitterLayout/index.js +13 -24
- package/es/StandardContent/SplitterLayout/Pane.js +13 -25
- package/es/StandardContent/SplitterLayout/index.js +30 -43
- package/es/StandardContent/SubfieldContent.js +13 -28
- package/es/StandardContent/WrapperContent.js +10 -24
- package/es/StandardDragModal/index.d.ts +11 -0
- package/es/StandardDragModal/index.js +30 -0
- package/es/StandardFilter/index.js +27 -46
- package/es/StandardForm/ActionList.js +8 -21
- package/es/StandardForm/StepForm.js +40 -68
- package/es/StandardForm/TabForm.js +26 -52
- package/es/StandardForm/index.js +28 -55
- package/es/StandardModal/UpdateFormRef.js +4 -18
- package/es/StandardModal/index.d.ts +3 -0
- package/es/StandardModal/index.js +118 -119
- package/es/StandardPanel/index.js +32 -53
- package/es/StandardTable/index.js +18 -36
- package/es/StandardTable/style/index.js +1 -3
- package/es/components/IconNode/index.js +6 -17
- package/es/components/index.js +2 -15
- package/es/data/func.code.js +2 -9
- package/es/data/general.config.js +2 -9
- package/es/data/index.js +3 -23
- package/es/index.js +24 -229
- package/es/utils/ValueFormat.js +1 -9
- package/es/utils/filterPermission.js +4 -20
- package/es/utils/getParentNodes.js +1 -12
- package/es/utils/index.js +3 -35
- package/lib/ButtonGroup/ButtonList.js +9 -9
- package/lib/ButtonGroup/ButtonMenu.js +11 -11
- package/lib/ButtonGroup/PopConfirmTitle.js +5 -5
- package/lib/ButtonGroup/index.js +47 -47
- package/lib/DragContent/DragBar.js +5 -5
- package/lib/DragContent/index.js +7 -7
- package/lib/FormComp/ChunkUploader/api.js +4 -4
- package/lib/FormComp/ChunkUploader/index.js +10 -10
- package/lib/FormComp/ChunkUploader/lib.js +2 -2
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +2 -2
- package/lib/FormComp/ChunkUploader/worker.js +2 -2
- package/lib/FormComp/EditButton/index.js +10 -10
- package/lib/FormComp/FieldComponent/ReUpload.js +9 -9
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +16 -16
- package/lib/FormComp/FieldComponent/TitleNode.js +4 -4
- package/lib/FormComp/FieldComponent/index.js +41 -41
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +17 -17
- package/lib/FormComp/RenderItemGroup/index.js +20 -20
- package/lib/FormComp/Uploader/index.js +16 -16
- package/lib/FormComp/VarTemplate/index.js +25 -23
- package/lib/FormComp/index.js +2 -2
- package/lib/NavLeafScroll/index.js +28 -28
- package/lib/RefactorTree/index.js +14 -14
- package/lib/RefactorTree/indexTreeNode.js +19 -19
- package/lib/SpecIcon/index.js +13 -13
- package/lib/SplitterLayout/Pane.js +4 -4
- package/lib/SplitterLayout/index.js +10 -10
- package/lib/StandardContent/SplitterLayout/Pane.js +11 -11
- package/lib/StandardContent/SplitterLayout/index.js +27 -27
- package/lib/StandardContent/SubfieldContent.js +9 -9
- package/lib/StandardContent/WrapperContent.js +7 -7
- package/lib/StandardDragModal/index.d.ts +11 -0
- package/lib/StandardDragModal/index.js +43 -0
- package/lib/StandardFilter/index.js +18 -18
- package/lib/StandardForm/ActionList.js +6 -6
- package/lib/StandardForm/StepForm.js +26 -26
- package/lib/StandardForm/TabForm.js +13 -13
- package/lib/StandardForm/index.js +14 -14
- package/lib/StandardModal/UpdateFormRef.js +4 -4
- package/lib/StandardModal/index.d.ts +3 -0
- package/lib/StandardModal/index.js +99 -70
- package/lib/StandardPanel/index.js +23 -23
- package/lib/StandardTable/index.js +9 -10
- package/lib/components/IconNode/index.js +6 -6
- package/lib/components/index.js +2 -2
- package/lib/data/func.code.js +2 -2
- package/lib/data/general.config.js +2 -2
- package/lib/data/index.js +3 -3
- package/lib/index.js +22 -22
- package/lib/utils/ValueFormat.js +2 -2
- package/lib/utils/filterPermission.js +2 -2
- package/lib/utils/index.js +2 -2
- package/package.json +4 -3
- package/es/ConfigContext/index.d.ts +0 -7
- package/es/ConfigContext/index.js +0 -12
- package/es/locale/index.d.ts +0 -12
- package/es/locale/index.js +0 -5
- package/es/locale/zh_CN.d.ts +0 -4
- package/es/locale/zh_CN.js +0 -34
- package/lib/ConfigContext/index.d.ts +0 -7
- package/lib/ConfigContext/index.js +0 -12
- package/lib/locale/index.d.ts +0 -12
- package/lib/locale/index.js +0 -5
- package/lib/locale/zh_CN.d.ts +0 -4
- package/lib/locale/zh_CN.js +0 -34
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
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); }
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
require("antd/es/badge/style");
|
|
11
|
-
|
|
12
|
-
var _badge = _interopRequireDefault(require("antd/es/badge"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
|
-
var _index = _interopRequireDefault(require("../SpecIcon/index"));
|
|
17
|
-
|
|
18
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
19
|
-
|
|
20
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
-
|
|
22
|
-
require("./style/index.less");
|
|
23
|
-
|
|
24
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
25
|
-
|
|
26
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
3
|
+
import "antd/es/badge/style";
|
|
4
|
+
import _Badge from "antd/es/badge";
|
|
29
5
|
|
|
30
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
7
|
|
|
@@ -43,12 +19,19 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
43
19
|
|
|
44
20
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
21
|
|
|
46
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
22
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
23
|
|
|
48
24
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
25
|
|
|
50
26
|
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; }
|
|
51
27
|
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
import React, { Component } from 'react';
|
|
30
|
+
import SpecIcon from "../SpecIcon/index";
|
|
31
|
+
import _ from 'lodash';
|
|
32
|
+
import classNames from 'classnames';
|
|
33
|
+
import './style/index.less';
|
|
34
|
+
|
|
52
35
|
var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
53
36
|
_inherits(NavLeafScroll, _Component);
|
|
54
37
|
|
|
@@ -101,7 +84,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
101
84
|
});
|
|
102
85
|
|
|
103
86
|
if (activeKey && navList.length > 0) {
|
|
104
|
-
var matchIndex =
|
|
87
|
+
var matchIndex = _.findIndex(navList, function (item) {
|
|
105
88
|
return item[(optionName === null || optionName === void 0 ? void 0 : optionName.key) || 'id'] === activeKey;
|
|
106
89
|
});
|
|
107
90
|
|
|
@@ -206,9 +189,9 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
206
189
|
stepSize: 0 // 当前一页可容纳的单元格数量
|
|
207
190
|
|
|
208
191
|
};
|
|
209
|
-
_this.mainWrap = /*#__PURE__*/
|
|
210
|
-
_this.leafWrap = /*#__PURE__*/
|
|
211
|
-
_this.leafNav = /*#__PURE__*/
|
|
192
|
+
_this.mainWrap = /*#__PURE__*/React.createRef();
|
|
193
|
+
_this.leafWrap = /*#__PURE__*/React.createRef();
|
|
194
|
+
_this.leafNav = /*#__PURE__*/React.createRef();
|
|
212
195
|
_this.initFloorValues = _this.initFloorValues.bind(_assertThisInitialized(_this));
|
|
213
196
|
return _this;
|
|
214
197
|
}
|
|
@@ -280,7 +263,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
280
263
|
}
|
|
281
264
|
|
|
282
265
|
if (activeKey !== prevProps.activeKey) {
|
|
283
|
-
var matchIndex =
|
|
266
|
+
var matchIndex = _.findIndex(navList, function (item) {
|
|
284
267
|
return item[optionName.key] === activeKey;
|
|
285
268
|
});
|
|
286
269
|
|
|
@@ -324,8 +307,8 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
324
307
|
showArrow = _this$state4.showArrow,
|
|
325
308
|
arrowPermit = _this$state4.arrowPermit,
|
|
326
309
|
leafNavScrollY = _this$state4.leafNavScrollY;
|
|
327
|
-
return /*#__PURE__*/
|
|
328
|
-
className: (
|
|
310
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
311
|
+
className: classNames(className, "nav-leaf"),
|
|
329
312
|
style: width ? {
|
|
330
313
|
width: "".concat(width, "px")
|
|
331
314
|
} : {},
|
|
@@ -333,32 +316,32 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
333
316
|
,
|
|
334
317
|
onMouseEnter: this.mouseEnter,
|
|
335
318
|
onMouseLeave: this.mouseLeave
|
|
336
|
-
}, /*#__PURE__*/
|
|
319
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
337
320
|
className: "nav-leaf-container nav-leaf-container-scroll",
|
|
338
321
|
style: !showArrow || noArrowPadding ? {
|
|
339
322
|
padding: 0
|
|
340
323
|
} : {},
|
|
341
324
|
"data-prev": showArrow
|
|
342
|
-
}, /*#__PURE__*/
|
|
343
|
-
className: (
|
|
325
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
326
|
+
className: classNames("nav-leaf-arrow nav-leaf-btn-prev", showArrow ? '' : 'is-hide', arrowPermit.prev ? '' : 'is-disabled'),
|
|
344
327
|
onClick: function onClick() {
|
|
345
328
|
return arrowPermit.prev ? _this2.handleLeafControl('prev') : '';
|
|
346
329
|
}
|
|
347
|
-
}, /*#__PURE__*/
|
|
330
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
348
331
|
name: "caret-up"
|
|
349
|
-
})), /*#__PURE__*/
|
|
350
|
-
className: (
|
|
332
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
333
|
+
className: classNames("nav-leaf-arrow nav-leaf-btn-next", showArrow ? '' : 'is-hide', arrowPermit.next ? '' : 'is-disabled'),
|
|
351
334
|
onClick: function onClick() {
|
|
352
335
|
return arrowPermit.next ? _this2.handleLeafControl('next') : '';
|
|
353
336
|
}
|
|
354
|
-
}, /*#__PURE__*/
|
|
337
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
355
338
|
name: "caret-down"
|
|
356
|
-
})), /*#__PURE__*/
|
|
339
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
357
340
|
className: "nav-leaf-wrap",
|
|
358
341
|
ref: this.leafWrap
|
|
359
|
-
}, /*#__PURE__*/
|
|
342
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
360
343
|
className: "nav-leaf-scroll"
|
|
361
|
-
}, /*#__PURE__*/
|
|
344
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
362
345
|
className: "nav-leaf-nav",
|
|
363
346
|
ref: this.leafNav,
|
|
364
347
|
style: {
|
|
@@ -367,22 +350,22 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
367
350
|
}, navList && navList.length > 0 ? navList.map(function (item, i) {
|
|
368
351
|
var _this2$props;
|
|
369
352
|
|
|
370
|
-
return /*#__PURE__*/
|
|
353
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
371
354
|
key: item[optionName.key],
|
|
372
|
-
className: (
|
|
355
|
+
className: classNames('nav-leaf-item', activeKey && activeKey === item[optionName.key] ? 'is-active' : ''),
|
|
373
356
|
style: {
|
|
374
357
|
height: "".concat(((_this2$props = _this2.props) === null || _this2$props === void 0 ? void 0 : _this2$props.baseItemHeight) || 40, "px")
|
|
375
358
|
},
|
|
376
359
|
onClick: function onClick() {
|
|
377
360
|
return _this2.handleItemControl(item[optionName.key], item);
|
|
378
361
|
}
|
|
379
|
-
}, customLeafNode ? customLeafNode(item) : /*#__PURE__*/
|
|
362
|
+
}, customLeafNode ? customLeafNode(item) : /*#__PURE__*/React.createElement(React.Fragment, null, item[optionName.title] && /*#__PURE__*/React.createElement("span", {
|
|
380
363
|
className: "leaf-title"
|
|
381
|
-
}, "".concat(item[optionName.title]), " "), item[optionName.count] ? /*#__PURE__*/
|
|
364
|
+
}, "".concat(item[optionName.title]), " "), item[optionName.count] ? /*#__PURE__*/React.createElement("span", {
|
|
382
365
|
className: "leaf-extra"
|
|
383
|
-
}, " ", /*#__PURE__*/
|
|
366
|
+
}, " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
384
367
|
name: "warn-fill"
|
|
385
|
-
}), /*#__PURE__*/
|
|
368
|
+
}), /*#__PURE__*/React.createElement(_Badge, {
|
|
386
369
|
className: "warning-count",
|
|
387
370
|
count: item[optionName.count]
|
|
388
371
|
})) : null));
|
|
@@ -391,7 +374,6 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
391
374
|
}]);
|
|
392
375
|
|
|
393
376
|
return NavLeafScroll;
|
|
394
|
-
}(
|
|
377
|
+
}(Component);
|
|
395
378
|
|
|
396
|
-
|
|
397
|
-
exports["default"] = _default;
|
|
379
|
+
export default NavLeafScroll;
|
package/es/RefactorTree/index.js
CHANGED
|
@@ -1,41 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import "antd/es/tree/style";
|
|
2
|
+
import _Tree from "antd/es/tree";
|
|
3
|
+
import "antd/es/empty/style";
|
|
4
|
+
import _Empty from "antd/es/empty";
|
|
5
|
+
import "antd/es/popconfirm/style";
|
|
6
|
+
import _Popconfirm from "antd/es/popconfirm";
|
|
2
7
|
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
require("antd/es/tree/style");
|
|
11
|
-
|
|
12
|
-
var _tree = _interopRequireDefault(require("antd/es/tree"));
|
|
13
|
-
|
|
14
|
-
require("antd/es/empty/style");
|
|
15
|
-
|
|
16
|
-
var _empty = _interopRequireDefault(require("antd/es/empty"));
|
|
17
|
-
|
|
18
|
-
require("antd/es/popconfirm/style");
|
|
19
|
-
|
|
20
|
-
var _popconfirm = _interopRequireDefault(require("antd/es/popconfirm"));
|
|
21
|
-
|
|
22
|
-
var _tslib = require("tslib");
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
-
|
|
26
|
-
var _index = _interopRequireDefault(require("../SpecIcon/index"));
|
|
27
|
-
|
|
28
|
-
var _util = require("./util");
|
|
29
|
-
|
|
30
|
-
require("./style/index.less");
|
|
31
|
-
|
|
32
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8
|
+
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; }
|
|
35
9
|
|
|
36
|
-
|
|
10
|
+
import { __rest } from "tslib"; // 重构树控件,可直接配置数据
|
|
37
11
|
|
|
38
|
-
|
|
12
|
+
import React, { useMemo } from 'react';
|
|
13
|
+
import SpecIcon from '../SpecIcon/index';
|
|
14
|
+
import { transDataParam, resetDataWithLimit, resetDataWithDisabled } from './util';
|
|
15
|
+
import './style/index.less';
|
|
39
16
|
|
|
40
17
|
var RefactorTree = function RefactorTree(props) {
|
|
41
18
|
var treeData = props.treeData,
|
|
@@ -61,13 +38,14 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
61
38
|
onCheck = props.onCheck,
|
|
62
39
|
titleRender = props.titleRender,
|
|
63
40
|
disabledFields = props.disabledFields,
|
|
64
|
-
otherProps =
|
|
41
|
+
otherProps = __rest(props, ["treeData", "rootName", "rootKey", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck", "titleRender", "disabledFields"]); // const { title, value, children, disabled } = { value: 'value', title: 'title', children: 'children', disabled: 'disabled', ...optionName }
|
|
65
42
|
// 重新组合指定数据源字段
|
|
66
43
|
|
|
67
|
-
|
|
44
|
+
|
|
45
|
+
var transTreeData = useMemo(function () {
|
|
68
46
|
var _ref;
|
|
69
47
|
|
|
70
|
-
var afterTransData =
|
|
48
|
+
var afterTransData = transDataParam(treeData, optionName); // 通过转换后的数据
|
|
71
49
|
|
|
72
50
|
var resultData; // 如果有配置根节点,则添加 一个根节点数据
|
|
73
51
|
|
|
@@ -75,12 +53,12 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
75
53
|
|
|
76
54
|
if (checkStrictly && limitKey && checkedKeys) {
|
|
77
55
|
if (Array.isArray(checkedKeys) && checkedKeys.length > 0 || checkedKeys && Array.isArray(checkedKeys.checked) && checkedKeys.checked.length > 0) {
|
|
78
|
-
resultData =
|
|
56
|
+
resultData = resetDataWithLimit(Array.isArray(checkedKeys) ? checkedKeys : checkedKeys.checked, resultData, optionName, limitKey);
|
|
79
57
|
}
|
|
80
58
|
}
|
|
81
59
|
|
|
82
60
|
if (disabledFields && Array.isArray(disabledFields)) {
|
|
83
|
-
resultData =
|
|
61
|
+
resultData = resetDataWithDisabled(resultData, optionName, disabledFields);
|
|
84
62
|
}
|
|
85
63
|
|
|
86
64
|
return resultData;
|
|
@@ -128,35 +106,35 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
128
106
|
|
|
129
107
|
var renderNodeTitle = function renderNodeTitle(item) {
|
|
130
108
|
if (titleRender) return titleRender(item);
|
|
131
|
-
return /*#__PURE__*/
|
|
109
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, item[optionName.title || 'title'], nodeControl ? /*#__PURE__*/React.createElement("span", {
|
|
132
110
|
className: "treeControl"
|
|
133
|
-
}, /*#__PURE__*/
|
|
111
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
134
112
|
onClick: function onClick(e) {
|
|
135
113
|
handleNodeControl(e, 'edit', item);
|
|
136
114
|
}
|
|
137
|
-
}, /*#__PURE__*/
|
|
115
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
138
116
|
name: 'edit'
|
|
139
|
-
})), /*#__PURE__*/
|
|
117
|
+
})), /*#__PURE__*/React.createElement(_Popconfirm, {
|
|
140
118
|
placement: 'top',
|
|
141
119
|
title: "\u786E\u5B9A\u8981\u5220\u9664\uFF1A".concat(item[optionName.title || 'title'], "\u5417\uFF1F"),
|
|
142
|
-
icon: /*#__PURE__*/
|
|
120
|
+
icon: /*#__PURE__*/React.createElement(SpecIcon, {
|
|
143
121
|
name: "question"
|
|
144
122
|
}),
|
|
145
123
|
onConfirm: function onConfirm(e) {
|
|
146
124
|
handleNodeControl(e, 'delete', item);
|
|
147
125
|
}
|
|
148
|
-
}, /*#__PURE__*/
|
|
126
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
149
127
|
onClick: function onClick(e) {
|
|
150
128
|
return e.stopPropagation();
|
|
151
129
|
}
|
|
152
|
-
}, /*#__PURE__*/
|
|
130
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
153
131
|
name: 'delete'
|
|
154
132
|
})))) : null, nodeExtra && nodeExtra(item));
|
|
155
133
|
};
|
|
156
134
|
|
|
157
135
|
if (transTreeData.length == 0) {
|
|
158
|
-
return /*#__PURE__*/
|
|
159
|
-
image:
|
|
136
|
+
return /*#__PURE__*/React.createElement(_Empty, {
|
|
137
|
+
image: _Empty.PRESENTED_IMAGE_SIMPLE,
|
|
160
138
|
description: emptyDescription
|
|
161
139
|
});
|
|
162
140
|
} else {
|
|
@@ -168,7 +146,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
168
146
|
defExpand = rootKey ? [rootKey] : ['0'];
|
|
169
147
|
}
|
|
170
148
|
|
|
171
|
-
return /*#__PURE__*/
|
|
149
|
+
return /*#__PURE__*/React.createElement(_Tree, Object.assign({}, otherProps, {
|
|
172
150
|
onSelect: function onSelect(keys, e) {
|
|
173
151
|
return handleToSelectTreeNode(keys, e);
|
|
174
152
|
},
|
|
@@ -186,5 +164,4 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
186
164
|
}
|
|
187
165
|
};
|
|
188
166
|
|
|
189
|
-
|
|
190
|
-
exports["default"] = _default;
|
|
167
|
+
export default RefactorTree;
|
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
require("antd/es/empty/style");
|
|
11
|
-
|
|
12
|
-
var _empty = _interopRequireDefault(require("antd/es/empty"));
|
|
13
|
-
|
|
14
|
-
require("antd/es/popconfirm/style");
|
|
15
|
-
|
|
16
|
-
var _popconfirm = _interopRequireDefault(require("antd/es/popconfirm"));
|
|
17
|
-
|
|
18
|
-
require("antd/es/tree/style");
|
|
19
|
-
|
|
20
|
-
var _tree = _interopRequireDefault(require("antd/es/tree"));
|
|
21
|
-
|
|
22
|
-
var _tslib = require("tslib");
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
-
|
|
26
|
-
var _index = _interopRequireDefault(require("../SpecIcon/index"));
|
|
27
|
-
|
|
28
|
-
require("./style/index.less");
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
1
|
+
import "antd/es/empty/style";
|
|
2
|
+
import _Empty from "antd/es/empty";
|
|
3
|
+
import "antd/es/popconfirm/style";
|
|
4
|
+
import _Popconfirm from "antd/es/popconfirm";
|
|
5
|
+
import "antd/es/tree/style";
|
|
6
|
+
import _Tree from "antd/es/tree";
|
|
35
7
|
|
|
36
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
9
|
|
|
@@ -45,7 +17,12 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
45
17
|
|
|
46
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
19
|
|
|
48
|
-
|
|
20
|
+
import { __rest } from "tslib"; // 重构树控件,可直接配置数据
|
|
21
|
+
|
|
22
|
+
import React, { useEffect, useState } from 'react';
|
|
23
|
+
import SpecIcon from '../SpecIcon/index';
|
|
24
|
+
var TreeNode = _Tree.TreeNode;
|
|
25
|
+
import './style/index.less';
|
|
49
26
|
|
|
50
27
|
var RefactorTree = function RefactorTree(props) {
|
|
51
28
|
var treeData = props.treeData,
|
|
@@ -71,10 +48,11 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
71
48
|
checkStrictly = props.checkStrictly,
|
|
72
49
|
onSelect = props.onSelect,
|
|
73
50
|
onCheck = props.onCheck,
|
|
74
|
-
otherProps =
|
|
51
|
+
otherProps = __rest(props, ["treeData", "rootName", "rootKey", "rootIcon", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeItemReset", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck"]); // 重新组合指定数据源字段 (limitKey:用于限制只能选择指定同一层级的数据)
|
|
75
52
|
// const { title, value, children, disabled } = { value: 'value', title: 'title', children: 'children', disabled: 'disabled', ...optionName }
|
|
76
53
|
|
|
77
|
-
|
|
54
|
+
|
|
55
|
+
var _useState = useState([]),
|
|
78
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
79
57
|
dataList = _useState2[0],
|
|
80
58
|
setDataList = _useState2[1]; // 限制节点选中条件下更新列表数据
|
|
@@ -116,7 +94,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
116
94
|
}
|
|
117
95
|
};
|
|
118
96
|
|
|
119
|
-
|
|
97
|
+
useEffect(function () {
|
|
120
98
|
// 有配置limitKey指定限制同级节点时,添加判断节点选择限制(在父子节点不相关联条件下使用checkStrictly=true)
|
|
121
99
|
if (checkStrictly && limitKey && checkedKeys) {
|
|
122
100
|
if (Array.isArray(checkedKeys) && checkedKeys.length > 0 || checkedKeys && Array.isArray(checkedKeys.checked) && checkedKeys.checked.length > 0) {
|
|
@@ -173,30 +151,30 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
173
151
|
|
|
174
152
|
|
|
175
153
|
var renderNodeTitle = function renderNodeTitle(item) {
|
|
176
|
-
return /*#__PURE__*/
|
|
154
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, nodeItemReset && nodeItemReset(item).icon || (item.icon ? /*#__PURE__*/React.createElement(SpecIcon, {
|
|
177
155
|
name: item.icon
|
|
178
|
-
}) : null), " ", item[optionName.title || 'title'], nodeControl ? /*#__PURE__*/
|
|
156
|
+
}) : null), " ", item[optionName.title || 'title'], nodeControl ? /*#__PURE__*/React.createElement("span", {
|
|
179
157
|
className: "treeControl"
|
|
180
|
-
}, /*#__PURE__*/
|
|
158
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
181
159
|
onClick: function onClick(e) {
|
|
182
160
|
handleNodeControl(e, 'edit', item);
|
|
183
161
|
}
|
|
184
|
-
}, /*#__PURE__*/
|
|
162
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
185
163
|
name: 'edit'
|
|
186
|
-
})), /*#__PURE__*/
|
|
164
|
+
})), /*#__PURE__*/React.createElement(_Popconfirm, {
|
|
187
165
|
placement: 'top',
|
|
188
166
|
title: "\u786E\u5B9A\u8981\u5220\u9664\uFF1A".concat(item[optionName.title || 'title'], "\u5417\uFF1F"),
|
|
189
|
-
icon: /*#__PURE__*/
|
|
167
|
+
icon: /*#__PURE__*/React.createElement(SpecIcon, {
|
|
190
168
|
name: "question"
|
|
191
169
|
}),
|
|
192
170
|
onConfirm: function onConfirm(e) {
|
|
193
171
|
handleNodeControl(e, 'delete', item);
|
|
194
172
|
}
|
|
195
|
-
}, /*#__PURE__*/
|
|
173
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
196
174
|
onClick: function onClick(e) {
|
|
197
175
|
return e.stopPropagation();
|
|
198
176
|
}
|
|
199
|
-
}, /*#__PURE__*/
|
|
177
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
200
178
|
name: 'delete'
|
|
201
179
|
})))) : null, nodeExtra && nodeExtra);
|
|
202
180
|
};
|
|
@@ -204,7 +182,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
204
182
|
var renderTreeNodes = function renderTreeNodes(data) {
|
|
205
183
|
return data.map(function (item) {
|
|
206
184
|
if (item[optionName.children || 'children']) {
|
|
207
|
-
return /*#__PURE__*/
|
|
185
|
+
return /*#__PURE__*/React.createElement(TreeNode, Object.assign({}, item, {
|
|
208
186
|
title: renderNodeTitle(item),
|
|
209
187
|
key: item[optionName.value || 'value'],
|
|
210
188
|
className: selectable ? '' : "notPointer",
|
|
@@ -213,7 +191,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
213
191
|
}), renderTreeNodes(item[optionName.children || 'children']));
|
|
214
192
|
}
|
|
215
193
|
|
|
216
|
-
return /*#__PURE__*/
|
|
194
|
+
return /*#__PURE__*/React.createElement(TreeNode, Object.assign({}, item, {
|
|
217
195
|
title: renderNodeTitle(item),
|
|
218
196
|
key: item[optionName.value || 'value'],
|
|
219
197
|
className: selectable ? '' : "notPointer",
|
|
@@ -223,8 +201,8 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
223
201
|
});
|
|
224
202
|
};
|
|
225
203
|
|
|
226
|
-
if (dataList.length == 0 && !rootName) return /*#__PURE__*/
|
|
227
|
-
image:
|
|
204
|
+
if (dataList.length == 0 && !rootName) return /*#__PURE__*/React.createElement(_Empty, {
|
|
205
|
+
image: _Empty.PRESENTED_IMAGE_SIMPLE,
|
|
228
206
|
description: emptyDescription
|
|
229
207
|
});
|
|
230
208
|
var defExpand = [];
|
|
@@ -235,7 +213,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
235
213
|
defExpand = rootKey ? [rootKey] : ['0'];
|
|
236
214
|
}
|
|
237
215
|
|
|
238
|
-
return /*#__PURE__*/
|
|
216
|
+
return /*#__PURE__*/React.createElement(_Tree, // switcherIcon={<Icon type="down" />}
|
|
239
217
|
Object.assign({}, otherProps, {
|
|
240
218
|
onSelect: function onSelect(keys, e) {
|
|
241
219
|
return handleToSelectTreeNode(keys, e);
|
|
@@ -248,7 +226,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
248
226
|
selectable: selectable,
|
|
249
227
|
checkedKeys: checkedKeys,
|
|
250
228
|
checkStrictly: checkStrictly
|
|
251
|
-
}), rootName ? /*#__PURE__*/
|
|
229
|
+
}), rootName ? /*#__PURE__*/React.createElement(TreeNode, {
|
|
252
230
|
title: rootName,
|
|
253
231
|
key: rootKey || '0',
|
|
254
232
|
className: selectable ? '' : "notPointer",
|
|
@@ -256,5 +234,4 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
256
234
|
}, renderTreeNodes(dataList)) : renderTreeNodes(dataList));
|
|
257
235
|
};
|
|
258
236
|
|
|
259
|
-
|
|
260
|
-
exports["default"] = _default;
|
|
237
|
+
export default RefactorTree;
|
package/es/RefactorTree/util.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transDataParam = transDataParam;
|
|
7
|
-
exports.resetDataWithLimit = resetDataWithLimit;
|
|
8
|
-
exports.resetDataWithDisabled = resetDataWithDisabled;
|
|
9
|
-
|
|
10
|
-
var _tslib = require("tslib");
|
|
11
|
-
|
|
12
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
2
|
|
|
14
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -21,6 +10,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
21
10
|
|
|
22
11
|
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; }
|
|
23
12
|
|
|
13
|
+
import { __rest } from "tslib";
|
|
24
14
|
/**
|
|
25
15
|
* transDataParam 根据指定选项字段名重组数据
|
|
26
16
|
*
|
|
@@ -28,7 +18,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
28
18
|
* @params {object} optionName 选项字段值
|
|
29
19
|
*
|
|
30
20
|
* */
|
|
31
|
-
|
|
21
|
+
|
|
22
|
+
export function transDataParam(array) {
|
|
32
23
|
var optionName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
33
24
|
key: 'key',
|
|
34
25
|
value: 'key',
|
|
@@ -74,8 +65,7 @@ function transDataParam(array) {
|
|
|
74
65
|
*
|
|
75
66
|
* */
|
|
76
67
|
|
|
77
|
-
|
|
78
|
-
function resetDataWithLimit(hasKeys, list) {
|
|
68
|
+
export function resetDataWithLimit(hasKeys, list) {
|
|
79
69
|
var optionName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
80
70
|
key: 'key',
|
|
81
71
|
value: 'key',
|
|
@@ -111,7 +101,8 @@ function resetDataWithLimit(hasKeys, list) {
|
|
|
111
101
|
if (!matchDataValue) return preList;
|
|
112
102
|
return preList === null || preList === void 0 ? void 0 : preList.map(function (preItem) {
|
|
113
103
|
var oldItem = Object.assign({}, preItem);
|
|
114
|
-
|
|
104
|
+
|
|
105
|
+
var item = __rest(oldItem, []);
|
|
115
106
|
|
|
116
107
|
if (item[limitKey] !== matchDataValue) {
|
|
117
108
|
item.disabled = true;
|
|
@@ -154,14 +145,15 @@ function resetDataWithLimit(hasKeys, list) {
|
|
|
154
145
|
*
|
|
155
146
|
* */
|
|
156
147
|
|
|
157
|
-
|
|
158
|
-
function resetDataWithDisabled(list, optionName, disabledFields) {
|
|
148
|
+
export function resetDataWithDisabled(list, optionName, disabledFields) {
|
|
159
149
|
// 筛选与禁用字段内值相同的节点进行禁用
|
|
160
150
|
var filterResetTargetFields = function filterResetTargetFields(preList, fields) {
|
|
161
151
|
if (!preList) return [];
|
|
162
152
|
return preList.map(function (preItem) {
|
|
163
153
|
var oldItem = Object.assign({}, preItem);
|
|
164
|
-
|
|
154
|
+
|
|
155
|
+
var item = __rest(oldItem, []);
|
|
156
|
+
|
|
165
157
|
Object.keys(item).forEach(function (itemKeyName) {
|
|
166
158
|
var _a;
|
|
167
159
|
|