@lemon-fe/kits 1.4.14-alpha.1 → 1.4.14-alpha.2
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 +4 -4
- package/es/app-provider/index.js +37 -9
- package/es/locale/en_US.js +2 -1
- package/es/locale/locale.d.ts +1 -0
- package/es/locale/vi.d.ts +2 -2
- package/es/locale/vi.js +4 -3
- package/es/locale/zh_CN.js +2 -1
- package/es/locale/zh_Hant_HK.js +2 -1
- package/package.json +4 -4
|
@@ -6,14 +6,14 @@ declare type AppConfigProps = {
|
|
|
6
6
|
children?: ReactNode | null;
|
|
7
7
|
locale?: Locale;
|
|
8
8
|
hooksConfig?: Partial<HooksOpts>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
};
|
|
10
|
+
declare type BatchOperatorConfig = {
|
|
11
|
+
openError?: (err: Error) => void;
|
|
12
12
|
};
|
|
13
13
|
export declare const AppContext: React.Context<{
|
|
14
14
|
message: ReturnType<typeof message.useMessage>[0];
|
|
15
15
|
modal: ReturnType<typeof Modal.useModal>[0];
|
|
16
|
-
batchOperatorConfig?:
|
|
16
|
+
batchOperatorConfig?: BatchOperatorConfig | undefined;
|
|
17
17
|
}>;
|
|
18
18
|
declare function AppProvider(props: AppConfigProps): JSX.Element;
|
|
19
19
|
declare namespace AppProvider {
|
package/es/app-provider/index.js
CHANGED
|
@@ -10,9 +10,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
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; }
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { createContext, useMemo, useContext } from 'react';
|
|
14
|
-
import { PageLoading, message, Modal, ConfigProvider, Result, Button } from '@lemon-fe/components';
|
|
13
|
+
import React, { createContext, useMemo, useContext, useCallback } from 'react';
|
|
14
|
+
import { PageLoading, message, Modal, ConfigProvider, Result, Button, RequestErrorMessage } from '@lemon-fe/components';
|
|
15
15
|
import { HooksConfigProvider } from '@lemon-fe/hooks';
|
|
16
|
+
import { isRequestError } from '@lemon-fe/utils';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export var AppContext = /*#__PURE__*/createContext({
|
|
@@ -33,13 +34,40 @@ export default function AppProvider(props) {
|
|
|
33
34
|
modalContextHolder = _Modal$useModal2[1];
|
|
34
35
|
var localeCtx = useContext(ConfigProvider.ConfigContext).locale;
|
|
35
36
|
var locale = props.locale || localeCtx;
|
|
37
|
+
var _showError = useCallback(function (err) {
|
|
38
|
+
if (isRequestError(err)) {
|
|
39
|
+
if (err.message.length > 30) {
|
|
40
|
+
modalApi.error({
|
|
41
|
+
title: locale === null || locale === void 0 ? void 0 : locale.Common.requestErrorTitle,
|
|
42
|
+
width: 420,
|
|
43
|
+
content: /*#__PURE__*/_jsx(RequestErrorMessage, {
|
|
44
|
+
error: err
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
messageApi.error( /*#__PURE__*/_jsx(RequestErrorMessage, {
|
|
49
|
+
error: err
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
messageApi.warning( /*#__PURE__*/_jsx(RequestErrorMessage, {
|
|
54
|
+
error: err
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
}, []);
|
|
58
|
+
var batchOperatorConfig = useMemo(function () {
|
|
59
|
+
var result = {
|
|
60
|
+
openError: _showError
|
|
61
|
+
};
|
|
62
|
+
return result;
|
|
63
|
+
}, []);
|
|
36
64
|
var appContext = useMemo(function () {
|
|
37
65
|
return {
|
|
38
66
|
message: messageApi,
|
|
39
67
|
modal: modalApi,
|
|
40
|
-
batchOperatorConfig:
|
|
68
|
+
batchOperatorConfig: batchOperatorConfig
|
|
41
69
|
};
|
|
42
|
-
}, [
|
|
70
|
+
}, [batchOperatorConfig, messageApi, modalApi]);
|
|
43
71
|
var hooksConfig = useMemo(function () {
|
|
44
72
|
var result = _objectSpread({
|
|
45
73
|
showToast: function showToast() {
|
|
@@ -54,9 +82,7 @@ export default function AppProvider(props) {
|
|
|
54
82
|
},
|
|
55
83
|
showError: function showError(err) {
|
|
56
84
|
console.error(err);
|
|
57
|
-
|
|
58
|
-
messageApi.error(err.message);
|
|
59
|
-
}
|
|
85
|
+
_showError(err);
|
|
60
86
|
},
|
|
61
87
|
setPrimaryColor: function setPrimaryColor(color) {
|
|
62
88
|
ConfigProvider.config({
|
|
@@ -70,7 +96,9 @@ export default function AppProvider(props) {
|
|
|
70
96
|
return /*#__PURE__*/_jsx(Result, {
|
|
71
97
|
status: "500",
|
|
72
98
|
title: "500",
|
|
73
|
-
subTitle:
|
|
99
|
+
subTitle: /*#__PURE__*/_jsx(RequestErrorMessage, {
|
|
100
|
+
error: err
|
|
101
|
+
}),
|
|
74
102
|
extra: /*#__PURE__*/_jsx(Button, {
|
|
75
103
|
type: "primary",
|
|
76
104
|
onClick: refresh,
|
|
@@ -80,7 +108,7 @@ export default function AppProvider(props) {
|
|
|
80
108
|
}
|
|
81
109
|
}, props.hooksConfig);
|
|
82
110
|
return result;
|
|
83
|
-
}, [props.hooksConfig, messageApi, locale]);
|
|
111
|
+
}, [props.hooksConfig, messageApi, locale, _showError]);
|
|
84
112
|
return /*#__PURE__*/_jsxs(AppContext.Provider, {
|
|
85
113
|
value: appContext,
|
|
86
114
|
children: [messageContextHolder, modalContextHolder, /*#__PURE__*/_jsx(HooksConfigProvider, {
|
package/es/locale/en_US.js
CHANGED
|
@@ -16,7 +16,8 @@ var enUS = _objectSpread(_objectSpread({}, componentsEnUS), {}, {
|
|
|
16
16
|
modalDefaultTitle: 'Tip',
|
|
17
17
|
backText: 'Back',
|
|
18
18
|
waitingText: 'Loading',
|
|
19
|
-
reloadPageText: 'Reload'
|
|
19
|
+
reloadPageText: 'Reload',
|
|
20
|
+
requestErrorTitle: 'Request Error'
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
export default enUS;
|
package/es/locale/locale.d.ts
CHANGED
package/es/locale/vi.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Locale } from './locale';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const vi: Locale;
|
|
3
|
+
export default vi;
|
package/es/locale/vi.js
CHANGED
|
@@ -8,7 +8,7 @@ import { default as UseBacthOperatorLocale } from "../hooks/use-batch-operator/l
|
|
|
8
8
|
import { default as BasicLayoutLocale } from "../layouts/basic-layout/locale/vi";
|
|
9
9
|
import { default as MicroLayoutLocale } from "../layouts/micro-layout/locale/vi";
|
|
10
10
|
import componentsVi from '@lemon-fe/components/es/locale/vi';
|
|
11
|
-
var
|
|
11
|
+
var vi = _objectSpread(_objectSpread({}, componentsVi), {}, {
|
|
12
12
|
UseBatchOperator: UseBacthOperatorLocale,
|
|
13
13
|
BasicLayout: BasicLayoutLocale,
|
|
14
14
|
MicroLayout: MicroLayoutLocale,
|
|
@@ -16,7 +16,8 @@ var enUS = _objectSpread(_objectSpread({}, componentsVi), {}, {
|
|
|
16
16
|
backText: 'Quay lại',
|
|
17
17
|
waitingText: 'Đang tải',
|
|
18
18
|
reloadPageText: 'Tải lại trang',
|
|
19
|
-
modalDefaultTitle: 'Thông báo'
|
|
19
|
+
modalDefaultTitle: 'Thông báo',
|
|
20
|
+
requestErrorTitle: 'Lỗi Yêu Cầu'
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
|
-
export default
|
|
23
|
+
export default vi;
|
package/es/locale/zh_CN.js
CHANGED
package/es/locale/zh_Hant_HK.js
CHANGED
|
@@ -16,7 +16,8 @@ var enUS = _objectSpread(_objectSpread({}, componentsZhHantHk), {}, {
|
|
|
16
16
|
backText: '返回',
|
|
17
17
|
waitingText: '加載中',
|
|
18
18
|
reloadPageText: '重新加載',
|
|
19
|
-
modalDefaultTitle: '提示'
|
|
19
|
+
modalDefaultTitle: '提示',
|
|
20
|
+
requestErrorTitle: '請求錯誤'
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
export default enUS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/kits",
|
|
3
|
-
"version": "1.4.14-alpha.
|
|
3
|
+
"version": "1.4.14-alpha.2",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@ant-design/icons": "^4.7.0",
|
|
27
|
-
"@lemon-fe/components": "^1.4.14-alpha.
|
|
27
|
+
"@lemon-fe/components": "^1.4.14-alpha.2",
|
|
28
28
|
"@lemon-fe/hooks": "^1.4.14-alpha.1",
|
|
29
|
-
"@lemon-fe/utils": "^1.
|
|
29
|
+
"@lemon-fe/utils": "^1.4.14-alpha.2",
|
|
30
30
|
"ag-grid-community": "29.2.0",
|
|
31
31
|
"antd": "4.24.8",
|
|
32
32
|
"classnames": "^2.2.6",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"registry": "https://registry.npmjs.org"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a28302dbd6045eceae1f473b0d09583b7d737303"
|
|
50
50
|
}
|