@lemon-fe/kits 1.2.0-alpha.0 → 1.2.0
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/es/app-provider/index.d.ts +11 -0
- package/es/app-provider/index.js +86 -0
- package/es/hooks/use-batch-operator/index.d.ts +1 -1
- package/es/hooks/use-batch-operator/index.js +52 -32
- package/es/index.d.ts +2 -5
- package/es/index.js +1 -5
- package/es/init.js +2 -154
- package/es/layouts/basic-layout/components/main-framework/components/menu/index.d.ts +2 -0
- package/es/layouts/basic-layout/components/main-framework/components/menu/index.js +8 -16
- package/es/layouts/basic-layout/components/main-framework/components/refresh-button/index.d.ts +2 -0
- package/es/layouts/basic-layout/components/main-framework/components/refresh-button/index.js +5 -11
- package/es/layouts/basic-layout/components/main-framework/index.d.ts +2 -0
- package/es/layouts/basic-layout/components/main-framework/index.js +4 -1
- package/es/layouts/basic-layout/components/main.js +11 -5
- package/es/layouts/breadcrumb/index.js +1 -2
- package/es/locale/en_US.js +5 -6
- package/es/locale/locale.d.ts +9 -9
- package/es/locale/zh_CN.js +6 -7
- package/package.json +4 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Locale } from '../locale/locale';
|
|
3
|
+
declare type AppConfigProps = {
|
|
4
|
+
children?: ReactNode | null;
|
|
5
|
+
locale?: Locale;
|
|
6
|
+
};
|
|
7
|
+
declare function AppProvider(props: AppConfigProps): JSX.Element;
|
|
8
|
+
declare namespace AppProvider {
|
|
9
|
+
var useApp;
|
|
10
|
+
}
|
|
11
|
+
export default AppProvider;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { createContext, useMemo, useEffect, useContext } from 'react';
|
|
8
|
+
import { PageLoading, PREFIX_CLS, message, Modal, ConfigProvider, Result, Button } from '@lemon-fe/components';
|
|
9
|
+
import { HooksConfigProvider } from '@lemon-fe/hooks';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var AppContext = /*#__PURE__*/createContext({
|
|
13
|
+
message: message,
|
|
14
|
+
modal: Modal
|
|
15
|
+
});
|
|
16
|
+
function useApp() {
|
|
17
|
+
return useContext(AppContext);
|
|
18
|
+
}
|
|
19
|
+
export default function AppProvider(props) {
|
|
20
|
+
var _message$useMessage = message.useMessage(),
|
|
21
|
+
_message$useMessage2 = _slicedToArray(_message$useMessage, 2),
|
|
22
|
+
messageApi = _message$useMessage2[0],
|
|
23
|
+
messageContextHolder = _message$useMessage2[1];
|
|
24
|
+
var _Modal$useModal = Modal.useModal(),
|
|
25
|
+
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
26
|
+
modalApi = _Modal$useModal2[0],
|
|
27
|
+
modalContextHolder = _Modal$useModal2[1];
|
|
28
|
+
var locale = useContext(ConfigProvider.ConfigContext).locale;
|
|
29
|
+
var appContext = useMemo(function () {
|
|
30
|
+
return {
|
|
31
|
+
message: messageApi,
|
|
32
|
+
modal: modalApi
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
/** 设置滚动条 */
|
|
37
|
+
if (/windows/.test(window.navigator.userAgent.toLowerCase())) {
|
|
38
|
+
document.body.classList.add("".concat(PREFIX_CLS, "-thin-scroll-bar"));
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
return /*#__PURE__*/_jsxs(AppContext.Provider, {
|
|
42
|
+
value: appContext,
|
|
43
|
+
children: [messageContextHolder, modalContextHolder, /*#__PURE__*/_jsx(HooksConfigProvider, {
|
|
44
|
+
value: {
|
|
45
|
+
showToast: function showToast() {
|
|
46
|
+
var _locale$Common;
|
|
47
|
+
return messageApi.loading(locale === null || locale === void 0 || (_locale$Common = locale.Common) === null || _locale$Common === void 0 ? void 0 : _locale$Common.waitingText, 0);
|
|
48
|
+
},
|
|
49
|
+
cancelToast: function cancelToast(hide) {
|
|
50
|
+
hide();
|
|
51
|
+
},
|
|
52
|
+
showLoading: function showLoading() {
|
|
53
|
+
return /*#__PURE__*/_jsx(PageLoading, {});
|
|
54
|
+
},
|
|
55
|
+
showError: function showError(err) {
|
|
56
|
+
console.error(err);
|
|
57
|
+
if (err && typeof err.message === 'string') {
|
|
58
|
+
messageApi.error(err.message);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
setPrimaryColor: function setPrimaryColor(color) {
|
|
62
|
+
ConfigProvider.config({
|
|
63
|
+
theme: {
|
|
64
|
+
primaryColor: color
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
errorResult: function errorResult(err, refresh) {
|
|
69
|
+
var _props$locale;
|
|
70
|
+
return /*#__PURE__*/_jsx(Result, {
|
|
71
|
+
status: "500",
|
|
72
|
+
title: "500",
|
|
73
|
+
subTitle: err.message,
|
|
74
|
+
extra: /*#__PURE__*/_jsx(Button, {
|
|
75
|
+
type: "primary",
|
|
76
|
+
onClick: refresh,
|
|
77
|
+
children: (_props$locale = props.locale) === null || _props$locale === void 0 || (_props$locale = _props$locale.Common) === null || _props$locale === void 0 ? void 0 : _props$locale.reloadPageText
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
children: props.children
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
AppProvider.useApp = useApp;
|
|
@@ -45,7 +45,7 @@ interface Props<RecordType extends Record<string, any> = Record<string, any>, Re
|
|
|
45
45
|
/**
|
|
46
46
|
* @description 弹窗关闭前的检验,返回true校验通过关闭弹窗,false校验不通过
|
|
47
47
|
*/
|
|
48
|
-
onBeforeClose?: (results: Map<Key, Result<ResultType
|
|
48
|
+
onBeforeClose?: (results: Map<Key, Result<ResultType>>, datas: RecordType[]) => Promise<boolean> | boolean;
|
|
49
49
|
/**
|
|
50
50
|
* @description 自定义渲染结果,不要依赖上下文
|
|
51
51
|
* @param params
|
|
@@ -27,11 +27,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
27
27
|
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; }
|
|
28
28
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
29
29
|
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); }
|
|
30
|
-
import { ConfigProvider, Modal, Row, Spin, Typography } from 'antd';
|
|
31
30
|
import React, { useContext, Component, createRef } from 'react';
|
|
32
31
|
import { unmountComponentAtNode, render } from 'react-dom';
|
|
33
32
|
import defaultLocale from "./locale/zh_CN";
|
|
34
|
-
import {
|
|
33
|
+
import { ConfigProvider, Modal, Row, Spin, Typography } from '@lemon-fe/components';
|
|
35
34
|
import { Actions, ComponentConfigureContext, DataGrid, Icons, Layout, Section } from '@lemon-fe/components';
|
|
36
35
|
import { Subject } from '@lemon-fe/utils';
|
|
37
36
|
import { get } from 'lodash';
|
|
@@ -56,11 +55,12 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
56
55
|
return String(result !== null && result !== void 0 ? result : '').toString();
|
|
57
56
|
});
|
|
58
57
|
_defineProperty(_assertThisInitialized(_this), "handleClose", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
59
|
-
var _this$props, onBeforeClose, onClose, results, value;
|
|
58
|
+
var _this$props, onBeforeClose, onClose, data, results, value;
|
|
60
59
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
61
60
|
while (1) switch (_context.prev = _context.next) {
|
|
62
61
|
case 0:
|
|
63
62
|
_this$props = _this.props, onBeforeClose = _this$props.onBeforeClose, onClose = _this$props.onClose;
|
|
63
|
+
data = _this.state.data;
|
|
64
64
|
results = new Map();
|
|
65
65
|
_toConsumableArray(_this.state.results).forEach(function (_ref2) {
|
|
66
66
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
@@ -73,20 +73,20 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
73
73
|
});
|
|
74
74
|
_context.t0 = onBeforeClose;
|
|
75
75
|
if (!_context.t0) {
|
|
76
|
-
_context.next =
|
|
76
|
+
_context.next = 9;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
|
-
_context.next =
|
|
80
|
-
return onBeforeClose(results);
|
|
81
|
-
case 7:
|
|
82
|
-
_context.t0 = !_context.sent;
|
|
79
|
+
_context.next = 8;
|
|
80
|
+
return onBeforeClose(results, data);
|
|
83
81
|
case 8:
|
|
82
|
+
_context.t0 = !_context.sent;
|
|
83
|
+
case 9:
|
|
84
84
|
if (!_context.t0) {
|
|
85
|
-
_context.next =
|
|
85
|
+
_context.next = 11;
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
return _context.abrupt("return");
|
|
89
|
-
case
|
|
89
|
+
case 11:
|
|
90
90
|
_this.setState({
|
|
91
91
|
open: false
|
|
92
92
|
});
|
|
@@ -100,7 +100,7 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
100
100
|
results: results
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
case
|
|
103
|
+
case 13:
|
|
104
104
|
case "end":
|
|
105
105
|
return _context.stop();
|
|
106
106
|
}
|
|
@@ -232,9 +232,12 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
232
232
|
flex: 1
|
|
233
233
|
},
|
|
234
234
|
children: [/*#__PURE__*/_jsx(Icons.Tip, {
|
|
235
|
-
type: "warning"
|
|
235
|
+
type: "warning",
|
|
236
|
+
style: {
|
|
237
|
+
marginRight: 2
|
|
238
|
+
}
|
|
236
239
|
}), /*#__PURE__*/_jsxs("span", {
|
|
237
|
-
children: [
|
|
240
|
+
children: [error.message, " "]
|
|
238
241
|
})]
|
|
239
242
|
}), /*#__PURE__*/_jsx("a", {
|
|
240
243
|
onClick: function onClick() {
|
|
@@ -255,11 +258,14 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
255
258
|
tooltip: error.message
|
|
256
259
|
},
|
|
257
260
|
children: [/*#__PURE__*/_jsx(Icons.Tip, {
|
|
258
|
-
type: "error"
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
type: "error",
|
|
262
|
+
style: {
|
|
263
|
+
marginRight: 2
|
|
264
|
+
}
|
|
265
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
266
|
+
children: error.message
|
|
261
267
|
})]
|
|
262
|
-
}), /*#__PURE__*/_jsx(
|
|
268
|
+
}), /*#__PURE__*/_jsx(Icons.Reload, {
|
|
263
269
|
onClick: function onClick() {
|
|
264
270
|
_this2.processNode(id, 0, _this2.props.params);
|
|
265
271
|
}
|
|
@@ -272,9 +278,12 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
272
278
|
tooltip: resultInfo
|
|
273
279
|
},
|
|
274
280
|
children: [/*#__PURE__*/_jsx(Icons.Tip, {
|
|
275
|
-
type: "success"
|
|
276
|
-
|
|
277
|
-
|
|
281
|
+
type: "success",
|
|
282
|
+
style: {
|
|
283
|
+
marginRight: 2
|
|
284
|
+
}
|
|
285
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
286
|
+
children: resultInfo
|
|
278
287
|
})]
|
|
279
288
|
});
|
|
280
289
|
}
|
|
@@ -415,11 +424,14 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
415
424
|
tooltip: error.message
|
|
416
425
|
},
|
|
417
426
|
children: [/*#__PURE__*/_jsx(Icons.Tip, {
|
|
418
|
-
type: "error"
|
|
419
|
-
|
|
420
|
-
|
|
427
|
+
type: "error",
|
|
428
|
+
style: {
|
|
429
|
+
marginRight: 2
|
|
430
|
+
}
|
|
431
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
432
|
+
children: error.message
|
|
421
433
|
})]
|
|
422
|
-
}), /*#__PURE__*/_jsx(
|
|
434
|
+
}), /*#__PURE__*/_jsx(Icons.Reload, {
|
|
423
435
|
onClick: function onClick() {
|
|
424
436
|
return reload();
|
|
425
437
|
}
|
|
@@ -437,7 +449,7 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
437
449
|
successIcon: /*#__PURE__*/_jsx(Icons.Tip, {
|
|
438
450
|
type: "success"
|
|
439
451
|
}),
|
|
440
|
-
reloadButton: /*#__PURE__*/_jsx(
|
|
452
|
+
reloadButton: /*#__PURE__*/_jsx(Icons.Reload, {
|
|
441
453
|
onClick: function onClick() {
|
|
442
454
|
return reload();
|
|
443
455
|
}
|
|
@@ -452,9 +464,12 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
452
464
|
tooltip: resultInfo
|
|
453
465
|
},
|
|
454
466
|
children: [/*#__PURE__*/_jsx(Icons.Tip, {
|
|
455
|
-
type: "success"
|
|
456
|
-
|
|
457
|
-
|
|
467
|
+
type: "success",
|
|
468
|
+
style: {
|
|
469
|
+
marginRight: 2
|
|
470
|
+
}
|
|
471
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
472
|
+
children: resultInfo
|
|
458
473
|
})]
|
|
459
474
|
});
|
|
460
475
|
}
|
|
@@ -539,7 +554,10 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
539
554
|
if (!state) {
|
|
540
555
|
return /*#__PURE__*/_jsxs("span", {
|
|
541
556
|
children: [/*#__PURE__*/_jsx(Icons.Tip, {
|
|
542
|
-
type: "warning"
|
|
557
|
+
type: "warning",
|
|
558
|
+
style: {
|
|
559
|
+
marginRight: 2
|
|
560
|
+
}
|
|
543
561
|
}), /*#__PURE__*/_jsx("span", {
|
|
544
562
|
children: pendingStateText
|
|
545
563
|
})]
|
|
@@ -550,7 +568,8 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
550
568
|
children: [/*#__PURE__*/_jsx(Spin, {
|
|
551
569
|
size: "small",
|
|
552
570
|
style: {
|
|
553
|
-
lineHeight: 1
|
|
571
|
+
lineHeight: 1,
|
|
572
|
+
marginRight: 2
|
|
554
573
|
}
|
|
555
574
|
}), /*#__PURE__*/_jsx("span", {
|
|
556
575
|
children: progressStateText
|
|
@@ -568,7 +587,8 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
568
587
|
}, {
|
|
569
588
|
key: "render",
|
|
570
589
|
value: function render() {
|
|
571
|
-
var _this5 = this
|
|
590
|
+
var _this5 = this,
|
|
591
|
+
_results$get;
|
|
572
592
|
var _this$props4 = this.props,
|
|
573
593
|
modalTitle = _this$props4.modalTitle,
|
|
574
594
|
_afterClose = _this$props4.afterClose,
|
|
@@ -620,7 +640,7 @@ var BatchOperate = /*#__PURE__*/function (_Component) {
|
|
|
620
640
|
children: "".concat(detailsText).concat(results.size > 0 ? "(".concat(results.size, "/").concat(data.length, ")") : '')
|
|
621
641
|
}), /*#__PURE__*/_jsx(Actions, {
|
|
622
642
|
actions: [paused ? {
|
|
623
|
-
disabled: data.length <= 0 || results.size >= data.length,
|
|
643
|
+
disabled: data.length <= 0 || results.size >= data.length || active !== undefined && ((_results$get = results.get(active)) === null || _results$get === void 0 ? void 0 : _results$get.loading),
|
|
624
644
|
text: active ? continueText : startExecText,
|
|
625
645
|
onClick: this.handleStart
|
|
626
646
|
} : {
|
package/es/index.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export * from 'antd';
|
|
2
|
-
export { Alert, Dropdown, InputNumber, Layout, Table } from '@lemon-fe/components';
|
|
3
1
|
export * from '@lemon-fe/components';
|
|
4
|
-
export { default as zhCN } from './locale/zh_CN';
|
|
5
|
-
export { default as enUS } from './locale/en_US';
|
|
6
|
-
export type { Locale } from './locale/locale';
|
|
7
2
|
export * from '@lemon-fe/hooks';
|
|
8
3
|
export * from '@lemon-fe/utils';
|
|
9
4
|
export { default as BasicLayout } from './layouts/basic-layout';
|
|
@@ -15,4 +10,6 @@ export { default as Breadcrumb } from './layouts/breadcrumb';
|
|
|
15
10
|
export { default as useBatchOperator } from './hooks/use-batch-operator';
|
|
16
11
|
export { default as useHistoryBlock } from './hooks/use-history-block';
|
|
17
12
|
export { TabInstance } from './layouts/tab-instance';
|
|
13
|
+
export { default as AppProvider } from './app-provider';
|
|
14
|
+
export type { Locale } from './locale/locale';
|
|
18
15
|
export { default as init } from './init';
|
package/es/index.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export * from 'antd';
|
|
2
|
-
export { Alert, Dropdown, InputNumber, Layout, Table } from '@lemon-fe/components';
|
|
3
|
-
//@ts-ignore
|
|
4
1
|
export * from '@lemon-fe/components';
|
|
5
|
-
export { default as zhCN } from "./locale/zh_CN";
|
|
6
|
-
export { default as enUS } from "./locale/en_US";
|
|
7
2
|
export * from '@lemon-fe/hooks';
|
|
8
3
|
export * from '@lemon-fe/utils';
|
|
9
4
|
export { default as BasicLayout } from "./layouts/basic-layout";
|
|
@@ -13,4 +8,5 @@ export { default as Breadcrumb } from "./layouts/breadcrumb";
|
|
|
13
8
|
export { default as useBatchOperator } from "./hooks/use-batch-operator";
|
|
14
9
|
export { default as useHistoryBlock } from "./hooks/use-history-block";
|
|
15
10
|
export { TabInstance } from "./layouts/tab-instance";
|
|
11
|
+
export { default as AppProvider } from "./app-provider";
|
|
16
12
|
export { default as init } from "./init";
|
package/es/init.js
CHANGED
|
@@ -1,165 +1,13 @@
|
|
|
1
|
-
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; }
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
-
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); }
|
|
6
|
-
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); }
|
|
7
|
-
import { message, Modal, Select, ConfigProvider, Result, Button, DatePicker, Cascader, TreeSelect, Empty, Menu, TimePicker, Tree } from 'antd';
|
|
8
1
|
import React from 'react';
|
|
9
|
-
import {
|
|
2
|
+
import { PageLoading, PREFIX_CLS, message, ConfigProvider, Result, Button } from '@lemon-fe/components';
|
|
10
3
|
import { config } from '@lemon-fe/hooks';
|
|
11
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
var Tip = Icons.Tip,
|
|
13
|
-
Down = Icons.Down,
|
|
14
|
-
CloseLight = Icons.CloseLight,
|
|
15
|
-
Clear = Icons.Clear;
|
|
16
5
|
export default function init(opts) {
|
|
17
|
-
var types = ['success', 'error', 'warning', 'info'];
|
|
18
6
|
var locale = opts.locale;
|
|
19
|
-
var modalLocale = locale.Modal;
|
|
20
7
|
var commonLocale = locale.Common;
|
|
21
|
-
types.forEach(function (item) {
|
|
22
|
-
var msgAPI = message[item].bind(message);
|
|
23
|
-
var modalAPI = Modal[item].bind(Modal);
|
|
24
|
-
message[item] = function () {
|
|
25
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
-
args[_key] = arguments[_key];
|
|
27
|
-
}
|
|
28
|
-
var args0 = args[0],
|
|
29
|
-
args1 = args[1],
|
|
30
|
-
args2 = args[2];
|
|
31
|
-
if (args.length === 1 && _typeof(args0) === 'object' && ! /*#__PURE__*/React.isValidElement(args0)) {
|
|
32
|
-
return msgAPI(_objectSpread({
|
|
33
|
-
icon: /*#__PURE__*/_jsx(Tip, {
|
|
34
|
-
type: item
|
|
35
|
-
})
|
|
36
|
-
}, args0));
|
|
37
|
-
}
|
|
38
|
-
return msgAPI({
|
|
39
|
-
content: args0,
|
|
40
|
-
duration: args1,
|
|
41
|
-
onClose: args2,
|
|
42
|
-
icon: /*#__PURE__*/_jsx(Tip, {
|
|
43
|
-
type: item
|
|
44
|
-
})
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
Modal[item] = function (args) {
|
|
48
|
-
return modalAPI(_objectSpread({
|
|
49
|
-
title: modalLocale.defaultTitle,
|
|
50
|
-
width: 400,
|
|
51
|
-
icon: /*#__PURE__*/_jsx(Tip, {
|
|
52
|
-
type: item
|
|
53
|
-
})
|
|
54
|
-
}, args));
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
var modalConfirm = Modal.confirm.bind(Modal);
|
|
58
|
-
Modal.confirm = function (args) {
|
|
59
|
-
return modalConfirm(_objectSpread({
|
|
60
|
-
icon: /*#__PURE__*/_jsx(Tip, {
|
|
61
|
-
type: "info"
|
|
62
|
-
}),
|
|
63
|
-
width: 400,
|
|
64
|
-
title: modalLocale.defaultTitle
|
|
65
|
-
}, args));
|
|
66
|
-
};
|
|
67
|
-
Modal.defaultProps = _objectSpread(_objectSpread({}, Modal.defaultProps), {}, {
|
|
68
|
-
maskClosable: false,
|
|
69
|
-
closeIcon: /*#__PURE__*/_jsx(CloseLight, {})
|
|
70
|
-
});
|
|
71
|
-
var node = /*#__PURE__*/_jsx(Down, {
|
|
72
|
-
style: {
|
|
73
|
-
pointerEvents: 'none'
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
Empty.defaultProps = {
|
|
77
|
-
image: /*#__PURE__*/_jsx(EmptyImage, {})
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
//@ts-ignore
|
|
81
|
-
Select.defaultProps = {
|
|
82
|
-
notFoundContent: /*#__PURE__*/_jsx(Empty, {
|
|
83
|
-
imageStyle: {
|
|
84
|
-
height: 60
|
|
85
|
-
}
|
|
86
|
-
}),
|
|
87
|
-
suffixIcon: node,
|
|
88
|
-
clearIcon: /*#__PURE__*/_jsx(Clear, {})
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
//@ts-ignore
|
|
92
|
-
TreeSelect.defaultProps = {
|
|
93
|
-
notFoundContent: /*#__PURE__*/_jsx(Empty, {
|
|
94
|
-
imageStyle: {
|
|
95
|
-
height: 60
|
|
96
|
-
}
|
|
97
|
-
}),
|
|
98
|
-
suffixIcon: node,
|
|
99
|
-
clearIcon: /*#__PURE__*/_jsx(Clear, {})
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
//@ts-ignore
|
|
103
|
-
Tree.defaultProps = {
|
|
104
|
-
switcherIcon: /*#__PURE__*/_jsx(Down, {
|
|
105
|
-
style: {
|
|
106
|
-
fontSize: 14,
|
|
107
|
-
color: 'rgba(51, 51, 51, 0.7)',
|
|
108
|
-
verticalAlign: '-0.125em'
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
//@ts-ignore
|
|
114
|
-
Cascader.defaultProps = {
|
|
115
|
-
suffixIcon: node,
|
|
116
|
-
clearIcon: /*#__PURE__*/_jsx(Clear, {})
|
|
117
|
-
};
|
|
118
|
-
DatePicker.RangePicker.defaultProps = _objectSpread(_objectSpread({}, DatePicker.RangePicker.defaultProps), {}, {
|
|
119
|
-
suffixIcon: /*#__PURE__*/_jsx(Icons.Calendar, {
|
|
120
|
-
style: {
|
|
121
|
-
pointerEvents: 'none'
|
|
122
|
-
}
|
|
123
|
-
}),
|
|
124
|
-
clearIcon: /*#__PURE__*/_jsx(Clear, {})
|
|
125
|
-
});
|
|
126
|
-
DatePicker.defaultProps = _objectSpread(_objectSpread({}, DatePicker.defaultProps), {}, {
|
|
127
|
-
suffixIcon: /*#__PURE__*/_jsx(Icons.Calendar, {
|
|
128
|
-
style: {
|
|
129
|
-
pointerEvents: 'none'
|
|
130
|
-
}
|
|
131
|
-
}),
|
|
132
|
-
clearIcon: /*#__PURE__*/_jsx(Clear, {})
|
|
133
|
-
});
|
|
134
|
-
TimePicker.defaultProps = _objectSpread(_objectSpread({}, TimePicker.defaultProps), {}, {
|
|
135
|
-
suffixIcon: /*#__PURE__*/_jsx(Icons.Clock, {
|
|
136
|
-
style: {
|
|
137
|
-
pointerEvents: 'none'
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
});
|
|
141
|
-
TimePicker.RangePicker.defaultProps = _objectSpread(_objectSpread({}, TimePicker.RangePicker.defaultProps), {}, {
|
|
142
|
-
suffixIcon: /*#__PURE__*/_jsx(Icons.Clock, {
|
|
143
|
-
style: {
|
|
144
|
-
pointerEvents: 'none'
|
|
145
|
-
}
|
|
146
|
-
}),
|
|
147
|
-
clearIcon: /*#__PURE__*/_jsx(Clear, {})
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
//@ts-ignore
|
|
151
|
-
Menu.defaultProps = {
|
|
152
|
-
expandIcon: /*#__PURE__*/_jsx(Down, {
|
|
153
|
-
style: {
|
|
154
|
-
transform: 'rotate(-90deg)',
|
|
155
|
-
top: 8,
|
|
156
|
-
color: '#666'
|
|
157
|
-
}
|
|
158
|
-
})
|
|
159
|
-
};
|
|
160
8
|
config({
|
|
161
9
|
showToast: function showToast() {
|
|
162
|
-
return message.loading(commonLocale.
|
|
10
|
+
return message.loading(commonLocale.waitingText, 0);
|
|
163
11
|
},
|
|
164
12
|
cancelToast: function cancelToast(hide) {
|
|
165
13
|
hide();
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { BasicLayoutLocale } from '../../../../locale/locale';
|
|
2
3
|
import type { MenuFavorites, MenuItem } from '../../typings';
|
|
3
4
|
interface Props {
|
|
4
5
|
data: MenuItem[];
|
|
5
6
|
favorites?: MenuFavorites;
|
|
6
7
|
onFavoritesChange?: (items: MenuFavorites) => void;
|
|
7
8
|
onClick?: (item: MenuItem) => void;
|
|
9
|
+
locale: BasicLayoutLocale['menu'];
|
|
8
10
|
}
|
|
9
11
|
export default function Menu(props: Props): JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -18,7 +18,6 @@ import { Divider } from 'antd';
|
|
|
18
18
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
19
19
|
import { createPortal } from 'react-dom';
|
|
20
20
|
import { PREFIX_CLS as prefixCls, Icons } from '@lemon-fe/components';
|
|
21
|
-
import { useLocaleReceiver } from '@lemon-fe/components/src';
|
|
22
21
|
import { useDebounce } from '@lemon-fe/hooks';
|
|
23
22
|
import classNames from 'classnames';
|
|
24
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -209,7 +208,8 @@ export default function Menu(props) {
|
|
|
209
208
|
onClick = props.onClick,
|
|
210
209
|
onFavoritesChange = props.onFavoritesChange,
|
|
211
210
|
_props$favorites = props.favorites,
|
|
212
|
-
favorites = _props$favorites === void 0 ? [] : _props$favorites
|
|
211
|
+
favorites = _props$favorites === void 0 ? [] : _props$favorites,
|
|
212
|
+
locale = props.locale;
|
|
213
213
|
var location = window.location;
|
|
214
214
|
var _useState = useState(null),
|
|
215
215
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -231,14 +231,6 @@ export default function Menu(props) {
|
|
|
231
231
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
232
232
|
top = _useState8[0],
|
|
233
233
|
setTop = _useState8[1];
|
|
234
|
-
var _useLocaleReceiver = useLocaleReceiver('BasicLayout'),
|
|
235
|
-
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
236
|
-
_useLocaleReceiver2$ = _useLocaleReceiver2[0].menu,
|
|
237
|
-
noFavoriteText = _useLocaleReceiver2$.noFavoriteText,
|
|
238
|
-
managementText = _useLocaleReceiver2$.managementText,
|
|
239
|
-
favotireText = _useLocaleReceiver2$.favotireText,
|
|
240
|
-
noWantMenuText = _useLocaleReceiver2$.noWantMenuText,
|
|
241
|
-
viewAllText = _useLocaleReceiver2$.viewAllText;
|
|
242
234
|
var activeMenu = useMemo(function () {
|
|
243
235
|
var check = function check(path) {
|
|
244
236
|
if (path) {
|
|
@@ -500,7 +492,7 @@ export default function Menu(props) {
|
|
|
500
492
|
}) : /*#__PURE__*/_jsxs("div", {
|
|
501
493
|
className: "".concat(prefixCls, "-menu-block-empty"),
|
|
502
494
|
children: [/*#__PURE__*/_jsx(FavoritesEmpty, {}), /*#__PURE__*/_jsx("span", {
|
|
503
|
-
children: noFavoriteText
|
|
495
|
+
children: locale.noFavoriteText
|
|
504
496
|
})]
|
|
505
497
|
})
|
|
506
498
|
}, "pop") : /*#__PURE__*/_jsx("div", {
|
|
@@ -593,7 +585,7 @@ export default function Menu(props) {
|
|
|
593
585
|
})
|
|
594
586
|
}), !collapsed ? /*#__PURE__*/_jsx("div", {
|
|
595
587
|
className: "".concat(prefixCls, "-menu-other-title"),
|
|
596
|
-
children: managementText
|
|
588
|
+
children: locale.managementText
|
|
597
589
|
}) : null, /*#__PURE__*/_jsx("div", {
|
|
598
590
|
className: classNames("".concat(prefixCls, "-menu-top-item"), _defineProperty({}, "".concat(prefixCls, "-menu-top-item-popover-active"), (popover === null || popover === void 0 ? void 0 : popover.name) === FAVORITES_POPOVER)),
|
|
599
591
|
onMouseEnter: function onMouseEnter(e) {
|
|
@@ -612,7 +604,7 @@ export default function Menu(props) {
|
|
|
612
604
|
children: favoriteIcon
|
|
613
605
|
}), /*#__PURE__*/_jsx("div", {
|
|
614
606
|
className: "".concat(prefixCls, "-menu-title"),
|
|
615
|
-
children: favotireText
|
|
607
|
+
children: locale.favotireText
|
|
616
608
|
})]
|
|
617
609
|
})
|
|
618
610
|
})]
|
|
@@ -626,12 +618,12 @@ export default function Menu(props) {
|
|
|
626
618
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
627
619
|
children: [/*#__PURE__*/_jsx("div", {
|
|
628
620
|
className: "".concat(prefixCls, "-menu-label"),
|
|
629
|
-
children: noWantMenuText
|
|
621
|
+
children: locale.noWantMenuText
|
|
630
622
|
}), /*#__PURE__*/_jsxs("div", {
|
|
631
623
|
className: "".concat(prefixCls, "-menu-more"),
|
|
632
624
|
onClick: openDrawer,
|
|
633
625
|
children: [drawerIcon, /*#__PURE__*/_jsx("span", {
|
|
634
|
-
children: viewAllText
|
|
626
|
+
children: locale.viewAllText
|
|
635
627
|
})]
|
|
636
628
|
})]
|
|
637
629
|
})]
|
|
@@ -641,7 +633,7 @@ export default function Menu(props) {
|
|
|
641
633
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
642
634
|
className: "".concat(prefixCls, "-menu-drawer-header"),
|
|
643
635
|
children: [/*#__PURE__*/_jsx("div", {
|
|
644
|
-
children: viewAllText
|
|
636
|
+
children: locale.viewAllText
|
|
645
637
|
}), /*#__PURE__*/_jsx("div", {
|
|
646
638
|
className: "".concat(prefixCls, "-menu-drawer-close"),
|
|
647
639
|
onClick: closeDrawer,
|
package/es/layouts/basic-layout/components/main-framework/components/refresh-button/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { BasicLayoutLocale } from '../../../../locale/locale';
|
|
2
3
|
export default function RefreshButton(props: {
|
|
3
4
|
onRefresh: () => void;
|
|
4
5
|
onCloseOther: () => void;
|
|
5
6
|
onCloseAll: () => void;
|
|
7
|
+
locale: BasicLayoutLocale['refreshButton'];
|
|
6
8
|
}): JSX.Element;
|
package/es/layouts/basic-layout/components/main-framework/components/refresh-button/index.js
CHANGED
|
@@ -11,24 +11,18 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { Popover } from 'antd';
|
|
12
12
|
import React, { useState } from 'react';
|
|
13
13
|
import { PREFIX_CLS as prefixCls } from '@lemon-fe/components';
|
|
14
|
-
import { useLocaleReceiver } from '@lemon-fe/components/src';
|
|
15
14
|
import classNames from 'classnames';
|
|
16
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
17
|
export default function RefreshButton(props) {
|
|
19
18
|
var onRefresh = props.onRefresh,
|
|
20
19
|
onCloseOther = props.onCloseOther,
|
|
21
|
-
onCloseAll = props.onCloseAll
|
|
20
|
+
onCloseAll = props.onCloseAll,
|
|
21
|
+
locale = props.locale;
|
|
22
22
|
var _useState = useState(false),
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
24
|
popVisible = _useState2[0],
|
|
25
25
|
setPopVisible = _useState2[1];
|
|
26
|
-
var _useLocaleReceiver = useLocaleReceiver('BasicLayout'),
|
|
27
|
-
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
28
|
-
_useLocaleReceiver2$ = _useLocaleReceiver2[0].refreshButton,
|
|
29
|
-
refreshCurrText = _useLocaleReceiver2$.refreshCurrText,
|
|
30
|
-
closeOthersText = _useLocaleReceiver2$.closeOthersText,
|
|
31
|
-
closeAllText = _useLocaleReceiver2$.closeAllText;
|
|
32
26
|
return /*#__PURE__*/_jsx(Popover, {
|
|
33
27
|
open: popVisible,
|
|
34
28
|
onOpenChange: setPopVisible,
|
|
@@ -43,21 +37,21 @@ export default function RefreshButton(props) {
|
|
|
43
37
|
onRefresh();
|
|
44
38
|
setPopVisible(false);
|
|
45
39
|
},
|
|
46
|
-
children: refreshCurrText
|
|
40
|
+
children: locale.refreshCurrText
|
|
47
41
|
}), /*#__PURE__*/_jsx("div", {
|
|
48
42
|
className: "".concat(prefixCls, "-refresh-down-tab"),
|
|
49
43
|
onClick: function onClick() {
|
|
50
44
|
onCloseOther();
|
|
51
45
|
setPopVisible(false);
|
|
52
46
|
},
|
|
53
|
-
children: closeOthersText
|
|
47
|
+
children: locale.closeOthersText
|
|
54
48
|
}), /*#__PURE__*/_jsx("div", {
|
|
55
49
|
className: "".concat(prefixCls, "-refresh-down-tab"),
|
|
56
50
|
onClick: function onClick() {
|
|
57
51
|
onCloseAll();
|
|
58
52
|
setPopVisible(false);
|
|
59
53
|
},
|
|
60
|
-
children: closeAllText
|
|
54
|
+
children: locale.closeAllText
|
|
61
55
|
})]
|
|
62
56
|
}),
|
|
63
57
|
children: /*#__PURE__*/_jsx("div", {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import type { BasicLayoutLocale } from '../../locale/locale';
|
|
2
3
|
import type { MenuFavorites, MenuItem } from './typings';
|
|
3
4
|
interface Props<T> {
|
|
4
5
|
title: string | ReactNode;
|
|
@@ -20,6 +21,7 @@ interface Props<T> {
|
|
|
20
21
|
className?: string;
|
|
21
22
|
style?: CSSProperties;
|
|
22
23
|
waterMark?: string;
|
|
24
|
+
locale: BasicLayoutLocale;
|
|
23
25
|
}
|
|
24
26
|
export default function MainFramework<TabType extends {
|
|
25
27
|
title: string;
|
|
@@ -27,7 +27,8 @@ export default function MainFramework(props) {
|
|
|
27
27
|
onFavoritesChange = props.onFavoritesChange,
|
|
28
28
|
renderMenu = props.renderMenu,
|
|
29
29
|
style = props.style,
|
|
30
|
-
waterMark = props.waterMark
|
|
30
|
+
waterMark = props.waterMark,
|
|
31
|
+
locale = props.locale;
|
|
31
32
|
return /*#__PURE__*/_jsxs("div", {
|
|
32
33
|
className: classNames("".concat(prefixCls, "-main"), className),
|
|
33
34
|
style: style,
|
|
@@ -65,6 +66,7 @@ export default function MainFramework(props) {
|
|
|
65
66
|
}), /*#__PURE__*/_jsxs("div", {
|
|
66
67
|
className: "".concat(prefixCls, "-nav-right"),
|
|
67
68
|
children: [/*#__PURE__*/_jsx(RefreshButton, {
|
|
69
|
+
locale: locale.refreshButton,
|
|
68
70
|
onRefresh: onRefresh,
|
|
69
71
|
onCloseAll: onCloseAll,
|
|
70
72
|
onCloseOther: onCloseOther
|
|
@@ -79,6 +81,7 @@ export default function MainFramework(props) {
|
|
|
79
81
|
children: renderMenu()
|
|
80
82
|
}) : /*#__PURE__*/_jsx(Menu, {
|
|
81
83
|
data: menus,
|
|
84
|
+
locale: locale.menu,
|
|
82
85
|
onClick: onMenuClick,
|
|
83
86
|
favorites: favorites,
|
|
84
87
|
onFavoritesChange: onFavoritesChange
|
|
@@ -14,11 +14,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
14
|
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; }
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
16
|
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); }
|
|
17
|
+
import { Modal } from 'antd';
|
|
17
18
|
import React, { useState, useMemo, useEffect, useRef } from 'react';
|
|
18
19
|
import { useHistory, useLocation, matchPath, useRouteMatch } from 'react-router';
|
|
19
20
|
import RouteTab from "../../components/route-tab";
|
|
21
|
+
import defaultLocale from "../locale/en_US";
|
|
20
22
|
import MainFramework from "./main-framework";
|
|
21
|
-
import {
|
|
23
|
+
import { useLocaleReceiver } from '@lemon-fe/components';
|
|
22
24
|
import moment from 'moment';
|
|
23
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
26
|
function mapTree(tree, childrenKey, mapper) {
|
|
@@ -96,6 +98,9 @@ export default function Main(props) {
|
|
|
96
98
|
_useState2 = _slicedToArray(_useState, 2),
|
|
97
99
|
favorites = _useState2[0],
|
|
98
100
|
setFavorites = _useState2[1];
|
|
101
|
+
var _useLocaleReceiver = useLocaleReceiver('BasicLayout', defaultLocale),
|
|
102
|
+
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
103
|
+
basicLocale = _useLocaleReceiver2[0];
|
|
99
104
|
useEffect(function () {
|
|
100
105
|
if (favorites !== defaultFavorites) {
|
|
101
106
|
window.localStorage.setItem('MENU_FAVORITES', JSON.stringify(favorites));
|
|
@@ -189,10 +194,10 @@ export default function Main(props) {
|
|
|
189
194
|
var today = moment().format('YYYY-MM-DD');
|
|
190
195
|
if (date === null || date !== today) {
|
|
191
196
|
Modal.confirm({
|
|
192
|
-
title:
|
|
193
|
-
content:
|
|
194
|
-
cancelText:
|
|
195
|
-
okText:
|
|
197
|
+
title: basicLocale.tabModal.infoText,
|
|
198
|
+
content: basicLocale.tabModal.contentText,
|
|
199
|
+
cancelText: basicLocale.tabModal.cancelText,
|
|
200
|
+
okText: basicLocale.tabModal.okText,
|
|
196
201
|
onCancel: function onCancel() {
|
|
197
202
|
localStorage.setItem(key, today);
|
|
198
203
|
}
|
|
@@ -332,6 +337,7 @@ export default function Main(props) {
|
|
|
332
337
|
favorites: favoritesProp || favorites,
|
|
333
338
|
onFavoritesChange: handleFavoritesChange,
|
|
334
339
|
waterMark: waterMark,
|
|
340
|
+
locale: basicLocale,
|
|
335
341
|
children: state.tabs.map(function (tab, index) {
|
|
336
342
|
var route = tab.route,
|
|
337
343
|
refreshCount = tab.refreshCount;
|
|
@@ -14,8 +14,7 @@ import { Breadcrumb } from 'antd';
|
|
|
14
14
|
import React, { useContext, useMemo } from 'react';
|
|
15
15
|
import { Link, matchPath, useRouteMatch } from 'react-router-dom';
|
|
16
16
|
import { RouteTabContext } from "../components/route-tab";
|
|
17
|
-
import { Icons, PREFIX_CLS } from '@lemon-fe/components';
|
|
18
|
-
import { useLocaleReceiver } from '@lemon-fe/components/src';
|
|
17
|
+
import { Icons, PREFIX_CLS, useLocaleReceiver } from '@lemon-fe/components';
|
|
19
18
|
import { uniqBy } from 'lodash';
|
|
20
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
package/es/locale/en_US.js
CHANGED
|
@@ -7,17 +7,16 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { default as UseBacthOperatorLocale } from "../hooks/use-batch-operator/locale/en_US";
|
|
8
8
|
import { default as BasicLayoutLocale } from "../layouts/basic-layout/locale/en_US";
|
|
9
9
|
import { default as MicroLayoutLocale } from "../layouts/micro-layout/locale/en_US";
|
|
10
|
-
import
|
|
10
|
+
import componentsEnUS from '@lemon-fe/components/es/locale/en_US';
|
|
11
11
|
var enUS = _objectSpread(_objectSpread({}, componentsEnUS), {}, {
|
|
12
12
|
UseBatchOperator: UseBacthOperatorLocale,
|
|
13
13
|
BasicLayout: BasicLayoutLocale,
|
|
14
14
|
MicroLayout: MicroLayoutLocale,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Common: _objectSpread(_objectSpread({}, componentsEnUS.Common), {}, {
|
|
15
|
+
Common: {
|
|
16
|
+
modalDefaultTitle: 'Tip',
|
|
17
|
+
backText: 'Back',
|
|
19
18
|
waitingText: 'Loading',
|
|
20
19
|
reloadPageText: 'Reload'
|
|
21
|
-
}
|
|
20
|
+
}
|
|
22
21
|
});
|
|
23
22
|
export default enUS;
|
package/es/locale/locale.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import type { UseBatchOperateLocale } from '../hooks/use-batch-operator/locale/l
|
|
|
2
2
|
import type { BasicLayoutLocale } from '../layouts/basic-layout/locale/locale';
|
|
3
3
|
import type { MicroLayoutLocale } from '../layouts/micro-layout/locale/locale';
|
|
4
4
|
import type { Locale as ComponentLocale } from '@lemon-fe/components';
|
|
5
|
-
|
|
6
|
-
interface ModalLocale extends Partial<AntModalLocale> {
|
|
7
|
-
defaultTitle: string;
|
|
8
|
-
}
|
|
9
|
-
export interface Locale extends Omit<ComponentLocale, 'Modal'> {
|
|
5
|
+
export interface Locale extends ComponentLocale {
|
|
10
6
|
UseBatchOperator: UseBatchOperateLocale;
|
|
11
|
-
BasicLayout
|
|
12
|
-
MicroLayout
|
|
13
|
-
|
|
7
|
+
BasicLayout?: BasicLayoutLocale;
|
|
8
|
+
MicroLayout?: MicroLayoutLocale;
|
|
9
|
+
Common: {
|
|
10
|
+
backText: string;
|
|
11
|
+
waitingText: string;
|
|
12
|
+
reloadPageText: string;
|
|
13
|
+
modalDefaultTitle: string;
|
|
14
|
+
};
|
|
14
15
|
}
|
|
15
|
-
export {};
|
package/es/locale/zh_CN.js
CHANGED
|
@@ -7,17 +7,16 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { default as UseBacthOperatorLocale } from "../hooks/use-batch-operator/locale/zh_CN";
|
|
8
8
|
import { default as BasicLayoutLocale } from "../layouts/basic-layout/locale/zh_CN";
|
|
9
9
|
import { default as MicroLayoutLocale } from "../layouts/micro-layout/locale/zh_CN";
|
|
10
|
-
import
|
|
10
|
+
import componentsZhCN from '@lemon-fe/components/es/locale/zh_CN';
|
|
11
11
|
var zhCN = _objectSpread(_objectSpread({}, componentsZhCN), {}, {
|
|
12
12
|
UseBatchOperator: UseBacthOperatorLocale,
|
|
13
13
|
BasicLayout: BasicLayoutLocale,
|
|
14
14
|
MicroLayout: MicroLayoutLocale,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
Common: _objectSpread(_objectSpread({}, componentsZhCN.Common), {}, {
|
|
15
|
+
Common: {
|
|
16
|
+
backText: '返回',
|
|
19
17
|
waitingText: '加载中',
|
|
20
|
-
reloadPageText: '重新加载'
|
|
21
|
-
|
|
18
|
+
reloadPageText: '重新加载',
|
|
19
|
+
modalDefaultTitle: '提示'
|
|
20
|
+
}
|
|
22
21
|
});
|
|
23
22
|
export default zhCN;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/kits",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ant-design/icons": "^4.7.0",
|
|
26
|
-
"@lemon-fe/components": "^1.2.0
|
|
27
|
-
"@lemon-fe/hooks": "^1.
|
|
26
|
+
"@lemon-fe/components": "^1.2.0",
|
|
27
|
+
"@lemon-fe/hooks": "^1.2.0",
|
|
28
28
|
"@lemon-fe/utils": "^1.1.0",
|
|
29
29
|
"antd": "4.24.8",
|
|
30
30
|
"classnames": "^2.2.6",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"registry": "https://registry.npmjs.org"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "bc6eefb9acd1c267e15c7cf8132b4d866d3eb9ca"
|
|
48
48
|
}
|