@quansitech/antd-admin 1.1.29 → 1.1.30

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.
@@ -17,7 +17,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
17
17
  import { PageContainer, ProLayout, ProProvider } from "@ant-design/pro-components";
18
18
  import { Button, Dropdown, Menu, Space } from "antd";
19
19
  import { LayoutContext } from "../LayoutContext";
20
- import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
20
+ import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
21
21
  import { routerNavigateTo } from "../../lib/helpers";
22
22
  import http from "../../lib/http";
23
23
  // @ts-ignore
@@ -107,24 +107,6 @@ export default function (_ref) {
107
107
  }
108
108
  setOpenKeys(findKeyPath(layoutContext.props.menuActiveKey, layoutContext.props.menuList || []));
109
109
  }, [layoutContext.props.menuActiveKey]);
110
- useCallback(function () {
111
- var _pageProps$layoutProp, _pageProps$layoutProp2;
112
- if ((_pageProps$layoutProp = pageProps.layoutProps) !== null && _pageProps$layoutProp !== void 0 && _pageProps$layoutProp.menuActiveKey) {
113
- assignProps({
114
- menuActiveKey: pageProps.layoutProps.menuActiveKey
115
- });
116
- }
117
- var title = layoutContext.props.title || layoutProps.title;
118
- if ((_pageProps$layoutProp2 = pageProps.layoutProps) !== null && _pageProps$layoutProp2 !== void 0 && _pageProps$layoutProp2.metaTitle) {
119
- assignProps({
120
- metaTitle: pageProps.layoutProps.metaTitle + ' | ' + title
121
- });
122
- } else {
123
- assignProps({
124
- metaTitle: title
125
- });
126
- }
127
- }, [pageProps.layoutProps]);
128
110
  useEffect(function () {
129
111
  // 设置内容高度
130
112
  function onResize() {
@@ -173,7 +155,7 @@ export default function (_ref) {
173
155
  };
174
156
  var proContext = useContext(ProProvider);
175
157
  var actionsRender = function actionsRender() {
176
- return /*#__PURE__*/React.createElement(React.Fragment, null, layoutProps.headerActions, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
158
+ return /*#__PURE__*/React.createElement(React.Fragment, null, layoutContext.props.headerActions, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
177
159
  type: 'text',
178
160
  onClick: function onClick() {
179
161
  setDarkMode(!proContext.dark);
@@ -193,7 +175,7 @@ export default function (_ref) {
193
175
  return "".concat(pageTitle, " | ").concat(layoutProps.title, " \u540E\u53F0\u7BA1\u7406");
194
176
  },
195
177
  footerRender: function footerRender() {
196
- return /*#__PURE__*/React.createElement(React.Fragment, null, layoutProps.footer !== undefined ? /*#__PURE__*/React.createElement(React.Fragment, null, layoutProps.footer) : /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("a", {
178
+ return /*#__PURE__*/React.createElement(React.Fragment, null, layoutContext.props.footer !== undefined ? /*#__PURE__*/React.createElement(React.Fragment, null, layoutContext.props.footer) : /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("a", {
197
179
  href: "https://www.quansitech.com/",
198
180
  target: '_blank'
199
181
  }, "\u5168\u601D\u79D1\u6280"), /*#__PURE__*/React.createElement("a", {
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export default function ({ children }: PropsWithChildren): any;
@@ -0,0 +1,18 @@
1
+ import { useContext, useEffect } from 'react';
2
+ import { LayoutContext } from "../../LayoutContext";
3
+ export default function (_ref) {
4
+ var children = _ref.children;
5
+ var layoutContext = useContext(LayoutContext);
6
+ useEffect(function () {
7
+ var footer = layoutContext.props.footer;
8
+ layoutContext.assignProps({
9
+ footer: children
10
+ });
11
+ return function () {
12
+ layoutContext.assignProps({
13
+ footer: footer
14
+ });
15
+ };
16
+ }, []);
17
+ return null;
18
+ }
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export default function ({ children }: PropsWithChildren): any;
@@ -0,0 +1,18 @@
1
+ import { useContext, useEffect } from 'react';
2
+ import { LayoutContext } from "../../LayoutContext";
3
+ export default function (_ref) {
4
+ var children = _ref.children;
5
+ var layoutContext = useContext(LayoutContext);
6
+ useEffect(function () {
7
+ var headerActions = layoutContext.props.headerActions;
8
+ layoutContext.assignProps({
9
+ headerActions: children
10
+ });
11
+ return function () {
12
+ layoutContext.assignProps({
13
+ headerActions: headerActions
14
+ });
15
+ };
16
+ }, []);
17
+ return null;
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quansitech/antd-admin",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
package/readme.md CHANGED
@@ -12,10 +12,10 @@ npm install @quansitech/antd-admin
12
12
 
13
13
  ### Layout组件Props
14
14
 
15
- | 属性 | 说明 | 类型 | 默认值 |
16
- |---------------|------|-----------|---------------|
17
- | headerActions | 顶部操作 | ReactNode | - |
18
- | footer | 底部内容 | ReactNode | 全思科技 - Github |
15
+ | 属性 | 替换组件 | 说明 | 类型 | 默认值 |
16
+ |---------------|---------------|------|-----------|---------------|
17
+ | headerActions | HeaderActions | 顶部操作 | ReactNode | - |
18
+ | footer | Footer | 底部内容 | ReactNode | 全思科技 - Github |
19
19
 
20
20
  可在项目目录 `/resources/js/backend/app.tsx` 中修改,如:
21
21
 
@@ -37,6 +37,23 @@ createInertiaApp({
37
37
  })
38
38
  ```
39
39
 
40
+ 对于单独页面修改Layout组件属性,可在页面中调用对应的 Replacement 组件,如:
41
+
42
+ ```tsx
43
+ import HeaderActions from "@quansitech/antd-admin/dist/components/Layout/Replacement/HeaderActions";
44
+
45
+ export default function () {
46
+
47
+ return <>
48
+ <HeaderActions>
49
+ 修改的内容
50
+ </HeaderActions>
51
+ 页面内容
52
+ </>
53
+ }
54
+
55
+ ```
56
+
40
57
  ### valueType列表
41
58
 
42
59
  参考 [ant-design-pro#valueType](https://procomponents.ant.design/components/schema#valuetype-%E5%88%97%E8%A1%A8)