fan-standard-comp 3.2.0 → 3.2.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/Readme.md +1 -33
- package/dist/09cd8e9be7081f2166444cce393fe968.svg +54 -0
- package/dist/e3378c145b7db195ad068735e15fb28a.svg +165 -0
- package/dist/fan-standard-comp.umd.js +166 -444
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/dist/fonts/lg.ttf +0 -0
- package/dist/fonts/lg.woff +0 -0
- package/dist/fonts/lg.woff2 +0 -0
- package/es/ButtonGroup/ButtonList.d.ts +2 -1
- package/es/ButtonGroup/ButtonMenu.d.ts +2 -1
- package/es/ButtonGroup/PopConfirmTitle.js +5 -5
- package/es/ButtonGroup/index.d.ts +3 -1
- package/es/ButtonGroup/index.js +147 -178
- package/es/ButtonGroup/style/index.less +4 -1
- package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/es/CalendarCoordPicker/CalendarMonthPicker.js +26 -0
- package/es/CalendarCoordPicker/index.d.ts +8 -0
- package/es/CalendarCoordPicker/index.js +296 -0
- package/es/CalendarCoordPicker/index.less +31 -0
- package/es/ConfigContext/index.d.ts +7 -0
- package/es/ConfigContext/index.js +12 -0
- package/es/DragContent/index.d.ts +1 -1
- package/es/DragContent/index.js +5 -5
- package/es/FormComp/ChunkUploader/api.js +14 -14
- package/es/FormComp/ChunkUploader/index.js +132 -139
- package/es/FormComp/ChunkUploader/lib.js +21 -21
- package/es/FormComp/ChunkUploader/upload-queue.class.js +64 -66
- package/es/FormComp/EditButton/index.d.ts +1 -1
- package/es/FormComp/EditButton/index.js +15 -17
- package/es/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/es/FormComp/FieldComponent/ReUpload.js +37 -23
- package/es/FormComp/FieldComponent/RefactorTextarea.js +32 -0
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +72 -19
- package/es/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/es/FormComp/FieldComponent/index.d.ts +1 -1
- package/es/FormComp/FieldComponent/index.js +33 -23
- package/es/FormComp/FieldComponent/setReadonlyValues.js +6 -6
- package/es/FormComp/RenderItemGroup/index.js +24 -8
- package/es/FormComp/Uploader/index.d.ts +3 -1
- package/es/FormComp/Uploader/index.js +243 -119
- package/es/FormComp/VarTemplate/index.js +57 -64
- package/es/ImageGallery/ImagePreview.d.ts +13 -0
- package/es/ImageGallery/ImagePreview.js +168 -0
- package/es/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
- package/es/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
- package/es/ImageGallery/PreviewStyles/lg-video.css +144 -0
- package/es/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
- package/es/ImageGallery/PreviewStyles/lightgallery.css +728 -0
- package/es/ImageGallery/SliderContent.d.ts +7 -0
- package/es/ImageGallery/SliderContent.js +699 -0
- package/es/ImageGallery/Thumbnail.d.ts +3 -0
- package/es/ImageGallery/Thumbnail.js +296 -0
- package/es/ImageGallery/hook/uniqueId.d.ts +1 -0
- package/es/ImageGallery/hook/uniqueId.js +10 -0
- package/es/ImageGallery/index.d.ts +4 -0
- package/es/ImageGallery/index.js +29 -0
- package/es/ImageGallery/style/index.less +5 -0
- package/es/ImageGallery/types.d.ts +5 -0
- package/es/ImageGallery/types.js +1 -0
- package/es/NavLeafScroll/index.js +94 -50
- package/es/RefactorTree/index.d.ts +1 -1
- package/es/RefactorTree/index.js +6 -6
- package/es/RefactorTree/indexTreeNode.d.ts +1 -1
- package/es/RefactorTree/indexTreeNode.js +19 -17
- package/es/RefactorTree/util.js +18 -18
- package/es/SpecIcon/fonts/demo_index.html +559 -5
- package/es/SpecIcon/fonts/iconfont.css +101 -3
- package/es/SpecIcon/fonts/iconfont.js +34 -27
- package/es/SpecIcon/fonts/iconfont.json +168 -0
- package/es/SpecIcon/fonts/iconfont.svg +163 -171
- package/es/SpecIcon/fonts/iconfont.ttf +0 -0
- package/es/SpecIcon/fonts/iconfont.woff +0 -0
- package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/es/SpecIcon/style/iconfont.less +106 -11
- package/es/SplitterLayout/Pane.d.ts +1 -1
- package/es/SplitterLayout/index.js +25 -26
- package/es/StandardContent/SplitterLayout/Pane.js +3 -3
- package/es/StandardContent/SplitterLayout/index.js +25 -26
- package/es/StandardContent/SubfieldContent.d.ts +1 -1
- package/es/StandardContent/WrapperContent.d.ts +1 -1
- package/es/StandardDragModal/index.d.ts +11 -3
- package/es/StandardDragModal/index.js +25 -3
- package/es/StandardFilter/index.d.ts +5 -16
- package/es/StandardFilter/index.js +212 -200
- package/es/StandardFilter/indexClass.d.ts +37 -0
- package/es/StandardFilter/indexClass.js +217 -0
- package/es/StandardFilter/style/index.less +82 -9
- package/es/StandardForm/StepForm.d.ts +1 -1
- package/es/StandardForm/StepForm.js +28 -22
- package/es/StandardForm/TabForm.d.ts +1 -1
- package/es/StandardForm/TabForm.js +41 -43
- package/es/StandardForm/index.d.ts +1 -1
- package/es/StandardForm/index.js +5 -5
- package/es/StandardModal/UpdateFormRef.js +0 -1
- package/es/StandardModal/index.d.ts +2 -1
- package/es/StandardModal/index.js +25 -39
- package/es/StandardPanel/index.d.ts +1 -1
- package/es/StandardPanel/index.js +7 -7
- package/es/StandardTable/index.d.ts +1 -0
- package/es/StandardTable/index.js +44 -26
- package/es/components/IconNode/index.d.ts +1 -1
- package/es/components/IconNode/index.js +0 -1
- package/es/data/general.config.js +31 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +6 -2
- package/es/utils/filterPermission.js +7 -10
- package/es/utils/getParentNodes.js +101 -26
- package/es/utils/index.js +2 -3
- package/es/utils/urlUtils.js +76 -0
- package/lib/ButtonGroup/ButtonList.d.ts +2 -1
- package/lib/ButtonGroup/ButtonList.js +2 -3
- package/lib/ButtonGroup/ButtonMenu.d.ts +2 -1
- package/lib/ButtonGroup/ButtonMenu.js +2 -3
- package/lib/ButtonGroup/PopConfirmTitle.js +7 -8
- package/lib/ButtonGroup/index.d.ts +3 -1
- package/lib/ButtonGroup/index.js +151 -183
- package/lib/ButtonGroup/style/index.less +4 -1
- package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/lib/CalendarCoordPicker/CalendarMonthPicker.js +36 -0
- package/lib/CalendarCoordPicker/index.d.ts +8 -0
- package/lib/CalendarCoordPicker/index.js +305 -0
- package/lib/CalendarCoordPicker/index.less +31 -0
- package/lib/ConfigContext/index.d.ts +7 -0
- package/lib/ConfigContext/index.js +17 -0
- package/lib/DragContent/DragBar.js +2 -3
- package/lib/DragContent/index.d.ts +1 -1
- package/lib/DragContent/index.js +9 -10
- package/lib/FormComp/ChunkUploader/api.js +15 -15
- package/lib/FormComp/ChunkUploader/index.js +135 -142
- package/lib/FormComp/ChunkUploader/lib.js +22 -22
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +66 -69
- package/lib/FormComp/ChunkUploader/worker.js +1 -1
- package/lib/FormComp/EditButton/index.d.ts +1 -1
- package/lib/FormComp/EditButton/index.js +19 -22
- package/lib/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/lib/FormComp/FieldComponent/ReUpload.js +40 -28
- package/lib/FormComp/FieldComponent/RefactorTextarea.js +42 -0
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +75 -23
- package/lib/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/lib/FormComp/FieldComponent/TitleNode.js +2 -3
- package/lib/FormComp/FieldComponent/index.d.ts +1 -1
- package/lib/FormComp/FieldComponent/index.js +38 -26
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +15 -20
- package/lib/FormComp/RenderItemGroup/index.js +26 -11
- package/lib/FormComp/Uploader/index.d.ts +3 -1
- package/lib/FormComp/Uploader/index.js +244 -123
- package/lib/FormComp/VarTemplate/index.js +63 -71
- package/lib/FormComp/index.js +1 -1
- package/lib/ImageGallery/ImagePreview.d.ts +13 -0
- package/lib/ImageGallery/ImagePreview.js +178 -0
- package/lib/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
- package/lib/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
- package/lib/ImageGallery/PreviewStyles/lg-video.css +144 -0
- package/lib/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
- package/lib/ImageGallery/PreviewStyles/lightgallery.css +728 -0
- package/lib/ImageGallery/SliderContent.d.ts +7 -0
- package/lib/ImageGallery/SliderContent.js +708 -0
- package/lib/ImageGallery/Thumbnail.d.ts +3 -0
- package/lib/ImageGallery/Thumbnail.js +306 -0
- package/lib/ImageGallery/hook/uniqueId.d.ts +1 -0
- package/lib/ImageGallery/hook/uniqueId.js +17 -0
- package/lib/ImageGallery/index.d.ts +4 -0
- package/lib/ImageGallery/index.js +36 -0
- package/lib/ImageGallery/style/index.less +5 -0
- package/lib/ImageGallery/types.d.ts +5 -0
- package/lib/ImageGallery/types.js +5 -0
- package/lib/NavLeafScroll/index.js +98 -55
- package/lib/RefactorTree/index.d.ts +1 -1
- package/lib/RefactorTree/index.js +10 -11
- package/lib/RefactorTree/indexTreeNode.d.ts +1 -1
- package/lib/RefactorTree/indexTreeNode.js +23 -22
- package/lib/RefactorTree/util.js +18 -18
- package/lib/SpecIcon/fonts/demo_index.html +559 -5
- package/lib/SpecIcon/fonts/iconfont.css +101 -3
- package/lib/SpecIcon/fonts/iconfont.js +34 -27
- package/lib/SpecIcon/fonts/iconfont.json +168 -0
- package/lib/SpecIcon/fonts/iconfont.svg +163 -171
- package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/lib/SpecIcon/index.js +2 -3
- package/lib/SpecIcon/style/iconfont.less +106 -11
- package/lib/SplitterLayout/Pane.d.ts +1 -1
- package/lib/SplitterLayout/Pane.js +2 -3
- package/lib/SplitterLayout/index.js +27 -29
- package/lib/StandardContent/SplitterLayout/Pane.js +5 -6
- package/lib/StandardContent/SplitterLayout/index.js +27 -29
- package/lib/StandardContent/SubfieldContent.d.ts +1 -1
- package/lib/StandardContent/SubfieldContent.js +2 -3
- package/lib/StandardContent/WrapperContent.d.ts +1 -1
- package/lib/StandardContent/WrapperContent.js +2 -3
- package/lib/StandardDragModal/index.d.ts +11 -3
- package/lib/StandardDragModal/index.js +27 -33
- package/lib/StandardFilter/index.d.ts +5 -16
- package/lib/StandardFilter/index.js +215 -201
- package/lib/StandardFilter/indexClass.d.ts +37 -0
- package/lib/StandardFilter/indexClass.js +223 -0
- package/lib/StandardFilter/style/index.less +82 -9
- package/lib/StandardForm/ActionList.js +2 -3
- package/lib/StandardForm/StepForm.d.ts +1 -1
- package/lib/StandardForm/StepForm.js +32 -27
- package/lib/StandardForm/TabForm.d.ts +1 -1
- package/lib/StandardForm/TabForm.js +45 -48
- package/lib/StandardForm/index.d.ts +1 -1
- package/lib/StandardForm/index.js +9 -10
- package/lib/StandardModal/UpdateFormRef.js +3 -4
- package/lib/StandardModal/index.d.ts +2 -1
- package/lib/StandardModal/index.js +29 -43
- package/lib/StandardPanel/index.d.ts +1 -1
- package/lib/StandardPanel/index.js +11 -12
- package/lib/StandardTable/index.d.ts +1 -0
- package/lib/StandardTable/index.js +49 -29
- package/lib/components/IconNode/index.d.ts +1 -1
- package/lib/components/IconNode/index.js +2 -4
- package/lib/components/index.js +1 -1
- package/lib/data/func.code.js +2 -3
- package/lib/data/general.config.js +33 -3
- package/lib/data/index.js +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +30 -10
- package/lib/utils/ValueFormat.js +1 -2
- package/lib/utils/filterPermission.js +11 -18
- package/lib/utils/getParentNodes.js +103 -29
- package/lib/utils/index.js +5 -27
- package/lib/utils/urlUtils.js +82 -0
- package/package.json +14 -9
- package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
- package/dist/fonts/iconfont.eot +0 -0
- package/es/StandardDragModal/ChangeStandardModal.d.ts +0 -44
- package/es/StandardDragModal/ChangeStandardModal.js +0 -493
- package/es/StandardDragModal/DraggableModal.d.ts +0 -7
- package/es/StandardDragModal/DraggableModal.js +0 -31
- package/es/StandardDragModal/DraggableModalContext.d.ts +0 -9
- package/es/StandardDragModal/DraggableModalContext.js +0 -5
- package/es/StandardDragModal/DraggableModalInner.d.ts +0 -16
- package/es/StandardDragModal/DraggableModalInner.js +0 -114
- package/es/StandardDragModal/DraggableModalProvider.d.ts +0 -4
- package/es/StandardDragModal/DraggableModalProvider.js +0 -40
- package/es/StandardDragModal/Modal.d.ts +0 -11
- package/es/StandardDragModal/Modal.js +0 -24
- package/es/StandardDragModal/ResizeHandle.d.ts +0 -2
- package/es/StandardDragModal/ResizeHandle.js +0 -8
- package/es/StandardDragModal/clamp.d.ts +0 -1
- package/es/StandardDragModal/clamp.js +0 -3
- package/es/StandardDragModal/draggableModalReducer.d.ts +0 -66
- package/es/StandardDragModal/draggableModalReducer.js +0 -157
- package/es/StandardDragModal/getWindowSize.d.ts +0 -4
- package/es/StandardDragModal/getWindowSize.js +0 -6
- package/es/StandardDragModal/index.less +0 -65
- package/es/StandardDragModal/useDrag.d.ts +0 -5
- package/es/StandardDragModal/useDrag.js +0 -66
- package/es/StandardDragModal/usePrevious.d.ts +0 -1
- package/es/StandardDragModal/usePrevious.js +0 -8
- package/es/StandardDragModal/useResize.d.ts +0 -7
- package/es/StandardDragModal/useResize.js +0 -74
- package/es/utils/dictSelectUtil.js +0 -153
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +0 -44
- package/lib/StandardDragModal/ChangeStandardModal.js +0 -502
- package/lib/StandardDragModal/DraggableModal.d.ts +0 -7
- package/lib/StandardDragModal/DraggableModal.js +0 -40
- package/lib/StandardDragModal/DraggableModalContext.d.ts +0 -9
- package/lib/StandardDragModal/DraggableModalContext.js +0 -15
- package/lib/StandardDragModal/DraggableModalInner.d.ts +0 -16
- package/lib/StandardDragModal/DraggableModalInner.js +0 -124
- package/lib/StandardDragModal/DraggableModalProvider.d.ts +0 -4
- package/lib/StandardDragModal/DraggableModalProvider.js +0 -48
- package/lib/StandardDragModal/Modal.d.ts +0 -11
- package/lib/StandardDragModal/Modal.js +0 -32
- package/lib/StandardDragModal/ResizeHandle.d.ts +0 -2
- package/lib/StandardDragModal/ResizeHandle.js +0 -18
- package/lib/StandardDragModal/clamp.d.ts +0 -1
- package/lib/StandardDragModal/clamp.js +0 -10
- package/lib/StandardDragModal/draggableModalReducer.d.ts +0 -66
- package/lib/StandardDragModal/draggableModalReducer.js +0 -167
- package/lib/StandardDragModal/getWindowSize.d.ts +0 -4
- package/lib/StandardDragModal/getWindowSize.js +0 -13
- package/lib/StandardDragModal/index.less +0 -65
- package/lib/StandardDragModal/useDrag.d.ts +0 -5
- package/lib/StandardDragModal/useDrag.js +0 -73
- package/lib/StandardDragModal/usePrevious.d.ts +0 -1
- package/lib/StandardDragModal/usePrevious.js +0 -15
- package/lib/StandardDragModal/useResize.d.ts +0 -7
- package/lib/StandardDragModal/useResize.js +0 -81
- package/lib/utils/dictSelectUtil.js +0 -161
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -11,31 +12,28 @@ var _index = _interopRequireDefault(require("../SpecIcon/index"));
|
|
|
11
12
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
14
|
require("./style/index.less");
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
16
|
-
function _interopRequireDefault(
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function
|
|
28
|
-
function
|
|
29
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
30
|
-
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); } // @ts-ignore
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
19
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
20
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
25
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
26
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
28
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
29
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } // @ts-ignore
|
|
31
30
|
var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
32
|
-
_inherits(NavLeafScroll, _Component);
|
|
33
|
-
var _super = _createSuper(NavLeafScroll);
|
|
34
31
|
function NavLeafScroll(props) {
|
|
35
32
|
var _this;
|
|
36
33
|
_classCallCheck(this, NavLeafScroll);
|
|
37
|
-
_this =
|
|
38
|
-
|
|
34
|
+
_this = _callSuper(this, NavLeafScroll, [props]);
|
|
35
|
+
// 初始化楼层相关的值,如:是否允许触发滚动,默认滚动区间高度等
|
|
36
|
+
_this.initFloorValues = function () {
|
|
39
37
|
var _this$props = _this.props,
|
|
40
38
|
baseItemHeight = _this$props.baseItemHeight,
|
|
41
39
|
baseItemWidth = _this$props.baseItemWidth,
|
|
@@ -47,13 +45,16 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
47
45
|
title: 'title',
|
|
48
46
|
count: 'count'
|
|
49
47
|
} : _this$props$optionNam,
|
|
50
|
-
type = _this$props.type
|
|
48
|
+
type = _this$props.type,
|
|
49
|
+
align = _this$props.align;
|
|
50
|
+
// 元素个数占用的高度是否不超过内容区域
|
|
51
51
|
var isInsideEnough = navList.length * baseItemHeight <= _this.mainWrap.current.clientHeight;
|
|
52
52
|
var wrapHeight = _this.mainWrap.current.clientHeight - (isInsideEnough ? 0 : 32 * 2); // 每次需要移动的偏移量 32是上下切换角占用的高度
|
|
53
53
|
var floorHeight = _this.leafNav.current.clientHeight; // 所有楼层占用的高度
|
|
54
54
|
// const isEnough = wrapHeight % baseItemHeight === 0; // 剩余的是否足够容纳一个单元格
|
|
55
55
|
var isInsideEnoughWidth = navList.length * baseItemWidth <= _this.mainWrap.current.clientWidth;
|
|
56
56
|
var wrapWidth = _this.mainWrap.current.clientWidth - (isInsideEnoughWidth ? 0 : 30 * 2);
|
|
57
|
+
console.log('this.mainWrap.current.clientWidth', _this.mainWrap.current.clientWidth, wrapWidth, isInsideEnoughWidth);
|
|
57
58
|
var floorWidth = _this.leafNav.current.clientWidth; // 所有楼层占用的宽度
|
|
58
59
|
if (type === 'horizontal') {
|
|
59
60
|
// 判断有效区域与单元格高度:若小于,则直接使用单元格高度,否则将内容区高度去除不足一个单元格高度
|
|
@@ -90,9 +91,19 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
90
91
|
var stepNo = type === 'horizontal' ? wrapWidth === 0 ? 0 : Math.floor(matchIndex / (wrapWidth / baseItemWidth)) : wrapHeight === 0 ? 0 : Math.floor(matchIndex / (wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
|
|
91
92
|
var stepTotalSize = Math.ceil(navList.length / stepSize) || 0; // 当前所有单元格占用的页总数
|
|
92
93
|
_this.setState({
|
|
93
|
-
leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo :
|
|
94
|
-
|
|
94
|
+
leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : _this.calculateScrollSize('X', {
|
|
95
|
+
wrapHeight: wrapHeight,
|
|
96
|
+
floorHeight: floorHeight,
|
|
97
|
+
wrapWidth: wrapWidth,
|
|
98
|
+
floorWidth: floorWidth
|
|
99
|
+
}),
|
|
95
100
|
// 如果当前默认传值有楼层节点,则需要判断其所在的位置
|
|
101
|
+
leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : _this.calculateScrollSize('Y', {
|
|
102
|
+
wrapHeight: wrapHeight,
|
|
103
|
+
floorHeight: floorHeight,
|
|
104
|
+
wrapWidth: wrapWidth,
|
|
105
|
+
floorWidth: floorWidth
|
|
106
|
+
}),
|
|
96
107
|
arrowPermit: {
|
|
97
108
|
prev: matchIndex !== -1 && stepNo !== 0,
|
|
98
109
|
left: matchIndex !== -1 && stepNo !== 0,
|
|
@@ -102,18 +113,45 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
102
113
|
});
|
|
103
114
|
} else {
|
|
104
115
|
_this.setState({
|
|
105
|
-
|
|
106
|
-
|
|
116
|
+
// 当只有一页的情况下,单元格不超出且配置了align='center'的情况下,默认居中展示。
|
|
117
|
+
leafNavScrollX: _this.calculateScrollSize('X', {
|
|
118
|
+
wrapHeight: wrapHeight,
|
|
119
|
+
floorHeight: floorHeight,
|
|
120
|
+
wrapWidth: wrapWidth,
|
|
121
|
+
floorWidth: floorWidth
|
|
122
|
+
}),
|
|
123
|
+
// 横向排版默认偏移
|
|
124
|
+
leafNavScrollY: _this.calculateScrollSize('Y', {
|
|
125
|
+
wrapHeight: wrapHeight,
|
|
126
|
+
floorHeight: floorHeight,
|
|
127
|
+
wrapWidth: wrapWidth,
|
|
128
|
+
floorWidth: floorWidth
|
|
129
|
+
}),
|
|
130
|
+
// 纵向排版默认偏移
|
|
107
131
|
arrowPermit: {
|
|
108
132
|
prev: false,
|
|
109
133
|
left: false,
|
|
110
134
|
next: floorHeight > wrapHeight,
|
|
111
|
-
|
|
135
|
+
// 所有单独格占用高度是否大于内容高度,判断是否有下一页
|
|
136
|
+
right: floorWidth > wrapWidth // 所有单独格占用高度是否大于内容高度,判断是否有下一页
|
|
112
137
|
}
|
|
113
138
|
});
|
|
114
139
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
140
|
+
};
|
|
141
|
+
// 计算初始时或者切换后,居中时默认滚动位置
|
|
142
|
+
_this.calculateScrollSize = function (direction, params) {
|
|
143
|
+
var wrapHeight = params.wrapHeight,
|
|
144
|
+
floorHeight = params.floorHeight,
|
|
145
|
+
wrapWidth = params.wrapWidth,
|
|
146
|
+
floorWidth = params.floorWidth;
|
|
147
|
+
var align = _this.props.align;
|
|
148
|
+
if (direction === 'X') {
|
|
149
|
+
return align === 'center' && !(floorWidth > wrapWidth) ? (_this.mainWrap.current.clientWidth - floorWidth) / 2 : 0; // // 横向排版默认偏移
|
|
150
|
+
} else {
|
|
151
|
+
return align === 'center' && !(floorHeight > wrapHeight) ? (_this.mainWrap.current.clientHeight - floorHeight) / 2 : 0; // 纵向排版默认偏移
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
_this.handleLeafControl = function (method) {
|
|
117
155
|
var type = _this.props.type;
|
|
118
156
|
var _this$state = _this.state,
|
|
119
157
|
floorRelatedSize = _this$state.floorRelatedSize,
|
|
@@ -131,7 +169,6 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
131
169
|
left: method === 'left' ? scrollX !== 0 : true,
|
|
132
170
|
right: method === 'left' ? true : scrollX !== maxNextPosition // 滚动大小与最大滚动值一致时,向右滚动禁用,
|
|
133
171
|
},
|
|
134
|
-
|
|
135
172
|
leafNavScrollX: scrollX
|
|
136
173
|
});
|
|
137
174
|
} else {
|
|
@@ -142,30 +179,31 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
142
179
|
prev: method === 'prev' ? scrollY !== 0 : true,
|
|
143
180
|
next: method === 'prev' ? true : scrollY !== _maxNextPosition // 滚动大小与最大滚动值一致时,向下滚动禁用,
|
|
144
181
|
},
|
|
145
|
-
|
|
146
182
|
leafNavScrollY: scrollY
|
|
147
183
|
});
|
|
148
184
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
185
|
+
};
|
|
186
|
+
// 点击节点事件
|
|
187
|
+
_this.handleItemControl = function (key, data) {
|
|
151
188
|
var onClick = _this.props.onClick;
|
|
152
189
|
onClick && onClick(key, data);
|
|
153
|
-
}
|
|
154
|
-
|
|
190
|
+
};
|
|
191
|
+
_this.mouseEnter = function (e) {
|
|
155
192
|
var onMouseEnter = _this.props.onMouseEnter;
|
|
156
193
|
_this.setState({
|
|
157
194
|
isMouseEnter: true
|
|
158
195
|
});
|
|
159
196
|
onMouseEnter && onMouseEnter(e);
|
|
160
|
-
}
|
|
161
|
-
|
|
197
|
+
};
|
|
198
|
+
_this.mouseLeave = function (e) {
|
|
162
199
|
var onMouseLeave = _this.props.onMouseLeave;
|
|
163
200
|
_this.setState({
|
|
164
201
|
isMouseEnter: false
|
|
165
202
|
});
|
|
166
203
|
onMouseLeave && onMouseLeave(e);
|
|
167
|
-
}
|
|
168
|
-
|
|
204
|
+
};
|
|
205
|
+
// 鼠标滚轮监听
|
|
206
|
+
_this.mouseWheel = function (e) {
|
|
169
207
|
var type = _this.props.type;
|
|
170
208
|
var _this$state2 = _this.state,
|
|
171
209
|
isMouseEnter = _this$state2.isMouseEnter,
|
|
@@ -178,7 +216,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
178
216
|
} else {
|
|
179
217
|
type === 'horizontal' ? arrowPermit.right && _this.handleLeafControl('right') : arrowPermit.next && _this.handleLeafControl('next'); // 向下滚动(向右滚动)
|
|
180
218
|
}
|
|
181
|
-
}
|
|
219
|
+
};
|
|
182
220
|
_this.state = {
|
|
183
221
|
isMouseEnter: false,
|
|
184
222
|
leafNavScrollX: 0,
|
|
@@ -195,17 +233,16 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
195
233
|
// 有效内容区域的
|
|
196
234
|
floorHeight: 0 // 楼层列表占用的高度
|
|
197
235
|
},
|
|
198
|
-
|
|
199
236
|
stepSize: 0 // 当前一页可容纳的单元格数量
|
|
200
237
|
};
|
|
201
|
-
|
|
202
238
|
_this.mainWrap = /*#__PURE__*/_react.default.createRef();
|
|
203
239
|
_this.leafWrap = /*#__PURE__*/_react.default.createRef();
|
|
204
240
|
_this.leafNav = /*#__PURE__*/_react.default.createRef();
|
|
205
|
-
_this.initFloorValues = _this.initFloorValues.bind(
|
|
241
|
+
_this.initFloorValues = _this.initFloorValues.bind(_this);
|
|
206
242
|
return _this;
|
|
207
243
|
}
|
|
208
|
-
|
|
244
|
+
_inherits(NavLeafScroll, _Component);
|
|
245
|
+
return _createClass(NavLeafScroll, [{
|
|
209
246
|
key: "componentDidMount",
|
|
210
247
|
value: function componentDidMount() {
|
|
211
248
|
var forbidScroll = this.props.forbidScroll;
|
|
@@ -246,7 +283,8 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
246
283
|
title: 'title',
|
|
247
284
|
count: 'count'
|
|
248
285
|
} : _this$props2$optionNa,
|
|
249
|
-
forbidScroll = _this$props2.forbidScroll
|
|
286
|
+
forbidScroll = _this$props2.forbidScroll,
|
|
287
|
+
align = _this$props2.align;
|
|
250
288
|
var _this$state3 = this.state,
|
|
251
289
|
_this$state3$floorRel = _this$state3.floorRelatedSize,
|
|
252
290
|
wrapHeight = _this$state3$floorRel.wrapHeight,
|
|
@@ -255,7 +293,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
255
293
|
floorWidth = _this$state3$floorRel.floorWidth,
|
|
256
294
|
stepSize = _this$state3.stepSize;
|
|
257
295
|
if (type === 'horizontal') {}
|
|
258
|
-
if (JSON.stringify(navList) !== JSON.stringify(prevProps.navList) || (type === 'horizontal' ? baseItemWidth !== prevProps.baseItemWidth : baseItemHeight !== prevProps.baseItemHeight)) {
|
|
296
|
+
if (JSON.stringify(navList) !== JSON.stringify(prevProps.navList) || (type === 'horizontal' ? baseItemWidth !== prevProps.baseItemWidth : baseItemHeight !== prevProps.baseItemHeight) || align !== prevProps.align) {
|
|
259
297
|
this.initFloorValues();
|
|
260
298
|
}
|
|
261
299
|
if (forbidScroll !== prevProps.forbidScroll) {
|
|
@@ -275,11 +313,20 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
275
313
|
});
|
|
276
314
|
var stepNo = Math.floor(matchIndex / (type === 'horizontal' ? wrapWidth / baseItemWidth : wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
|
|
277
315
|
var stepTotalSize = Array.isArray(navList) && Math.ceil(navList.length / stepSize) || 0; // 当前所有单元格占用的页总数
|
|
278
|
-
console.log('stepTotalSize', stepTotalSize);
|
|
279
316
|
this.setState({
|
|
280
|
-
leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo :
|
|
281
|
-
|
|
317
|
+
leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : this.calculateScrollSize('X', {
|
|
318
|
+
wrapHeight: wrapHeight,
|
|
319
|
+
floorHeight: floorHeight,
|
|
320
|
+
wrapWidth: wrapWidth,
|
|
321
|
+
floorWidth: floorWidth
|
|
322
|
+
}),
|
|
282
323
|
// 如果当前默认传值有楼层节点,则需要判断其所在的位置
|
|
324
|
+
leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : this.calculateScrollSize('Y', {
|
|
325
|
+
wrapHeight: wrapHeight,
|
|
326
|
+
floorHeight: floorHeight,
|
|
327
|
+
wrapWidth: wrapWidth,
|
|
328
|
+
floorWidth: floorWidth
|
|
329
|
+
}),
|
|
283
330
|
arrowPermit: {
|
|
284
331
|
prev: matchIndex !== -1 && stepNo !== 0,
|
|
285
332
|
next: floorHeight > wrapHeight && stepNo + 1 !== stepTotalSize,
|
|
@@ -289,9 +336,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
289
336
|
isMouseEnter: true
|
|
290
337
|
});
|
|
291
338
|
}
|
|
292
|
-
}
|
|
293
|
-
// 点击节点事件
|
|
294
|
-
// 鼠标滚轮监听
|
|
339
|
+
}
|
|
295
340
|
}, {
|
|
296
341
|
key: "render",
|
|
297
342
|
value: function render() {
|
|
@@ -400,7 +445,5 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
|
|
|
400
445
|
}) : emptyNode)))));
|
|
401
446
|
}
|
|
402
447
|
}]);
|
|
403
|
-
return NavLeafScroll;
|
|
404
448
|
}(_react.Component);
|
|
405
|
-
var _default = NavLeafScroll;
|
|
406
|
-
exports.default = _default;
|
|
449
|
+
var _default = exports.default = NavLeafScroll;
|
|
@@ -15,13 +15,13 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
var _index = _interopRequireDefault(require("../SpecIcon/index"));
|
|
16
16
|
var _util = require("./util");
|
|
17
17
|
require("./style/index.less");
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
20
|
-
function _interopRequireDefault(
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
21
|
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); }
|
|
22
|
-
function _defineProperty(
|
|
23
|
-
function _toPropertyKey(
|
|
24
|
-
function _toPrimitive(
|
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
24
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // 重构树控件,可直接配置数据
|
|
25
25
|
var RefactorTree = function RefactorTree(props) {
|
|
26
26
|
var treeData = props.treeData,
|
|
27
27
|
rootName = props.rootName,
|
|
@@ -46,14 +46,14 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
46
46
|
onCheck = props.onCheck,
|
|
47
47
|
titleRender = props.titleRender,
|
|
48
48
|
disabledFields = props.disabledFields,
|
|
49
|
-
otherProps = (0, _tslib.__rest)(props, ["treeData", "rootName", "rootKey", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck", "titleRender", "disabledFields"]);
|
|
49
|
+
otherProps = (0, _tslib.__rest)(props, ["treeData", "rootName", "rootKey", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck", "titleRender", "disabledFields"]);
|
|
50
|
+
// const { title, value, children, disabled } = { value: 'value', title: 'title', children: 'children', disabled: 'disabled', ...optionName }
|
|
50
51
|
// 重新组合指定数据源字段
|
|
51
52
|
var transTreeData = (0, _react.useMemo)(function () {
|
|
52
|
-
var _ref;
|
|
53
53
|
var afterTransData = (0, _util.transDataParam)(treeData, optionName); // 通过转换后的数据
|
|
54
54
|
var resultData;
|
|
55
55
|
// 如果有配置根节点,则添加 一个根节点数据
|
|
56
|
-
resultData = rootName ? [(
|
|
56
|
+
resultData = rootName ? [_defineProperty(_defineProperty(_defineProperty({}, optionName.title || 'title', rootName), optionName.key || 'key', rootKey || '0'), 'children', afterTransData)] : afterTransData;
|
|
57
57
|
// 有配置limitKey指定限制同级节点时,添加判断节点选择限制(在父子节点不相关联条件下使用checkStrictly=true)
|
|
58
58
|
if (checkStrictly && limitKey && checkedKeys) {
|
|
59
59
|
if (Array.isArray(checkedKeys) && checkedKeys.length > 0 || checkedKeys && Array.isArray(checkedKeys.checked) && checkedKeys.checked.length > 0) {
|
|
@@ -155,5 +155,4 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
155
155
|
}));
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
var _default = RefactorTree;
|
|
159
|
-
exports.default = _default;
|
|
158
|
+
var _default = exports.default = RefactorTree;
|
|
@@ -15,15 +15,15 @@ var _tslib = require("tslib");
|
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _index = _interopRequireDefault(require("../SpecIcon/index"));
|
|
17
17
|
require("./style/index.less");
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
20
|
-
function _interopRequireDefault(
|
|
21
|
-
function _slicedToArray(
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
22
22
|
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."); }
|
|
23
|
-
function _unsupportedIterableToArray(
|
|
24
|
-
function _arrayLikeToArray(
|
|
25
|
-
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)
|
|
26
|
-
function _arrayWithHoles(
|
|
23
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
24
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
25
|
+
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; } }
|
|
26
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // 重构树控件,可直接配置数据
|
|
27
27
|
var TreeNode = _tree.default.TreeNode;
|
|
28
28
|
var RefactorTree = function RefactorTree(props) {
|
|
29
29
|
var treeData = props.treeData,
|
|
@@ -49,40 +49,42 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
49
49
|
checkStrictly = props.checkStrictly,
|
|
50
50
|
onSelect = props.onSelect,
|
|
51
51
|
onCheck = props.onCheck,
|
|
52
|
-
otherProps = (0, _tslib.__rest)(props, ["treeData", "rootName", "rootKey", "rootIcon", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeItemReset", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck"]);
|
|
52
|
+
otherProps = (0, _tslib.__rest)(props, ["treeData", "rootName", "rootKey", "rootIcon", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeItemReset", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck"]);
|
|
53
|
+
// 重新组合指定数据源字段 (limitKey:用于限制只能选择指定同一层级的数据)
|
|
53
54
|
// const { title, value, children, disabled } = { value: 'value', title: 'title', children: 'children', disabled: 'disabled', ...optionName }
|
|
54
55
|
var _useState = (0, _react.useState)([]),
|
|
55
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
56
57
|
dataList = _useState2[0],
|
|
57
|
-
setDataList = _useState2[1];
|
|
58
|
+
setDataList = _useState2[1];
|
|
59
|
+
// 限制节点选中条件下更新列表数据
|
|
58
60
|
var resetDataWithLimit = function resetDataWithLimit(hasKeys, list, resultList) {
|
|
59
61
|
// 利用ID匹配对应选中的完整节点数据
|
|
60
|
-
var
|
|
62
|
+
var _filterCheckedNode = function filterCheckedNode(ids, preList, matchList) {
|
|
61
63
|
if (Array.isArray(preList) && preList.length > 0) {
|
|
62
64
|
preList.forEach(function (item, i) {
|
|
63
65
|
if (ids.includes(item[optionName.value])) {
|
|
64
66
|
matchList.push(Object.assign({}, item));
|
|
65
67
|
}
|
|
66
|
-
|
|
68
|
+
_filterCheckedNode(ids, item[optionName.children || 'children'], matchList);
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
};
|
|
70
72
|
// 筛选同一层级可选择,其他层级数据不可选择(限制按指定字段名的层级数据)
|
|
71
|
-
var
|
|
73
|
+
var _filterResetSameLevel = function filterResetSameLevel(preList, resData, matchData) {
|
|
72
74
|
if (Array.isArray(preList) && preList.length > 0) {
|
|
73
75
|
preList.forEach(function (item, i) {
|
|
74
76
|
resData[i] = Object.assign({}, item);
|
|
75
77
|
resData[i].isLimit = item[limitKey] !== matchData; // [limitKey];
|
|
76
78
|
var newDeepArr = [];
|
|
77
|
-
|
|
79
|
+
_filterResetSameLevel(item[optionName.children || 'children'], newDeepArr, matchData);
|
|
78
80
|
resData[i][optionName.children || 'children'] = newDeepArr;
|
|
79
81
|
});
|
|
80
82
|
}
|
|
81
83
|
};
|
|
82
84
|
var matchItems = [];
|
|
83
|
-
|
|
85
|
+
_filterCheckedNode(hasKeys, list, matchItems); // 先筛选出来选中节点的数据,取其中的 level 层级的值(数据必须保证同级类型值一致)
|
|
84
86
|
if (matchItems.length > 0) {
|
|
85
|
-
|
|
87
|
+
_filterResetSameLevel(list, resultList, matchItems[0][limitKey]);
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
90
|
(0, _react.useEffect)(function () {
|
|
@@ -161,7 +163,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
161
163
|
name: 'delete'
|
|
162
164
|
})))) : null, nodeExtra && nodeExtra);
|
|
163
165
|
};
|
|
164
|
-
var
|
|
166
|
+
var _renderTreeNodes = function renderTreeNodes(data) {
|
|
165
167
|
return data.map(function (item) {
|
|
166
168
|
if (item[optionName.children || 'children']) {
|
|
167
169
|
return /*#__PURE__*/_react.default.createElement(TreeNode, Object.assign({}, item, {
|
|
@@ -170,7 +172,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
170
172
|
className: selectable ? '' : "notPointer",
|
|
171
173
|
disabled: item.isLimit || nodeItemReset && nodeItemReset(item).disabled || item[optionName.disabled || 'disabled'],
|
|
172
174
|
dataRef: item
|
|
173
|
-
}),
|
|
175
|
+
}), _renderTreeNodes(item[optionName.children || 'children']));
|
|
174
176
|
}
|
|
175
177
|
return /*#__PURE__*/_react.default.createElement(TreeNode, Object.assign({}, item, {
|
|
176
178
|
title: renderNodeTitle(item),
|
|
@@ -203,12 +205,11 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
203
205
|
selectable: selectable,
|
|
204
206
|
checkedKeys: checkedKeys,
|
|
205
207
|
checkStrictly: checkStrictly
|
|
206
|
-
}), rootName ? /*#__PURE__*/_react.default.createElement(TreeNode, {
|
|
208
|
+
}), rootName ? (/*#__PURE__*/_react.default.createElement(TreeNode, {
|
|
207
209
|
title: rootName,
|
|
208
210
|
key: rootKey || '0',
|
|
209
211
|
className: selectable ? '' : "notPointer",
|
|
210
212
|
icon: rootIcon || null
|
|
211
|
-
},
|
|
213
|
+
}, _renderTreeNodes(dataList))) : _renderTreeNodes(dataList));
|
|
212
214
|
};
|
|
213
|
-
var _default = RefactorTree;
|
|
214
|
-
exports.default = _default;
|
|
215
|
+
var _default = exports.default = RefactorTree;
|