@zykj2024/much-library 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/McCascader/city.js +909 -0
- package/dist/McCascader/index.css +60 -0
- package/dist/McCascader/index.d.ts +19 -0
- package/dist/McCascader/index.js +221 -0
- package/dist/McContainer/demo/actionBar.d.ts +8 -0
- package/dist/McContainer/demo/actionBar.js +70 -0
- package/dist/McContainer/demo/base.d.ts +8 -0
- package/dist/McContainer/demo/base.js +80 -0
- package/dist/McContainer/demo/batch.d.ts +8 -0
- package/dist/McContainer/demo/batch.js +89 -0
- package/dist/McContainer/demo/collapse.d.ts +8 -0
- package/dist/McContainer/demo/collapse.js +76 -0
- package/dist/McContainer/demo/expand.d.ts +8 -0
- package/dist/McContainer/demo/expand.js +90 -0
- package/dist/McContainer/demo/pagination.d.ts +7 -0
- package/dist/McContainer/demo/pagination.js +93 -0
- package/dist/McContainer/demo/search.d.ts +7 -0
- package/dist/McContainer/demo/search.js +101 -0
- package/dist/McContainer/demo/standard.d.ts +7 -0
- package/dist/McContainer/demo/standard.js +168 -0
- package/dist/McContainer/index.css +123 -0
- package/dist/McContainer/index.d.ts +49 -0
- package/dist/McContainer/index.js +407 -0
- package/dist/McDateRange/demo/base.d.ts +6 -0
- package/dist/McDateRange/demo/base.js +22 -0
- package/dist/McDateRange/demo/cancelPresets.d.ts +6 -0
- package/dist/McDateRange/demo/cancelPresets.js +23 -0
- package/dist/McDateRange/demo/overlap.d.ts +2 -0
- package/dist/McDateRange/demo/overlap.js +32 -0
- package/dist/McDateRange/index.css +31 -0
- package/dist/McDateRange/index.d.ts +28 -0
- package/dist/McDateRange/index.js +167 -0
- package/dist/McFonts/index.d.ts +7 -0
- package/dist/McFonts/index.js +10 -0
- package/dist/McFonts/public/FF DIN Pro Bold.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Bold.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Light.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Medium.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Regular.otf +0 -0
- package/dist/McGroupPanel/comps/SelectedItem/index.d.ts +4 -0
- package/dist/McGroupPanel/comps/SelectedItem/index.js +76 -0
- package/dist/McGroupPanel/index.css +162 -0
- package/dist/McGroupPanel/index.d.ts +29 -0
- package/dist/McGroupPanel/index.js +411 -0
- package/dist/McIconFont/iconfont.js +1 -0
- package/dist/McIconFont/index.d.ts +5 -0
- package/dist/McIconFont/index.js +8 -0
- package/dist/McIcons/business.json +137 -0
- package/dist/McInput/Input.d.ts +19 -0
- package/dist/McInput/Input.js +48 -0
- package/dist/McInput/Search.d.ts +39 -0
- package/dist/McInput/Search.js +81 -0
- package/dist/McInput/TextArea.d.ts +11 -0
- package/dist/McInput/TextArea.js +37 -0
- package/dist/McInput/demo/Input/addonBefore.d.ts +3 -0
- package/dist/McInput/demo/Input/addonBefore.js +67 -0
- package/dist/McInput/demo/Input/base.d.ts +2 -0
- package/dist/McInput/demo/Input/base.js +31 -0
- package/dist/McInput/demo/Input/isTrim.d.ts +2 -0
- package/dist/McInput/demo/Input/isTrim.js +22 -0
- package/dist/McInput/demo/Input/label.d.ts +2 -0
- package/dist/McInput/demo/Input/label.js +26 -0
- package/dist/McInput/demo/Input/ref.d.ts +3 -0
- package/dist/McInput/demo/Input/ref.js +53 -0
- package/dist/McInput/demo/Input/status.d.ts +2 -0
- package/dist/McInput/demo/Input/status.js +23 -0
- package/dist/McInput/demo/Search/search-base.d.ts +2 -0
- package/dist/McInput/demo/Search/search-base.js +38 -0
- package/dist/McInput/demo/TextArea/text-area-base.d.ts +2 -0
- package/dist/McInput/demo/TextArea/text-area-base.js +38 -0
- package/dist/McInput/index.css +44 -0
- package/dist/McInput/index.d.ts +13 -0
- package/dist/McInput/index.js +7 -0
- package/dist/McInputNumber/demo/index.d.ts +2 -0
- package/dist/McInputNumber/demo/index.js +28 -0
- package/dist/McInputNumber/demo/label.d.ts +2 -0
- package/dist/McInputNumber/demo/label.js +26 -0
- package/dist/McInputNumber/demo/precision.d.ts +2 -0
- package/dist/McInputNumber/demo/precision.js +20 -0
- package/dist/McInputNumber/index.css +9 -0
- package/dist/McInputNumber/index.d.ts +13 -0
- package/dist/McInputNumber/index.js +43 -0
- package/dist/McModalProvider/index.d.ts +174 -0
- package/dist/McModalProvider/index.js +498 -0
- package/dist/McPeriodSelect/demo/base.d.ts +6 -0
- package/dist/McPeriodSelect/demo/base.js +19 -0
- package/dist/McPeriodSelect/demo/half.d.ts +6 -0
- package/dist/McPeriodSelect/demo/half.js +20 -0
- package/dist/McPeriodSelect/index.css +189 -0
- package/dist/McPeriodSelect/index.d.ts +13 -0
- package/dist/McPeriodSelect/index.js +305 -0
- package/dist/McPopoverButton/index.d.ts +14 -0
- package/dist/McPopoverButton/index.js +52 -0
- package/dist/McPopoverForm/index.d.ts +14 -0
- package/dist/McPopoverForm/index.js +95 -0
- package/dist/McResult/default.d.ts +1 -0
- package/dist/McResult/default.js +84 -0
- package/dist/McResult/demo/403.d.ts +6 -0
- package/dist/McResult/demo/403.js +17 -0
- package/dist/McResult/demo/404.d.ts +6 -0
- package/dist/McResult/demo/404.js +17 -0
- package/dist/McResult/demo/500.d.ts +6 -0
- package/dist/McResult/demo/500.js +17 -0
- package/dist/McResult/demo/building.d.ts +6 -0
- package/dist/McResult/demo/building.js +12 -0
- package/dist/McResult/demo/empty.d.ts +2 -0
- package/dist/McResult/demo/empty.js +11 -0
- package/dist/McResult/demo/noFunction.d.ts +2 -0
- package/dist/McResult/demo/noFunction.js +11 -0
- package/dist/McResult/demo/noUser.d.ts +6 -0
- package/dist/McResult/demo/noUser.js +12 -0
- package/dist/McResult/demo/preview.d.ts +2 -0
- package/dist/McResult/demo/preview.js +14 -0
- package/dist/McResult/icon.d.ts +25 -0
- package/dist/McResult/icon.js +946 -0
- package/dist/McResult/index.css +20 -0
- package/dist/McResult/index.d.ts +27 -0
- package/dist/McResult/index.js +103 -0
- package/dist/McResult/public/403.svg +164 -0
- package/dist/McResult/public/404.svg +123 -0
- package/dist/McResult/public/500.svg +129 -0
- package/dist/McResult/public/building.svg +127 -0
- package/dist/McResult/public/code403.svg +7 -0
- package/dist/McResult/public/code404.svg +5 -0
- package/dist/McResult/public/code500.svg +5 -0
- package/dist/McResult/public/empty.svg +1 -0
- package/dist/McResult/public/noFunction.svg +1 -0
- package/dist/McResult/public/noUser.svg +90 -0
- package/dist/McSelect/demo/base.d.ts +2 -0
- package/dist/McSelect/demo/base.js +63 -0
- package/dist/McSelect/demo/changeOnHidden.d.ts +2 -0
- package/dist/McSelect/demo/changeOnHidden.js +43 -0
- package/dist/McSelect/demo/dropdownRender.d.ts +7 -0
- package/dist/McSelect/demo/dropdownRender.js +78 -0
- package/dist/McSelect/demo/fetchOptions.d.ts +7 -0
- package/dist/McSelect/demo/fetchOptions.js +210 -0
- package/dist/McSelect/demo/inexistent.d.ts +2 -0
- package/dist/McSelect/demo/inexistent.js +79 -0
- package/dist/McSelect/demo/labelInValue.d.ts +2 -0
- package/dist/McSelect/demo/labelInValue.js +72 -0
- package/dist/McSelect/demo/maxTagCount.d.ts +3 -0
- package/dist/McSelect/demo/maxTagCount.js +51 -0
- package/dist/McSelect/demo/multiple.d.ts +2 -0
- package/dist/McSelect/demo/multiple.js +46 -0
- package/dist/McSelect/demo/optionRender.d.ts +3 -0
- package/dist/McSelect/demo/optionRender.js +51 -0
- package/dist/McSelect/demo/tagRender.d.ts +3 -0
- package/dist/McSelect/demo/tagRender.js +51 -0
- package/dist/McSelect/index.css +60 -0
- package/dist/McSelect/index.d.ts +40 -0
- package/dist/McSelect/index.js +350 -0
- package/dist/McThemeConfig/customToken.json +38 -0
- package/dist/McThemeConfig/demo/button.d.ts +2 -0
- package/dist/McThemeConfig/demo/button.js +226 -0
- package/dist/McThemeConfig/demo/drawer.d.ts +2 -0
- package/dist/McThemeConfig/demo/drawer.js +59 -0
- package/dist/McThemeConfig/demo/modal.d.ts +2 -0
- package/dist/McThemeConfig/demo/modal.js +78 -0
- package/dist/McThemeConfig/demo/radio.d.ts +2 -0
- package/dist/McThemeConfig/demo/radio.js +97 -0
- package/dist/McThemeConfig/demo/switch.d.ts +2 -0
- package/dist/McThemeConfig/demo/switch.js +96 -0
- package/dist/McThemeConfig/demo/tabs.d.ts +2 -0
- package/dist/McThemeConfig/demo/tabs.js +35 -0
- package/dist/McThemeConfig/globalStyle.d.ts +2 -0
- package/dist/McThemeConfig/globalStyle.js +172 -0
- package/dist/McThemeConfig/index.d.ts +9 -0
- package/dist/McThemeConfig/index.js +16 -0
- package/dist/McThemeConfig/layoutStyle.d.ts +2 -0
- package/dist/McThemeConfig/layoutStyle.js +1 -0
- package/dist/McThemeConfig/provider.d.ts +7 -0
- package/dist/McThemeConfig/provider.js +19 -0
- package/dist/McThemeConfig/themeToken.json +149 -0
- package/dist/McTreePanel/SelectedItem.d.ts +4 -0
- package/dist/McTreePanel/SelectedItem.js +75 -0
- package/dist/McTreePanel/demo/base.d.ts +6 -0
- package/dist/McTreePanel/demo/base.js +45 -0
- package/dist/McTreePanel/demo/fieldNames.d.ts +6 -0
- package/dist/McTreePanel/demo/fieldNames.js +37 -0
- package/dist/McTreePanel/demo/inexistent.d.ts +6 -0
- package/dist/McTreePanel/demo/inexistent.js +56 -0
- package/dist/McTreePanel/demo/labelInValue.d.ts +6 -0
- package/dist/McTreePanel/demo/labelInValue.js +56 -0
- package/dist/McTreePanel/demo/sortable.d.ts +6 -0
- package/dist/McTreePanel/demo/sortable.js +34 -0
- package/dist/McTreePanel/index.css +110 -0
- package/dist/McTreePanel/index.d.ts +27 -0
- package/dist/McTreePanel/index.js +315 -0
- package/dist/McTreeSelect/demo/base.d.ts +5 -0
- package/dist/McTreeSelect/demo/base.js +58 -0
- package/dist/McTreeSelect/demo/inexistent.d.ts +5 -0
- package/dist/McTreeSelect/demo/inexistent.js +63 -0
- package/dist/McTreeSelect/demo/label.d.ts +5 -0
- package/dist/McTreeSelect/demo/label.js +60 -0
- package/dist/McTreeSelect/demo/multiple.d.ts +5 -0
- package/dist/McTreeSelect/demo/multiple.js +71 -0
- package/dist/McTreeSelect/index.css +60 -0
- package/dist/McTreeSelect/index.d.ts +13 -0
- package/dist/McTreeSelect/index.js +182 -0
- package/dist/Utils/index.d.ts +4 -0
- package/dist/Utils/index.js +26 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/typings.d.ts +20 -0
- package/package.json +82 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
/**
|
3
|
+
* title: 树形数据展示
|
4
|
+
* description: 表格支持树形数据的展示,当数据中有 `children` 字段时会自动展示为树形表格,如果不需要或配置为其他字段可以用 `childrenColumnName` 进行配置,`rowKey`必须设置且唯一。
|
5
|
+
* transform: true
|
6
|
+
* compact: true
|
7
|
+
*/
|
8
|
+
|
9
|
+
import { McContainer, McInput } from "../..";
|
10
|
+
import { useState } from 'react';
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
13
|
+
var tableData = Array.from({
|
14
|
+
length: 5
|
15
|
+
}, function (_, index) {
|
16
|
+
return {
|
17
|
+
id: index + 1,
|
18
|
+
name: "\u59D3\u540D".concat(index + 1),
|
19
|
+
age: 10 + index,
|
20
|
+
children: Array.from({
|
21
|
+
length: 5
|
22
|
+
}, function (_, i) {
|
23
|
+
return {
|
24
|
+
id: 10 * (index + 1) + i,
|
25
|
+
name: "\u59D3\u540D".concat(10 * (index + 1) + i),
|
26
|
+
age: 10 * (index + 1) + i
|
27
|
+
};
|
28
|
+
})
|
29
|
+
};
|
30
|
+
});
|
31
|
+
export default (function () {
|
32
|
+
var _useState = useState(tableData),
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
34
|
+
dataSource = _useState2[0],
|
35
|
+
setDataSource = _useState2[1];
|
36
|
+
var _useState3 = useState(false),
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
38
|
+
loading = _useState4[0],
|
39
|
+
setLoading = _useState4[1];
|
40
|
+
var columns = [{
|
41
|
+
title: 'ID',
|
42
|
+
dataIndex: 'id'
|
43
|
+
}, {
|
44
|
+
title: '姓名',
|
45
|
+
dataIndex: 'name'
|
46
|
+
}, {
|
47
|
+
title: '年龄',
|
48
|
+
dataIndex: 'age'
|
49
|
+
}, {
|
50
|
+
title: '操作',
|
51
|
+
dataIndex: 'option',
|
52
|
+
width: 100,
|
53
|
+
render: function render() {
|
54
|
+
return /*#__PURE__*/_jsx("a", {
|
55
|
+
children: "\u7F16\u8F91"
|
56
|
+
});
|
57
|
+
}
|
58
|
+
}];
|
59
|
+
var queryItems = /*#__PURE__*/_jsx(_Fragment, {
|
60
|
+
children: /*#__PURE__*/_jsx(McInput, {
|
61
|
+
label: "\u59D3\u540D",
|
62
|
+
name: "name",
|
63
|
+
style: {
|
64
|
+
width: 270
|
65
|
+
}
|
66
|
+
})
|
67
|
+
});
|
68
|
+
var onQuery = function onQuery() {
|
69
|
+
return new Promise(function (resolve) {
|
70
|
+
setLoading(true);
|
71
|
+
setTimeout(function () {
|
72
|
+
setDataSource(tableData);
|
73
|
+
setLoading(false);
|
74
|
+
resolve();
|
75
|
+
}, 1000);
|
76
|
+
});
|
77
|
+
};
|
78
|
+
return /*#__PURE__*/_jsx(McContainer, {
|
79
|
+
height: "100%",
|
80
|
+
immediateQuery: false,
|
81
|
+
loading: loading,
|
82
|
+
onQuery: onQuery,
|
83
|
+
queryItems: queryItems,
|
84
|
+
tableProps: {
|
85
|
+
columns: columns,
|
86
|
+
dataSource: dataSource,
|
87
|
+
rowKey: 'id'
|
88
|
+
}
|
89
|
+
});
|
90
|
+
});
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
/**
|
3
|
+
* title: 分页器配置
|
4
|
+
* description: 参考 ant deign [Pagination](https://ant-design.antgroup.com/components/pagination-cn#api)
|
5
|
+
* transform: true
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { Col, Row, Switch } from 'antd';
|
9
|
+
import { McContainer } from "../..";
|
10
|
+
import { useState } from 'react';
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
14
|
+
var tableData = Array.from({
|
15
|
+
length: 5
|
16
|
+
}, function (_, index) {
|
17
|
+
return {
|
18
|
+
id: index + 1,
|
19
|
+
name: "\u59D3\u540D".concat(index + 1),
|
20
|
+
age: 18 + index
|
21
|
+
};
|
22
|
+
});
|
23
|
+
export default (function () {
|
24
|
+
var _useState = useState(tableData),
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
26
|
+
dataSource = _useState2[0],
|
27
|
+
setDataSource = _useState2[1];
|
28
|
+
var _useState3 = useState(false),
|
29
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
30
|
+
loading = _useState4[0],
|
31
|
+
setLoading = _useState4[1];
|
32
|
+
var _useState5 = useState(0),
|
33
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
34
|
+
total = _useState6[0],
|
35
|
+
setTotal = _useState6[1];
|
36
|
+
var _useState7 = useState(true),
|
37
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
38
|
+
showPagination = _useState8[0],
|
39
|
+
setShowPagination = _useState8[1];
|
40
|
+
var columns = [{
|
41
|
+
title: 'ID',
|
42
|
+
dataIndex: 'id'
|
43
|
+
}, {
|
44
|
+
title: '姓名',
|
45
|
+
dataIndex: 'name'
|
46
|
+
}, {
|
47
|
+
title: '年龄',
|
48
|
+
dataIndex: 'age'
|
49
|
+
}, {
|
50
|
+
title: '操作',
|
51
|
+
dataIndex: 'option',
|
52
|
+
width: 100,
|
53
|
+
render: function render() {
|
54
|
+
return /*#__PURE__*/_jsx("a", {
|
55
|
+
children: "\u7F16\u8F91"
|
56
|
+
});
|
57
|
+
}
|
58
|
+
}];
|
59
|
+
var onQuery = function onQuery() {
|
60
|
+
return new Promise(function (resolve) {
|
61
|
+
setLoading(true);
|
62
|
+
setTimeout(function () {
|
63
|
+
setDataSource(tableData);
|
64
|
+
setTotal(tableData === null || tableData === void 0 ? void 0 : tableData.length);
|
65
|
+
setLoading(false);
|
66
|
+
resolve();
|
67
|
+
}, 1000);
|
68
|
+
});
|
69
|
+
};
|
70
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
71
|
+
children: [/*#__PURE__*/_jsx(Row, {
|
72
|
+
children: /*#__PURE__*/_jsxs(Col, {
|
73
|
+
children: ["\u662F\u5426\u5C55\u793A\u5206\u9875\u5668\uFF1A", /*#__PURE__*/_jsx(Switch, {
|
74
|
+
checked: showPagination,
|
75
|
+
onChange: setShowPagination
|
76
|
+
})]
|
77
|
+
})
|
78
|
+
}), /*#__PURE__*/_jsx(McContainer, {
|
79
|
+
height: "100%",
|
80
|
+
immediateQuery: false,
|
81
|
+
loading: loading,
|
82
|
+
onQuery: onQuery,
|
83
|
+
queryRender: null,
|
84
|
+
tableProps: {
|
85
|
+
columns: columns,
|
86
|
+
dataSource: dataSource,
|
87
|
+
pagination: showPagination ? {
|
88
|
+
total: total
|
89
|
+
} : false
|
90
|
+
}
|
91
|
+
})]
|
92
|
+
});
|
93
|
+
});
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
/**
|
3
|
+
* title: 搜索栏区域
|
4
|
+
* description: 将 `queryRender` 设置为 `null` 则不显示;设置 `queryRender` 可自定义搜索区。`showQuery` 控制查询按钮显隐;`showReset` 控制重置按钮显隐。
|
5
|
+
* transform: true
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { Col, Row, Switch } from 'antd';
|
9
|
+
import { McCascader, McContainer, McDateRange, McInput } from "../..";
|
10
|
+
import { useState } from 'react';
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
|
+
export default (function () {
|
15
|
+
var _useState = useState(true),
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
17
|
+
showQuery = _useState2[0],
|
18
|
+
setShowQuery = _useState2[1];
|
19
|
+
var _useState3 = useState(true),
|
20
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
21
|
+
showReset = _useState4[0],
|
22
|
+
setShowReset = _useState4[1];
|
23
|
+
var dataSource = Array.from({
|
24
|
+
length: 5
|
25
|
+
}, function (_, index) {
|
26
|
+
return {
|
27
|
+
id: index + 1,
|
28
|
+
name: "\u59D3\u540D".concat(index + 1),
|
29
|
+
city: "\u57CE\u5E02".concat(index + 1),
|
30
|
+
date: "2024-01-0".concat(index + 1, " 12:00:00")
|
31
|
+
};
|
32
|
+
});
|
33
|
+
var columns = [{
|
34
|
+
title: 'ID',
|
35
|
+
dataIndex: 'id'
|
36
|
+
}, {
|
37
|
+
title: '姓名',
|
38
|
+
dataIndex: 'name'
|
39
|
+
}, {
|
40
|
+
title: '城市',
|
41
|
+
dataIndex: 'city'
|
42
|
+
}, {
|
43
|
+
title: '日期',
|
44
|
+
dataIndex: 'date'
|
45
|
+
}, {
|
46
|
+
title: '操作',
|
47
|
+
dataIndex: 'option',
|
48
|
+
width: 100,
|
49
|
+
render: function render() {
|
50
|
+
return /*#__PURE__*/_jsx("a", {
|
51
|
+
children: "\u7F16\u8F91"
|
52
|
+
});
|
53
|
+
}
|
54
|
+
}];
|
55
|
+
var queryItems = /*#__PURE__*/_jsxs(_Fragment, {
|
56
|
+
children: [/*#__PURE__*/_jsx(McInput.Search, {
|
57
|
+
name: "name",
|
58
|
+
style: {
|
59
|
+
width: 270
|
60
|
+
}
|
61
|
+
}), /*#__PURE__*/_jsx(McCascader, {
|
62
|
+
label: "\u57CE\u5E02",
|
63
|
+
name: "city",
|
64
|
+
city: true,
|
65
|
+
style: {
|
66
|
+
width: 270
|
67
|
+
}
|
68
|
+
}), /*#__PURE__*/_jsx(McDateRange, {
|
69
|
+
label: "\u65E5\u671F",
|
70
|
+
name: "date",
|
71
|
+
style: {
|
72
|
+
width: 270
|
73
|
+
}
|
74
|
+
})]
|
75
|
+
});
|
76
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
77
|
+
children: [/*#__PURE__*/_jsxs(Row, {
|
78
|
+
gutter: 24,
|
79
|
+
children: [/*#__PURE__*/_jsxs(Col, {
|
80
|
+
children: ["\u662F\u5426\u5C55\u793A\u67E5\u8BE2\u6309\u94AE\uFF1A", /*#__PURE__*/_jsx(Switch, {
|
81
|
+
checked: showQuery,
|
82
|
+
onChange: setShowQuery
|
83
|
+
})]
|
84
|
+
}), /*#__PURE__*/_jsxs(Col, {
|
85
|
+
children: ["\u662F\u5426\u5C55\u793A\u91CD\u7F6E\u6309\u94AE\uFF1A", /*#__PURE__*/_jsx(Switch, {
|
86
|
+
checked: showReset,
|
87
|
+
onChange: setShowReset
|
88
|
+
})]
|
89
|
+
})]
|
90
|
+
}), /*#__PURE__*/_jsx(McContainer, {
|
91
|
+
height: "100%",
|
92
|
+
showReset: showReset,
|
93
|
+
showQuery: showQuery,
|
94
|
+
queryItems: queryItems,
|
95
|
+
tableProps: {
|
96
|
+
columns: columns,
|
97
|
+
dataSource: dataSource
|
98
|
+
}
|
99
|
+
})]
|
100
|
+
});
|
101
|
+
});
|
@@ -0,0 +1,168 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
/**
|
3
|
+
* title: 标准用法
|
4
|
+
* description: 标准用法功能全面,可以直接用于常规页面
|
5
|
+
* transform: true
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { Button, Col, Row, Space } from 'antd';
|
9
|
+
import { AddOutlined } from 'much-icons';
|
10
|
+
import { McCascader, McContainer, McDateRange, McInput, McPopoverButton } from "../..";
|
11
|
+
import { useEffect, useRef, useState } from 'react';
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
15
|
+
var tableData = Array.from({
|
16
|
+
length: 5
|
17
|
+
}, function (_, index) {
|
18
|
+
return {
|
19
|
+
id: index + 1,
|
20
|
+
name: "\u59D3\u540D".concat(index + 1),
|
21
|
+
age: 18 + index,
|
22
|
+
city: "\u57CE\u5E02".concat(index + 1),
|
23
|
+
date: "2024-01-0".concat(index + 1, " 12:00:00")
|
24
|
+
};
|
25
|
+
});
|
26
|
+
export default (function () {
|
27
|
+
var _selectedRows$length;
|
28
|
+
var mcContainerRef = useRef();
|
29
|
+
var _useState = useState(0),
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
31
|
+
total = _useState2[0],
|
32
|
+
setTotal = _useState2[1];
|
33
|
+
var _useState3 = useState(tableData),
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
35
|
+
dataSource = _useState4[0],
|
36
|
+
setDataSource = _useState4[1];
|
37
|
+
var _useState5 = useState(false),
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
39
|
+
loading = _useState6[0],
|
40
|
+
setLoading = _useState6[1];
|
41
|
+
var _useState7 = useState([]),
|
42
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
43
|
+
selectedRows = _useState8[0],
|
44
|
+
setSelectedRows = _useState8[1];
|
45
|
+
var _useState9 = useState(),
|
46
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
47
|
+
searchJsonStr = _useState10[0],
|
48
|
+
setSearchJsonStr = _useState10[1];
|
49
|
+
var columns = [{
|
50
|
+
title: 'ID',
|
51
|
+
dataIndex: 'id'
|
52
|
+
}, {
|
53
|
+
title: '姓名',
|
54
|
+
dataIndex: 'name'
|
55
|
+
}, {
|
56
|
+
title: '年龄',
|
57
|
+
dataIndex: 'age'
|
58
|
+
}, {
|
59
|
+
title: '城市',
|
60
|
+
dataIndex: 'city'
|
61
|
+
}, {
|
62
|
+
title: '日期',
|
63
|
+
dataIndex: 'date'
|
64
|
+
}, {
|
65
|
+
title: '操作',
|
66
|
+
dataIndex: 'option',
|
67
|
+
width: 100,
|
68
|
+
render: function render() {
|
69
|
+
return /*#__PURE__*/_jsxs(Space, {
|
70
|
+
size: 16,
|
71
|
+
children: [/*#__PURE__*/_jsx("a", {
|
72
|
+
children: "\u7F16\u8F91"
|
73
|
+
}), /*#__PURE__*/_jsx(McPopoverButton, {
|
74
|
+
onConfirm: function onConfirm() {
|
75
|
+
var _mcContainerRef$curre;
|
76
|
+
return (_mcContainerRef$curre = mcContainerRef.current) === null || _mcContainerRef$curre === void 0 ? void 0 : _mcContainerRef$curre.query();
|
77
|
+
}
|
78
|
+
})]
|
79
|
+
});
|
80
|
+
}
|
81
|
+
}];
|
82
|
+
var queryItems = /*#__PURE__*/_jsxs(_Fragment, {
|
83
|
+
children: [/*#__PURE__*/_jsx(McInput, {
|
84
|
+
label: "\u59D3\u540D",
|
85
|
+
name: "name",
|
86
|
+
style: {
|
87
|
+
width: 270
|
88
|
+
}
|
89
|
+
}), /*#__PURE__*/_jsx(McCascader, {
|
90
|
+
label: "\u57CE\u5E02",
|
91
|
+
name: "city",
|
92
|
+
city: true,
|
93
|
+
style: {
|
94
|
+
width: 270
|
95
|
+
}
|
96
|
+
}), /*#__PURE__*/_jsx(McDateRange, {
|
97
|
+
label: "\u65E5\u671F",
|
98
|
+
name: "date",
|
99
|
+
style: {
|
100
|
+
width: 270
|
101
|
+
}
|
102
|
+
})]
|
103
|
+
});
|
104
|
+
useEffect(function () {
|
105
|
+
var _mcContainerRef$curre2;
|
106
|
+
(_mcContainerRef$curre2 = mcContainerRef.current) === null || _mcContainerRef$curre2 === void 0 || _mcContainerRef$curre2.setDefaultQueryParams({
|
107
|
+
name: '姓名1'
|
108
|
+
});
|
109
|
+
}, []);
|
110
|
+
var onQuery = function onQuery(values) {
|
111
|
+
setSearchJsonStr(JSON.stringify(values !== null && values !== void 0 ? values : {}));
|
112
|
+
return new Promise(function (resolve) {
|
113
|
+
setLoading(true);
|
114
|
+
setTimeout(function () {
|
115
|
+
setDataSource(tableData);
|
116
|
+
setTotal(tableData === null || tableData === void 0 ? void 0 : tableData.length);
|
117
|
+
setLoading(false);
|
118
|
+
resolve();
|
119
|
+
}, 1000);
|
120
|
+
});
|
121
|
+
};
|
122
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
123
|
+
children: [/*#__PURE__*/_jsx(Row, {
|
124
|
+
children: /*#__PURE__*/_jsxs(Col, {
|
125
|
+
children: ["\u641C\u7D22\u53C2\u6570\uFF1A", /*#__PURE__*/_jsx("span", {
|
126
|
+
children: searchJsonStr
|
127
|
+
})]
|
128
|
+
})
|
129
|
+
}), /*#__PURE__*/_jsx(McContainer, {
|
130
|
+
ref: mcContainerRef,
|
131
|
+
height: "100%",
|
132
|
+
loading: loading,
|
133
|
+
immediateQuery: false,
|
134
|
+
onQuery: onQuery,
|
135
|
+
queryItems: queryItems,
|
136
|
+
actionBar: /*#__PURE__*/_jsx(Button, {
|
137
|
+
type: "primary",
|
138
|
+
icon: /*#__PURE__*/_jsx(AddOutlined, {}),
|
139
|
+
children: "\u65B0\u589E"
|
140
|
+
}),
|
141
|
+
batchNum: (_selectedRows$length = selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) !== null && _selectedRows$length !== void 0 ? _selectedRows$length : 0,
|
142
|
+
onCancel: function onCancel() {
|
143
|
+
return setSelectedRows([]);
|
144
|
+
},
|
145
|
+
batchBtns: /*#__PURE__*/_jsx(Button, {
|
146
|
+
type: "primary",
|
147
|
+
children: "\u6279\u91CF\u5220\u9664"
|
148
|
+
}),
|
149
|
+
tableProps: {
|
150
|
+
columns: columns,
|
151
|
+
dataSource: dataSource,
|
152
|
+
rowKey: 'id',
|
153
|
+
pagination: {
|
154
|
+
total: total
|
155
|
+
},
|
156
|
+
rowSelection: {
|
157
|
+
selectedRowKeys: selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.map(function (item) {
|
158
|
+
return item.id;
|
159
|
+
}),
|
160
|
+
preserveSelectedRowKeys: true,
|
161
|
+
onChange: function onChange(selectedRowKeys, selectedRows) {
|
162
|
+
return setSelectedRows(selectedRows);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
})]
|
167
|
+
});
|
168
|
+
});
|
@@ -0,0 +1,123 @@
|
|
1
|
+
.mc-container {
|
2
|
+
position: relative;
|
3
|
+
}
|
4
|
+
.mc-container__ceiling {
|
5
|
+
width: calc(100% - 48px);
|
6
|
+
height: 24px;
|
7
|
+
position: absolute;
|
8
|
+
top: 0;
|
9
|
+
left: 24px;
|
10
|
+
z-index: 9;
|
11
|
+
}
|
12
|
+
.mc-container__wrapper {
|
13
|
+
height: 100%;
|
14
|
+
padding: 24px 24px 64px;
|
15
|
+
overflow: auto;
|
16
|
+
}
|
17
|
+
.mc-container__query {
|
18
|
+
display: -webkit-box;
|
19
|
+
display: -ms-flexbox;
|
20
|
+
display: flex;
|
21
|
+
-ms-flex-wrap: wrap;
|
22
|
+
flex-wrap: wrap;
|
23
|
+
gap: 16px;
|
24
|
+
}
|
25
|
+
.mc-container__query .mc-input,
|
26
|
+
.mc-container__query .mc-search,
|
27
|
+
.mc-container__query .mc-select,
|
28
|
+
.mc-container__query .mc-cascader,
|
29
|
+
.mc-container__query .mc-input-number {
|
30
|
+
width: 280px;
|
31
|
+
}
|
32
|
+
.mc-container__query .mc-date-range {
|
33
|
+
width: 330px;
|
34
|
+
}
|
35
|
+
.mc-container__divider {
|
36
|
+
height: 1px;
|
37
|
+
margin: 24px 0;
|
38
|
+
background: #ebebeb;
|
39
|
+
}
|
40
|
+
.mc-container__action-bar {
|
41
|
+
position: sticky;
|
42
|
+
top: -24px;
|
43
|
+
z-index: 9;
|
44
|
+
display: -webkit-box;
|
45
|
+
display: -ms-flexbox;
|
46
|
+
display: flex;
|
47
|
+
-ms-flex-wrap: wrap;
|
48
|
+
flex-wrap: wrap;
|
49
|
+
gap: 16px;
|
50
|
+
-webkit-box-align: center;
|
51
|
+
-ms-flex-align: center;
|
52
|
+
align-items: center;
|
53
|
+
padding: 24px 0 16px;
|
54
|
+
margin-top: -24px;
|
55
|
+
overflow: hidden;
|
56
|
+
}
|
57
|
+
.mc-container__batch-bar {
|
58
|
+
position: sticky;
|
59
|
+
z-index: 9;
|
60
|
+
padding-bottom: 8px;
|
61
|
+
}
|
62
|
+
.mc-container__batch-bar__inner {
|
63
|
+
display: -webkit-box;
|
64
|
+
display: -ms-flexbox;
|
65
|
+
display: flex;
|
66
|
+
-webkit-box-align: center;
|
67
|
+
-ms-flex-align: center;
|
68
|
+
align-items: center;
|
69
|
+
height: 40px;
|
70
|
+
padding: 0 16px;
|
71
|
+
background: #325cf7;
|
72
|
+
border-radius: 4px;
|
73
|
+
}
|
74
|
+
.mc-container__batch-bar__inner button.ant-btn {
|
75
|
+
background: transparent;
|
76
|
+
color: #fff;
|
77
|
+
border-color: transparent;
|
78
|
+
padding: 4px;
|
79
|
+
margin-left: 16px;
|
80
|
+
}
|
81
|
+
.mc-container__batch-bar__inner button.ant-btn:hover {
|
82
|
+
background-color: transparent !important;
|
83
|
+
color: #fff !important;
|
84
|
+
border-color: transparent !important;
|
85
|
+
}
|
86
|
+
.mc-container__batch-num {
|
87
|
+
color: #fff;
|
88
|
+
font-size: 14px;
|
89
|
+
opacity: 0.8;
|
90
|
+
}
|
91
|
+
.mc-container__batch-btns {
|
92
|
+
position: relative;
|
93
|
+
margin-left: 16px;
|
94
|
+
}
|
95
|
+
.mc-container__batch-btns::before {
|
96
|
+
position: absolute;
|
97
|
+
top: calc(50% - 12px);
|
98
|
+
left: 0;
|
99
|
+
display: block;
|
100
|
+
width: 1px;
|
101
|
+
height: 24px;
|
102
|
+
background: rgba(255, 255, 255, 0.3);
|
103
|
+
content: '';
|
104
|
+
}
|
105
|
+
.mc-container__table .ant-spin-nested-loading {
|
106
|
+
position: static;
|
107
|
+
}
|
108
|
+
.mc-container__table .ant-spin-nested-loading .ant-spin-container {
|
109
|
+
position: static;
|
110
|
+
}
|
111
|
+
.mc-container__table__expand-icon > svg {
|
112
|
+
-webkit-transition: all 0.3s;
|
113
|
+
transition: all 0.3s;
|
114
|
+
}
|
115
|
+
.mc-container__pagination {
|
116
|
+
padding: 16px 0 24px;
|
117
|
+
margin: 0 !important;
|
118
|
+
width: calc(100% - 48px);
|
119
|
+
position: absolute;
|
120
|
+
left: 24px;
|
121
|
+
bottom: 0;
|
122
|
+
z-index: 9;
|
123
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { TableProps } from 'antd';
|
2
|
+
import { CSSProperties, FC, ReactElement, ReactNode } from 'react';
|
3
|
+
import './index.less';
|
4
|
+
export type PropsType = {
|
5
|
+
style?: CSSProperties;
|
6
|
+
className?: string;
|
7
|
+
height?: string;
|
8
|
+
backgroundColor?: string;
|
9
|
+
immediateQuery?: boolean;
|
10
|
+
loading?: boolean;
|
11
|
+
queryItems?: ReactElement;
|
12
|
+
showQuery?: boolean;
|
13
|
+
showReset?: boolean;
|
14
|
+
showCollapse?: boolean;
|
15
|
+
collapsibleQueryItems?: ReactElement;
|
16
|
+
onQuery?: (params: {
|
17
|
+
current?: number;
|
18
|
+
pageSize?: number;
|
19
|
+
[key: string]: any;
|
20
|
+
}, filters?: any, sorter?: any, extra?: any) => void;
|
21
|
+
onReset?: (params?: {
|
22
|
+
current?: number;
|
23
|
+
pageSize?: number;
|
24
|
+
[key: string]: any;
|
25
|
+
}) => void;
|
26
|
+
queryRender?: ReactNode;
|
27
|
+
actionBar?: ReactNode;
|
28
|
+
batchNum?: number;
|
29
|
+
batchBtns?: ReactNode;
|
30
|
+
onCancel?: () => void;
|
31
|
+
tableProps?: TableProps<any>;
|
32
|
+
tableRender?: ReactNode;
|
33
|
+
[key: string]: any;
|
34
|
+
};
|
35
|
+
export type McContainerRef = {
|
36
|
+
query: (params?: {
|
37
|
+
[key: string]: any;
|
38
|
+
}) => void;
|
39
|
+
reset: () => void;
|
40
|
+
setDefaultQueryParams: (params: {
|
41
|
+
[key: string]: any;
|
42
|
+
}) => void;
|
43
|
+
setQueryParam: (name: string, value: any) => void;
|
44
|
+
getQueryParam: (name: string) => any;
|
45
|
+
getQueryParams: () => any;
|
46
|
+
resetQueryParams: () => void;
|
47
|
+
};
|
48
|
+
declare const McContainer: FC<PropsType>;
|
49
|
+
export default McContainer;
|