@zykj2024/much-library 1.1.6 → 1.1.7-beta.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/package.json +8 -7
- package/LICENSE +0 -21
- package/README.md +0 -35
- package/dist/McCascader/city.js +0 -909
- package/dist/McCascader/index.css +0 -60
- package/dist/McCascader/index.d.ts +0 -19
- package/dist/McCascader/index.js +0 -221
- package/dist/McContainer/demo/actionBar.d.ts +0 -8
- package/dist/McContainer/demo/actionBar.js +0 -118
- package/dist/McContainer/demo/base.d.ts +0 -8
- package/dist/McContainer/demo/base.js +0 -82
- package/dist/McContainer/demo/batch.d.ts +0 -8
- package/dist/McContainer/demo/batch.js +0 -129
- package/dist/McContainer/demo/collapse.d.ts +0 -8
- package/dist/McContainer/demo/collapse.js +0 -77
- package/dist/McContainer/demo/expand.d.ts +0 -8
- package/dist/McContainer/demo/expand.js +0 -90
- package/dist/McContainer/demo/pagination.d.ts +0 -7
- package/dist/McContainer/demo/pagination.js +0 -133
- package/dist/McContainer/demo/search.d.ts +0 -7
- package/dist/McContainer/demo/search.js +0 -102
- package/dist/McContainer/demo/standard.d.ts +0 -7
- package/dist/McContainer/demo/standard.js +0 -219
- package/dist/McContainer/index.css +0 -123
- package/dist/McContainer/index.d.ts +0 -153
- package/dist/McContainer/index.js +0 -513
- package/dist/McContainer/mock/index.d.ts +0 -21
- package/dist/McContainer/mock/index.js +0 -50
- package/dist/McDateRange/demo/base.d.ts +0 -6
- package/dist/McDateRange/demo/base.js +0 -22
- package/dist/McDateRange/demo/cancelPresets.d.ts +0 -6
- package/dist/McDateRange/demo/cancelPresets.js +0 -23
- package/dist/McDateRange/demo/overlap.d.ts +0 -2
- package/dist/McDateRange/demo/overlap.js +0 -32
- package/dist/McDateRange/index.css +0 -31
- package/dist/McDateRange/index.d.ts +0 -28
- package/dist/McDateRange/index.js +0 -167
- package/dist/McEllipsisMiddle/demo/base.d.ts +0 -6
- package/dist/McEllipsisMiddle/demo/base.js +0 -25
- package/dist/McEllipsisMiddle/demo/tooltip.d.ts +0 -6
- package/dist/McEllipsisMiddle/demo/tooltip.js +0 -35
- package/dist/McEllipsisMiddle/index.css +0 -4
- package/dist/McEllipsisMiddle/index.d.ts +0 -13
- package/dist/McEllipsisMiddle/index.js +0 -42
- package/dist/McFonts/index.d.ts +0 -8
- package/dist/McFonts/index.js +0 -7
- package/dist/McGroupPanel/comps/SelectedItem/index.d.ts +0 -4
- package/dist/McGroupPanel/comps/SelectedItem/index.js +0 -75
- package/dist/McGroupPanel/index.css +0 -164
- package/dist/McGroupPanel/index.d.ts +0 -29
- package/dist/McGroupPanel/index.js +0 -411
- package/dist/McIconFont/iconfont.js +0 -1
- package/dist/McIconFont/index.d.ts +0 -5
- package/dist/McIconFont/index.js +0 -8
- package/dist/McIcons/business.json +0 -137
- package/dist/McIcons/index.css +0 -33
- package/dist/McInput/Input.d.ts +0 -19
- package/dist/McInput/Input.js +0 -48
- package/dist/McInput/Search.d.ts +0 -39
- package/dist/McInput/Search.js +0 -81
- package/dist/McInput/TextArea.d.ts +0 -11
- package/dist/McInput/TextArea.js +0 -37
- package/dist/McInput/demo/Input/addonBefore.d.ts +0 -3
- package/dist/McInput/demo/Input/addonBefore.js +0 -67
- package/dist/McInput/demo/Input/base.d.ts +0 -2
- package/dist/McInput/demo/Input/base.js +0 -31
- package/dist/McInput/demo/Input/isTrim.d.ts +0 -2
- package/dist/McInput/demo/Input/isTrim.js +0 -22
- package/dist/McInput/demo/Input/label.d.ts +0 -2
- package/dist/McInput/demo/Input/label.js +0 -26
- package/dist/McInput/demo/Input/ref.d.ts +0 -3
- package/dist/McInput/demo/Input/ref.js +0 -53
- package/dist/McInput/demo/Input/status.d.ts +0 -2
- package/dist/McInput/demo/Input/status.js +0 -23
- package/dist/McInput/demo/Search/search-base.d.ts +0 -2
- package/dist/McInput/demo/Search/search-base.js +0 -38
- package/dist/McInput/demo/TextArea/text-area-base.d.ts +0 -2
- package/dist/McInput/demo/TextArea/text-area-base.js +0 -38
- package/dist/McInput/index.css +0 -71
- package/dist/McInput/index.d.ts +0 -13
- package/dist/McInput/index.js +0 -7
- package/dist/McInputNumber/demo/index.d.ts +0 -2
- package/dist/McInputNumber/demo/index.js +0 -34
- package/dist/McInputNumber/demo/label.d.ts +0 -2
- package/dist/McInputNumber/demo/label.js +0 -26
- package/dist/McInputNumber/demo/precision.d.ts +0 -2
- package/dist/McInputNumber/demo/precision.js +0 -20
- package/dist/McInputNumber/index.css +0 -36
- package/dist/McInputNumber/index.d.ts +0 -13
- package/dist/McInputNumber/index.js +0 -43
- package/dist/McLazyLoader/demo/basic.d.ts +0 -2
- package/dist/McLazyLoader/demo/basic.js +0 -33
- package/dist/McLazyLoader/demo/container.d.ts +0 -2
- package/dist/McLazyLoader/demo/container.js +0 -83
- package/dist/McLazyLoader/demo/form.d.ts +0 -2
- package/dist/McLazyLoader/demo/form.js +0 -38
- package/dist/McLazyLoader/demo/has-root.d.ts +0 -2
- package/dist/McLazyLoader/demo/has-root.js +0 -44
- package/dist/McLazyLoader/demo/hori.d.ts +0 -2
- package/dist/McLazyLoader/demo/hori.js +0 -39
- package/dist/McLazyLoader/demo/table.d.ts +0 -2
- package/dist/McLazyLoader/demo/table.js +0 -73
- package/dist/McLazyLoader/index.d.ts +0 -39
- package/dist/McLazyLoader/index.js +0 -88
- package/dist/McModalProvider/index.d.ts +0 -174
- package/dist/McModalProvider/index.js +0 -498
- package/dist/McPeriodSelect/demo/base.d.ts +0 -6
- package/dist/McPeriodSelect/demo/base.js +0 -19
- package/dist/McPeriodSelect/demo/half.d.ts +0 -6
- package/dist/McPeriodSelect/demo/half.js +0 -20
- package/dist/McPeriodSelect/index.css +0 -189
- package/dist/McPeriodSelect/index.d.ts +0 -13
- package/dist/McPeriodSelect/index.js +0 -305
- package/dist/McPopoverButton/index.d.ts +0 -14
- package/dist/McPopoverButton/index.js +0 -52
- package/dist/McPopoverForm/index.d.ts +0 -14
- package/dist/McPopoverForm/index.js +0 -95
- package/dist/McProSelect/demo/async.d.ts +0 -2
- package/dist/McProSelect/demo/async.js +0 -66
- package/dist/McProSelect/demo/base.d.ts +0 -2
- package/dist/McProSelect/demo/base.js +0 -29
- package/dist/McProSelect/demo/exclusion-async-rename.d.ts +0 -3
- package/dist/McProSelect/demo/exclusion-async-rename.js +0 -103
- package/dist/McProSelect/demo/exclusion-rename.d.ts +0 -3
- package/dist/McProSelect/demo/exclusion-rename.js +0 -74
- package/dist/McProSelect/demo/exclusion.d.ts +0 -3
- package/dist/McProSelect/demo/exclusion.js +0 -70
- package/dist/McProSelect/demo/require.d.ts +0 -2
- package/dist/McProSelect/demo/require.js +0 -82
- package/dist/McProSelect/index.d.ts +0 -35
- package/dist/McProSelect/index.js +0 -152
- package/dist/McResult/default.d.ts +0 -1
- package/dist/McResult/default.js +0 -98
- package/dist/McResult/demo/403.d.ts +0 -6
- package/dist/McResult/demo/403.js +0 -17
- package/dist/McResult/demo/404.d.ts +0 -6
- package/dist/McResult/demo/404.js +0 -17
- package/dist/McResult/demo/500.d.ts +0 -6
- package/dist/McResult/demo/500.js +0 -17
- package/dist/McResult/demo/building.d.ts +0 -6
- package/dist/McResult/demo/building.js +0 -12
- package/dist/McResult/demo/empty.d.ts +0 -2
- package/dist/McResult/demo/empty.js +0 -11
- package/dist/McResult/demo/noFunction.d.ts +0 -2
- package/dist/McResult/demo/noFunction.js +0 -11
- package/dist/McResult/demo/noUser.d.ts +0 -6
- package/dist/McResult/demo/noUser.js +0 -12
- package/dist/McResult/demo/preview.d.ts +0 -2
- package/dist/McResult/demo/preview.js +0 -19
- package/dist/McResult/icon.d.ts +0 -25
- package/dist/McResult/icon.js +0 -1014
- package/dist/McResult/index.css +0 -20
- package/dist/McResult/index.d.ts +0 -31
- package/dist/McResult/index.js +0 -119
- package/dist/McResult/public/403.svg +0 -164
- package/dist/McResult/public/404.svg +0 -123
- package/dist/McResult/public/500.svg +0 -129
- package/dist/McResult/public/building.svg +0 -127
- package/dist/McResult/public/code403.svg +0 -7
- package/dist/McResult/public/code404.svg +0 -5
- package/dist/McResult/public/code500.svg +0 -5
- package/dist/McResult/public/detailEmpty.svg +0 -1
- package/dist/McResult/public/empty.svg +0 -1
- package/dist/McResult/public/noFunction.svg +0 -1
- package/dist/McResult/public/noUser.svg +0 -90
- package/dist/McSelect/components/PanelSearchInput/index.css +0 -6
- package/dist/McSelect/components/PanelSearchInput/index.d.ts +0 -12
- package/dist/McSelect/components/PanelSearchInput/index.js +0 -45
- package/dist/McSelect/demo/base.d.ts +0 -2
- package/dist/McSelect/demo/base.js +0 -63
- package/dist/McSelect/demo/changeOnHidden.d.ts +0 -2
- package/dist/McSelect/demo/changeOnHidden.js +0 -43
- package/dist/McSelect/demo/dropdownRender.d.ts +0 -7
- package/dist/McSelect/demo/dropdownRender.js +0 -78
- package/dist/McSelect/demo/exclusion.d.ts +0 -3
- package/dist/McSelect/demo/exclusion.js +0 -64
- package/dist/McSelect/demo/fetchOptions.d.ts +0 -7
- package/dist/McSelect/demo/fetchOptions.js +0 -211
- package/dist/McSelect/demo/inexistent.d.ts +0 -2
- package/dist/McSelect/demo/inexistent.js +0 -79
- package/dist/McSelect/demo/labelInValue.d.ts +0 -2
- package/dist/McSelect/demo/labelInValue.js +0 -72
- package/dist/McSelect/demo/maxTagCount.d.ts +0 -3
- package/dist/McSelect/demo/maxTagCount.js +0 -51
- package/dist/McSelect/demo/multiple.d.ts +0 -2
- package/dist/McSelect/demo/multiple.js +0 -46
- package/dist/McSelect/demo/optionRender.d.ts +0 -3
- package/dist/McSelect/demo/optionRender.js +0 -51
- package/dist/McSelect/demo/panelInSearch.d.ts +0 -2
- package/dist/McSelect/demo/panelInSearch.js +0 -47
- package/dist/McSelect/demo/tagRender.d.ts +0 -3
- package/dist/McSelect/demo/tagRender.js +0 -51
- package/dist/McSelect/index.css +0 -60
- package/dist/McSelect/index.d.ts +0 -47
- package/dist/McSelect/index.js +0 -436
- package/dist/McTag/demo/demo1.d.ts +0 -2
- package/dist/McTag/demo/demo1.js +0 -18
- package/dist/McTag/demo/demo2.d.ts +0 -2
- package/dist/McTag/demo/demo2.js +0 -20
- package/dist/McTag/demo/demo3.d.ts +0 -2
- package/dist/McTag/demo/demo3.js +0 -19
- package/dist/McTag/demo/demo4.d.ts +0 -2
- package/dist/McTag/demo/demo4.js +0 -22
- package/dist/McTag/index.d.ts +0 -22
- package/dist/McTag/index.js +0 -59
- package/dist/McThemeConfig/customToken.json +0 -39
- package/dist/McThemeConfig/demo/button.d.ts +0 -2
- package/dist/McThemeConfig/demo/button.js +0 -226
- package/dist/McThemeConfig/demo/card.d.ts +0 -2
- package/dist/McThemeConfig/demo/card.js +0 -60
- package/dist/McThemeConfig/demo/drawer.d.ts +0 -2
- package/dist/McThemeConfig/demo/drawer.js +0 -59
- package/dist/McThemeConfig/demo/modal.d.ts +0 -2
- package/dist/McThemeConfig/demo/modal.js +0 -78
- package/dist/McThemeConfig/demo/radio.d.ts +0 -2
- package/dist/McThemeConfig/demo/radio.js +0 -136
- package/dist/McThemeConfig/demo/switch.d.ts +0 -2
- package/dist/McThemeConfig/demo/switch.js +0 -96
- package/dist/McThemeConfig/demo/tabs.d.ts +0 -2
- package/dist/McThemeConfig/demo/tabs.js +0 -35
- package/dist/McThemeConfig/globalStyle.d.ts +0 -2
- package/dist/McThemeConfig/globalStyle.js +0 -198
- package/dist/McThemeConfig/index.d.ts +0 -9
- package/dist/McThemeConfig/index.js +0 -16
- package/dist/McThemeConfig/layoutStyle.d.ts +0 -2
- package/dist/McThemeConfig/layoutStyle.js +0 -1
- package/dist/McThemeConfig/provider.d.ts +0 -8
- package/dist/McThemeConfig/provider.js +0 -20
- package/dist/McThemeConfig/themeToken.json +0 -152
- package/dist/McTreePanel/SelectedItem.d.ts +0 -4
- package/dist/McTreePanel/SelectedItem.js +0 -75
- package/dist/McTreePanel/demo/base.d.ts +0 -6
- package/dist/McTreePanel/demo/base.js +0 -45
- package/dist/McTreePanel/demo/fieldNames.d.ts +0 -6
- package/dist/McTreePanel/demo/fieldNames.js +0 -37
- package/dist/McTreePanel/demo/inexistent.d.ts +0 -6
- package/dist/McTreePanel/demo/inexistent.js +0 -56
- package/dist/McTreePanel/demo/labelInValue.d.ts +0 -6
- package/dist/McTreePanel/demo/labelInValue.js +0 -56
- package/dist/McTreePanel/demo/sortable.d.ts +0 -6
- package/dist/McTreePanel/demo/sortable.js +0 -34
- package/dist/McTreePanel/index.css +0 -110
- package/dist/McTreePanel/index.d.ts +0 -27
- package/dist/McTreePanel/index.js +0 -315
- package/dist/McTreeSelect/demo/base.d.ts +0 -5
- package/dist/McTreeSelect/demo/base.js +0 -58
- package/dist/McTreeSelect/demo/inexistent.d.ts +0 -5
- package/dist/McTreeSelect/demo/inexistent.js +0 -63
- package/dist/McTreeSelect/demo/label.d.ts +0 -5
- package/dist/McTreeSelect/demo/label.js +0 -60
- package/dist/McTreeSelect/demo/multiple.d.ts +0 -5
- package/dist/McTreeSelect/demo/multiple.js +0 -71
- package/dist/McTreeSelect/index.css +0 -60
- package/dist/McTreeSelect/index.d.ts +0 -13
- package/dist/McTreeSelect/index.js +0 -182
- package/dist/Utils/index.d.ts +0 -13
- package/dist/Utils/index.js +0 -60
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -28
- package/dist/styles/demo/basic.d.ts +0 -2
- package/dist/styles/demo/basic.js +0 -44
- package/dist/styles/demo/delete-icon.d.ts +0 -2
- package/dist/styles/demo/delete-icon.js +0 -72
- package/dist/styles/demo/form-bottom-0.d.ts +0 -2
- package/dist/styles/demo/form-bottom-0.js +0 -33
- package/dist/styles/index.css +0 -41
- package/dist/styles/mixins.css +0 -2
- package/dist/styles/utilities.css +0 -41
- package/dist/typings.d.ts +0 -20
@@ -1,73 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
/**
|
3
|
-
* title: 在Antd Table翻页场景中使用
|
4
|
-
* description: 翻页后的数据会重新进入懒加载流程
|
5
|
-
*/
|
6
|
-
import { Table } from 'antd';
|
7
|
-
import { McLazyLoader } from "../..";
|
8
|
-
import { useState } from 'react';
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
-
var getTextList = function getTextList(cur) {
|
11
|
-
return Array.from({
|
12
|
-
length: 40
|
13
|
-
}, function (_, index) {
|
14
|
-
return {
|
15
|
-
key: index + cur,
|
16
|
-
value: index
|
17
|
-
};
|
18
|
-
});
|
19
|
-
};
|
20
|
-
export default (function () {
|
21
|
-
var _useState = useState(1),
|
22
|
-
_useState2 = _slicedToArray(_useState, 2),
|
23
|
-
cur = _useState2[0],
|
24
|
-
setCur = _useState2[1];
|
25
|
-
console.log(cur);
|
26
|
-
return /*#__PURE__*/_jsx("div", {
|
27
|
-
children: /*#__PURE__*/_jsx(Table, {
|
28
|
-
dataSource: getTextList(cur),
|
29
|
-
scroll: {
|
30
|
-
y: 200
|
31
|
-
},
|
32
|
-
pagination: {
|
33
|
-
pageSize: 40,
|
34
|
-
current: cur,
|
35
|
-
total: 120
|
36
|
-
},
|
37
|
-
onChange: function onChange(info) {
|
38
|
-
var _info$current;
|
39
|
-
setCur((_info$current = info === null || info === void 0 ? void 0 : info.current) !== null && _info$current !== void 0 ? _info$current : 1);
|
40
|
-
},
|
41
|
-
components: {
|
42
|
-
body: function body(data) {
|
43
|
-
return /*#__PURE__*/_jsx(McLazyLoader, {
|
44
|
-
style: {
|
45
|
-
height: 200,
|
46
|
-
width: 430,
|
47
|
-
overflow: 'auto',
|
48
|
-
display: 'flex',
|
49
|
-
flexWrap: 'wrap'
|
50
|
-
},
|
51
|
-
onItemVisible: function onItemVisible(index) {
|
52
|
-
console.log('visible', index);
|
53
|
-
},
|
54
|
-
itemMinHeight: 50
|
55
|
-
// 不加这个的话,水平排列的元素不占空间,没有懒加载
|
56
|
-
,
|
57
|
-
itemMinWidth: 200,
|
58
|
-
children: data.map(function (x) {
|
59
|
-
return /*#__PURE__*/_jsx("img", {
|
60
|
-
width: "auto",
|
61
|
-
height: 50,
|
62
|
-
onLoad: function onLoad() {
|
63
|
-
console.log('[window root: loaded]', new Date(), x.key, cur);
|
64
|
-
},
|
65
|
-
src: "http://pre.data.muchcloud.com/static/img/logo-t.34c4816d.png"
|
66
|
-
}, x.key + '_' + cur);
|
67
|
-
})
|
68
|
-
});
|
69
|
-
}
|
70
|
-
}
|
71
|
-
})
|
72
|
-
});
|
73
|
-
});
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
interface ObserverInsertionWrapperProps {
|
3
|
-
children: React.ReactNode[];
|
4
|
-
/**
|
5
|
-
* @description 最小高度,不能为0。为0时懒加载可能会无效
|
6
|
-
* @default 20
|
7
|
-
*/
|
8
|
-
itemMinHeight: number;
|
9
|
-
/**
|
10
|
-
* @description 最小宽度,水平排列时不能为0
|
11
|
-
* @default unset
|
12
|
-
*/
|
13
|
-
itemMinWidth?: number;
|
14
|
-
/**
|
15
|
-
* @description 元素进入视图回调
|
16
|
-
*/
|
17
|
-
onItemVisible?: (index: number, key: string) => void;
|
18
|
-
/**
|
19
|
-
* @description 距离视图多少像素时触发。出于用户体验考虑,建议设置一个正数
|
20
|
-
* @default 0
|
21
|
-
*/
|
22
|
-
offset?: number;
|
23
|
-
/**
|
24
|
-
* @description 重叠比例为多少时触发
|
25
|
-
* @default 0
|
26
|
-
*/
|
27
|
-
threshold?: number;
|
28
|
-
/**
|
29
|
-
* @description 监听的根元素,不传则监听浏览器窗口
|
30
|
-
* @default null
|
31
|
-
*/
|
32
|
-
root?: Element | Document | null;
|
33
|
-
/**
|
34
|
-
* @description 外层容器样式
|
35
|
-
*/
|
36
|
-
style?: React.CSSProperties;
|
37
|
-
}
|
38
|
-
declare const ObserverInsertionWrapper: React.FC<ObserverInsertionWrapperProps>;
|
39
|
-
export default ObserverInsertionWrapper;
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
-
var getKey = function getKey(child, index) {
|
5
|
-
var _child$key;
|
6
|
-
return /*#__PURE__*/React.isValidElement(child) ? String((_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : index) : String(index);
|
7
|
-
};
|
8
|
-
var ObserverInsertionWrapper = function ObserverInsertionWrapper(_ref) {
|
9
|
-
var children = _ref.children,
|
10
|
-
style = _ref.style,
|
11
|
-
_ref$offset = _ref.offset,
|
12
|
-
offset = _ref$offset === void 0 ? 0 : _ref$offset,
|
13
|
-
_ref$threshold = _ref.threshold,
|
14
|
-
threshold = _ref$threshold === void 0 ? 0 : _ref$threshold,
|
15
|
-
_ref$root = _ref.root,
|
16
|
-
root = _ref$root === void 0 ? null : _ref$root,
|
17
|
-
_ref$itemMinHeight = _ref.itemMinHeight,
|
18
|
-
itemMinHeight = _ref$itemMinHeight === void 0 ? 20 : _ref$itemMinHeight,
|
19
|
-
itemMinWidth = _ref.itemMinWidth,
|
20
|
-
onItemVisible = _ref.onItemVisible;
|
21
|
-
var wrapperRef = useRef(null);
|
22
|
-
|
23
|
-
// 已经显示过的 key 列表
|
24
|
-
var _useState = useState(new Set()),
|
25
|
-
_useState2 = _slicedToArray(_useState, 2),
|
26
|
-
visibleItems = _useState2[0],
|
27
|
-
setVisibleItems = _useState2[1];
|
28
|
-
|
29
|
-
// 为避免 children 每次渲染变化导致 useEffect 重复执行,构建一个 keyList 哈希
|
30
|
-
var keyListHash = useMemo(function () {
|
31
|
-
var list = React.Children.toArray(children).map(function (child, index) {
|
32
|
-
return getKey(child, index);
|
33
|
-
});
|
34
|
-
return JSON.stringify(list);
|
35
|
-
}, [children]);
|
36
|
-
|
37
|
-
// 每次 keyList 变动重置显示列表
|
38
|
-
useEffect(function () {
|
39
|
-
setVisibleItems(new Set());
|
40
|
-
}, [keyListHash]);
|
41
|
-
useEffect(function () {
|
42
|
-
var _wrapperRef$current;
|
43
|
-
var observer = new IntersectionObserver(function (entries) {
|
44
|
-
entries.forEach(function (entry) {
|
45
|
-
var index = Number(entry.target.getAttribute('data-index'));
|
46
|
-
var key = String(entry.target.getAttribute('data-key'));
|
47
|
-
if (entry.isIntersecting && !visibleItems.has(key)) {
|
48
|
-
setVisibleItems(function (prev) {
|
49
|
-
var next = new Set(prev);
|
50
|
-
next.add(key);
|
51
|
-
onItemVisible === null || onItemVisible === void 0 || onItemVisible(index, key);
|
52
|
-
return next;
|
53
|
-
});
|
54
|
-
}
|
55
|
-
});
|
56
|
-
}, {
|
57
|
-
root: root,
|
58
|
-
rootMargin: "".concat(offset, "px"),
|
59
|
-
threshold: threshold
|
60
|
-
});
|
61
|
-
var elements = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.children;
|
62
|
-
elements && Array.from(elements).forEach(function (element) {
|
63
|
-
observer.observe(element);
|
64
|
-
});
|
65
|
-
return function () {
|
66
|
-
elements && Array.from(elements).forEach(function (element) {
|
67
|
-
observer.unobserve(element);
|
68
|
-
});
|
69
|
-
};
|
70
|
-
}, [offset, threshold, root, keyListHash, visibleItems]);
|
71
|
-
return /*#__PURE__*/_jsx("div", {
|
72
|
-
ref: wrapperRef,
|
73
|
-
style: style,
|
74
|
-
children: React.Children.map(children, function (child, index) {
|
75
|
-
var key = getKey(child, index);
|
76
|
-
return /*#__PURE__*/_jsx("div", {
|
77
|
-
"data-key": key,
|
78
|
-
"data-index": index,
|
79
|
-
style: {
|
80
|
-
minHeight: itemMinHeight,
|
81
|
-
minWidth: itemMinWidth !== null && itemMinWidth !== void 0 ? itemMinWidth : 'unset'
|
82
|
-
},
|
83
|
-
children: visibleItems.has(key) ? child : null
|
84
|
-
}, key);
|
85
|
-
})
|
86
|
-
});
|
87
|
-
};
|
88
|
-
export default ObserverInsertionWrapper;
|
@@ -1,174 +0,0 @@
|
|
1
|
-
import React, { ReactNode } from 'react';
|
2
|
-
export interface McModalState {
|
3
|
-
id: string;
|
4
|
-
args?: Record<string, unknown>;
|
5
|
-
visible?: boolean;
|
6
|
-
delayVisible?: boolean;
|
7
|
-
keepMounted?: boolean;
|
8
|
-
}
|
9
|
-
export interface McModalStore {
|
10
|
-
[key: string]: McModalState;
|
11
|
-
}
|
12
|
-
export interface McModalAction {
|
13
|
-
type: string;
|
14
|
-
payload: {
|
15
|
-
modalId: string;
|
16
|
-
args?: Record<string, unknown>;
|
17
|
-
flags?: Record<string, unknown>;
|
18
|
-
};
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* The handler to manage a modal returned by {@link useModal | useModal} hook.
|
22
|
-
*/
|
23
|
-
export interface McModalHandler<Props = Record<string, unknown>> extends McModalState {
|
24
|
-
/**
|
25
|
-
* Whether a modal is visible, it's controlled by {@link McModalHandler.show | show}/{@link McModalHandler.hide | hide} method.
|
26
|
-
*/
|
27
|
-
visible: boolean;
|
28
|
-
/**
|
29
|
-
* If you don't want to remove the modal from the tree after hide when using helpers, set it to true.
|
30
|
-
*/
|
31
|
-
keepMounted: boolean;
|
32
|
-
/**
|
33
|
-
* Show the modal, it will change {@link McModalHandler.visible | visible} state to true.
|
34
|
-
* @param args - an object passed to modal component as props.
|
35
|
-
*/
|
36
|
-
show: (args?: Props) => Promise<unknown>;
|
37
|
-
/**
|
38
|
-
* Hide the modal, it will change {@link McModalHandler.visible | visible} state to false.
|
39
|
-
*/
|
40
|
-
hide: () => Promise<unknown>;
|
41
|
-
/**
|
42
|
-
* Resolve the promise returned by {@link McModalHandler.show | show} method.
|
43
|
-
*/
|
44
|
-
resolve: (args?: unknown) => void;
|
45
|
-
/**
|
46
|
-
* Reject the promise returned by {@link McModalHandler.show | show} method.
|
47
|
-
*/
|
48
|
-
reject: (args?: unknown) => void;
|
49
|
-
/**
|
50
|
-
* Remove the modal component from React component tree. It improves performance compared to just making a modal invisible.
|
51
|
-
*/
|
52
|
-
remove: () => void;
|
53
|
-
/**
|
54
|
-
* Resolve the promise returned by {@link McModalHandler.hide | hide} method.
|
55
|
-
*/
|
56
|
-
resolveHide: (args?: unknown) => void;
|
57
|
-
}
|
58
|
-
export interface McModalHocProps {
|
59
|
-
id: string;
|
60
|
-
defaultVisible?: boolean;
|
61
|
-
keepMounted?: boolean;
|
62
|
-
}
|
63
|
-
export declare const McModalContext: React.Context<McModalStore>;
|
64
|
-
declare let dispatch: React.Dispatch<McModalAction>;
|
65
|
-
export declare const reducer: (state: McModalStore | undefined, action: McModalAction) => McModalStore;
|
66
|
-
declare function getModal(modalId: string): React.FC<any> | undefined;
|
67
|
-
export declare const register: <T extends React.FC<any>>(id: string, comp: T, props?: Partial<McModalArgs<T>> | undefined) => void;
|
68
|
-
type McModalArgs<T> = T extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any> ? React.ComponentProps<T> : Record<string, unknown>;
|
69
|
-
export declare function show<T extends any, C extends any, P extends Partial<McModalArgs<React.FC<C>>>>(modal: React.FC<C>, args?: P): Promise<T>;
|
70
|
-
export declare function show<T extends any>(modal: string, args?: Record<string, unknown>): Promise<T>;
|
71
|
-
export declare function show<T extends any, P extends any>(modal: string, args: P): Promise<T>;
|
72
|
-
export declare function hide<T>(modal: string | React.FC<any>): Promise<T>;
|
73
|
-
export declare const remove: (modal: string | React.FC<any>) => void;
|
74
|
-
export declare function useModal(): McModalHandler;
|
75
|
-
export declare function useModal(modal: string, args?: Record<string, unknown>): McModalHandler;
|
76
|
-
export declare function useModal<C extends any, P extends Partial<McModalArgs<React.FC<C>>>>(modal: React.FC<C>, args?: P): Omit<McModalHandler, 'show'> & {
|
77
|
-
show: (args?: P) => Promise<unknown>;
|
78
|
-
};
|
79
|
-
export declare const create: <P extends {}>(Comp: React.ComponentType<P>) => React.FC<P & McModalHocProps>;
|
80
|
-
/**
|
81
|
-
* Unregister a modal.
|
82
|
-
* @param id - The id of the modal.
|
83
|
-
*/
|
84
|
-
export declare const unregister: (id: string) => void;
|
85
|
-
export declare const Provider: ({ children, dispatch: givenDispatch, modals: givenModals, }: {
|
86
|
-
children: ReactNode;
|
87
|
-
dispatch?: React.Dispatch<McModalAction> | undefined;
|
88
|
-
modals?: McModalStore | undefined;
|
89
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
90
|
-
/**
|
91
|
-
* Declarative way to register a modal.
|
92
|
-
* @param id - The id of the modal.
|
93
|
-
* @param component - The modal Component.
|
94
|
-
* @returns
|
95
|
-
*/
|
96
|
-
export declare const ModalDef: ({ id, component, }: {
|
97
|
-
id: string;
|
98
|
-
component: React.FC<any>;
|
99
|
-
}) => null;
|
100
|
-
/**
|
101
|
-
* A place holder allows to bind props to a modal.
|
102
|
-
* It assigns show/hide methods to handler object to show/hide the modal.
|
103
|
-
*
|
104
|
-
* Comparing to use the <MyMcModal id=../> directly, this approach allows use registered modal id to find the modal component.
|
105
|
-
* Also it avoids to create unique id for MyMcModal.
|
106
|
-
*
|
107
|
-
* @param modal - The modal id registered or a modal component.
|
108
|
-
* @param handler - The handler object to control the modal.
|
109
|
-
* @returns
|
110
|
-
*/
|
111
|
-
export declare const ModalHolder: ({ modal, handler, ...restProps }: {
|
112
|
-
[key: string]: any;
|
113
|
-
modal: string | React.FC<any>;
|
114
|
-
handler: any;
|
115
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
116
|
-
export declare const antdModalV4: (modal: McModalHandler) => {
|
117
|
-
visible: boolean;
|
118
|
-
onCancel: () => void;
|
119
|
-
onOk: () => void;
|
120
|
-
afterClose: () => void;
|
121
|
-
};
|
122
|
-
export declare const antdModal: (modal: McModalHandler) => {
|
123
|
-
open: boolean;
|
124
|
-
onCancel: () => void;
|
125
|
-
onOk: () => void;
|
126
|
-
afterClose: () => void;
|
127
|
-
};
|
128
|
-
export declare const antdDrawerV4: (modal: McModalHandler) => {
|
129
|
-
visible: boolean;
|
130
|
-
onClose: () => void;
|
131
|
-
afterVisibleChange: (visible: boolean) => void;
|
132
|
-
};
|
133
|
-
export declare const antdDrawer: (modal: McModalHandler) => {
|
134
|
-
open: boolean;
|
135
|
-
onClose: () => void;
|
136
|
-
afterOpenChange: (visible: boolean) => void;
|
137
|
-
};
|
138
|
-
declare const McModal: {
|
139
|
-
Provider: ({ children, dispatch: givenDispatch, modals: givenModals, }: {
|
140
|
-
children: ReactNode;
|
141
|
-
dispatch?: React.Dispatch<McModalAction> | undefined;
|
142
|
-
modals?: McModalStore | undefined;
|
143
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
144
|
-
ModalDef: ({ id, component, }: {
|
145
|
-
id: string;
|
146
|
-
component: React.FC<any>;
|
147
|
-
}) => null;
|
148
|
-
ModalHolder: ({ modal, handler, ...restProps }: {
|
149
|
-
[key: string]: any;
|
150
|
-
modal: string | React.FC<any>;
|
151
|
-
handler: any;
|
152
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
153
|
-
McModalContext: React.Context<McModalStore>;
|
154
|
-
create: <P extends {}>(Comp: React.ComponentType<P>) => React.FC<P & McModalHocProps>;
|
155
|
-
register: <T extends React.FC<any>>(id: string, comp: T, props?: Partial<McModalArgs<T>> | undefined) => void;
|
156
|
-
getModal: typeof getModal;
|
157
|
-
show: typeof show;
|
158
|
-
hide: typeof hide;
|
159
|
-
remove: (modal: string | React.FC<any>) => void;
|
160
|
-
useModal: typeof useModal;
|
161
|
-
reducer: (state: McModalStore | undefined, action: McModalAction) => McModalStore;
|
162
|
-
antdModal: (modal: McModalHandler) => {
|
163
|
-
open: boolean;
|
164
|
-
onCancel: () => void;
|
165
|
-
onOk: () => void;
|
166
|
-
afterClose: () => void;
|
167
|
-
};
|
168
|
-
antdDrawer: (modal: McModalHandler) => {
|
169
|
-
open: boolean;
|
170
|
-
onClose: () => void;
|
171
|
-
afterOpenChange: (visible: boolean) => void;
|
172
|
-
};
|
173
|
-
};
|
174
|
-
export default McModal;
|