@tachybase/client 1.6.22 → 1.6.23
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/application/utils/globalDeps.mjs +1 -1
- package/es/built-in/locale/LocalePlugin.d.ts +2 -0
- package/es/built-in/locale/LocalePlugin.mjs +13 -4
- package/es/schema-component/antd/grid/Grid.mjs +2 -1
- package/lib/built-in/locale/LocalePlugin.js +17 -5
- package/lib/schema-component/antd/grid/Grid.js +2 -1
- package/package.json +4 -4
|
@@ -11,9 +11,9 @@ import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
|
11
11
|
import * as __WEBPACK_EXTERNAL_MODULE_ahooks__ from "ahooks";
|
|
12
12
|
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema_532e17e1__ from "@tachybase/schema";
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__ from "react-router-dom";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd_style_1dcbd21e__ from "antd-style";
|
|
14
15
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons_a8184985__ from "@ant-design/icons";
|
|
15
16
|
import * as __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__ from "@emotion/css";
|
|
16
|
-
import * as __WEBPACK_EXTERNAL_MODULE_antd_style_1dcbd21e__ from "antd-style";
|
|
17
17
|
import * as __WEBPACK_EXTERNAL_MODULE_i18next__ from "i18next";
|
|
18
18
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_cssinjs_c619260f__ from "@ant-design/cssinjs";
|
|
19
19
|
import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_accessibility_682092eb__ from "@dnd-kit/accessibility";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Application } from '../../application/Application';
|
|
1
2
|
import { Plugin } from '../../application/Plugin';
|
|
3
|
+
export declare function handleUnauthorizedLocaleLoad(app: Application): string;
|
|
2
4
|
export declare class LocalePlugin extends Plugin {
|
|
3
5
|
locales: any;
|
|
4
6
|
afterAdd(): Promise<void>;
|
|
@@ -14,6 +14,16 @@ function _define_property(obj, key, value) {
|
|
|
14
14
|
else obj[key] = value;
|
|
15
15
|
return obj;
|
|
16
16
|
}
|
|
17
|
+
function handleUnauthorizedLocaleLoad(app) {
|
|
18
|
+
var _auth_setRole, _auth_setAuthenticator;
|
|
19
|
+
const auth = app.apiClient.auth;
|
|
20
|
+
auth.setToken(null);
|
|
21
|
+
null == (_auth_setRole = auth.setRole) || _auth_setRole.call(auth, null);
|
|
22
|
+
null == (_auth_setAuthenticator = auth.setAuthenticator) || _auth_setAuthenticator.call(auth, null);
|
|
23
|
+
const signInPath = app.getHref('signin');
|
|
24
|
+
if (window.location.pathname.toLowerCase() === signInPath.toLowerCase()) return signInPath;
|
|
25
|
+
return "".concat(signInPath, "?redirect=").concat(window.location.pathname).concat(window.location.search);
|
|
26
|
+
}
|
|
17
27
|
class LocalePlugin extends Plugin {
|
|
18
28
|
async afterAdd() {
|
|
19
29
|
const api = this.app.apiClient;
|
|
@@ -25,6 +35,7 @@ class LocalePlugin extends Plugin {
|
|
|
25
35
|
params: {
|
|
26
36
|
locale
|
|
27
37
|
},
|
|
38
|
+
skipNotify: true,
|
|
28
39
|
headers: {
|
|
29
40
|
'X-Role': 'anonymous'
|
|
30
41
|
}
|
|
@@ -59,9 +70,7 @@ class LocalePlugin extends Plugin {
|
|
|
59
70
|
window['cronLocale'] = null == data ? void 0 : null == (_data_data4 = data.data) ? void 0 : _data_data4.cron;
|
|
60
71
|
} catch (error) {
|
|
61
72
|
var _error_response;
|
|
62
|
-
if ((null == error ? void 0 : null == (_error_response = error.response) ? void 0 : _error_response.status) === 401)
|
|
63
|
-
window.location.href = '/signIn';
|
|
64
|
-
}, 1000);
|
|
73
|
+
if ((null == error ? void 0 : null == (_error_response = error.response) ? void 0 : _error_response.status) === 401) window.location.href = handleUnauthorizedLocaleLoad(this.app);
|
|
65
74
|
throw error;
|
|
66
75
|
}
|
|
67
76
|
}
|
|
@@ -69,4 +78,4 @@ class LocalePlugin extends Plugin {
|
|
|
69
78
|
super(...args), _define_property(this, "locales", {});
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
|
-
export { LocalePlugin };
|
|
81
|
+
export { LocalePlugin, handleUnauthorizedLocaleLoad };
|
|
@@ -2,13 +2,14 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import react, { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { RecursionField, Schema, observer, uid, useField, useFieldSchema } from "@tachybase/schema";
|
|
4
4
|
import { TinyColor } from "@ctrl/tinycolor";
|
|
5
|
-
import {
|
|
5
|
+
import { useDndContext, useDndMonitor, useDraggable, useDroppable } from "@dnd-kit/core";
|
|
6
6
|
import classnames from "classnames";
|
|
7
7
|
import lodash from "lodash";
|
|
8
8
|
import { useToken } from "../__builtins__/index.mjs";
|
|
9
9
|
import { useSchemaInitializerRender } from "../../../application/schema-initializer/hooks/index.mjs";
|
|
10
10
|
import { useFormBlockContext } from "../../../block-provider/FormBlockContext.mjs";
|
|
11
11
|
import { useFormBlockType } from "../../../block-provider/FormBlockProvider.mjs";
|
|
12
|
+
import { DndContext } from "../../common/dnd-context/index.mjs";
|
|
12
13
|
import { SchemaComponent } from "../../core/SchemaComponent.mjs";
|
|
13
14
|
import { useDesignable } from "../../hooks/useDesignable.mjs";
|
|
14
15
|
import Grid_style from "./Grid.style.mjs";
|
|
@@ -33,7 +33,8 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
LocalePlugin: ()=>LocalePlugin
|
|
36
|
+
LocalePlugin: ()=>LocalePlugin,
|
|
37
|
+
handleUnauthorizedLocaleLoad: ()=>handleUnauthorizedLocaleLoad
|
|
37
38
|
});
|
|
38
39
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
39
40
|
const external_antd_namespaceObject = require("antd");
|
|
@@ -52,6 +53,16 @@ function _define_property(obj, key, value) {
|
|
|
52
53
|
else obj[key] = value;
|
|
53
54
|
return obj;
|
|
54
55
|
}
|
|
56
|
+
function handleUnauthorizedLocaleLoad(app) {
|
|
57
|
+
var _auth_setRole, _auth_setAuthenticator;
|
|
58
|
+
const auth = app.apiClient.auth;
|
|
59
|
+
auth.setToken(null);
|
|
60
|
+
null == (_auth_setRole = auth.setRole) || _auth_setRole.call(auth, null);
|
|
61
|
+
null == (_auth_setAuthenticator = auth.setAuthenticator) || _auth_setAuthenticator.call(auth, null);
|
|
62
|
+
const signInPath = app.getHref('signin');
|
|
63
|
+
if (window.location.pathname.toLowerCase() === signInPath.toLowerCase()) return signInPath;
|
|
64
|
+
return "".concat(signInPath, "?redirect=").concat(window.location.pathname).concat(window.location.search);
|
|
65
|
+
}
|
|
55
66
|
class LocalePlugin extends Plugin_js_namespaceObject.Plugin {
|
|
56
67
|
async afterAdd() {
|
|
57
68
|
const api = this.app.apiClient;
|
|
@@ -63,6 +74,7 @@ class LocalePlugin extends Plugin_js_namespaceObject.Plugin {
|
|
|
63
74
|
params: {
|
|
64
75
|
locale
|
|
65
76
|
},
|
|
77
|
+
skipNotify: true,
|
|
66
78
|
headers: {
|
|
67
79
|
'X-Role': 'anonymous'
|
|
68
80
|
}
|
|
@@ -97,9 +109,7 @@ class LocalePlugin extends Plugin_js_namespaceObject.Plugin {
|
|
|
97
109
|
window['cronLocale'] = null == data ? void 0 : null == (_data_data4 = data.data) ? void 0 : _data_data4.cron;
|
|
98
110
|
} catch (error) {
|
|
99
111
|
var _error_response;
|
|
100
|
-
if ((null == error ? void 0 : null == (_error_response = error.response) ? void 0 : _error_response.status) === 401)
|
|
101
|
-
window.location.href = '/signIn';
|
|
102
|
-
}, 1000);
|
|
112
|
+
if ((null == error ? void 0 : null == (_error_response = error.response) ? void 0 : _error_response.status) === 401) window.location.href = handleUnauthorizedLocaleLoad(this.app);
|
|
103
113
|
throw error;
|
|
104
114
|
}
|
|
105
115
|
}
|
|
@@ -108,8 +118,10 @@ class LocalePlugin extends Plugin_js_namespaceObject.Plugin {
|
|
|
108
118
|
}
|
|
109
119
|
}
|
|
110
120
|
exports.LocalePlugin = __webpack_exports__.LocalePlugin;
|
|
121
|
+
exports.handleUnauthorizedLocaleLoad = __webpack_exports__.handleUnauthorizedLocaleLoad;
|
|
111
122
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
112
|
-
"LocalePlugin"
|
|
123
|
+
"LocalePlugin",
|
|
124
|
+
"handleUnauthorizedLocaleLoad"
|
|
113
125
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
114
126
|
Object.defineProperty(exports, '__esModule', {
|
|
115
127
|
value: true
|
|
@@ -52,6 +52,7 @@ const index_js_namespaceObject = require("../__builtins__/index.js");
|
|
|
52
52
|
const hooks_index_js_namespaceObject = require("../../../application/schema-initializer/hooks/index.js");
|
|
53
53
|
const FormBlockContext_js_namespaceObject = require("../../../block-provider/FormBlockContext.js");
|
|
54
54
|
const FormBlockProvider_js_namespaceObject = require("../../../block-provider/FormBlockProvider.js");
|
|
55
|
+
const dnd_context_index_js_namespaceObject = require("../../common/dnd-context/index.js");
|
|
55
56
|
const SchemaComponent_js_namespaceObject = require("../../core/SchemaComponent.js");
|
|
56
57
|
const useDesignable_js_namespaceObject = require("../../hooks/useDesignable.js");
|
|
57
58
|
const external_Grid_style_js_namespaceObject = require("./Grid.style.js");
|
|
@@ -287,7 +288,7 @@ const DndWrapper = (props)=>{
|
|
|
287
288
|
if (false === props.dndContext) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
288
289
|
children: props.children
|
|
289
290
|
});
|
|
290
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
291
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(dnd_context_index_js_namespaceObject.DndContext, {
|
|
291
292
|
...props.dndContext,
|
|
292
293
|
children: props.children
|
|
293
294
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/client",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.23",
|
|
4
4
|
"homepage": "https://github.com/tegojs/tego-standard#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/tegojs/tego-standard/issues"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@floating-ui/react": "0.26.28",
|
|
31
31
|
"@js-preview/excel": "^1.7.14",
|
|
32
32
|
"@lottiefiles/dotlottie-react": "^0.9.3",
|
|
33
|
-
"@tachybase/schema": "1.6.
|
|
34
|
-
"@tachybase/utils": "1.6.
|
|
35
|
-
"@tego/client": "1.6.
|
|
33
|
+
"@tachybase/schema": "1.6.16",
|
|
34
|
+
"@tachybase/utils": "1.6.16",
|
|
35
|
+
"@tego/client": "1.6.16",
|
|
36
36
|
"ahooks": "^3.9.0",
|
|
37
37
|
"antd": "5.22.5",
|
|
38
38
|
"antd-style": "3.7.1",
|