@nocobase/client 0.7.0-alpha.61 → 0.7.0-alpha.64
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/api-client/APIClient.js +1 -0
- package/es/block-provider/CalendarBlockProvider.js +5 -1
- package/es/document-title/index.d.ts +1 -0
- package/es/document-title/index.js +9 -0
- package/lib/api-client/APIClient.js +1 -0
- package/lib/block-provider/CalendarBlockProvider.js +5 -1
- package/lib/document-title/index.d.ts +1 -0
- package/lib/document-title/index.js +14 -1
- package/package.json +3 -3
- package/src/api-client/APIClient.ts +1 -0
- package/src/block-provider/CalendarBlockProvider.tsx +1 -1
- package/src/document-title/index.tsx +10 -0
|
@@ -59,6 +59,7 @@ export var APIClient = /*#__PURE__*/function () {
|
|
|
59
59
|
|
|
60
60
|
this.axios.interceptors.request.use(function (config) {
|
|
61
61
|
var token = localStorage.getItem(_this.tokenKey);
|
|
62
|
+
config.headers['X-Locale'] = localStorage.getItem('NOCOBASE_LANG');
|
|
62
63
|
config.headers['X-Hostname'] = window.location.hostname;
|
|
63
64
|
|
|
64
65
|
if (token) {
|
|
@@ -33,7 +33,11 @@ var InternalCalendarBlockProvider = function InternalCalendarBlockProvider(props
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export var CalendarBlockProvider = function CalendarBlockProvider(props) {
|
|
36
|
-
return /*#__PURE__*/React.createElement(BlockProvider, _objectSpread({}, props),
|
|
36
|
+
return /*#__PURE__*/React.createElement(BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
37
|
+
params: _objectSpread(_objectSpread({}, props.params), {}, {
|
|
38
|
+
paginate: false
|
|
39
|
+
})
|
|
40
|
+
}), /*#__PURE__*/React.createElement(InternalCalendarBlockProvider, _objectSpread({}, props)));
|
|
37
41
|
};
|
|
38
42
|
export var useCalendarBlockContext = function useCalendarBlockContext() {
|
|
39
43
|
return useContext(CalendarBlockContext);
|
|
@@ -8,6 +8,7 @@ export declare const DocumentTitleProvider: React.FC<{
|
|
|
8
8
|
addonBefore?: string;
|
|
9
9
|
addonAfter?: string;
|
|
10
10
|
}>;
|
|
11
|
+
export declare const RemoteDocumentTitleProvider: React.FC;
|
|
11
12
|
export declare const useDocumentTitle: () => DocumentTitleContextProps;
|
|
12
13
|
export declare const useCurrentDocumentTitle: (title: string) => void;
|
|
13
14
|
export {};
|
|
@@ -12,6 +12,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
|
|
13
13
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
14
14
|
import { Helmet } from 'react-helmet';
|
|
15
|
+
import { useSystemSettings } from '../system-settings';
|
|
15
16
|
export var DocumentTitleContext = /*#__PURE__*/createContext({
|
|
16
17
|
title: null,
|
|
17
18
|
setTitle: function setTitle() {}
|
|
@@ -33,6 +34,14 @@ export var DocumentTitleProvider = function DocumentTitleProvider(props) {
|
|
|
33
34
|
}
|
|
34
35
|
}, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("title", null, documentTitle)), props.children);
|
|
35
36
|
};
|
|
37
|
+
export var RemoteDocumentTitleProvider = function RemoteDocumentTitleProvider(props) {
|
|
38
|
+
var _ctx$data, _ctx$data$data;
|
|
39
|
+
|
|
40
|
+
var ctx = useSystemSettings();
|
|
41
|
+
return /*#__PURE__*/React.createElement(DocumentTitleProvider, {
|
|
42
|
+
addonAfter: ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : (_ctx$data$data = _ctx$data.data) === null || _ctx$data$data === void 0 ? void 0 : _ctx$data$data.title
|
|
43
|
+
}, props.children);
|
|
44
|
+
};
|
|
36
45
|
export var useDocumentTitle = function useDocumentTitle() {
|
|
37
46
|
return useContext(DocumentTitleContext);
|
|
38
47
|
};
|
|
@@ -72,6 +72,7 @@ var APIClient = /*#__PURE__*/function () {
|
|
|
72
72
|
|
|
73
73
|
this.axios.interceptors.request.use(function (config) {
|
|
74
74
|
var token = localStorage.getItem(_this.tokenKey);
|
|
75
|
+
config.headers['X-Locale'] = localStorage.getItem('NOCOBASE_LANG');
|
|
75
76
|
config.headers['X-Hostname'] = window.location.hostname;
|
|
76
77
|
|
|
77
78
|
if (token) {
|
|
@@ -51,7 +51,11 @@ var InternalCalendarBlockProvider = function InternalCalendarBlockProvider(props
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
var CalendarBlockProvider = function CalendarBlockProvider(props) {
|
|
54
|
-
return /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread({}, props),
|
|
54
|
+
return /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
55
|
+
params: _objectSpread(_objectSpread({}, props.params), {}, {
|
|
56
|
+
paginate: false
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/_react2.default.createElement(InternalCalendarBlockProvider, _objectSpread({}, props)));
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
exports.CalendarBlockProvider = CalendarBlockProvider;
|
|
@@ -8,6 +8,7 @@ export declare const DocumentTitleProvider: React.FC<{
|
|
|
8
8
|
addonBefore?: string;
|
|
9
9
|
addonAfter?: string;
|
|
10
10
|
}>;
|
|
11
|
+
export declare const RemoteDocumentTitleProvider: React.FC;
|
|
11
12
|
export declare const useDocumentTitle: () => DocumentTitleContextProps;
|
|
12
13
|
export declare const useCurrentDocumentTitle: (title: string) => void;
|
|
13
14
|
export {};
|
|
@@ -5,12 +5,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useDocumentTitle = exports.useCurrentDocumentTitle = exports.DocumentTitleProvider = exports.DocumentTitleContext = void 0;
|
|
8
|
+
exports.useDocumentTitle = exports.useCurrentDocumentTitle = exports.RemoteDocumentTitleProvider = exports.DocumentTitleProvider = exports.DocumentTitleContext = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
12
|
var _reactHelmet = require("react-helmet");
|
|
13
13
|
|
|
14
|
+
var _systemSettings = require("../system-settings");
|
|
15
|
+
|
|
14
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
17
|
|
|
16
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -53,6 +55,17 @@ var DocumentTitleProvider = function DocumentTitleProvider(props) {
|
|
|
53
55
|
|
|
54
56
|
exports.DocumentTitleProvider = DocumentTitleProvider;
|
|
55
57
|
|
|
58
|
+
var RemoteDocumentTitleProvider = function RemoteDocumentTitleProvider(props) {
|
|
59
|
+
var _ctx$data, _ctx$data$data;
|
|
60
|
+
|
|
61
|
+
var ctx = (0, _systemSettings.useSystemSettings)();
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(DocumentTitleProvider, {
|
|
63
|
+
addonAfter: ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : (_ctx$data$data = _ctx$data.data) === null || _ctx$data$data === void 0 ? void 0 : _ctx$data$data.title
|
|
64
|
+
}, props.children);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
exports.RemoteDocumentTitleProvider = RemoteDocumentTitleProvider;
|
|
68
|
+
|
|
56
69
|
var useDocumentTitle = function useDocumentTitle() {
|
|
57
70
|
return (0, _react.useContext)(DocumentTitleContext);
|
|
58
71
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.64",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"licenses": [
|
|
6
6
|
{
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@formily/antd": "2.0.20",
|
|
19
19
|
"@formily/core": "2.0.20",
|
|
20
20
|
"@formily/react": "2.0.20",
|
|
21
|
-
"@nocobase/utils": "0.7.0-alpha.
|
|
21
|
+
"@nocobase/utils": "0.7.0-alpha.64",
|
|
22
22
|
"ahooks": "^3.0.5",
|
|
23
23
|
"antd": "~4.19.5",
|
|
24
24
|
"axios": "^0.26.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"@types/marked": "^4.0.1",
|
|
52
52
|
"axios-mock-adapter": "^1.20.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "35d01a5fb0f0522e263c7fc37bc8384f99424240"
|
|
55
55
|
}
|
|
@@ -59,6 +59,7 @@ export class APIClient {
|
|
|
59
59
|
authMiddleware() {
|
|
60
60
|
this.axios.interceptors.request.use((config) => {
|
|
61
61
|
const token = localStorage.getItem(this.tokenKey);
|
|
62
|
+
config.headers['X-Locale'] = localStorage.getItem('NOCOBASE_LANG');
|
|
62
63
|
config.headers['X-Hostname'] = window.location.hostname;
|
|
63
64
|
if (token) {
|
|
64
65
|
config.headers['Authorization'] = `Bearer ${token}`;
|
|
@@ -29,7 +29,7 @@ const InternalCalendarBlockProvider = (props) => {
|
|
|
29
29
|
|
|
30
30
|
export const CalendarBlockProvider = (props) => {
|
|
31
31
|
return (
|
|
32
|
-
<BlockProvider {...props}>
|
|
32
|
+
<BlockProvider {...props} params={{ ...props.params, paginate: false }}>
|
|
33
33
|
<InternalCalendarBlockProvider {...props} />
|
|
34
34
|
</BlockProvider>
|
|
35
35
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
2
|
import { Helmet } from 'react-helmet';
|
|
3
|
+
import { useSystemSettings } from '../system-settings';
|
|
3
4
|
|
|
4
5
|
interface DocumentTitleContextProps {
|
|
5
6
|
title?: any;
|
|
@@ -32,6 +33,15 @@ export const DocumentTitleProvider: React.FC<{ addonBefore?: string; addonAfter?
|
|
|
32
33
|
);
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
export const RemoteDocumentTitleProvider: React.FC = (props) => {
|
|
37
|
+
const ctx = useSystemSettings();
|
|
38
|
+
return (
|
|
39
|
+
<DocumentTitleProvider addonAfter={ctx?.data?.data?.title}>
|
|
40
|
+
{props.children}
|
|
41
|
+
</DocumentTitleProvider>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
35
45
|
export const useDocumentTitle = () => {
|
|
36
46
|
return useContext(DocumentTitleContext);
|
|
37
47
|
};
|