@quansitech/antd-admin 1.1.23 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Layout/New.js +30 -10
- package/dist/components/Layout.js +36 -11
- package/dist/components/Table.js +1 -0
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ import http from "../../lib/http";
|
|
|
25
25
|
import { MoonOutlined, SunOutlined } from "@ant-design/icons";
|
|
26
26
|
import { usePage } from "@inertiajs/react";
|
|
27
27
|
export default function (_ref) {
|
|
28
|
+
var _layoutContext$props$;
|
|
28
29
|
var children = _ref.children,
|
|
29
30
|
pageTitle = _ref.pageTitle,
|
|
30
31
|
siteTitle = _ref.siteTitle,
|
|
@@ -47,11 +48,9 @@ export default function (_ref) {
|
|
|
47
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
49
|
openKeys = _useState2[0],
|
|
49
50
|
setOpenKeys = _useState2[1];
|
|
50
|
-
var
|
|
51
|
-
var _layoutProps$menuList;
|
|
52
|
-
return {
|
|
51
|
+
var _useState3 = useState({
|
|
53
52
|
key: '/',
|
|
54
|
-
routes: (
|
|
53
|
+
routes: (_layoutContext$props$ = layoutContext.props.menuList) === null || _layoutContext$props$ === void 0 ? void 0 : _layoutContext$props$.map(function (menu) {
|
|
55
54
|
var _menu$children;
|
|
56
55
|
return {
|
|
57
56
|
name: menu.name,
|
|
@@ -64,8 +63,29 @@ export default function (_ref) {
|
|
|
64
63
|
})
|
|
65
64
|
};
|
|
66
65
|
})
|
|
67
|
-
}
|
|
68
|
-
|
|
66
|
+
}),
|
|
67
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
|
+
route = _useState4[0],
|
|
69
|
+
setRoute = _useState4[1];
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
var _layoutContext$props$2;
|
|
72
|
+
setRoute({
|
|
73
|
+
key: '/',
|
|
74
|
+
routes: (_layoutContext$props$2 = layoutContext.props.menuList) === null || _layoutContext$props$2 === void 0 ? void 0 : _layoutContext$props$2.map(function (menu) {
|
|
75
|
+
var _menu$children2;
|
|
76
|
+
return {
|
|
77
|
+
name: menu.name,
|
|
78
|
+
key: menu.key,
|
|
79
|
+
children: (_menu$children2 = menu.children) === null || _menu$children2 === void 0 ? void 0 : _menu$children2.map(function (child) {
|
|
80
|
+
return {
|
|
81
|
+
name: child.name,
|
|
82
|
+
key: child.key
|
|
83
|
+
};
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}, [layoutContext.props.menuList]);
|
|
69
89
|
useEffect(function () {
|
|
70
90
|
function findKeyPath(key, list) {
|
|
71
91
|
for (var i = 0; i < list.length; i++) {
|
|
@@ -119,9 +139,9 @@ export default function (_ref) {
|
|
|
119
139
|
};
|
|
120
140
|
}, []);
|
|
121
141
|
var onMenuClick = function onMenuClick(info) {
|
|
122
|
-
var _layoutContext$props
|
|
142
|
+
var _layoutContext$props$3, _menu;
|
|
123
143
|
var keyPath = info.keyPath.reverse();
|
|
124
|
-
var menu = (_layoutContext$props$ = layoutContext.props.menuList) === null || _layoutContext$props$ === void 0 ? void 0 : _layoutContext$props
|
|
144
|
+
var menu = (_layoutContext$props$3 = layoutContext.props.menuList) === null || _layoutContext$props$3 === void 0 ? void 0 : _layoutContext$props$3.find(function (menu) {
|
|
125
145
|
return menu.key === keyPath[0];
|
|
126
146
|
});
|
|
127
147
|
var _loop = function _loop(i) {
|
|
@@ -184,10 +204,10 @@ export default function (_ref) {
|
|
|
184
204
|
avatarProps: {
|
|
185
205
|
title: 'admin',
|
|
186
206
|
render: function render(p, dom) {
|
|
187
|
-
var _layoutContext$props$
|
|
207
|
+
var _layoutContext$props$4;
|
|
188
208
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
189
209
|
menu: {
|
|
190
|
-
items: ((_layoutContext$props$
|
|
210
|
+
items: ((_layoutContext$props$4 = layoutContext.props.userMenu) === null || _layoutContext$props$4 === void 0 ? void 0 : _layoutContext$props$4.map(function (menu) {
|
|
191
211
|
return {
|
|
192
212
|
label: menu.title,
|
|
193
213
|
key: menu.url,
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -62,23 +68,42 @@ export default function (props) {
|
|
|
62
68
|
}
|
|
63
69
|
var listener = function listener(e) {
|
|
64
70
|
var layoutProps = e.detail.page.props.layoutProps;
|
|
65
|
-
assignProps({
|
|
71
|
+
assignProps(_objectSpread(_objectSpread({}, layoutProps), {}, {
|
|
66
72
|
metaTitle: (layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.metaTitle) || ''
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
}));
|
|
74
|
+
};
|
|
75
|
+
document.addEventListener('inertia:navigate', listener);
|
|
76
|
+
return function () {
|
|
77
|
+
document.removeEventListener('inertia:navigate', listener);
|
|
78
|
+
};
|
|
79
|
+
}, []);
|
|
80
|
+
useEffect(function () {
|
|
81
|
+
var listener = function listener(e) {
|
|
82
|
+
if (!e.detail.response.headers['content-type'].includes('json')) {
|
|
83
|
+
return;
|
|
72
84
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
var data = e.detail.response.data;
|
|
87
|
+
var goto = function goto() {
|
|
88
|
+
if (!data.url) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
window.location.href = data.url;
|
|
92
|
+
};
|
|
93
|
+
if (data.info) {
|
|
94
|
+
global.notification.warning({
|
|
95
|
+
message: data.info
|
|
76
96
|
});
|
|
97
|
+
setTimeout(function () {
|
|
98
|
+
goto();
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
goto();
|
|
77
102
|
}
|
|
78
103
|
};
|
|
79
|
-
document.addEventListener('inertia:
|
|
104
|
+
document.addEventListener('inertia:invalid', listener);
|
|
80
105
|
return function () {
|
|
81
|
-
document.removeEventListener('inertia:
|
|
106
|
+
document.removeEventListener('inertia:invalid', listener);
|
|
82
107
|
};
|
|
83
108
|
}, []);
|
|
84
109
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Head, {
|
package/dist/components/Table.js
CHANGED
|
@@ -68,6 +68,7 @@ export default function (props) {
|
|
|
68
68
|
props = getValueByPath(props, tabsContext.propsPath);
|
|
69
69
|
}
|
|
70
70
|
setDataSource(postData(props.dataSource));
|
|
71
|
+
setExtraRenderValues(props.extraRenderValues);
|
|
71
72
|
setPagination(props.pagination);
|
|
72
73
|
},
|
|
73
74
|
onFinish: function onFinish() {
|