@tachybase/client 1.6.25 → 1.6.27
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.d.ts +3 -0
- package/es/api-client/APIClient.mjs +11 -2
- package/es/api-client/constants.d.ts +1 -0
- package/es/api-client/constants.mjs +2 -0
- package/es/api-client/index.d.ts +1 -0
- package/es/api-client/index.mjs +1 -0
- package/es/built-in/acl/Configuration/ConfigureCenter.d.ts +6 -0
- package/es/built-in/acl/Configuration/ConfigureCenter.mjs +4 -22
- package/es/built-in/acl/acl-snippet.d.ts +18 -0
- package/es/built-in/acl/acl-snippet.mjs +40 -0
- package/es/built-in/acl/index.d.ts +1 -0
- package/es/built-in/acl/index.mjs +1 -0
- package/es/built-in/admin-layout/CurrentNavigationMenuProvider.d.ts +19 -0
- package/es/built-in/admin-layout/CurrentNavigationMenuProvider.mjs +58 -0
- package/es/built-in/admin-layout/InternalAdminLayout.d.ts +3 -0
- package/es/built-in/admin-layout/InternalAdminLayout.mjs +20 -2
- package/es/built-in/admin-layout/index.d.ts +1 -0
- package/es/built-in/admin-layout/index.mjs +1 -0
- package/es/built-in/admin-layout/style.d.ts +1 -0
- package/es/built-in/admin-layout/style.mjs +22 -10
- package/es/built-in/index.d.ts +7 -1
- package/es/built-in/index.mjs +4 -2
- package/es/built-in/setting-layout/SettingsCenterDropdown.d.ts +3 -0
- package/es/built-in/setting-layout/SettingsCenterDropdown.mjs +7 -6
- package/es/collection-manager/Configuration/components/index.d.ts +24 -0
- package/es/collection-manager/templates/sql.d.ts +13 -0
- package/es/collection-manager/templates/view.d.ts +12 -0
- package/lib/api-client/APIClient.js +11 -2
- package/lib/api-client/constants.js +36 -0
- package/lib/api-client/index.js +12 -3
- package/lib/block-provider/hooks/index.js +2 -2
- package/lib/built-in/acl/Configuration/ConfigureCenter.js +4 -22
- package/lib/built-in/acl/acl-snippet.js +83 -0
- package/lib/built-in/acl/index.js +15 -6
- package/lib/built-in/admin-layout/CurrentNavigationMenuProvider.js +95 -0
- package/lib/built-in/admin-layout/InternalAdminLayout.js +28 -0
- package/lib/built-in/admin-layout/index.js +24 -15
- package/lib/built-in/admin-layout/style.js +22 -10
- package/lib/built-in/index.js +56 -41
- package/lib/built-in/setting-layout/SettingsCenterDropdown.js +7 -6
- package/lib/locale/en_US.js +9 -0
- package/lib/locale/es_ES.js +9 -0
- package/lib/locale/fr_FR.js +9 -0
- package/lib/locale/ja_JP.js +9 -0
- package/lib/locale/ko_KR.js +9 -0
- package/lib/locale/pt_BR.js +9 -0
- package/lib/locale/ru_RU.js +9 -0
- package/lib/locale/tr_TR.js +9 -0
- package/lib/locale/uk_UA.js +9 -0
- package/lib/locale/zh-CN.js +9 -0
- package/lib/locale/zh-TW.js +9 -0
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { APIClient as APIClientSDK } from '@tego/client';
|
|
2
2
|
import { Result } from 'ahooks/es/useRequest/src/types';
|
|
3
3
|
import type { Application } from '../application';
|
|
4
|
+
/**
|
|
5
|
+
* Renders or configures the apiclient client entry point.
|
|
6
|
+
*/
|
|
4
7
|
export declare class APIClient extends APIClientSDK {
|
|
5
8
|
services: Record<string, Result<any, any>>;
|
|
6
9
|
silence: boolean;
|
|
@@ -2,6 +2,7 @@ import react from "react";
|
|
|
2
2
|
import { APIClient } from "@tego/client";
|
|
3
3
|
import { notification as external_antd_notification } from "antd";
|
|
4
4
|
import { i18n } from "../i18n/index.mjs";
|
|
5
|
+
import { CURRENT_TENANT_ID_STORAGE_KEY } from "./constants.mjs";
|
|
5
6
|
function _define_property(obj, key, value) {
|
|
6
7
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
7
8
|
value: value,
|
|
@@ -78,10 +79,12 @@ class APIClient_APIClient extends APIClient {
|
|
|
78
79
|
return api;
|
|
79
80
|
}
|
|
80
81
|
getHeaders() {
|
|
81
|
-
var _this_app, _window_location, _window;
|
|
82
|
+
var _this_app, _this_storage_getItem, _this_storage, _window_location, _window;
|
|
82
83
|
const headers = super.getHeaders();
|
|
83
84
|
const appName = null == (_this_app = this.app) ? void 0 : _this_app.getName();
|
|
85
|
+
const currentTenantId = null == (_this_storage = this.storage) ? void 0 : null == (_this_storage_getItem = _this_storage.getItem) ? void 0 : _this_storage_getItem.call(_this_storage, CURRENT_TENANT_ID_STORAGE_KEY);
|
|
84
86
|
if (appName) headers['X-App'] = appName;
|
|
87
|
+
if (currentTenantId) headers['X-Tenant-Id'] = currentTenantId;
|
|
85
88
|
headers['X-Timezone'] = getCurrentTimezone();
|
|
86
89
|
headers['X-Hostname'] = null == (_window = window) ? void 0 : null == (_window_location = _window.location) ? void 0 : _window_location.hostname;
|
|
87
90
|
return headers;
|
|
@@ -94,7 +97,13 @@ class APIClient_APIClient extends APIClient {
|
|
|
94
97
|
config.headers['X-With-ACL-Meta'] = true;
|
|
95
98
|
const headers = this.getHeaders();
|
|
96
99
|
Object.keys(headers).forEach((key)=>{
|
|
97
|
-
|
|
100
|
+
var _config_headers;
|
|
101
|
+
const hasHeader = 'function' == typeof (null == (_config_headers = config.headers) ? void 0 : _config_headers.has) ? config.headers.has(key) : Object.keys(config.headers || {}).some((headerKey)=>headerKey.toLowerCase() === key.toLowerCase());
|
|
102
|
+
if (!hasHeader) {
|
|
103
|
+
var _config_headers1;
|
|
104
|
+
if ('function' == typeof (null == (_config_headers1 = config.headers) ? void 0 : _config_headers1.set)) config.headers.set(key, headers[key]);
|
|
105
|
+
else config.headers[key] = headers[key];
|
|
106
|
+
}
|
|
98
107
|
});
|
|
99
108
|
return config;
|
|
100
109
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CURRENT_TENANT_ID_STORAGE_KEY = "current_tenant_id";
|
package/es/api-client/index.d.ts
CHANGED
package/es/api-client/index.mjs
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders or configures the setting center provider client entry point.
|
|
3
|
+
*/
|
|
1
4
|
export declare const SettingCenterProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Renders or configures the settings center configure client entry point.
|
|
7
|
+
*/
|
|
2
8
|
export declare const SettingsCenterConfigure: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,15 +8,8 @@ import { useApp } from "../../../application/index.mjs";
|
|
|
8
8
|
import { useRecord } from "../../../record-provider/index.mjs";
|
|
9
9
|
import { useCompile } from "../../../schema-component/index.mjs";
|
|
10
10
|
import { SettingsCenterContext } from "../../pm/index.mjs";
|
|
11
|
+
import { getAclSnippetChecked, updateAclSnippetSelection } from "../acl-snippet.mjs";
|
|
11
12
|
import { useStyles } from "../style.mjs";
|
|
12
|
-
const getChildrenKeys = function() {
|
|
13
|
-
let data = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], arr = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [];
|
|
14
|
-
for (const item of data){
|
|
15
|
-
arr.push(item.aclSnippet);
|
|
16
|
-
if (item.children && item.children.length) getChildrenKeys(item.children, arr);
|
|
17
|
-
}
|
|
18
|
-
return arr;
|
|
19
|
-
};
|
|
20
13
|
const SettingMenuContext = /*#__PURE__*/ createContext(null);
|
|
21
14
|
SettingMenuContext.displayName = 'SettingMenuContext';
|
|
22
15
|
const SettingCenterProvider = (props)=>{
|
|
@@ -54,19 +47,8 @@ const SettingsCenterConfigure = ()=>{
|
|
|
54
47
|
});
|
|
55
48
|
const resource = api.resource('roles.snippets', record.name);
|
|
56
49
|
const handleChange = async (checked, record)=>{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (checked) {
|
|
60
|
-
await resource.add({
|
|
61
|
-
values: totalKeys.map((v)=>'!' + v)
|
|
62
|
-
});
|
|
63
|
-
refresh();
|
|
64
|
-
} else {
|
|
65
|
-
await resource.remove({
|
|
66
|
-
values: totalKeys.map((v)=>'!' + v)
|
|
67
|
-
});
|
|
68
|
-
refresh();
|
|
69
|
-
}
|
|
50
|
+
await updateAclSnippetSelection(resource, checked, record);
|
|
51
|
+
refresh();
|
|
70
52
|
message.success(t('Saved successfully'));
|
|
71
53
|
};
|
|
72
54
|
return /*#__PURE__*/ jsx(Table, {
|
|
@@ -106,7 +88,7 @@ const SettingsCenterConfigure = ()=>{
|
|
|
106
88
|
]
|
|
107
89
|
}),
|
|
108
90
|
render: (_, record)=>{
|
|
109
|
-
const checked =
|
|
91
|
+
const checked = getAclSnippetChecked(record, snippets);
|
|
110
92
|
return /*#__PURE__*/ jsx(Checkbox, {
|
|
111
93
|
checked: checked,
|
|
112
94
|
onChange: ()=>handleChange(checked, record)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type AclSnippetRecord = {
|
|
2
|
+
aclMode?: string;
|
|
3
|
+
aclSnippet?: string;
|
|
4
|
+
children?: AclSnippetRecord[];
|
|
5
|
+
};
|
|
6
|
+
type AclSnippetResource = {
|
|
7
|
+
add?: (options: {
|
|
8
|
+
values: string[];
|
|
9
|
+
}) => Promise<any>;
|
|
10
|
+
remove?: (options: {
|
|
11
|
+
values: string[];
|
|
12
|
+
}) => Promise<any>;
|
|
13
|
+
};
|
|
14
|
+
export declare const isExplicitAclSnippet: (record?: AclSnippetRecord) => boolean;
|
|
15
|
+
export declare const getChildrenAclSnippetKeys: (data?: AclSnippetRecord[], arr?: string[]) => string[];
|
|
16
|
+
export declare const getAclSnippetChecked: (record: AclSnippetRecord, snippets: string[]) => boolean;
|
|
17
|
+
export declare function updateAclSnippetSelection(resource: AclSnippetResource, checked: boolean, record: AclSnippetRecord): Promise<void>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const isExplicitAclSnippet = (record)=>(null == record ? void 0 : record.aclMode) === 'explicit';
|
|
2
|
+
const isString = (value)=>'string' == typeof value;
|
|
3
|
+
function assertAclSnippetResource(resource) {
|
|
4
|
+
if ('function' != typeof resource.add || 'function' != typeof resource.remove) throw new Error('roles.snippets resource does not support acl snippet mutations');
|
|
5
|
+
}
|
|
6
|
+
const getChildrenAclSnippetKeys = function() {
|
|
7
|
+
let data = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], arr = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [];
|
|
8
|
+
for (const item of data){
|
|
9
|
+
var _item_children;
|
|
10
|
+
if (item.aclSnippet) arr.push(item.aclSnippet);
|
|
11
|
+
if (null == (_item_children = item.children) ? void 0 : _item_children.length) getChildrenAclSnippetKeys(item.children, arr);
|
|
12
|
+
}
|
|
13
|
+
return arr;
|
|
14
|
+
};
|
|
15
|
+
const getAclSnippetChecked = (record, snippets)=>isExplicitAclSnippet(record) ? snippets.includes(record.aclSnippet) : !snippets.includes("!".concat(record.aclSnippet));
|
|
16
|
+
async function updateAclSnippetSelection(resource, checked, record) {
|
|
17
|
+
assertAclSnippetResource(resource);
|
|
18
|
+
if (isExplicitAclSnippet(record)) {
|
|
19
|
+
const values = [
|
|
20
|
+
record.aclSnippet
|
|
21
|
+
].filter(isString);
|
|
22
|
+
if (checked) await resource.remove({
|
|
23
|
+
values
|
|
24
|
+
});
|
|
25
|
+
else await resource.add({
|
|
26
|
+
values
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const childrenKeys = getChildrenAclSnippetKeys(null == record ? void 0 : record.children, []);
|
|
31
|
+
const totalKeys = childrenKeys.concat(record.aclSnippet).filter(isString);
|
|
32
|
+
const values = totalKeys.map((value)=>"!".concat(value));
|
|
33
|
+
if (checked) await resource.add({
|
|
34
|
+
values
|
|
35
|
+
});
|
|
36
|
+
else await resource.remove({
|
|
37
|
+
values
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { getAclSnippetChecked, getChildrenAclSnippetKeys, isExplicitAclSnippet, updateAclSnippetSelection };
|
|
@@ -2,5 +2,6 @@ export * from "./ACLProvider.mjs";
|
|
|
2
2
|
export * from "./ACLContext.mjs";
|
|
3
3
|
export * from "./ACLCollectionFieldProvider.mjs";
|
|
4
4
|
export * from "./ACLShortcut.mjs";
|
|
5
|
+
export * from "./acl-snippet.mjs";
|
|
5
6
|
export * from "./Configuration/index.mjs";
|
|
6
7
|
export * from "./ACLPlugin.mjs";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
type NavigationItem = ReactElement & {
|
|
3
|
+
key?: React.Key;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Returns the use current navigation menu hook state.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useCurrentNavigationMenu: () => {
|
|
9
|
+
getItems: () => NavigationItem[];
|
|
10
|
+
addItem: (item: NavigationItem) => void;
|
|
11
|
+
removeItem: (key: React.Key) => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Renders or configures the current navigation menu provider client entry point.
|
|
15
|
+
*/
|
|
16
|
+
export declare const CurrentNavigationMenuProvider: ({ children }: {
|
|
17
|
+
children: any;
|
|
18
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useRef, useState } from "react";
|
|
3
|
+
import { error } from "@tego/client";
|
|
4
|
+
const CurrentNavigationMenuContext = /*#__PURE__*/ createContext(null);
|
|
5
|
+
CurrentNavigationMenuContext.displayName = 'CurrentNavigationMenuContext';
|
|
6
|
+
const useCurrentNavigationMenu = ()=>{
|
|
7
|
+
const { items, update } = useContext(CurrentNavigationMenuContext) || {};
|
|
8
|
+
const getItems = useCallback(()=>items.current, [
|
|
9
|
+
items
|
|
10
|
+
]);
|
|
11
|
+
const addItem = useCallback((item)=>{
|
|
12
|
+
if (null === item.key || void 0 === item.key) {
|
|
13
|
+
items.current.push(item);
|
|
14
|
+
update();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const index = items.current.findIndex((current)=>current.key === item.key);
|
|
18
|
+
if (-1 !== index) items.current[index] = item;
|
|
19
|
+
else items.current.push(item);
|
|
20
|
+
update();
|
|
21
|
+
}, [
|
|
22
|
+
items,
|
|
23
|
+
update
|
|
24
|
+
]);
|
|
25
|
+
const removeItem = useCallback((key)=>{
|
|
26
|
+
if (null == key) return;
|
|
27
|
+
const nextItems = items.current.filter((current)=>current.key !== key);
|
|
28
|
+
if (nextItems.length === items.current.length) return;
|
|
29
|
+
items.current = nextItems;
|
|
30
|
+
update();
|
|
31
|
+
}, [
|
|
32
|
+
items,
|
|
33
|
+
update
|
|
34
|
+
]);
|
|
35
|
+
if (!items) {
|
|
36
|
+
error('AdminLayout: You should use `CurrentNavigationMenuProvider` in the root of your app.');
|
|
37
|
+
throw new Error('AdminLayout: You should use `CurrentNavigationMenuProvider` in the root of your app.');
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
getItems,
|
|
41
|
+
addItem,
|
|
42
|
+
removeItem
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const CurrentNavigationMenuProvider = (param)=>{
|
|
46
|
+
let { children } = param;
|
|
47
|
+
const items = useRef([]);
|
|
48
|
+
const [, setVersion] = useState(0);
|
|
49
|
+
const update = useCallback(()=>setVersion((version)=>version + 1), []);
|
|
50
|
+
return /*#__PURE__*/ jsx(CurrentNavigationMenuContext.Provider, {
|
|
51
|
+
value: {
|
|
52
|
+
items,
|
|
53
|
+
update
|
|
54
|
+
},
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export { CurrentNavigationMenuProvider, useCurrentNavigationMenu };
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef } from "react";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react, { useRef } from "react";
|
|
3
3
|
import { Layout } from "antd";
|
|
4
4
|
import { useParams } from "react-router-dom";
|
|
5
5
|
import { CurrentUser, PinnedPluginList, useApp, useSystemSettings } from "../../index.mjs";
|
|
6
6
|
import { AdminContent } from "./AdminContent.mjs";
|
|
7
7
|
import { AdminTabs } from "./AdminTabs.mjs";
|
|
8
|
+
import { useCurrentNavigationMenu } from "./CurrentNavigationMenuProvider.mjs";
|
|
8
9
|
import { MenuEditor } from "./MenuEditor.mjs";
|
|
9
10
|
import { useStyles } from "./style.mjs";
|
|
11
|
+
const NavigationMenuItems = ()=>{
|
|
12
|
+
const { getItems } = useCurrentNavigationMenu();
|
|
13
|
+
const { styles } = useStyles();
|
|
14
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
15
|
+
children: getItems().map((item, index)=>{
|
|
16
|
+
var _item_key;
|
|
17
|
+
return /*#__PURE__*/ react.cloneElement(item, {
|
|
18
|
+
key: null != (_item_key = item.key) ? _item_key : "navigation-item-".concat(index),
|
|
19
|
+
className: [
|
|
20
|
+
item.props.className,
|
|
21
|
+
styles.navigationItem
|
|
22
|
+
].filter(Boolean).join(' ')
|
|
23
|
+
});
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
};
|
|
10
27
|
const InternalAdminLayout = (props)=>{
|
|
11
28
|
var _result_data_data_logo, _result_data_data, _result_data, _result_data_data1, _result_data1;
|
|
12
29
|
const sideMenuRef = useRef();
|
|
@@ -44,6 +61,7 @@ const InternalAdminLayout = (props)=>{
|
|
|
44
61
|
/*#__PURE__*/ jsx(MenuEditor, {
|
|
45
62
|
sideMenuRef: sideMenuRef
|
|
46
63
|
}),
|
|
64
|
+
/*#__PURE__*/ jsx(NavigationMenuItems, {}),
|
|
47
65
|
/*#__PURE__*/ jsx("div", {
|
|
48
66
|
className: styles.headerTabs,
|
|
49
67
|
children: /*#__PURE__*/ jsx(AdminTabs, {})
|
|
@@ -3,6 +3,7 @@ export * from './AdminLayout';
|
|
|
3
3
|
export * from './AdminLayoutPlugin';
|
|
4
4
|
export * from './AdminProvider';
|
|
5
5
|
export * from './AdminTabs';
|
|
6
|
+
export * from './CurrentNavigationMenuProvider';
|
|
6
7
|
export * from './InternalAdminLayout';
|
|
7
8
|
export * from './MenuEditor';
|
|
8
9
|
export * from './NoticeArea';
|
|
@@ -3,6 +3,7 @@ export * from "./AdminLayout.mjs";
|
|
|
3
3
|
export * from "./AdminLayoutPlugin.mjs";
|
|
4
4
|
export * from "./AdminProvider.mjs";
|
|
5
5
|
export * from "./AdminTabs.mjs";
|
|
6
|
+
export * from "./CurrentNavigationMenuProvider.mjs";
|
|
6
7
|
export * from "./InternalAdminLayout.mjs";
|
|
7
8
|
export * from "./MenuEditor.mjs";
|
|
8
9
|
export * from "./NoticeArea.mjs";
|
|
@@ -6,6 +6,7 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
6
6
|
titleContainer: import("antd-style").SerializedStyles;
|
|
7
7
|
logo: import("antd-style").SerializedStyles;
|
|
8
8
|
title: import("antd-style").SerializedStyles;
|
|
9
|
+
navigationItem: import("antd-style").SerializedStyles;
|
|
9
10
|
right: import("antd-style").SerializedStyles;
|
|
10
11
|
headerTabs: import("antd-style").SerializedStyles;
|
|
11
12
|
notice: import("antd-style").SerializedStyles;
|
|
@@ -79,7 +79,9 @@ function _templateObject6() {
|
|
|
79
79
|
}
|
|
80
80
|
function _templateObject7() {
|
|
81
81
|
const data = _tagged_template_literal([
|
|
82
|
-
"\n display: inline-flex;\n
|
|
82
|
+
"\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n height: var(--tb-header-height);\n padding: 0 8px;\n .ant-select {\n width: auto;\n min-width: auto;\n }\n .ant-select-selector {\n padding-inline: 8px !important;\n }\n .ant-select-selection-item,\n .ant-select-arrow {\n color: ",
|
|
83
|
+
" !important;\n }\n &:hover {\n background: ",
|
|
84
|
+
" !important;\n }\n "
|
|
83
85
|
]);
|
|
84
86
|
_templateObject7 = function() {
|
|
85
87
|
return data;
|
|
@@ -88,7 +90,7 @@ function _templateObject7() {
|
|
|
88
90
|
}
|
|
89
91
|
function _templateObject8() {
|
|
90
92
|
const data = _tagged_template_literal([
|
|
91
|
-
"\n
|
|
93
|
+
"\n display: inline-flex;\n position: relative;\n flex-shrink: 0;\n height: 100%;\n z-index: 10;\n "
|
|
92
94
|
]);
|
|
93
95
|
_templateObject8 = function() {
|
|
94
96
|
return data;
|
|
@@ -97,7 +99,7 @@ function _templateObject8() {
|
|
|
97
99
|
}
|
|
98
100
|
function _templateObject9() {
|
|
99
101
|
const data = _tagged_template_literal([
|
|
100
|
-
"\n flex: 1;\n "
|
|
102
|
+
"\n flex: 1 1 auto;\n display: flex;\n width: 0;\n overflow: hidden;\n white-space: nowrap;\n margin: 0;\n "
|
|
101
103
|
]);
|
|
102
104
|
_templateObject9 = function() {
|
|
103
105
|
return data;
|
|
@@ -106,7 +108,7 @@ function _templateObject9() {
|
|
|
106
108
|
}
|
|
107
109
|
function _templateObject10() {
|
|
108
110
|
const data = _tagged_template_literal([
|
|
109
|
-
"\n
|
|
111
|
+
"\n flex: 1;\n "
|
|
110
112
|
]);
|
|
111
113
|
_templateObject10 = function() {
|
|
112
114
|
return data;
|
|
@@ -115,13 +117,22 @@ function _templateObject10() {
|
|
|
115
117
|
}
|
|
116
118
|
function _templateObject11() {
|
|
117
119
|
const data = _tagged_template_literal([
|
|
118
|
-
"\n
|
|
120
|
+
"\n height: 100%;\n position: relative;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 100;\n "
|
|
119
121
|
]);
|
|
120
122
|
_templateObject11 = function() {
|
|
121
123
|
return data;
|
|
122
124
|
};
|
|
123
125
|
return data;
|
|
124
126
|
}
|
|
127
|
+
function _templateObject12() {
|
|
128
|
+
const data = _tagged_template_literal([
|
|
129
|
+
"\n display: flex;\n flex-direction: column;\n position: relative;\n height: 100%;\n > div {\n position: relative;\n }\n .ant-layout-content {\n height: calc(100vh - var(--tb-header-height));\n overflow: auto;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "
|
|
130
|
+
]);
|
|
131
|
+
_templateObject12 = function() {
|
|
132
|
+
return data;
|
|
133
|
+
};
|
|
134
|
+
return data;
|
|
135
|
+
}
|
|
125
136
|
const useStyles = createStyles((param)=>{
|
|
126
137
|
let { css, token } = param;
|
|
127
138
|
return {
|
|
@@ -132,11 +143,12 @@ const useStyles = createStyles((param)=>{
|
|
|
132
143
|
titleContainer: css(_templateObject4()),
|
|
133
144
|
logo: css(_templateObject5()),
|
|
134
145
|
title: css(_templateObject6()),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
navigationItem: css(_templateObject7(), token.colorTextHeaderMenu, token.colorBgHeaderMenuHover),
|
|
147
|
+
right: css(_templateObject8()),
|
|
148
|
+
headerTabs: css(_templateObject9()),
|
|
149
|
+
notice: css(_templateObject10()),
|
|
150
|
+
sider: css(_templateObject11()),
|
|
151
|
+
main: css(_templateObject12())
|
|
140
152
|
};
|
|
141
153
|
});
|
|
142
154
|
export { useStyles };
|
package/es/built-in/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Plugin } from '../application/Plugin';
|
|
2
|
-
export { AdminProvider, NoticeArea, AdminLayout, MenuEditor, AdminTabs } from './admin-layout';
|
|
2
|
+
export { AdminProvider, NoticeArea, AdminLayout, MenuEditor, AdminTabs, CurrentNavigationMenuProvider, useCurrentNavigationMenu, } from './admin-layout';
|
|
3
3
|
export * from './pinned-list';
|
|
4
4
|
export * from './context-menu/useContextMenu';
|
|
5
|
+
/**
|
|
6
|
+
* Renders or configures the app not found client entry point.
|
|
7
|
+
*/
|
|
5
8
|
export declare const AppNotFound: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Renders or configures the built in plugin client entry point.
|
|
11
|
+
*/
|
|
6
12
|
export declare class BuiltInPlugin extends Plugin {
|
|
7
13
|
afterAdd(): Promise<void>;
|
|
8
14
|
load(): Promise<void>;
|
package/es/built-in/index.mjs
CHANGED
|
@@ -24,6 +24,7 @@ import { CurrentUserProvider, CurrentUserSettingsMenuProvider } from "../user/in
|
|
|
24
24
|
import { ACLPlugin } from "./acl/ACLPlugin.mjs";
|
|
25
25
|
import { AdminLayoutPlugin } from "./admin-layout/AdminLayoutPlugin.mjs";
|
|
26
26
|
import { WelcomeCard } from "./admin-layout/components/WelcomeCard.mjs";
|
|
27
|
+
import { CurrentNavigationMenuProvider } from "./admin-layout/CurrentNavigationMenuProvider.mjs";
|
|
27
28
|
import { AttachmentPreviewPlugin } from "./attachment-preview/index.mjs";
|
|
28
29
|
import { PluginBlockSchemaComponent } from "./block-schema-component/index.mjs";
|
|
29
30
|
import { PluginContextMenu } from "./context-menu/index.mjs";
|
|
@@ -38,7 +39,7 @@ import { ScrollAssistantPlugin } from "./scroll-assistant/index.mjs";
|
|
|
38
39
|
import { SystemSettingsPlugin } from "./system-settings/index.mjs";
|
|
39
40
|
import { PluginSystemVersion } from "./system-version/index.mjs";
|
|
40
41
|
import { UserSettingsPlugin } from "./user-settings/index.mjs";
|
|
41
|
-
import { AdminLayout, AdminProvider, AdminTabs, MenuEditor, NoticeArea } from "./admin-layout/index.mjs";
|
|
42
|
+
import { AdminLayout, AdminProvider, AdminTabs, CurrentNavigationMenuProvider as index_mjs_CurrentNavigationMenuProvider, MenuEditor, NoticeArea, useCurrentNavigationMenu } from "./admin-layout/index.mjs";
|
|
42
43
|
export * from "./pinned-list/index.mjs";
|
|
43
44
|
export * from "./context-menu/useContextMenu.mjs";
|
|
44
45
|
function _tagged_template_literal(strings, raw) {
|
|
@@ -297,6 +298,7 @@ class BuiltInPlugin extends Plugin {
|
|
|
297
298
|
this.addRoutes();
|
|
298
299
|
this.app.use(CurrentUserProvider);
|
|
299
300
|
this.app.use(CurrentUserSettingsMenuProvider);
|
|
301
|
+
this.app.use(CurrentNavigationMenuProvider);
|
|
300
302
|
this.addSystemSettingGroups();
|
|
301
303
|
}
|
|
302
304
|
addSystemSettingGroups() {
|
|
@@ -496,4 +498,4 @@ class BuiltInPlugin extends Plugin {
|
|
|
496
498
|
});
|
|
497
499
|
}
|
|
498
500
|
}
|
|
499
|
-
export { AdminLayout, AdminProvider, AdminTabs, AppNotFound, BuiltInPlugin, MenuEditor, NoticeArea };
|
|
501
|
+
export { AdminLayout, AdminProvider, AdminTabs, AppNotFound, BuiltInPlugin, index_mjs_CurrentNavigationMenuProvider as CurrentNavigationMenuProvider, MenuEditor, NoticeArea, useCurrentNavigationMenu };
|
|
@@ -28,23 +28,24 @@ const SettingsCenterDropdown = ()=>{
|
|
|
28
28
|
const menuItems = useMemo(()=>{
|
|
29
29
|
const list = app.systemSettingsManager.getList();
|
|
30
30
|
function traverse(settings) {
|
|
31
|
-
return settings.filter((item)=>!item.path.includes(':')).map((item)=>{
|
|
31
|
+
return settings.filter((item)=>!item.hideInMenu && !item.path.includes(':')).map((item)=>{
|
|
32
32
|
var _item_children;
|
|
33
|
-
|
|
33
|
+
const title = compile(item.title);
|
|
34
|
+
var _item_key;
|
|
34
35
|
item.label = /*#__PURE__*/ jsx(Link, {
|
|
35
36
|
to: item.path,
|
|
36
|
-
children:
|
|
37
|
-
});
|
|
37
|
+
children: title
|
|
38
|
+
}, null != (_item_key = item.key) ? _item_key : item.path);
|
|
38
39
|
if (null == (_item_children = item.children) ? void 0 : _item_children.length) {
|
|
39
40
|
item.children = traverse(item.children);
|
|
40
|
-
item.label =
|
|
41
|
+
item.label = title;
|
|
41
42
|
}
|
|
42
43
|
return {
|
|
43
44
|
key: item.key,
|
|
44
45
|
label: item.label,
|
|
45
46
|
path: item.path,
|
|
46
47
|
children: item.children,
|
|
47
|
-
name:
|
|
48
|
+
name: title
|
|
48
49
|
};
|
|
49
50
|
});
|
|
50
51
|
}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Renders the source foreign key client component.
|
|
4
|
+
*/
|
|
2
5
|
export declare const SourceForeignKey: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<unknown>>;
|
|
6
|
+
/**
|
|
7
|
+
* Renders the through foreign key client component.
|
|
8
|
+
*/
|
|
3
9
|
export declare const ThroughForeignKey: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<unknown>>;
|
|
10
|
+
/**
|
|
11
|
+
* Renders the target foreign key client component.
|
|
12
|
+
*/
|
|
4
13
|
export declare const TargetForeignKey: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<unknown>>;
|
|
14
|
+
/**
|
|
15
|
+
* Renders the source collection client component.
|
|
16
|
+
*/
|
|
5
17
|
export declare const SourceCollection: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<unknown>>;
|
|
18
|
+
/**
|
|
19
|
+
* Renders the source key client component.
|
|
20
|
+
*/
|
|
6
21
|
export declare const SourceKey: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<Omit<any, "ref">>>;
|
|
22
|
+
/**
|
|
23
|
+
* Renders the target key client component.
|
|
24
|
+
*/
|
|
7
25
|
export declare const TargetKey: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<Omit<any, "ref">>>;
|
|
26
|
+
/**
|
|
27
|
+
* Renders the foreign key client component.
|
|
28
|
+
*/
|
|
8
29
|
export declare const ForeignKey: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<Omit<any, "ref">>>;
|
|
30
|
+
/**
|
|
31
|
+
* Renders the through collection client component.
|
|
32
|
+
*/
|
|
9
33
|
export declare const ThroughCollection: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<Omit<any, "ref">>>;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { CollectionTemplate } from '../../data-source/collection-template/CollectionTemplate';
|
|
2
|
+
/**
|
|
3
|
+
* SQL collection template.
|
|
4
|
+
*
|
|
5
|
+
* Tenant isolation boundary:
|
|
6
|
+
* - SQL collections do NOT support the `tenancy` configuration option.
|
|
7
|
+
* - `sqlCollection:execute` applies no tenant filtering — the raw SQL is executed as-is.
|
|
8
|
+
* - The default ACL (deny-all) already prevents non-root/non-admin roles from accessing
|
|
9
|
+
* this resource. No explicit `acl.deny` is needed, but admins should be aware that
|
|
10
|
+
* SQL collections bypass the tenant resource guard entirely.
|
|
11
|
+
* - Users who need tenant-scoped data access should use general collections with proper
|
|
12
|
+
* tenancy configuration instead of raw SQL.
|
|
13
|
+
* - When module-tenant is enabled, its client plugin injects the corresponding UI warning.
|
|
14
|
+
*/
|
|
2
15
|
export declare class SqlCollectionTemplate extends CollectionTemplate {
|
|
3
16
|
name: string;
|
|
4
17
|
title: string;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { CollectionTemplate } from '../../data-source/collection-template/CollectionTemplate';
|
|
2
|
+
/**
|
|
3
|
+
* View collection template (connect to database view).
|
|
4
|
+
*
|
|
5
|
+
* Tenant isolation boundary:
|
|
6
|
+
* - View collections do NOT support the `tenancy` configuration option.
|
|
7
|
+
* - `dbViews:query` executes raw `SELECT * FROM <view>` with no tenant filtering.
|
|
8
|
+
* - The default ACL (deny-all) prevents non-root/non-admin roles from accessing
|
|
9
|
+
* this resource. No explicit `acl.deny` is needed, but admins should be aware that
|
|
10
|
+
* view collections bypass the tenant resource guard entirely.
|
|
11
|
+
* - The underlying database view itself is responsible for any row-level security.
|
|
12
|
+
* - When module-tenant is enabled, its client plugin injects the corresponding UI warning.
|
|
13
|
+
*/
|
|
2
14
|
export declare class ViewCollectionTemplate extends CollectionTemplate {
|
|
3
15
|
name: string;
|
|
4
16
|
title: string;
|
|
@@ -40,6 +40,7 @@ var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_
|
|
|
40
40
|
const client_namespaceObject = require("@tego/client");
|
|
41
41
|
const external_antd_namespaceObject = require("antd");
|
|
42
42
|
const index_js_namespaceObject = require("../i18n/index.js");
|
|
43
|
+
const external_constants_js_namespaceObject = require("./constants.js");
|
|
43
44
|
function _define_property(obj, key, value) {
|
|
44
45
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
45
46
|
value: value,
|
|
@@ -116,10 +117,12 @@ class APIClient extends client_namespaceObject.APIClient {
|
|
|
116
117
|
return api;
|
|
117
118
|
}
|
|
118
119
|
getHeaders() {
|
|
119
|
-
var _this_app, _window_location, _window;
|
|
120
|
+
var _this_app, _this_storage_getItem, _this_storage, _window_location, _window;
|
|
120
121
|
const headers = super.getHeaders();
|
|
121
122
|
const appName = null == (_this_app = this.app) ? void 0 : _this_app.getName();
|
|
123
|
+
const currentTenantId = null == (_this_storage = this.storage) ? void 0 : null == (_this_storage_getItem = _this_storage.getItem) ? void 0 : _this_storage_getItem.call(_this_storage, external_constants_js_namespaceObject.CURRENT_TENANT_ID_STORAGE_KEY);
|
|
122
124
|
if (appName) headers['X-App'] = appName;
|
|
125
|
+
if (currentTenantId) headers['X-Tenant-Id'] = currentTenantId;
|
|
123
126
|
headers['X-Timezone'] = getCurrentTimezone();
|
|
124
127
|
headers['X-Hostname'] = null == (_window = window) ? void 0 : null == (_window_location = _window.location) ? void 0 : _window_location.hostname;
|
|
125
128
|
return headers;
|
|
@@ -132,7 +135,13 @@ class APIClient extends client_namespaceObject.APIClient {
|
|
|
132
135
|
config.headers['X-With-ACL-Meta'] = true;
|
|
133
136
|
const headers = this.getHeaders();
|
|
134
137
|
Object.keys(headers).forEach((key)=>{
|
|
135
|
-
|
|
138
|
+
var _config_headers;
|
|
139
|
+
const hasHeader = 'function' == typeof (null == (_config_headers = config.headers) ? void 0 : _config_headers.has) ? config.headers.has(key) : Object.keys(config.headers || {}).some((headerKey)=>headerKey.toLowerCase() === key.toLowerCase());
|
|
140
|
+
if (!hasHeader) {
|
|
141
|
+
var _config_headers1;
|
|
142
|
+
if ('function' == typeof (null == (_config_headers1 = config.headers) ? void 0 : _config_headers1.set)) config.headers.set(key, headers[key]);
|
|
143
|
+
else config.headers[key] = headers[key];
|
|
144
|
+
}
|
|
136
145
|
});
|
|
137
146
|
return config;
|
|
138
147
|
});
|