@zat-design/sisyphus-react 4.0.0-beta.3 → 4.0.0-beta.4
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/babel.config.js +7 -30
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/regExp/index.d.ts +19 -0
- package/dist/esm/regExp/index.js +73 -0
- package/dist/esm/tools/calc/index.d.ts +4 -0
- package/dist/esm/tools/calc/index.js +67 -0
- package/dist/esm/tools/dateUtils.d.ts +7 -0
- package/dist/esm/tools/dateUtils.js +23 -0
- package/dist/esm/tools/disableDate/index.d.ts +9 -0
- package/dist/esm/tools/disableDate/index.js +43 -0
- package/dist/esm/tools/disableTimeRange/index.d.ts +9 -0
- package/dist/esm/tools/disableTimeRange/index.js +121 -0
- package/dist/esm/tools/formatAmount/index.d.ts +7 -0
- package/dist/esm/tools/formatAmount/index.js +14 -0
- package/dist/esm/tools/formatPerMill/index.d.ts +7 -0
- package/dist/esm/tools/formatPerMill/index.js +11 -0
- package/dist/esm/tools/formatPercent/index.d.ts +7 -0
- package/dist/esm/tools/formatPercent/index.js +11 -0
- package/dist/esm/tools/getDataByIdCard/index.d.ts +16 -0
- package/dist/esm/tools/getDataByIdCard/index.js +65 -0
- package/dist/esm/tools/index.d.ts +12 -0
- package/dist/esm/tools/index.js +14 -0
- package/dist/esm/tools/sumAmount/index.d.ts +16 -0
- package/dist/esm/tools/sumAmount/index.js +40 -0
- package/dist/esm/tools/toChineseNum/index.d.ts +7 -0
- package/dist/esm/tools/toChineseNum/index.js +103 -0
- package/dist/esm/tools/toFixed/index.d.ts +2 -0
- package/dist/esm/tools/toFixed/index.js +5 -0
- package/dist/esm/tools/transformDataName/index.d.ts +12 -0
- package/dist/esm/tools/transformDataName/index.js +37 -0
- package/dist/esm/transforms/dateTransformer/index.d.ts +24 -0
- package/dist/esm/transforms/dateTransformer/index.js +67 -0
- package/dist/esm/transforms/index.d.ts +6 -0
- package/dist/esm/transforms/index.js +6 -0
- package/dist/esm/transforms/propTypes.d.ts +7 -0
- package/dist/esm/transforms/propTypes.js +1 -0
- package/dist/esm/transforms/transformDate/index.d.ts +21 -0
- package/dist/esm/transforms/transformDate/index.js +141 -0
- package/dist/esm/transforms/transformDatePicker/index.d.ts +12 -0
- package/dist/esm/transforms/transformDatePicker/index.js +24 -0
- package/dist/esm/transforms/transformRangePicker/index.d.ts +29 -0
- package/dist/esm/transforms/transformRangePicker/index.js +61 -0
- package/dist/esm/transforms/transformSwitch/index.d.ts +13 -0
- package/dist/esm/transforms/transformSwitch/index.js +35 -0
- package/dist/esm/transforms/utils.d.ts +2 -0
- package/dist/esm/transforms/utils.js +8 -0
- package/dist/esm/validate/index.d.ts +107 -0
- package/dist/esm/validate/index.js +284 -0
- package/es/ProAction/index.less +0 -2
- package/es/ProConfigProvider/index.d.ts +1 -0
- package/es/ProConfigProvider/index.js +4 -5
- package/es/ProDownload/style/index.less +0 -2
- package/es/ProDrawerForm/index.js +33 -29
- package/es/ProDrawerForm/style/index.less +0 -2
- package/es/ProEditLabel/style/index.less +0 -2
- package/es/ProEditTable/components/RcTable/DraggableTable.js +1 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -2
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +2 -4
- package/es/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/es/ProEditTable/utils/diffOriginal.js +68 -1
- package/es/ProEnum/hooks/useEnum.js +5 -0
- package/es/ProEnum/style/index.less +0 -2
- package/es/ProForm/components/FormFooter/index.js +6 -6
- package/es/ProForm/components/base/DatePicker/index.js +19 -34
- package/es/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
- package/es/ProForm/components/base/TextArea/index.less +0 -2
- package/es/ProForm/components/base/TimePicker/style/index.less +0 -2
- package/es/ProForm/components/combination/Container/style/index.less +0 -2
- package/es/ProForm/components/combination/FormList/style/index.less +0 -2
- package/es/ProForm/components/combination/Group/component/ComRender.js +9 -8
- package/es/ProForm/components/combination/Group/hooks/index.js +17 -4
- package/es/ProForm/components/combination/Group/index.d.ts +8 -2
- package/es/ProForm/components/combination/Group/index.js +10 -16
- package/es/ProForm/components/combination/ProCascader/index.js +106 -52
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/es/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
- package/es/ProForm/components/combination/ProModalSelect/index.js +38 -64
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
- package/es/ProForm/components/render/ChangedWrapper.js +2 -2
- package/es/ProForm/components/render/Render.js +17 -5
- package/es/ProForm/components/render/RenderFields.d.ts +1 -0
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/components/render/propsType.d.ts +1 -0
- package/es/ProForm/index.d.ts +2 -2
- package/es/ProForm/index.js +5 -2
- package/es/ProForm/propsType.d.ts +2 -0
- package/es/ProForm/style/index.less +0 -2
- package/es/ProForm/utils/diffOriginal.d.ts +1 -0
- package/es/ProForm/utils/diffOriginal.js +66 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProForm/utils/useShouldUpdate.d.ts +1 -0
- package/es/ProForm/utils/useShouldUpdate.js +89 -3
- package/es/ProIcon/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +60 -8
- package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +25 -3
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/index.js +4 -1
- package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/es/ProLayout/components/ProCollapse/index.js +27 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/es/ProLayout/components/ProFooter/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/style/index.less +0 -2
- package/es/ProLayout/index.d.ts +0 -11
- package/es/ProLayout/index.js +60 -32
- package/es/ProLayout/propTypes.d.ts +9 -0
- package/es/ProLayout/style/index.less +0 -2
- package/es/ProLayout/utils/index.d.ts +7 -0
- package/es/ProLayout/utils/index.js +30 -0
- package/es/ProSelect/index.less +0 -2
- package/es/ProSelect/utils/index.js +62 -1
- package/es/ProStep/components/Item/index.js +1 -2
- package/es/ProStep/style/index.less +0 -2
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
- package/es/ProTable/hooks/useAntdTable.d.ts +3 -0
- package/es/ProTable/hooks/useAntdTable.js +92 -64
- package/es/ProTable/index.d.ts +3 -7
- package/es/ProTable/index.js +14 -14
- package/es/ProTable/propsType.d.ts +3 -2
- package/es/ProTable/style/index.less +4 -6
- package/es/ProTabs/style/index.less +0 -2
- package/es/ProThemeTools/index.d.ts +0 -7
- package/es/ProThemeTools/index.js +10 -12
- package/es/ProThemeTools/style/index.less +0 -2
- package/es/ProTooltip/style/index.less +0 -2
- package/es/ProTree/components/ProTreeSelect/style/index.less +0 -2
- package/es/ProTree/style/index.less +0 -2
- package/es/ProTreeModal/style/index.less +0 -2
- package/es/ProUpload/style/index.less +0 -2
- package/es/ProViewer/style/index.less +0 -2
- package/es/style/theme/antd.less +0 -2
- package/jest.config.js +46 -4
- package/lib/ProAction/index.less +0 -2
- package/lib/ProConfigProvider/index.d.ts +1 -0
- package/lib/ProConfigProvider/index.js +4 -3
- package/lib/ProDownload/style/index.less +0 -2
- package/lib/ProDrawerForm/index.js +25 -28
- package/lib/ProDrawerForm/style/index.less +0 -2
- package/lib/ProEditLabel/style/index.less +0 -2
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +1 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -2
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/style/index.less +2 -4
- package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/lib/ProEditTable/utils/diffOriginal.js +48 -1
- package/lib/ProEnum/hooks/useEnum.js +3 -0
- package/lib/ProEnum/style/index.less +0 -2
- package/lib/ProForm/components/FormFooter/index.js +6 -5
- package/lib/ProForm/components/base/DatePicker/index.js +21 -33
- package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
- package/lib/ProForm/components/base/TextArea/index.less +0 -2
- package/lib/ProForm/components/base/TimePicker/style/index.less +0 -2
- package/lib/ProForm/components/combination/Container/style/index.less +0 -2
- package/lib/ProForm/components/combination/FormList/style/index.less +0 -2
- package/lib/ProForm/components/combination/Group/component/ComRender.js +8 -7
- package/lib/ProForm/components/combination/Group/hooks/index.js +8 -2
- package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
- package/lib/ProForm/components/combination/Group/index.js +8 -13
- package/lib/ProForm/components/combination/ProCascader/index.js +73 -16
- package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/lib/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -52
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
- package/lib/ProForm/components/render/ChangedWrapper.js +2 -2
- package/lib/ProForm/components/render/Render.js +11 -3
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/components/render/propsType.d.ts +1 -0
- package/lib/ProForm/index.d.ts +2 -2
- package/lib/ProForm/index.js +3 -1
- package/lib/ProForm/propsType.d.ts +2 -0
- package/lib/ProForm/style/index.less +0 -2
- package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
- package/lib/ProForm/utils/diffOriginal.js +48 -1
- package/lib/ProForm/utils/index.js +1 -1
- package/lib/ProForm/utils/useShouldUpdate.d.ts +1 -0
- package/lib/ProForm/utils/useShouldUpdate.js +50 -1
- package/lib/ProIcon/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +33 -4
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +7 -2
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +2 -1
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/index.js +4 -1
- package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/lib/ProLayout/components/ProCollapse/index.js +27 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
- package/lib/ProLayout/index.d.ts +0 -11
- package/lib/ProLayout/index.js +51 -32
- package/lib/ProLayout/propTypes.d.ts +9 -0
- package/lib/ProLayout/style/index.less +0 -2
- package/lib/ProLayout/utils/index.d.ts +7 -0
- package/lib/ProLayout/utils/index.js +15 -0
- package/lib/ProSelect/index.less +0 -2
- package/lib/ProSelect/utils/index.js +34 -5
- package/lib/ProStep/components/Item/index.js +1 -2
- package/lib/ProStep/style/index.less +0 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
- package/lib/ProTable/hooks/useAntdTable.d.ts +3 -0
- package/lib/ProTable/hooks/useAntdTable.js +71 -36
- package/lib/ProTable/index.d.ts +3 -7
- package/lib/ProTable/index.js +8 -13
- package/lib/ProTable/propsType.d.ts +3 -2
- package/lib/ProTable/style/index.less +4 -6
- package/lib/ProTabs/style/index.less +0 -2
- package/lib/ProThemeTools/index.d.ts +0 -7
- package/lib/ProThemeTools/index.js +5 -12
- package/lib/ProThemeTools/style/index.less +0 -2
- package/lib/ProTooltip/style/index.less +0 -2
- package/lib/ProTree/components/ProTreeSelect/style/index.less +0 -2
- package/lib/ProTree/style/index.less +0 -2
- package/lib/ProTreeModal/style/index.less +0 -2
- package/lib/ProUpload/style/index.less +0 -2
- package/lib/ProViewer/style/index.less +0 -2
- package/lib/style/theme/antd.less +0 -2
- package/package.json +7 -6
- package/tests/__mocks__/fileMock.js +1 -0
- package/tests/__mocks__/zatUtils.js +27 -0
- package/tests/setup.ts +484 -0
- package/tests/test-utils.tsx +81 -0
- package/dist/index.esm.css +0 -6445
- package/dist/index.esm.js +0 -3
- package/dist/less.esm.css +0 -5871
- package/dist/less.esm.js +0 -3
@@ -41,7 +41,7 @@ var import_SideMenu = __toESM(require("../SideMenu"));
|
|
41
41
|
var import__2 = require("../../../../index");
|
42
42
|
var import_utils = require("../../../../utils");
|
43
43
|
var FoldMenu = (props) => {
|
44
|
-
const { style, dataSource } = props;
|
44
|
+
const { style, dataSource, onMenuClick } = props;
|
45
45
|
const { menus, iconfontUrl, notice, collapsed, headerHeight } = dataSource;
|
46
46
|
const pathNamePrefix = `/${window.location.pathname.split("/")[1]}`;
|
47
47
|
const noticeCls = (0, import_classnames.default)({
|
@@ -88,7 +88,7 @@ var FoldMenu = (props) => {
|
|
88
88
|
{
|
89
89
|
key: `${id}-${name}`,
|
90
90
|
mouseEnterDelay: 0,
|
91
|
-
content: /* @__PURE__ */ React.createElement(import_SideMenu.default, { dataSource: { ...dataSource, menus: item } }),
|
91
|
+
content: /* @__PURE__ */ React.createElement(import_SideMenu.default, { dataSource: { ...dataSource, menus: item }, onMenuClick }),
|
92
92
|
color: "#fff",
|
93
93
|
classNames: {
|
94
94
|
root: noticeCls
|
@@ -101,18 +101,47 @@ var FoldMenu = (props) => {
|
|
101
101
|
},
|
102
102
|
placement: "rightTop"
|
103
103
|
},
|
104
|
-
|
104
|
+
/* @__PURE__ */ React.createElement(
|
105
|
+
"span",
|
106
|
+
{
|
107
|
+
onClick: () => {
|
108
|
+
const menuItem = (0, import_utils.findMenuItemByKey)(menus, String(id));
|
109
|
+
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
110
|
+
if (onMenuClick) {
|
111
|
+
onMenuClick({ item: menuItem, key: String(id), keyPath: menuKeyPath });
|
112
|
+
}
|
113
|
+
}
|
114
|
+
},
|
115
|
+
LiNode
|
116
|
+
)
|
105
117
|
) : !collapsed ? /* @__PURE__ */ React.createElement(import_antd.Tooltip, { placement: "right", title: name, key: toPath }, /* @__PURE__ */ React.createElement(
|
106
118
|
"span",
|
107
119
|
{
|
108
120
|
onClick: () => {
|
121
|
+
const menuItem = (0, import_utils.findMenuItemByKey)(menus, String(id));
|
122
|
+
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
123
|
+
if (onMenuClick) {
|
124
|
+
onMenuClick({ item: menuItem, key: String(id), keyPath: menuKeyPath });
|
125
|
+
}
|
109
126
|
onSelected({
|
110
127
|
selectedPath: toPath
|
111
128
|
});
|
112
129
|
}
|
113
130
|
},
|
114
131
|
/* @__PURE__ */ React.createElement(import_react_router_dom.Link, { to: toPath, key: toPath }, LiNode)
|
115
|
-
)) : /* @__PURE__ */ React.createElement(
|
132
|
+
)) : /* @__PURE__ */ React.createElement(
|
133
|
+
"span",
|
134
|
+
{
|
135
|
+
onClick: () => {
|
136
|
+
const menuItem = (0, import_utils.findMenuItemByKey)(menus, String(id));
|
137
|
+
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
138
|
+
if (onMenuClick) {
|
139
|
+
onMenuClick({ item: menuItem, key: String(id), keyPath: menuKeyPath });
|
140
|
+
}
|
141
|
+
}
|
142
|
+
},
|
143
|
+
/* @__PURE__ */ React.createElement(import_react_router_dom.Link, { to: toPath, key: toPath }, LiNode)
|
144
|
+
);
|
116
145
|
})));
|
117
146
|
};
|
118
147
|
var FoldMenu_default = FoldMenu;
|
@@ -44,7 +44,7 @@ var import_utils = require("../../../../utils");
|
|
44
44
|
var import__2 = require("../../index");
|
45
45
|
var OpenMenu = (props) => {
|
46
46
|
var _a;
|
47
|
-
const { className, dataSource, style, theme = "dark" } = props;
|
47
|
+
const { className, dataSource, style, theme = "dark", onMenuClick } = props;
|
48
48
|
const { menus, sideMenu } = dataSource || {};
|
49
49
|
const linkRef = (0, import_react.useRef)(null);
|
50
50
|
const [{ selectedKeys, openKeys, router }, setState] = (0, import_ahooks.useSetState)({
|
@@ -147,8 +147,13 @@ var OpenMenu = (props) => {
|
|
147
147
|
openKeys: openKeys2
|
148
148
|
});
|
149
149
|
},
|
150
|
-
onClick: ({ item, keyPath }) => {
|
150
|
+
onClick: ({ item, keyPath, key, domEvent }) => {
|
151
151
|
var _a2, _b, _c;
|
152
|
+
const menuItem = (0, import_utils.findMenuItemByKey)(menus, key);
|
153
|
+
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id) => String(id)) : keyPath;
|
154
|
+
if (onMenuClick) {
|
155
|
+
onMenuClick({ item: menuItem, key, keyPath: menuKeyPath });
|
156
|
+
}
|
152
157
|
setState({
|
153
158
|
selectedKeys: keyPath,
|
154
159
|
router: (_a2 = item == null ? void 0 : item.props) == null ? void 0 : _a2.router
|
@@ -37,7 +37,7 @@ var import_classnames = __toESM(require("classnames"));
|
|
37
37
|
var import_ahooks = require("ahooks");
|
38
38
|
var import_OpenMenu = __toESM(require("../OpenMenu"));
|
39
39
|
var SideMenu = (props) => {
|
40
|
-
const { dataSource } = props;
|
40
|
+
const { dataSource, onMenuClick } = props;
|
41
41
|
const ref = (0, import_react.useRef)(null);
|
42
42
|
const size = (0, import_ahooks.useSize)(ref);
|
43
43
|
const { menus, iconfontUrl, notice, collapsed, headerHeight } = dataSource;
|
@@ -49,6 +49,7 @@ var SideMenu = (props) => {
|
|
49
49
|
{
|
50
50
|
className: "pro-layout-sider-menu-list",
|
51
51
|
theme: "light",
|
52
|
+
onMenuClick,
|
52
53
|
dataSource: {
|
53
54
|
menus: (menus == null ? void 0 : menus.children) || [],
|
54
55
|
iconfontUrl,
|
@@ -46,7 +46,8 @@ var Menu = (props) => {
|
|
46
46
|
pure,
|
47
47
|
theme,
|
48
48
|
sideMenuFooterRender,
|
49
|
-
sideMenuHeaderRender
|
49
|
+
sideMenuHeaderRender,
|
50
|
+
onMenuClick
|
50
51
|
} = props || {};
|
51
52
|
let menus = [];
|
52
53
|
const menuCls = (0, import_classnames.default)({
|
@@ -70,6 +71,7 @@ var Menu = (props) => {
|
|
70
71
|
height: headerHeight + (notice ? 32 : 0) + 48
|
71
72
|
},
|
72
73
|
theme,
|
74
|
+
onMenuClick,
|
73
75
|
style: {
|
74
76
|
display: collapsed ? "block" : "none"
|
75
77
|
}
|
@@ -85,6 +87,7 @@ var Menu = (props) => {
|
|
85
87
|
collapsed,
|
86
88
|
headerHeight
|
87
89
|
},
|
90
|
+
onMenuClick,
|
88
91
|
style: {
|
89
92
|
display: collapsed ? "none" : "block",
|
90
93
|
height: `calc(100vh - ${headerHeight + (notice ? 32 : 0) + 48 || 0}px)`
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
2
2
|
import { CollapseProps, CollapsePanelProps } from 'antd/es/collapse';
|
3
|
-
export type levelType = '1' | '2';
|
3
|
+
export type levelType = '1' | '2' | '3';
|
4
4
|
export interface TitleListType {
|
5
5
|
/**
|
6
6
|
* @description 描述的标题
|
@@ -28,12 +28,12 @@ export interface ProCollapseType {
|
|
28
28
|
* @description 自动适应窗口大小
|
29
29
|
* @default -
|
30
30
|
*/
|
31
|
-
autoHeight?:
|
31
|
+
autoHeight?: boolean;
|
32
32
|
/**
|
33
33
|
* @description 标题前图标
|
34
34
|
* @default -
|
35
35
|
*/
|
36
|
-
icon?: React.ReactNode |
|
36
|
+
icon?: React.ReactNode | boolean;
|
37
37
|
/**
|
38
38
|
* @description 折叠头部多个标题
|
39
39
|
* @default []
|
@@ -59,6 +59,11 @@ export interface ProCollapseType {
|
|
59
59
|
* @default false
|
60
60
|
*/
|
61
61
|
towCollapse?: boolean;
|
62
|
+
/**
|
63
|
+
* @description 三级折叠是否带收起
|
64
|
+
* @default false
|
65
|
+
*/
|
66
|
+
threeCollapse?: boolean;
|
62
67
|
/**
|
63
68
|
* @description 标题右侧扩展信息
|
64
69
|
* @default -
|
@@ -36,7 +36,6 @@ var import_react = require("react");
|
|
36
36
|
var import_antd = require("antd");
|
37
37
|
var import_icons = require("@ant-design/icons");
|
38
38
|
var import_classnames = __toESM(require("classnames"));
|
39
|
-
var import_lodash = require("lodash");
|
40
39
|
var import_fold = __toESM(require("../../../assets/fold.svg"));
|
41
40
|
var import_ProIcon = __toESM(require("../../../ProIcon/index"));
|
42
41
|
var ProCollapse = (props) => {
|
@@ -47,6 +46,7 @@ var ProCollapse = (props) => {
|
|
47
46
|
children,
|
48
47
|
level = "1",
|
49
48
|
towCollapse = false,
|
49
|
+
threeCollapse = false,
|
50
50
|
titleList,
|
51
51
|
extra,
|
52
52
|
column = 3,
|
@@ -67,9 +67,10 @@ var ProCollapse = (props) => {
|
|
67
67
|
const cls = (0, import_classnames.default)({
|
68
68
|
"pro-collapse": true,
|
69
69
|
"pro-collapse-level2": level === "2",
|
70
|
+
"pro-collapse-level3": level === "3",
|
70
71
|
"pro-collapse-list": titleList == null ? void 0 : titleList.length,
|
71
72
|
"pro-collapse-no-title": !title,
|
72
|
-
"pro-collapse-no-level1-title": !title && level !== "2",
|
73
|
+
"pro-collapse-no-level1-title": !title && level !== "2" && level !== "3",
|
73
74
|
[`${className}`]: className
|
74
75
|
});
|
75
76
|
const content = /* @__PURE__ */ React.createElement("div", { className: "pro-collapse-content", style: contentStyle }, children);
|
@@ -87,8 +88,31 @@ var ProCollapse = (props) => {
|
|
87
88
|
panelProps.collapsible = "disabled";
|
88
89
|
}
|
89
90
|
}
|
91
|
+
if (level === "3") {
|
92
|
+
const level3Panel = (0, import_classnames.default)({
|
93
|
+
"pro-collapse-level3-collapse": threeCollapse,
|
94
|
+
"pro-collapse-level3-no-collapse": !threeCollapse,
|
95
|
+
"pro-collapse-panel": true
|
96
|
+
});
|
97
|
+
const hasCollapse = {};
|
98
|
+
if (!threeCollapse) {
|
99
|
+
hasCollapse.collapsible = "disabled";
|
100
|
+
}
|
101
|
+
return [
|
102
|
+
{
|
103
|
+
key: "1",
|
104
|
+
label: _title,
|
105
|
+
children: content,
|
106
|
+
extra: /* @__PURE__ */ React.createElement("div", { className: "extra-info" }, extra),
|
107
|
+
className: level3Panel,
|
108
|
+
forceRender: true,
|
109
|
+
...hasCollapse,
|
110
|
+
...collapsePanelProps
|
111
|
+
}
|
112
|
+
];
|
113
|
+
}
|
90
114
|
if (icon) {
|
91
|
-
_title = /* @__PURE__ */ React.createElement(import_antd.Space, { size: 8, align: "center" }, /* @__PURE__ */ React.createElement("div", { className: "pro-collapse-icon" },
|
115
|
+
_title = /* @__PURE__ */ React.createElement(import_antd.Space, { size: 8, align: "center" }, /* @__PURE__ */ React.createElement("div", { className: "pro-collapse-icon" }, typeof icon === "boolean" ? /* @__PURE__ */ React.createElement(
|
92
116
|
import_ProIcon.default,
|
93
117
|
{
|
94
118
|
src: import_fold.default,
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @root-entry-name: 'default'; */
|
2
|
-
/* @import (reference) '~antd/es/style/themes/index.less'; */
|
3
1
|
|
4
2
|
.pro-collapse {
|
5
3
|
.pro-collapse-icon{
|
@@ -33,7 +31,8 @@
|
|
33
31
|
.@{ant-prefix}-collapse-header {
|
34
32
|
align-items: center !important;
|
35
33
|
padding: 10px var(--zaui-space-size-md, 16px) !important;
|
36
|
-
background:
|
34
|
+
background: #e4f2fe;
|
35
|
+
border-radius: 8px !important;
|
37
36
|
}
|
38
37
|
|
39
38
|
.@{ant-prefix}-collapse-header-text {
|
@@ -99,7 +98,7 @@
|
|
99
98
|
}
|
100
99
|
|
101
100
|
.pro-collapse-content {
|
102
|
-
padding: var(--zaui-space-size-
|
101
|
+
padding: var(--zaui-space-size-md, 16px) !important;
|
103
102
|
}
|
104
103
|
|
105
104
|
.pro-collapse-level2-collapse {
|
@@ -111,6 +110,7 @@
|
|
111
110
|
padding: 0 8px 6px !important;
|
112
111
|
border-bottom: 1px solid #dee0e3;
|
113
112
|
margin: 0 -8px;
|
113
|
+
border-radius: 0 !important;
|
114
114
|
.@{ant-prefix}-collapse-arrow{
|
115
115
|
right: 8px;
|
116
116
|
}
|
@@ -150,6 +150,9 @@
|
|
150
150
|
.@{ant-prefix}-collapse-expand-icon {
|
151
151
|
display: none;
|
152
152
|
}
|
153
|
+
.pro-collapse-content{
|
154
|
+
padding: var(--zaui-space-size-sm, 8px) 0 !important;
|
155
|
+
}
|
153
156
|
}
|
154
157
|
}
|
155
158
|
|
@@ -201,4 +204,145 @@
|
|
201
204
|
}
|
202
205
|
|
203
206
|
}
|
207
|
+
|
208
|
+
&.pro-collapse-level3 {
|
209
|
+
margin-bottom: var(--zaui-space-size-md, 16px);
|
210
|
+
|
211
|
+
.pro-collapse-level2{
|
212
|
+
margin-top: 8px !important;
|
213
|
+
.pro-collapse-panel {
|
214
|
+
border: none !important;
|
215
|
+
}
|
216
|
+
.@{ant-prefix}-collapse-header {
|
217
|
+
height: auto !important;
|
218
|
+
background: #fff !important;
|
219
|
+
&:hover{
|
220
|
+
background: #fff !important;
|
221
|
+
}
|
222
|
+
.@{ant-prefix}-collapse-header-text {
|
223
|
+
&:before{
|
224
|
+
display: block;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
.@{ant-prefix}-collapse-extra {
|
229
|
+
.extra-info {
|
230
|
+
font-size: var(--zaui-font-size, 14px);
|
231
|
+
color: var(--zaui-text, #343434);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
.@{ant-prefix}-collapse-content{
|
236
|
+
.@{ant-prefix}-collapse-content-box{
|
237
|
+
.pro-collapse-content{
|
238
|
+
padding: var(--zaui-space-size-sm, 8px) 0 !important;
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
}
|
244
|
+
|
245
|
+
.@{ant-prefix}-collapse-item-active{
|
246
|
+
margin-bottom: 0 !important;
|
247
|
+
}
|
248
|
+
.pro-collapse-panel {
|
249
|
+
border: 1px solid #d9d9d9;
|
250
|
+
margin-bottom: var(--zaui-space-size-md, 16px);
|
251
|
+
overflow: hidden;
|
252
|
+
border-radius: 8px !important;
|
253
|
+
|
254
|
+
&:last-child {
|
255
|
+
margin-bottom: 0;
|
256
|
+
border-bottom: 1px solid #d9d9d9;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
.pro-collapse-level3-no-collapse{
|
261
|
+
.@{ant-prefix}-collapse-header{
|
262
|
+
padding: 0 !important;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
.@{ant-prefix}-collapse-header {
|
267
|
+
height: 48px !important;
|
268
|
+
padding: 0 var(--zaui-space-size-md, 16px) !important;
|
269
|
+
background: #F8F8F8 !important;
|
270
|
+
border-radius: 8px;
|
271
|
+
align-items: center !important;
|
272
|
+
justify-content: center !important;
|
273
|
+
display: flex !important;
|
274
|
+
margin: 0 !important;
|
275
|
+
border-bottom: none !important;
|
276
|
+
|
277
|
+
.@{ant-prefix}-collapse-header-text {
|
278
|
+
font-size: var(--zaui-font-size, 14px);
|
279
|
+
font-weight: 500;
|
280
|
+
color: var(--zaui-text, #343434);
|
281
|
+
padding-left: 16px !important;
|
282
|
+
&:before{
|
283
|
+
display: none;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
.@{ant-prefix}-collapse-extra {
|
288
|
+
.extra-info {
|
289
|
+
font-size: var(--zaui-font-size, 14px);
|
290
|
+
color: var(--zaui-text, #343434);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
}
|
294
|
+
|
295
|
+
.@{ant-prefix}-collapse-content {
|
296
|
+
.@{ant-prefix}-collapse-content-box {
|
297
|
+
.pro-collapse-content {
|
298
|
+
padding: var(--zaui-space-size-md, 16px) !important;
|
299
|
+
background: var(--zaui-base-bg, #ffffff);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
// 可折叠样式
|
305
|
+
.pro-collapse-level3-collapse {
|
306
|
+
.@{ant-prefix}-collapse-expand-icon {
|
307
|
+
display: block !important;
|
308
|
+
color: #999;
|
309
|
+
margin-right: 8px;
|
310
|
+
}
|
311
|
+
|
312
|
+
.@{ant-prefix}-collapse-header {
|
313
|
+
cursor: pointer;
|
314
|
+
padding: 0 !important;
|
315
|
+
&:hover {
|
316
|
+
background: #f0f0f0;
|
317
|
+
}
|
318
|
+
}
|
319
|
+
}
|
320
|
+
|
321
|
+
// 不可折叠样式
|
322
|
+
.pro-collapse-level3-no-collapse {
|
323
|
+
.@{ant-prefix}-collapse-expand-icon {
|
324
|
+
display: none !important;
|
325
|
+
}
|
326
|
+
|
327
|
+
.@{ant-prefix}-collapse-header {
|
328
|
+
cursor: default;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
// 禁用折叠时的样式
|
333
|
+
&.@{ant-prefix}-collapse .@{ant-prefix}-collapse-item-disabled > .@{ant-prefix}-collapse-header,
|
334
|
+
.@{ant-prefix}-collapse
|
335
|
+
.@{ant-prefix}-collapse-item-disabled
|
336
|
+
> .@{ant-prefix}-collapse-header
|
337
|
+
> .arrow {
|
338
|
+
color: var(--zaui-text, #343434);
|
339
|
+
cursor: default;
|
340
|
+
background: #F8F8F8 !important;
|
341
|
+
}
|
342
|
+
}
|
343
|
+
// 当pro-collapse-content直接包含level3且不包含level2时,添加padding
|
344
|
+
.pro-collapse-level2 .pro-collapse-content:has(.pro-collapse-level3) {
|
345
|
+
padding: var(--zaui-space-size-md, 16px) !important;
|
346
|
+
padding-right: 0 !important;
|
347
|
+
}
|
204
348
|
}
|
package/lib/ProLayout/index.d.ts
CHANGED
@@ -7,17 +7,6 @@ export declare const LayoutContext: import("react").Context<{
|
|
7
7
|
}>;
|
8
8
|
declare const ProLayout: {
|
9
9
|
(props: ProLayoutType): import("react/jsx-runtime").JSX.Element;
|
10
|
-
defaultProps: {
|
11
|
-
menus: any[];
|
12
|
-
iconfontUrl: string;
|
13
|
-
title: string;
|
14
|
-
collapsed: boolean;
|
15
|
-
routerMatch: string;
|
16
|
-
pure: boolean;
|
17
|
-
theme: string;
|
18
|
-
headerHeight: number;
|
19
|
-
contentStyle: {};
|
20
|
-
};
|
21
10
|
ProCollapse: (props: import("./components/ProCollapse/PropTypes").ProCollapseType) => import("react/jsx-runtime").JSX.Element;
|
22
11
|
ProFooter: import("react").MemoExoticComponent<(props: import("./components/ProFooter/PropTypes").ProFooterType) => import("react/jsx-runtime").JSX.Element>;
|
23
12
|
ProHeader: import("react").MemoExoticComponent<(props: import("./components/ProHeader/PropTypes").ProHeaderType) => import("react/jsx-runtime").JSX.Element>;
|
package/lib/ProLayout/index.js
CHANGED
@@ -48,17 +48,29 @@ var ProLayout = (props) => {
|
|
48
48
|
children,
|
49
49
|
className = "",
|
50
50
|
pure = false,
|
51
|
-
headerHeight,
|
52
|
-
contentStyle,
|
51
|
+
headerHeight = 48,
|
52
|
+
contentStyle = {},
|
53
53
|
waterMarkProps = {},
|
54
54
|
headerNotice,
|
55
55
|
notice: noticeIn,
|
56
56
|
// 修改别名
|
57
57
|
dataSource,
|
58
58
|
pathPrefix = "",
|
59
|
-
theme,
|
59
|
+
theme = "dark",
|
60
60
|
target,
|
61
|
-
onCollapsedChange
|
61
|
+
onCollapsedChange,
|
62
|
+
collapsed: propsCollapsed = false,
|
63
|
+
onMenuClick,
|
64
|
+
// Header组件需要的props
|
65
|
+
headerTitleRender,
|
66
|
+
headerContentRender,
|
67
|
+
rightContentRender,
|
68
|
+
title,
|
69
|
+
logo,
|
70
|
+
// Menu组件需要的props
|
71
|
+
iconfontUrl,
|
72
|
+
sideMenuFooterRender,
|
73
|
+
sideMenuHeaderRender
|
62
74
|
} = props;
|
63
75
|
const [{ notice, menus, selectedPath }, setState] = (0, import_ahooks.useSetState)({
|
64
76
|
notice: headerNotice || noticeIn,
|
@@ -67,8 +79,8 @@ var ProLayout = (props) => {
|
|
67
79
|
});
|
68
80
|
const [collapsed, { toggle, set }] = (0, import_ahooks.useToggle)(props.collapsed || false);
|
69
81
|
(0, import_ahooks.useDeepCompareEffect)(() => {
|
70
|
-
set(
|
71
|
-
}, [
|
82
|
+
set(propsCollapsed || false);
|
83
|
+
}, [propsCollapsed]);
|
72
84
|
(0, import_ahooks.useDeepCompareEffect)(() => {
|
73
85
|
if (Array.isArray(dataSource) && !dataSource.length) {
|
74
86
|
return import_antd.message.warning(
|
@@ -90,6 +102,36 @@ var ProLayout = (props) => {
|
|
90
102
|
"pro-layout-row-left-pure": typeof pure !== "boolean" && (pure == null ? void 0 : pure.leftMenu)
|
91
103
|
});
|
92
104
|
const noticeHeight = notice ? 32 : 0;
|
105
|
+
const headerProps = {
|
106
|
+
headerHeight,
|
107
|
+
pure,
|
108
|
+
headerTitleRender,
|
109
|
+
headerContentRender,
|
110
|
+
rightContentRender,
|
111
|
+
title,
|
112
|
+
logo
|
113
|
+
};
|
114
|
+
const noticeProps = {
|
115
|
+
headerHeight,
|
116
|
+
notice,
|
117
|
+
onCancel: onCancelNotice
|
118
|
+
};
|
119
|
+
const menuProps = {
|
120
|
+
headerHeight,
|
121
|
+
dataSource: Array.isArray(menus) ? { menus } : menus,
|
122
|
+
iconfontUrl,
|
123
|
+
collapsed,
|
124
|
+
notice,
|
125
|
+
onToggle: () => {
|
126
|
+
toggle();
|
127
|
+
onCollapsedChange && onCollapsedChange(!collapsed);
|
128
|
+
},
|
129
|
+
pure,
|
130
|
+
theme,
|
131
|
+
sideMenuFooterRender,
|
132
|
+
sideMenuHeaderRender,
|
133
|
+
onMenuClick
|
134
|
+
};
|
93
135
|
const layoutDom = /* @__PURE__ */ React.createElement(
|
94
136
|
"div",
|
95
137
|
{
|
@@ -100,21 +142,9 @@ var ProLayout = (props) => {
|
|
100
142
|
[`${className}`]: className
|
101
143
|
})
|
102
144
|
},
|
103
|
-
/* @__PURE__ */ React.createElement(import_Layout.Header, { ...
|
104
|
-
/* @__PURE__ */ React.createElement(import_Layout.Notice, { ...
|
105
|
-
/* @__PURE__ */ React.createElement("div", { className: contentCls }, /* @__PURE__ */ React.createElement(
|
106
|
-
import_Layout.Menu,
|
107
|
-
{
|
108
|
-
...props,
|
109
|
-
dataSource: Array.isArray(menus) ? { menus } : menus,
|
110
|
-
notice,
|
111
|
-
collapsed,
|
112
|
-
onToggle: () => {
|
113
|
-
toggle();
|
114
|
-
onCollapsedChange && onCollapsedChange(!collapsed);
|
115
|
-
}
|
116
|
-
}
|
117
|
-
), /* @__PURE__ */ React.createElement(
|
145
|
+
/* @__PURE__ */ React.createElement(import_Layout.Header, { ...headerProps }),
|
146
|
+
/* @__PURE__ */ React.createElement(import_Layout.Notice, { ...noticeProps }),
|
147
|
+
/* @__PURE__ */ React.createElement("div", { className: contentCls }, /* @__PURE__ */ React.createElement(import_Layout.Menu, { ...menuProps }), /* @__PURE__ */ React.createElement(
|
118
148
|
"div",
|
119
149
|
{
|
120
150
|
className: "pro-layout-content",
|
@@ -128,17 +158,6 @@ var ProLayout = (props) => {
|
|
128
158
|
);
|
129
159
|
return /* @__PURE__ */ React.createElement(LayoutContext.Provider, { value: { selectedPath, target, onSelected: setState } }, !((_a = Object.keys(waterMarkProps)) == null ? void 0 : _a.length) ? layoutDom : /* @__PURE__ */ React.createElement(import__.ProWaterMark, { ...waterMarkProps }, layoutDom));
|
130
160
|
};
|
131
|
-
ProLayout.defaultProps = {
|
132
|
-
menus: [],
|
133
|
-
iconfontUrl: "",
|
134
|
-
title: "",
|
135
|
-
collapsed: false,
|
136
|
-
routerMatch: "id",
|
137
|
-
pure: false,
|
138
|
-
theme: "dark",
|
139
|
-
headerHeight: 48,
|
140
|
-
contentStyle: {}
|
141
|
-
};
|
142
161
|
ProLayout.ProCollapse = import_components.ProCollapse;
|
143
162
|
ProLayout.ProFooter = import_components.ProFooter;
|
144
163
|
ProLayout.ProHeader = import_components.ProHeader;
|
@@ -180,6 +180,15 @@ export interface ProLayoutType {
|
|
180
180
|
* @default -
|
181
181
|
*/
|
182
182
|
onCollapsedChange?: (collapsed: boolean) => void;
|
183
|
+
/**
|
184
|
+
* @description 菜单点击回调事件,返回命中的菜单项数据和完整路径
|
185
|
+
* @default -
|
186
|
+
*/
|
187
|
+
onMenuClick?: (params: {
|
188
|
+
item: MenusType | null;
|
189
|
+
key: string;
|
190
|
+
keyPath: string[];
|
191
|
+
}) => void;
|
183
192
|
/**
|
184
193
|
* @description 规定在何处打开被链接文档
|
185
194
|
* @default "_self"
|
@@ -34,3 +34,10 @@ export declare const getPathNameKey: ({ menus, pathName, }: {
|
|
34
34
|
menus: any[];
|
35
35
|
pathName: string;
|
36
36
|
}) => any;
|
37
|
+
/**
|
38
|
+
* 根据key查找完整的菜单项数据
|
39
|
+
* @param menus 菜单数据数组
|
40
|
+
* @param key 要查找的菜单项key
|
41
|
+
* @returns 找到的菜单项数据或null
|
42
|
+
*/
|
43
|
+
export declare const findMenuItemByKey: (menus: any[], key: string) => any;
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
19
19
|
// src/ProLayout/utils/index.ts
|
20
20
|
var utils_exports = {};
|
21
21
|
__export(utils_exports, {
|
22
|
+
findMenuItemByKey: () => findMenuItemByKey,
|
22
23
|
getIdsByPathName: () => getIdsByPathName,
|
23
24
|
getPathNameKey: () => getPathNameKey,
|
24
25
|
getUrlParams: () => getUrlParams,
|
@@ -150,8 +151,22 @@ var getPathNameKey = ({
|
|
150
151
|
menuDeep(menus);
|
151
152
|
return result;
|
152
153
|
};
|
154
|
+
var findMenuItemByKey = (menus, key) => {
|
155
|
+
for (const item of menus) {
|
156
|
+
if (String(item.id) === key) {
|
157
|
+
return item;
|
158
|
+
}
|
159
|
+
if (Array.isArray(item.children) && item.children.length) {
|
160
|
+
const found = findMenuItemByKey(item.children, key);
|
161
|
+
if (found)
|
162
|
+
return found;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
return null;
|
166
|
+
};
|
153
167
|
// Annotate the CommonJS export names for ESM import in node:
|
154
168
|
0 && (module.exports = {
|
169
|
+
findMenuItemByKey,
|
155
170
|
getIdsByPathName,
|
156
171
|
getPathNameKey,
|
157
172
|
getUrlParams,
|