linkmore-design 1.0.53 → 1.0.56
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/CardTable/card/PictureTextRowOperate.d.ts +7 -0
- 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/LmFilter/Controls/CheckboxTags.d.ts +6 -0
- package/dist/LmFilter/Controls/index.d.ts +2 -0
- package/dist/LmFilter/LmFilter.d.ts +6 -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/drawer.d.ts +4 -0
- package/dist/LmFilter/complexFilter/index.d.ts +4 -0
- package/dist/LmFilter/complexFilter/valueDrawer.d.ts +4 -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/localization.d.ts +8 -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/Switch/demos/table.d.ts +2 -0
- package/dist/Switch/index.d.ts +2 -1
- 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 +4245 -3326
- package/dist/index.umd.min.js +5 -5
- 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/es/{Notification → 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/CardTable/body/TableBodyCell.js +3 -0
- package/es/CardTable/card/PictureTextColumn.js +8 -6
- package/es/CardTable/card/PictureTextRow.js +14 -51
- package/es/CardTable/card/PictureTextRowOperate.js +130 -0
- 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/es/CardTable/style/index.css +160 -12
- 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/Descriptions/style/index.css +10 -8
- package/es/IconFont/index.js +3 -2
- package/es/LmFilter/Controls/CheckboxTags.js +53 -0
- package/es/LmFilter/Controls/index.js +47 -0
- package/es/LmFilter/LmFilter.js +39 -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/drawer.js +376 -0
- package/es/LmFilter/complexFilter/index.js +64 -0
- package/es/LmFilter/complexFilter/valueDrawer.js +238 -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 +229 -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 +73 -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/localization.d.ts +8 -0
- package/es/LmFilter/localization.js +12 -0
- package/es/LmFilter/style/index.js +3 -0
- package/es/LmFilter/style/style.css +212 -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 +170 -0
- package/es/LmFilter/wrapper/FilterWrapper.js +25 -0
- 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/Switch/index.d.ts +2 -1
- package/es/Switch/index.js +33 -1
- package/es/Switch/style/index.css +41 -0
- 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/_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/style/index.css +1 -0
- 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/lib/{Notification → 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/CardTable/body/TableBodyCell.js +3 -0
- package/lib/CardTable/card/PictureTextColumn.js +8 -6
- package/lib/CardTable/card/PictureTextRow.js +14 -51
- package/lib/CardTable/card/PictureTextRowOperate.js +130 -0
- 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/lib/CardTable/style/index.css +160 -12
- 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/Descriptions/style/index.css +10 -8
- package/lib/IconFont/index.js +3 -2
- package/lib/LmFilter/Controls/CheckboxTags.js +53 -0
- package/lib/LmFilter/Controls/index.js +47 -0
- package/lib/LmFilter/LmFilter.js +39 -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/drawer.js +376 -0
- package/lib/LmFilter/complexFilter/index.js +64 -0
- package/lib/LmFilter/complexFilter/valueDrawer.js +238 -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 +229 -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 +73 -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/localization.d.ts +8 -0
- package/lib/LmFilter/localization.js +19 -0
- package/lib/LmFilter/style/index.js +3 -0
- package/lib/LmFilter/style/style.css +212 -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 +170 -0
- package/lib/LmFilter/wrapper/FilterWrapper.js +25 -0
- 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/Switch/index.d.ts +2 -1
- package/lib/Switch/index.js +34 -1
- package/lib/Switch/style/index.css +41 -0
- 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/_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/style/index.css +1 -0
- 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,170 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _FilterWrapper = _interopRequireDefault(require("./FilterWrapper"));
|
|
21
|
+
|
|
22
|
+
var _filterFns = _interopRequireDefault(require("../filterFns"));
|
|
23
|
+
|
|
24
|
+
// 根文件 => 参数聚合
|
|
25
|
+
var reducer = function reducer(state, action) {
|
|
26
|
+
var basicFilter = action.basicFilter,
|
|
27
|
+
resize = action.resize,
|
|
28
|
+
rows = action.rows,
|
|
29
|
+
complexDrawer = action.complexDrawer,
|
|
30
|
+
valueDrawer = action.valueDrawer,
|
|
31
|
+
complexFilter = action.complexFilter;
|
|
32
|
+
|
|
33
|
+
switch (action.type) {
|
|
34
|
+
case 'changeBasicFilter':
|
|
35
|
+
// 基础筛选数据改变
|
|
36
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
37
|
+
basicFilter: basicFilter
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
case 'changeRows':
|
|
41
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
42
|
+
rows: rows
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
case 'windowResize':
|
|
46
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
47
|
+
resize: resize
|
|
48
|
+
});
|
|
49
|
+
// 高级筛选
|
|
50
|
+
|
|
51
|
+
case 'changeComplexFilter':
|
|
52
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
53
|
+
complexFilter: complexFilter
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
case 'changeComplexDrawer':
|
|
57
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
58
|
+
complexDrawer: complexDrawer
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
case 'changeValueDrawer':
|
|
62
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
63
|
+
valueDrawer: valueDrawer
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
case 'reset':
|
|
67
|
+
// 一键清空
|
|
68
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
69
|
+
basicFilter: {}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
default:
|
|
73
|
+
throw new Error();
|
|
74
|
+
}
|
|
75
|
+
}; // const getRows = ({ fieldName, value }, arr) => {
|
|
76
|
+
// const findItem = arr.find(item => {
|
|
77
|
+
// return item.field === fieldName;
|
|
78
|
+
// })
|
|
79
|
+
// switch (findItem.type) {
|
|
80
|
+
// case 'input':
|
|
81
|
+
// return value;
|
|
82
|
+
// case 'select':
|
|
83
|
+
// return findItem.data.find(v => v.value === value);
|
|
84
|
+
// case 'checkbox':
|
|
85
|
+
// return findItem.data.find(v => [value].includes(v.value));
|
|
86
|
+
// default:
|
|
87
|
+
// break;
|
|
88
|
+
// }
|
|
89
|
+
// };
|
|
90
|
+
// 仅在初始化时触发一次
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var getInitialState = function getInitialState(_ref) {
|
|
94
|
+
var localization = _ref.localization;
|
|
95
|
+
var globalQuery = localization.globalQuery,
|
|
96
|
+
filterQuery = localization.filterQuery;
|
|
97
|
+
var basicFilter = {};
|
|
98
|
+
filterQuery.filter.forEach(function (item) {
|
|
99
|
+
basicFilter[item.fieldName] = item.value;
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
basicFilter: basicFilter,
|
|
103
|
+
complexFilter: {},
|
|
104
|
+
complexDrawer: {
|
|
105
|
+
visible: false,
|
|
106
|
+
data: {}
|
|
107
|
+
},
|
|
108
|
+
valueDrawer: {
|
|
109
|
+
visible: false,
|
|
110
|
+
data: {}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
var LmFilterRoot = function LmFilterRoot(props, ref) {
|
|
116
|
+
var initialState = (0, _react.useMemo)(function () {
|
|
117
|
+
return getInitialState(props);
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
var _useReducer = (0, _react.useReducer)(reducer, initialState),
|
|
121
|
+
_useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
|
|
122
|
+
state = _useReducer2[0],
|
|
123
|
+
dispatch = _useReducer2[1]; // 初始化配置
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
var configProps = (0, _react.useMemo)(function () {
|
|
127
|
+
var resetProps = (0, _extends2.default)({}, props);
|
|
128
|
+
return (0, _objectSpread2.default)({
|
|
129
|
+
dataSource: [],
|
|
130
|
+
// 数据源
|
|
131
|
+
enableSearch: true,
|
|
132
|
+
// 是否启用模糊查询
|
|
133
|
+
enableBaisc: true,
|
|
134
|
+
// 是否启用基础筛选
|
|
135
|
+
enableComplex: false,
|
|
136
|
+
// 是否启用高级筛选
|
|
137
|
+
enableCustom: false,
|
|
138
|
+
// 是否启用自定义筛选
|
|
139
|
+
size: 'middle',
|
|
140
|
+
// 尺寸
|
|
141
|
+
searchKey: 'search',
|
|
142
|
+
// 搜索的key值
|
|
143
|
+
placeholder: '请输入'
|
|
144
|
+
}, resetProps);
|
|
145
|
+
}, [props]); // 事件集合
|
|
146
|
+
|
|
147
|
+
var eventProps = (0, _react.useMemo)(function () {
|
|
148
|
+
return (0, _filterFns.default)({
|
|
149
|
+
state: state,
|
|
150
|
+
dispatch: dispatch,
|
|
151
|
+
props: props
|
|
152
|
+
});
|
|
153
|
+
}, [state, dispatch, props]); // 组件示例
|
|
154
|
+
|
|
155
|
+
var instance = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, configProps), eventProps), {}, {
|
|
156
|
+
state: state,
|
|
157
|
+
dispatch: dispatch
|
|
158
|
+
}); // 向外暴露出的方法
|
|
159
|
+
|
|
160
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
161
|
+
return (0, _objectSpread2.default)({}, eventProps);
|
|
162
|
+
});
|
|
163
|
+
return /*#__PURE__*/_react.default.createElement(_FilterWrapper.default, {
|
|
164
|
+
instance: instance
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
var _default = /*#__PURE__*/(0, _react.forwardRef)(LmFilterRoot);
|
|
169
|
+
|
|
170
|
+
exports.default = _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
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.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _FilterContainer = _interopRequireDefault(require("./FilterContainer"));
|
|
13
|
+
|
|
14
|
+
// 包裹过滤组件区域: 拓展其他结构
|
|
15
|
+
var LmFilterWrapper = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
16
|
+
var instance = _ref.instance;
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
+
className: "lm_filter_wrapper"
|
|
19
|
+
}, /*#__PURE__*/_react.default.createElement(_FilterContainer.default, {
|
|
20
|
+
instance: instance
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
var _default = LmFilterWrapper;
|
|
25
|
+
exports.default = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IMenuData {
|
|
3
|
+
menuId: string;
|
|
4
|
+
title: string | React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface IQuickMenuProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
top?: number;
|
|
10
|
+
menuData: IMenuData[];
|
|
11
|
+
warpElement: any;
|
|
12
|
+
}
|
|
13
|
+
declare const LMQuickMenu: React.FC<IQuickMenuProps>;
|
|
14
|
+
export default LMQuickMenu;
|
|
@@ -0,0 +1,187 @@
|
|
|
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _linkmoreDesign = require("linkmore-design");
|
|
17
|
+
|
|
18
|
+
var _ahooks = require("ahooks");
|
|
19
|
+
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
|
|
22
|
+
var _domTarget = require("../_util/domTarget");
|
|
23
|
+
|
|
24
|
+
var prefixCls = 'lm_quick_menu';
|
|
25
|
+
|
|
26
|
+
var LMQuickMenu = function LMQuickMenu(props) {
|
|
27
|
+
var className = props.className,
|
|
28
|
+
_props$top = props.top,
|
|
29
|
+
top = _props$top === void 0 ? '104px' : _props$top,
|
|
30
|
+
_props$menuData = props.menuData,
|
|
31
|
+
menuData = _props$menuData === void 0 ? [] : _props$menuData,
|
|
32
|
+
warpElement = props.warpElement;
|
|
33
|
+
var idTopInfo = (0, _react.useRef)({});
|
|
34
|
+
|
|
35
|
+
var _useState = (0, _react.useState)(false),
|
|
36
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
+
hovering = _useState2[0],
|
|
38
|
+
setHovering = _useState2[1];
|
|
39
|
+
|
|
40
|
+
var menuTimeEventRef = (0, _react.useRef)(null);
|
|
41
|
+
|
|
42
|
+
var _useState3 = (0, _react.useState)(false),
|
|
43
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
44
|
+
scrollOpenStatus = _useState4[0],
|
|
45
|
+
setScrollOpenStatus = _useState4[1];
|
|
46
|
+
|
|
47
|
+
var scrollTimeOut = (0, _react.useRef)(null);
|
|
48
|
+
var scroll = (0, _ahooks.useScroll)((0, _domTarget.getTargetElement)(warpElement || document), function () {
|
|
49
|
+
return scrollOpenStatus;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
function clearActiveToc() {
|
|
53
|
+
[].forEach.call(document.querySelectorAll('.lm_menu_list li a'), function (node) {
|
|
54
|
+
node.className = '';
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var updateActiveToc = function updateActiveToc(id) {
|
|
59
|
+
var currentNode = document.querySelectorAll(".lm_menu_list li a[data-id=\"".concat(id, "\"]"))[0];
|
|
60
|
+
|
|
61
|
+
if (currentNode) {
|
|
62
|
+
clearActiveToc();
|
|
63
|
+
currentNode.className = 'current';
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var bindScroller = function bindScroller() {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
|
|
70
|
+
if (menuTimeEventRef.current) {
|
|
71
|
+
(_a = menuTimeEventRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!menuData.length) {
|
|
75
|
+
return;
|
|
76
|
+
} // eslint-disable-next-line global-require
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
require('intersection-observer'); // eslint-disable-next-line global-require
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
var scrollama = require('scrollama');
|
|
83
|
+
|
|
84
|
+
menuTimeEventRef.current = scrollama();
|
|
85
|
+
(_c = (_b = menuTimeEventRef.current) === null || _b === void 0 ? void 0 : _b.setup({
|
|
86
|
+
step: menuData.map(function (item) {
|
|
87
|
+
return document.getElementById("".concat(item.menuId));
|
|
88
|
+
}).filter(Boolean) // required
|
|
89
|
+
// offset: '10px',
|
|
90
|
+
|
|
91
|
+
})) === null || _c === void 0 ? void 0 : _c.onStepEnter(function (_ref) {
|
|
92
|
+
var element = _ref.element;
|
|
93
|
+
updateActiveToc(element.id);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function setKeysDom() {
|
|
98
|
+
menuData.forEach(function (item) {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
|
|
101
|
+
var warpTop = ((_a = (0, _domTarget.getTargetElement)(warpElement || document)) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
|
|
102
|
+
idTopInfo.current["".concat(item.menuId)] = ((_b = document.getElementById("".concat(item.menuId))) === null || _b === void 0 ? void 0 : _b.offsetTop) - warpTop;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
(0, _react.useEffect)(function () {
|
|
107
|
+
if (scroll && !hovering) {
|
|
108
|
+
setHovering(true);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (scrollTimeOut.current) {
|
|
112
|
+
clearTimeout(scrollTimeOut.current);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
scrollTimeOut.current = setTimeout(function () {
|
|
116
|
+
setHovering(false);
|
|
117
|
+
}, 2000);
|
|
118
|
+
}, [scroll]);
|
|
119
|
+
|
|
120
|
+
var bindDom = function bindDom() {
|
|
121
|
+
if (!Object.keys(idTopInfo.current).length) {
|
|
122
|
+
setKeysDom();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var handleScroll = function handleScroll() {
|
|
127
|
+
setScrollOpenStatus(true);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var golink = function golink(id) {
|
|
131
|
+
var _a;
|
|
132
|
+
|
|
133
|
+
(0, _domTarget.getTargetElement)(warpElement || document).scrollTop = (_a = idTopInfo.current) === null || _a === void 0 ? void 0 : _a[id];
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
(0, _react.useEffect)(function () {
|
|
137
|
+
var _a; // bindScroller();
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
setTimeout(function () {
|
|
141
|
+
bindDom();
|
|
142
|
+
bindScroller();
|
|
143
|
+
}, 200);
|
|
144
|
+
(_a = (0, _domTarget.getTargetElement)(warpElement || document)) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', handleScroll, {
|
|
145
|
+
once: true
|
|
146
|
+
});
|
|
147
|
+
return function () {
|
|
148
|
+
var _a;
|
|
149
|
+
|
|
150
|
+
(_a = (0, _domTarget.getTargetElement)(warpElement || document)) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', handleScroll);
|
|
151
|
+
};
|
|
152
|
+
}, []);
|
|
153
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
154
|
+
className: (0, _classnames.default)(prefixCls),
|
|
155
|
+
onMouseEnter: function onMouseEnter() {
|
|
156
|
+
if (scrollTimeOut.current) {
|
|
157
|
+
clearTimeout(scrollTimeOut.current);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
setHovering(true);
|
|
161
|
+
},
|
|
162
|
+
onMouseLeave: function onMouseLeave() {
|
|
163
|
+
setHovering(false);
|
|
164
|
+
},
|
|
165
|
+
style: {
|
|
166
|
+
top: top
|
|
167
|
+
}
|
|
168
|
+
}, !hovering && /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
|
|
169
|
+
icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
|
|
170
|
+
type: 'lmweb-icon_m_open'
|
|
171
|
+
})
|
|
172
|
+
}), /*#__PURE__*/_react.default.createElement("ul", {
|
|
173
|
+
className: (0, _classnames.default)('lm_menu_list', hovering && 'show', className)
|
|
174
|
+
}, menuData.map(function (item) {
|
|
175
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
176
|
+
key: item.menuId,
|
|
177
|
+
onClick: function onClick() {
|
|
178
|
+
return golink(item.menuId);
|
|
179
|
+
}
|
|
180
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
181
|
+
"data-id": item.menuId
|
|
182
|
+
}, item.title));
|
|
183
|
+
})));
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
var _default = LMQuickMenu;
|
|
187
|
+
exports.default = _default;
|