linkmore-design 1.0.51 → 1.0.55
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/{Notification → Affix}/demos/basic.d.ts +0 -0
- package/dist/Affix/index.d.ts +54 -0
- package/dist/{Notification → Affix}/style/index.d.ts +0 -0
- package/dist/Affix/utils.d.ts +15 -0
- package/dist/Alert/ErrorBoundary.d.ts +22 -0
- package/dist/{Notification/demos/button.d.ts → Alert/demos/basic.d.ts} +0 -0
- package/dist/{Notification/demos/icon.d.ts → Alert/demos/visible.d.ts} +0 -0
- package/dist/Alert/index.d.ts +41 -0
- package/dist/Alert/style/index.d.ts +1 -0
- package/dist/Button/style/index.d.ts +1 -1
- package/dist/CardTable/fns/index.d.ts +3 -3
- package/dist/CardTable/{toolbar → pager}/TablePagination.d.ts +0 -0
- package/dist/CardTable/pager/index.d.ts +3 -0
- package/dist/IconFont/index.d.ts +1 -1
- package/dist/LmEditTable/style/index.d.ts +1 -1
- package/dist/LmFilter/LmFilter.d.ts +3 -0
- package/dist/LmFilter/baseFilter/fuzzySearch.d.ts +4 -0
- package/dist/LmFilter/baseFilter/index.d.ts +3 -0
- package/dist/LmFilter/clearFilter/index.d.ts +3 -0
- package/dist/LmFilter/complexFilter/index.d.ts +2 -0
- package/dist/LmFilter/components/CascaderFilter.d.ts +5 -0
- package/dist/LmFilter/components/CheckboxFilter.d.ts +5 -0
- package/dist/LmFilter/components/DateFilter.d.ts +5 -0
- package/dist/LmFilter/components/DropdownFIlter.d.ts +3 -0
- package/dist/LmFilter/components/EmptyFilter.d.ts +2 -0
- package/dist/LmFilter/components/InputFilter.d.ts +4 -0
- package/dist/LmFilter/components/InputSearchClose.d.ts +3 -0
- package/dist/LmFilter/components/SelectFilter.d.ts +5 -0
- package/dist/LmFilter/components/index.d.ts +3 -0
- package/dist/LmFilter/customFilter/index.d.ts +2 -0
- package/dist/LmFilter/demos/basic.d.ts +2 -0
- package/dist/LmFilter/filterFns/index.d.ts +12 -0
- package/dist/LmFilter/hooks/index.d.ts +1 -0
- package/dist/LmFilter/hooks/useDelayedFn.d.ts +2 -0
- package/dist/LmFilter/index.d.ts +2 -0
- package/dist/LmFilter/style/index.d.ts +1 -0
- package/dist/LmFilter/utils.d.ts +9 -0
- package/dist/LmFilter/wrapper/Filter.d.ts +3 -0
- package/dist/LmFilter/wrapper/FilterContainer.d.ts +3 -0
- package/dist/LmFilter/wrapper/FilterRoot.d.ts +3 -0
- package/dist/LmFilter/wrapper/FilterWrapper.d.ts +3 -0
- package/dist/QuickMenu/demos/basic.d.ts +2 -0
- package/dist/QuickMenu/index.d.ts +14 -0
- package/dist/QuickMenu/style/index.d.ts +1 -0
- package/dist/Tag/demos/ExigencyTag.d.ts +2 -0
- package/dist/Tag/index.d.ts +4 -0
- package/dist/Upload/demos/picture-little.d.ts +3 -0
- package/dist/Upload/index.d.ts +5 -1
- package/dist/_util/domTarget.d.ts +7 -0
- package/dist/_util/getDataOrAriaProps.d.ts +1 -0
- package/dist/_util/reactNode.d.ts +7 -0
- package/dist/_util/throttleByAnimationFrame.d.ts +8 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.umd.js +3453 -317
- package/dist/index.umd.min.js +6 -6
- package/dist/message/hooks/useMessage.d.ts +7 -0
- package/dist/message/index.d.ts +63 -4
- package/dist/notification/demos/basic.d.ts +2 -0
- package/dist/notification/demos/button.d.ts +2 -0
- package/dist/notification/demos/icon.d.ts +2 -0
- package/dist/notification/hooks/useNotification.d.ts +7 -0
- package/dist/notification/index.d.ts +54 -0
- package/dist/notification/style/index.d.ts +1 -0
- package/es/Affix/index.d.ts +54 -0
- package/es/Affix/index.js +326 -0
- package/{lib/Notification → es/Affix}/style/index.css +0 -3
- package/es/{Notification → Affix}/style/index.d.ts +0 -0
- package/es/{Notification → Affix}/style/index.js +0 -0
- package/es/Affix/utils.d.ts +15 -0
- package/es/Affix/utils.js +83 -0
- package/es/Alert/ErrorBoundary.d.ts +22 -0
- package/es/Alert/ErrorBoundary.js +65 -0
- package/es/Alert/index.d.ts +41 -0
- package/es/Alert/index.js +192 -0
- package/es/Alert/style/index.css +531 -0
- package/{lib/Notification → es/Alert}/style/index.d.ts +0 -0
- package/es/Alert/style/index.js +1 -0
- package/es/Button/style/{style.css → index.css} +0 -0
- package/es/Button/style/index.d.ts +1 -1
- package/es/Button/style/index.js +1 -1
- package/es/ButtonTags/style/{style.css → index.css} +0 -0
- package/es/ButtonTags/style/index.js +1 -1
- package/es/CardTable/card/PictureTextColumn.js +8 -6
- package/es/CardTable/card/PictureTextRow.js +1 -1
- package/es/CardTable/fns/index.js +38 -8
- package/es/CardTable/{toolbar → pager}/TablePagination.js +0 -0
- package/es/CardTable/pager/index.js +48 -0
- package/{lib/CardTable/style/style.css → es/CardTable/style/index.css} +2 -2
- package/es/CardTable/style/index.js +1 -1
- package/es/CardTable/table/TableRoot.js +20 -18
- package/es/CardTable/table/TableWrapper.js +4 -0
- package/es/CardTable/toolbar/ToolBarBottom.js +8 -27
- package/es/Checkbox/style/{style.css → index.css} +0 -0
- package/es/Checkbox/style/index.js +1 -1
- package/es/CkFilter/style/{style.css → index.css} +0 -0
- package/es/CkFilter/style/index.js +1 -1
- package/es/CustomerService/style/{style.css → index.css} +0 -0
- package/es/CustomerService/style/index.js +1 -1
- package/es/Descriptions/style/index.css +10 -8
- package/es/EditTable/style/{style.css → index.css} +0 -0
- package/es/EditTable/style/index.js +1 -1
- package/es/EnlargeImg/style/{style.css → index.css} +0 -0
- package/es/EnlargeImg/style/index.js +1 -1
- package/es/Filter/style/{style.css → index.css} +0 -0
- package/es/Filter/style/index.js +1 -1
- package/es/IconFont/index.js +3 -2
- package/es/IconSelect/style/{style.css → index.css} +0 -0
- package/es/IconSelect/style/index.js +1 -1
- package/es/Input/style/{style.css → index.css} +0 -0
- package/es/Input/style/index.js +1 -1
- package/es/LeftTable/style/{style.css → index.css} +0 -0
- package/es/LeftTable/style/index.js +1 -1
- package/es/LmEditTable/style/{style.css → index.css} +0 -0
- package/es/LmEditTable/style/index.d.ts +1 -1
- package/es/LmEditTable/style/index.js +1 -1
- package/es/LmFilter/LmFilter.js +27 -0
- package/es/LmFilter/baseFilter/fuzzySearch.js +53 -0
- package/es/LmFilter/baseFilter/index.js +34 -0
- package/es/LmFilter/clearFilter/index.js +35 -0
- package/es/LmFilter/complexFilter/index.js +17 -0
- package/es/LmFilter/components/CascaderFilter.js +159 -0
- package/es/LmFilter/components/CheckboxFilter.js +197 -0
- package/es/LmFilter/components/DateFilter.js +139 -0
- package/es/LmFilter/components/DropdownFIlter.js +230 -0
- package/es/LmFilter/components/EmptyFilter.js +27 -0
- package/es/LmFilter/components/InputFilter.js +52 -0
- package/es/LmFilter/components/InputSearchClose.js +74 -0
- package/es/LmFilter/components/SelectFilter.js +113 -0
- package/es/LmFilter/components/index.js +140 -0
- package/es/LmFilter/customFilter/index.js +17 -0
- package/es/LmFilter/filterFns/index.js +54 -0
- package/es/LmFilter/hooks/index.js +18 -0
- package/es/LmFilter/hooks/useDelayedFn.js +29 -0
- package/es/LmFilter/icon_placeholder.png +0 -0
- package/es/LmFilter/index.js +16 -0
- package/es/LmFilter/style/index.js +3 -0
- package/es/LmFilter/style/style.css +205 -0
- package/es/LmFilter/utils.js +71 -0
- package/es/LmFilter/wrapper/Filter.js +33 -0
- package/es/LmFilter/wrapper/FilterContainer.js +29 -0
- package/es/LmFilter/wrapper/FilterRoot.js +120 -0
- package/es/LmFilter/wrapper/FilterWrapper.js +25 -0
- package/es/LmTable/style/{style.css → index.css} +0 -0
- package/es/LmTable/style/index.js +1 -1
- package/es/OldModal/style/{style.css → index.css} +0 -0
- package/es/OldModal/style/index.js +1 -1
- package/es/PopTable/style/{style.css → index.css} +0 -0
- package/es/PopTable/style/index.js +1 -1
- package/es/ProTable/style/{style.css → index.css} +0 -0
- package/es/ProTable/style/index.js +1 -1
- package/es/QuickMenu/index.d.ts +14 -0
- package/es/QuickMenu/index.js +169 -0
- package/es/QuickMenu/style/index.css +560 -0
- package/es/QuickMenu/style/index.d.ts +1 -0
- package/es/QuickMenu/style/index.js +1 -0
- package/es/Radio/style/{style.css → index.css} +0 -0
- package/es/Radio/style/index.js +1 -1
- package/es/TableRender/style/{style.css → index.css} +0 -0
- package/es/TableRender/style/index.js +1 -1
- package/es/Tag/index.d.ts +4 -0
- package/es/Tag/index.js +48 -2
- package/es/Tag/style/index.css +4 -1
- package/es/Upload/index.d.ts +5 -1
- package/es/Upload/index.js +7 -2
- package/es/Upload/style/index.css +35 -0
- package/es/UploadOss/style/{style.css → index.css} +0 -0
- package/es/UploadOss/style/index.js +1 -1
- package/es/VirtualList/style/{style.css → index.css} +0 -0
- package/es/VirtualList/style/index.js +1 -1
- package/es/_util/domTarget.d.ts +7 -0
- package/es/_util/domTarget.js +20 -0
- package/es/_util/getDataOrAriaProps.d.ts +1 -0
- package/es/_util/getDataOrAriaProps.js +9 -0
- package/es/_util/reactNode.d.ts +7 -0
- package/es/_util/reactNode.js +10 -0
- package/es/_util/throttleByAnimationFrame.d.ts +8 -0
- package/es/_util/throttleByAnimationFrame.js +58 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -2
- package/es/message/hooks/useMessage.d.ts +7 -0
- package/es/message/hooks/useMessage.js +83 -0
- package/es/message/index.d.ts +63 -4
- package/es/message/index.js +241 -12
- package/es/message/style/index.css +28 -1
- package/es/notification/hooks/useNotification.d.ts +7 -0
- package/es/notification/hooks/useNotification.js +54 -0
- package/es/notification/index.d.ts +54 -0
- package/es/notification/index.js +342 -0
- package/es/notification/style/index.css +546 -0
- package/es/notification/style/index.d.ts +1 -0
- package/es/notification/style/index.js +1 -0
- package/lib/Affix/index.d.ts +54 -0
- package/lib/Affix/index.js +349 -0
- package/{es/Notification → lib/Affix}/style/index.css +0 -3
- package/lib/Affix/style/index.d.ts +1 -0
- package/lib/{Notification → Affix}/style/index.js +0 -0
- package/lib/Affix/utils.d.ts +15 -0
- package/lib/Affix/utils.js +104 -0
- package/lib/Alert/ErrorBoundary.d.ts +22 -0
- package/lib/Alert/ErrorBoundary.js +79 -0
- package/lib/Alert/index.d.ts +41 -0
- package/lib/Alert/index.js +215 -0
- package/lib/Alert/style/index.css +531 -0
- package/lib/Alert/style/index.d.ts +1 -0
- package/lib/Alert/style/index.js +3 -0
- package/lib/Button/style/{style.css → index.css} +0 -0
- package/lib/Button/style/index.d.ts +1 -1
- package/lib/Button/style/index.js +1 -1
- package/lib/ButtonTags/style/{style.css → index.css} +0 -0
- package/lib/ButtonTags/style/index.js +1 -1
- package/lib/CardTable/card/PictureTextColumn.js +8 -6
- package/lib/CardTable/card/PictureTextRow.js +1 -1
- package/lib/CardTable/fns/index.js +38 -8
- package/lib/CardTable/{toolbar → pager}/TablePagination.js +0 -0
- package/lib/CardTable/pager/index.js +48 -0
- package/{es/CardTable/style/style.css → lib/CardTable/style/index.css} +2 -2
- package/lib/CardTable/style/index.js +1 -1
- package/lib/CardTable/table/TableRoot.js +20 -18
- package/lib/CardTable/table/TableWrapper.js +4 -0
- package/lib/CardTable/toolbar/ToolBarBottom.js +8 -27
- package/lib/Checkbox/style/{style.css → index.css} +0 -0
- package/lib/Checkbox/style/index.js +1 -1
- package/lib/CkFilter/style/{style.css → index.css} +0 -0
- package/lib/CkFilter/style/index.js +1 -1
- package/lib/CustomerService/style/{style.css → index.css} +0 -0
- package/lib/CustomerService/style/index.js +1 -1
- package/lib/Descriptions/style/index.css +10 -8
- package/lib/EditTable/style/{style.css → index.css} +0 -0
- package/lib/EditTable/style/index.js +1 -1
- package/lib/EnlargeImg/style/{style.css → index.css} +0 -0
- package/lib/EnlargeImg/style/index.js +1 -1
- package/lib/Filter/style/{style.css → index.css} +0 -0
- package/lib/Filter/style/index.js +1 -1
- package/lib/IconFont/index.js +3 -2
- package/lib/IconSelect/style/{style.css → index.css} +0 -0
- package/lib/IconSelect/style/index.js +1 -1
- package/lib/Input/style/{style.css → index.css} +0 -0
- package/lib/Input/style/index.js +1 -1
- package/lib/LeftTable/style/{style.css → index.css} +0 -0
- package/lib/LeftTable/style/index.js +1 -1
- package/lib/LmEditTable/style/{style.css → index.css} +0 -0
- package/lib/LmEditTable/style/index.d.ts +1 -1
- package/lib/LmEditTable/style/index.js +1 -1
- package/lib/LmFilter/LmFilter.js +27 -0
- package/lib/LmFilter/baseFilter/fuzzySearch.js +53 -0
- package/lib/LmFilter/baseFilter/index.js +34 -0
- package/lib/LmFilter/clearFilter/index.js +35 -0
- package/lib/LmFilter/complexFilter/index.js +17 -0
- package/lib/LmFilter/components/CascaderFilter.js +159 -0
- package/lib/LmFilter/components/CheckboxFilter.js +197 -0
- package/lib/LmFilter/components/DateFilter.js +139 -0
- package/lib/LmFilter/components/DropdownFIlter.js +230 -0
- package/lib/LmFilter/components/EmptyFilter.js +27 -0
- package/lib/LmFilter/components/InputFilter.js +52 -0
- package/lib/LmFilter/components/InputSearchClose.js +74 -0
- package/lib/LmFilter/components/SelectFilter.js +113 -0
- package/lib/LmFilter/components/index.js +140 -0
- package/lib/LmFilter/customFilter/index.js +17 -0
- package/lib/LmFilter/filterFns/index.js +54 -0
- package/lib/LmFilter/hooks/index.js +18 -0
- package/lib/LmFilter/hooks/useDelayedFn.js +29 -0
- package/lib/LmFilter/icon_placeholder.png +0 -0
- package/lib/LmFilter/index.js +16 -0
- package/lib/LmFilter/style/index.js +3 -0
- package/lib/LmFilter/style/style.css +205 -0
- package/lib/LmFilter/utils.js +71 -0
- package/lib/LmFilter/wrapper/Filter.js +33 -0
- package/lib/LmFilter/wrapper/FilterContainer.js +29 -0
- package/lib/LmFilter/wrapper/FilterRoot.js +120 -0
- package/lib/LmFilter/wrapper/FilterWrapper.js +25 -0
- package/lib/LmTable/style/{style.css → index.css} +0 -0
- package/lib/LmTable/style/index.js +1 -1
- package/lib/OldModal/style/{style.css → index.css} +0 -0
- package/lib/OldModal/style/index.js +1 -1
- package/lib/PopTable/style/{style.css → index.css} +0 -0
- package/lib/PopTable/style/index.js +1 -1
- package/lib/ProTable/style/{style.css → index.css} +0 -0
- package/lib/ProTable/style/index.js +1 -1
- package/lib/QuickMenu/index.d.ts +14 -0
- package/lib/QuickMenu/index.js +187 -0
- package/lib/QuickMenu/style/index.css +560 -0
- package/lib/QuickMenu/style/index.d.ts +1 -0
- package/lib/QuickMenu/style/index.js +3 -0
- package/lib/Radio/style/{style.css → index.css} +0 -0
- package/lib/Radio/style/index.js +1 -1
- package/lib/TableRender/style/{style.css → index.css} +0 -0
- package/lib/TableRender/style/index.js +1 -1
- package/lib/Tag/index.d.ts +4 -0
- package/lib/Tag/index.js +48 -1
- package/lib/Tag/style/index.css +4 -1
- package/lib/Upload/index.d.ts +5 -1
- package/lib/Upload/index.js +8 -2
- package/lib/Upload/style/index.css +35 -0
- package/lib/UploadOss/style/{style.css → index.css} +0 -0
- package/lib/UploadOss/style/index.js +1 -1
- package/lib/VirtualList/style/{style.css → index.css} +0 -0
- package/lib/VirtualList/style/index.js +1 -1
- package/lib/_util/domTarget.d.ts +7 -0
- package/lib/_util/domTarget.js +31 -0
- package/lib/_util/getDataOrAriaProps.d.ts +1 -0
- package/lib/_util/getDataOrAriaProps.js +16 -0
- package/lib/_util/reactNode.d.ts +7 -0
- package/lib/_util/reactNode.js +24 -0
- package/lib/_util/throttleByAnimationFrame.d.ts +8 -0
- package/lib/_util/throttleByAnimationFrame.js +72 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +11 -3
- package/lib/message/hooks/useMessage.d.ts +7 -0
- package/lib/message/hooks/useMessage.js +101 -0
- package/lib/message/index.d.ts +63 -4
- package/lib/message/index.js +262 -16
- package/lib/message/style/index.css +28 -1
- package/lib/notification/hooks/useNotification.d.ts +7 -0
- package/lib/notification/hooks/useNotification.js +69 -0
- package/lib/notification/index.d.ts +54 -0
- package/lib/notification/index.js +365 -0
- package/lib/notification/style/index.css +546 -0
- package/lib/notification/style/index.d.ts +1 -0
- package/lib/notification/style/index.js +3 -0
- package/package.json +5 -2
- package/dist/Notification/index.d.ts +0 -7
- package/es/Notification/index.d.ts +0 -7
- package/es/Notification/index.js +0 -10
- package/lib/Notification/index.d.ts +0 -7
- package/lib/Notification/index.js +0 -23
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
require("antd/es/affix/style");
|
|
13
|
+
|
|
14
|
+
var _affix = _interopRequireDefault(require("antd/es/affix"));
|
|
15
|
+
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
|
|
18
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
+
|
|
20
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
24
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
25
|
+
|
|
26
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
27
|
+
|
|
28
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
29
|
+
|
|
30
|
+
var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
|
|
31
|
+
|
|
32
|
+
var _omit = _interopRequireDefault(require("rc-util/lib/omit"));
|
|
33
|
+
|
|
34
|
+
var React = _interopRequireWildcard(require("react"));
|
|
35
|
+
|
|
36
|
+
var _configProvider = require("antd/es/config-provider");
|
|
37
|
+
|
|
38
|
+
var _throttleByAnimationFrame = require("../_util/throttleByAnimationFrame");
|
|
39
|
+
|
|
40
|
+
var _utils = require("./utils");
|
|
41
|
+
|
|
42
|
+
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
|
|
43
|
+
var c = arguments.length,
|
|
44
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
45
|
+
d;
|
|
46
|
+
if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof2.default)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
|
47
|
+
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
48
|
+
}
|
|
49
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function getDefaultTarget() {
|
|
53
|
+
return typeof window !== 'undefined' ? window : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var AffixStatus;
|
|
57
|
+
|
|
58
|
+
(function (AffixStatus) {
|
|
59
|
+
AffixStatus[AffixStatus["None"] = 0] = "None";
|
|
60
|
+
AffixStatus[AffixStatus["Prepare"] = 1] = "Prepare";
|
|
61
|
+
})(AffixStatus || (AffixStatus = {}));
|
|
62
|
+
|
|
63
|
+
var Affix = /*#__PURE__*/function (_React$Component) {
|
|
64
|
+
(0, _inherits2.default)(Affix, _React$Component);
|
|
65
|
+
|
|
66
|
+
var _super = (0, _createSuper2.default)(Affix);
|
|
67
|
+
|
|
68
|
+
function Affix() {
|
|
69
|
+
var _this;
|
|
70
|
+
|
|
71
|
+
(0, _classCallCheck2.default)(this, Affix);
|
|
72
|
+
_this = _super.apply(this, arguments);
|
|
73
|
+
_this.state = {
|
|
74
|
+
status: AffixStatus.None,
|
|
75
|
+
lastAffix: false,
|
|
76
|
+
prevTarget: null
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
_this.getOffsetTop = function () {
|
|
80
|
+
var _this$props = _this.props,
|
|
81
|
+
offsetBottom = _this$props.offsetBottom,
|
|
82
|
+
offsetTop = _this$props.offsetTop;
|
|
83
|
+
return offsetBottom === undefined && offsetTop === undefined ? 0 : offsetTop;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
_this.getOffsetBottom = function () {
|
|
87
|
+
return _this.props.offsetBottom;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
_this.savePlaceholderNode = function (node) {
|
|
91
|
+
_this.placeholderNode = node;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
_this.saveFixedNode = function (node) {
|
|
95
|
+
_this.fixedNode = node;
|
|
96
|
+
}; // =================== Measure ===================
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
_this.measure = function () {
|
|
100
|
+
var _this$state = _this.state,
|
|
101
|
+
status = _this$state.status,
|
|
102
|
+
lastAffix = _this$state.lastAffix;
|
|
103
|
+
var onChange = _this.props.onChange;
|
|
104
|
+
|
|
105
|
+
var targetFunc = _this.getTargetFunc();
|
|
106
|
+
|
|
107
|
+
if (status !== AffixStatus.Prepare || !_this.fixedNode || !_this.placeholderNode || !targetFunc) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var offsetTop = _this.getOffsetTop();
|
|
112
|
+
|
|
113
|
+
var offsetBottom = _this.getOffsetBottom();
|
|
114
|
+
|
|
115
|
+
var targetNode = targetFunc();
|
|
116
|
+
|
|
117
|
+
if (!targetNode) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var newState = {
|
|
122
|
+
status: AffixStatus.None
|
|
123
|
+
};
|
|
124
|
+
var targetRect = (0, _utils.getTargetRect)(targetNode);
|
|
125
|
+
var placeholderReact = (0, _utils.getTargetRect)(_this.placeholderNode);
|
|
126
|
+
var fixedTop = (0, _utils.getFixedTop)(placeholderReact, targetRect, offsetTop);
|
|
127
|
+
var fixedBottom = (0, _utils.getFixedBottom)(placeholderReact, targetRect, offsetBottom);
|
|
128
|
+
|
|
129
|
+
if (fixedTop !== undefined) {
|
|
130
|
+
newState.affixStyle = {
|
|
131
|
+
position: 'fixed',
|
|
132
|
+
top: fixedTop,
|
|
133
|
+
width: placeholderReact.width,
|
|
134
|
+
height: placeholderReact.height
|
|
135
|
+
};
|
|
136
|
+
newState.placeholderStyle = {
|
|
137
|
+
width: placeholderReact.width,
|
|
138
|
+
height: placeholderReact.height
|
|
139
|
+
};
|
|
140
|
+
} else if (fixedBottom !== undefined) {
|
|
141
|
+
newState.affixStyle = {
|
|
142
|
+
position: 'fixed',
|
|
143
|
+
bottom: fixedBottom,
|
|
144
|
+
width: placeholderReact.width,
|
|
145
|
+
height: placeholderReact.height
|
|
146
|
+
};
|
|
147
|
+
newState.placeholderStyle = {
|
|
148
|
+
width: placeholderReact.width,
|
|
149
|
+
height: placeholderReact.height
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
newState.lastAffix = !!newState.affixStyle;
|
|
154
|
+
|
|
155
|
+
if (onChange && lastAffix !== newState.lastAffix) {
|
|
156
|
+
onChange(newState.lastAffix);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
_this.setState(newState);
|
|
160
|
+
}; // @ts-ignore TS6133
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
_this.prepareMeasure = function () {
|
|
164
|
+
// event param is used before. Keep compatible ts define here.
|
|
165
|
+
_this.setState({
|
|
166
|
+
status: AffixStatus.Prepare,
|
|
167
|
+
affixStyle: undefined,
|
|
168
|
+
placeholderStyle: undefined
|
|
169
|
+
}); // Test if `updatePosition` called
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if (process.env.NODE_ENV === 'test') {
|
|
173
|
+
var onTestUpdatePosition = _this.props.onTestUpdatePosition;
|
|
174
|
+
onTestUpdatePosition === null || onTestUpdatePosition === void 0 ? void 0 : onTestUpdatePosition();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return _this;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
(0, _createClass2.default)(Affix, [{
|
|
182
|
+
key: "getTargetFunc",
|
|
183
|
+
value: function getTargetFunc() {
|
|
184
|
+
var getTargetContainer = this.context.getTargetContainer;
|
|
185
|
+
var target = this.props.target;
|
|
186
|
+
|
|
187
|
+
if (target !== undefined) {
|
|
188
|
+
return target;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return getTargetContainer || getDefaultTarget;
|
|
192
|
+
} // Event handler
|
|
193
|
+
|
|
194
|
+
}, {
|
|
195
|
+
key: "componentDidMount",
|
|
196
|
+
value: function componentDidMount() {
|
|
197
|
+
var _this2 = this;
|
|
198
|
+
|
|
199
|
+
var targetFunc = this.getTargetFunc();
|
|
200
|
+
|
|
201
|
+
if (targetFunc) {
|
|
202
|
+
// [Legacy] Wait for parent component ref has its value.
|
|
203
|
+
// We should use target as directly element instead of function which makes element check hard.
|
|
204
|
+
this.timeout = setTimeout(function () {
|
|
205
|
+
(0, _utils.addObserveTarget)(targetFunc(), _this2); // Mock Event object.
|
|
206
|
+
|
|
207
|
+
_this2.updatePosition();
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, {
|
|
212
|
+
key: "componentDidUpdate",
|
|
213
|
+
value: function componentDidUpdate(prevProps) {
|
|
214
|
+
var prevTarget = this.state.prevTarget;
|
|
215
|
+
var targetFunc = this.getTargetFunc();
|
|
216
|
+
var newTarget = (targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc()) || null;
|
|
217
|
+
|
|
218
|
+
if (prevTarget !== newTarget) {
|
|
219
|
+
(0, _utils.removeObserveTarget)(this);
|
|
220
|
+
|
|
221
|
+
if (newTarget) {
|
|
222
|
+
(0, _utils.addObserveTarget)(newTarget, this); // Mock Event object.
|
|
223
|
+
|
|
224
|
+
this.updatePosition();
|
|
225
|
+
} // eslint-disable-next-line react/no-did-update-set-state
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
this.setState({
|
|
229
|
+
prevTarget: newTarget
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (prevProps.offsetTop !== this.props.offsetTop || prevProps.offsetBottom !== this.props.offsetBottom) {
|
|
234
|
+
this.updatePosition();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
this.measure();
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
key: "componentWillUnmount",
|
|
241
|
+
value: function componentWillUnmount() {
|
|
242
|
+
clearTimeout(this.timeout);
|
|
243
|
+
(0, _utils.removeObserveTarget)(this);
|
|
244
|
+
this.updatePosition.cancel(); // https://github.com/ant-design/ant-design/issues/22683
|
|
245
|
+
|
|
246
|
+
this.lazyUpdatePosition.cancel();
|
|
247
|
+
} // Handle realign logic
|
|
248
|
+
|
|
249
|
+
}, {
|
|
250
|
+
key: "updatePosition",
|
|
251
|
+
value: function updatePosition() {
|
|
252
|
+
this.prepareMeasure();
|
|
253
|
+
}
|
|
254
|
+
}, {
|
|
255
|
+
key: "lazyUpdatePosition",
|
|
256
|
+
value: function lazyUpdatePosition() {
|
|
257
|
+
var targetFunc = this.getTargetFunc();
|
|
258
|
+
var affixStyle = this.state.affixStyle; // Check position change before measure to make Safari smooth
|
|
259
|
+
|
|
260
|
+
if (targetFunc && affixStyle) {
|
|
261
|
+
var offsetTop = this.getOffsetTop();
|
|
262
|
+
var offsetBottom = this.getOffsetBottom();
|
|
263
|
+
var targetNode = targetFunc();
|
|
264
|
+
|
|
265
|
+
if (targetNode && this.placeholderNode) {
|
|
266
|
+
var targetRect = (0, _utils.getTargetRect)(targetNode);
|
|
267
|
+
var placeholderReact = (0, _utils.getTargetRect)(this.placeholderNode);
|
|
268
|
+
var fixedTop = (0, _utils.getFixedTop)(placeholderReact, targetRect, offsetTop);
|
|
269
|
+
var fixedBottom = (0, _utils.getFixedBottom)(placeholderReact, targetRect, offsetBottom);
|
|
270
|
+
|
|
271
|
+
if (fixedTop !== undefined && affixStyle.top === fixedTop || fixedBottom !== undefined && affixStyle.bottom === fixedBottom) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
} // Directly call prepare measure since it's already throttled.
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
this.prepareMeasure();
|
|
279
|
+
} // =================== Render ===================
|
|
280
|
+
|
|
281
|
+
}, {
|
|
282
|
+
key: "render",
|
|
283
|
+
value: function render() {
|
|
284
|
+
var _this3 = this;
|
|
285
|
+
|
|
286
|
+
var _this$state2 = this.state,
|
|
287
|
+
affixStyle = _this$state2.affixStyle,
|
|
288
|
+
placeholderStyle = _this$state2.placeholderStyle;
|
|
289
|
+
var _this$props2 = this.props,
|
|
290
|
+
affixPrefixCls = _this$props2.affixPrefixCls,
|
|
291
|
+
children = _this$props2.children;
|
|
292
|
+
var className = (0, _classnames.default)((0, _defineProperty2.default)({}, affixPrefixCls, !!affixStyle));
|
|
293
|
+
var props = (0, _omit.default)(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange', 'affixPrefixCls']); // Omit this since `onTestUpdatePosition` only works on test.
|
|
294
|
+
|
|
295
|
+
if (process.env.NODE_ENV === 'test') {
|
|
296
|
+
props = (0, _omit.default)(props, ['onTestUpdatePosition']);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return /*#__PURE__*/React.createElement(_rcResizeObserver.default, {
|
|
300
|
+
onResize: function onResize() {
|
|
301
|
+
_this3.updatePosition();
|
|
302
|
+
}
|
|
303
|
+
}, /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
|
304
|
+
ref: this.savePlaceholderNode
|
|
305
|
+
}), affixStyle && /*#__PURE__*/React.createElement("div", {
|
|
306
|
+
style: placeholderStyle,
|
|
307
|
+
"aria-hidden": "true"
|
|
308
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
309
|
+
className: className,
|
|
310
|
+
ref: this.saveFixedNode,
|
|
311
|
+
style: affixStyle
|
|
312
|
+
}, /*#__PURE__*/React.createElement(_rcResizeObserver.default, {
|
|
313
|
+
onResize: function onResize() {
|
|
314
|
+
_this3.updatePosition();
|
|
315
|
+
}
|
|
316
|
+
}, children))));
|
|
317
|
+
}
|
|
318
|
+
}]);
|
|
319
|
+
return Affix;
|
|
320
|
+
}(React.Component);
|
|
321
|
+
|
|
322
|
+
Affix.contextType = _configProvider.ConfigContext;
|
|
323
|
+
|
|
324
|
+
__decorate([(0, _throttleByAnimationFrame.throttleByAnimationFrameDecorator)()], Affix.prototype, "updatePosition", null);
|
|
325
|
+
|
|
326
|
+
__decorate([(0, _throttleByAnimationFrame.throttleByAnimationFrameDecorator)()], Affix.prototype, "lazyUpdatePosition", null);
|
|
327
|
+
|
|
328
|
+
var AffixFC = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
329
|
+
var customizePrefixCls = props.prefixCls;
|
|
330
|
+
|
|
331
|
+
var _React$useContext = React.useContext(_configProvider.ConfigContext),
|
|
332
|
+
getPrefixCls = _React$useContext.getPrefixCls;
|
|
333
|
+
|
|
334
|
+
var affixPrefixCls = getPrefixCls('affix', customizePrefixCls);
|
|
335
|
+
var affixProps = Object.assign(Object.assign({}, props), {
|
|
336
|
+
affixPrefixCls: affixPrefixCls
|
|
337
|
+
});
|
|
338
|
+
return /*#__PURE__*/React.createElement(Affix, Object.assign({}, affixProps, {
|
|
339
|
+
ref: ref
|
|
340
|
+
}));
|
|
341
|
+
});
|
|
342
|
+
AffixFC.AntdAffix = _affix.default;
|
|
343
|
+
|
|
344
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
345
|
+
AffixFC.displayName = 'Affix';
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
var _default = AffixFC;
|
|
349
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type BindElement = HTMLElement | Window | null | undefined;
|
|
2
|
+
export declare function getTargetRect(target: BindElement): DOMRect;
|
|
3
|
+
export declare function getFixedTop(placeholderReact: DOMRect, targetRect: DOMRect, offsetTop?: number): number;
|
|
4
|
+
export declare function getFixedBottom(placeholderReact: DOMRect, targetRect: DOMRect, offsetBottom?: number): number;
|
|
5
|
+
interface ObserverEntity {
|
|
6
|
+
target: HTMLElement | Window;
|
|
7
|
+
affixList: any[];
|
|
8
|
+
eventHandlers: {
|
|
9
|
+
[eventName: string]: any;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function getObserverEntities(): ObserverEntity[];
|
|
13
|
+
export declare function addObserveTarget<T>(target: HTMLElement | Window | null, affix: T): void;
|
|
14
|
+
export declare function removeObserveTarget<T>(affix: T): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.addObserveTarget = addObserveTarget;
|
|
9
|
+
exports.getFixedBottom = getFixedBottom;
|
|
10
|
+
exports.getFixedTop = getFixedTop;
|
|
11
|
+
exports.getObserverEntities = getObserverEntities;
|
|
12
|
+
exports.getTargetRect = getTargetRect;
|
|
13
|
+
exports.removeObserveTarget = removeObserveTarget;
|
|
14
|
+
|
|
15
|
+
var _addEventListener = _interopRequireDefault(require("rc-util/lib/Dom/addEventListener"));
|
|
16
|
+
|
|
17
|
+
function getTargetRect(target) {
|
|
18
|
+
return target !== window ? target.getBoundingClientRect() : {
|
|
19
|
+
top: 0,
|
|
20
|
+
bottom: window.innerHeight
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getFixedTop(placeholderReact, targetRect, offsetTop) {
|
|
25
|
+
if (offsetTop !== undefined && targetRect.top > placeholderReact.top - offsetTop) {
|
|
26
|
+
return offsetTop + targetRect.top;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getFixedBottom(placeholderReact, targetRect, offsetBottom) {
|
|
33
|
+
if (offsetBottom !== undefined && targetRect.bottom < placeholderReact.bottom + offsetBottom) {
|
|
34
|
+
var targetBottomOffset = window.innerHeight - targetRect.bottom;
|
|
35
|
+
return offsetBottom + targetBottomOffset;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return undefined;
|
|
39
|
+
} // ======================== Observer ========================
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
var TRIGGER_EVENTS = ['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'];
|
|
43
|
+
var observerEntities = [];
|
|
44
|
+
|
|
45
|
+
function getObserverEntities() {
|
|
46
|
+
// Only used in test env. Can be removed if refactor.
|
|
47
|
+
return observerEntities;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function addObserveTarget(target, affix) {
|
|
51
|
+
if (!target) return;
|
|
52
|
+
var entity = observerEntities.find(function (item) {
|
|
53
|
+
return item.target === target;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (entity) {
|
|
57
|
+
entity.affixList.push(affix);
|
|
58
|
+
} else {
|
|
59
|
+
entity = {
|
|
60
|
+
target: target,
|
|
61
|
+
affixList: [affix],
|
|
62
|
+
eventHandlers: {}
|
|
63
|
+
};
|
|
64
|
+
observerEntities.push(entity); // Add listener
|
|
65
|
+
|
|
66
|
+
TRIGGER_EVENTS.forEach(function (eventName) {
|
|
67
|
+
entity.eventHandlers[eventName] = (0, _addEventListener.default)(target, eventName, function () {
|
|
68
|
+
entity.affixList.forEach(function (targetAffix) {
|
|
69
|
+
targetAffix.lazyUpdatePosition();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function removeObserveTarget(affix) {
|
|
77
|
+
var observerEntity = observerEntities.find(function (oriObserverEntity) {
|
|
78
|
+
var hasAffix = oriObserverEntity.affixList.some(function (item) {
|
|
79
|
+
return item === affix;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (hasAffix) {
|
|
83
|
+
oriObserverEntity.affixList = oriObserverEntity.affixList.filter(function (item) {
|
|
84
|
+
return item !== affix;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return hasAffix;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (observerEntity && observerEntity.affixList.length === 0) {
|
|
92
|
+
observerEntities = observerEntities.filter(function (item) {
|
|
93
|
+
return item !== observerEntity;
|
|
94
|
+
}); // Remove listener
|
|
95
|
+
|
|
96
|
+
TRIGGER_EVENTS.forEach(function (eventName) {
|
|
97
|
+
var handler = observerEntity.eventHandlers[eventName];
|
|
98
|
+
|
|
99
|
+
if (handler && handler.remove) {
|
|
100
|
+
handler.remove();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface ErrorBoundaryProps {
|
|
3
|
+
message?: React.ReactNode;
|
|
4
|
+
description?: React.ReactNode;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, {
|
|
8
|
+
error?: Error | null;
|
|
9
|
+
info: {
|
|
10
|
+
componentStack?: string;
|
|
11
|
+
};
|
|
12
|
+
}> {
|
|
13
|
+
state: {
|
|
14
|
+
error: any;
|
|
15
|
+
info: {
|
|
16
|
+
componentStack: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
componentDidCatch(error: Error | null, info: object): void;
|
|
20
|
+
render(): React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
|
+
|
|
20
|
+
var React = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _ = _interopRequireDefault(require("."));
|
|
23
|
+
|
|
24
|
+
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
25
|
+
(0, _inherits2.default)(ErrorBoundary, _React$Component);
|
|
26
|
+
|
|
27
|
+
var _super = (0, _createSuper2.default)(ErrorBoundary);
|
|
28
|
+
|
|
29
|
+
function ErrorBoundary() {
|
|
30
|
+
var _this;
|
|
31
|
+
|
|
32
|
+
(0, _classCallCheck2.default)(this, ErrorBoundary);
|
|
33
|
+
_this = _super.apply(this, arguments);
|
|
34
|
+
_this.state = {
|
|
35
|
+
error: undefined,
|
|
36
|
+
info: {
|
|
37
|
+
componentStack: ''
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return _this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
(0, _createClass2.default)(ErrorBoundary, [{
|
|
44
|
+
key: "componentDidCatch",
|
|
45
|
+
value: function componentDidCatch(error, info) {
|
|
46
|
+
this.setState({
|
|
47
|
+
error: error,
|
|
48
|
+
info: info
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
var _this$props = this.props,
|
|
55
|
+
message = _this$props.message,
|
|
56
|
+
description = _this$props.description,
|
|
57
|
+
children = _this$props.children;
|
|
58
|
+
var _this$state = this.state,
|
|
59
|
+
error = _this$state.error,
|
|
60
|
+
info = _this$state.info;
|
|
61
|
+
var componentStack = info && info.componentStack ? info.componentStack : null;
|
|
62
|
+
var errorMessage = typeof message === 'undefined' ? (error || '').toString() : message;
|
|
63
|
+
var errorDescription = typeof description === 'undefined' ? componentStack : description;
|
|
64
|
+
|
|
65
|
+
if (error) {
|
|
66
|
+
return /*#__PURE__*/React.createElement(_.default, {
|
|
67
|
+
type: "error",
|
|
68
|
+
message: errorMessage,
|
|
69
|
+
description: /*#__PURE__*/React.createElement("pre", null, errorDescription)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return children;
|
|
74
|
+
}
|
|
75
|
+
}]);
|
|
76
|
+
return ErrorBoundary;
|
|
77
|
+
}(React.Component);
|
|
78
|
+
|
|
79
|
+
exports.default = ErrorBoundary;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Alert as AntdAlert } from 'antd';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import ErrorBoundary from './ErrorBoundary';
|
|
4
|
+
export interface AlertProps {
|
|
5
|
+
/** Type of Alert styles, options:`success`, `info`, `warning`, `error` */
|
|
6
|
+
type?: 'success' | 'info' | 'warning' | 'error';
|
|
7
|
+
/** Whether Alert can be closed */
|
|
8
|
+
closable?: boolean;
|
|
9
|
+
/** Close text to show */
|
|
10
|
+
closeText?: React.ReactNode;
|
|
11
|
+
/** Content of Alert */
|
|
12
|
+
message?: React.ReactNode;
|
|
13
|
+
/** Additional content of Alert */
|
|
14
|
+
description?: React.ReactNode;
|
|
15
|
+
/** Callback when close Alert */
|
|
16
|
+
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
17
|
+
/** Trigger when animation ending of Alert */
|
|
18
|
+
afterClose?: () => void;
|
|
19
|
+
/** Whether to show icon */
|
|
20
|
+
showIcon?: boolean;
|
|
21
|
+
/** https://www.w3.org/TR/2014/REC-html5-20141028/dom.html#aria-role-attribute */
|
|
22
|
+
role?: string;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
prefixCls?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
banner?: boolean;
|
|
27
|
+
icon?: React.ReactNode;
|
|
28
|
+
/** Custome closeIcon */
|
|
29
|
+
closeIcon?: React.ReactNode;
|
|
30
|
+
action?: React.ReactNode;
|
|
31
|
+
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
32
|
+
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
|
33
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
34
|
+
duration?: number;
|
|
35
|
+
}
|
|
36
|
+
interface AlertInterface extends React.FC<AlertProps> {
|
|
37
|
+
ErrorBoundary: typeof ErrorBoundary;
|
|
38
|
+
AntdAlert: typeof AntdAlert;
|
|
39
|
+
}
|
|
40
|
+
declare const Alert: AlertInterface;
|
|
41
|
+
export default Alert;
|