@tachybase/client 1.6.20 → 1.6.22
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 +2 -1
- package/es/api-client/APIClient.mjs +6 -3
- package/es/application/Plugin.d.ts +2 -2
- package/es/application/hoc/withDynamicSchemaProps.mjs +1 -1
- package/es/application/schema-initializer/hooks/index.mjs +4 -1
- package/es/application/schema-settings/components/SchemaSettingsChildren.mjs +14 -14
- package/es/application/utils/clientModuleRegistry.d.ts +2 -0
- package/es/application/utils/clientModuleRegistry.mjs +9 -0
- package/es/application/utils/globalDeps.mjs +3 -3
- package/es/block-provider/BlockProvider.d.ts +1 -27
- package/es/block-provider/BlockProvider.mjs +1 -3
- package/es/block-provider/BlockRequestContext.d.ts +27 -0
- package/es/block-provider/BlockRequestContext.mjs +5 -0
- package/es/block-provider/FormBlockContext.d.ts +32 -0
- package/es/block-provider/FormBlockContext.mjs +5 -0
- package/es/block-provider/FormBlockProvider.d.ts +1 -33
- package/es/block-provider/FormBlockProvider.mjs +4 -5
- package/es/built-in/acl/ACLCollectionFieldProvider.d.ts +1 -0
- package/es/built-in/acl/ACLCollectionFieldProvider.mjs +42 -0
- package/es/built-in/acl/ACLContext.d.ts +9 -0
- package/es/built-in/acl/ACLContext.mjs +24 -0
- package/es/built-in/acl/ACLPlugin.mjs +2 -1
- package/es/built-in/acl/ACLProvider.d.ts +0 -11
- package/es/built-in/acl/ACLProvider.mjs +6 -51
- package/es/built-in/acl/index.d.ts +2 -0
- package/es/built-in/acl/index.mjs +2 -0
- package/es/collection-manager/hooks/useCollectionManager_deprecated.mjs +2 -1
- package/es/collection-manager/sub-table.d.ts +1 -1
- package/es/data-source/data-source/DataSourceManager.d.ts +1 -2
- package/es/data-source/data-source/DataSourceManager.mjs +1 -2
- package/es/data-source/data-source/constants.d.ts +2 -0
- package/es/data-source/data-source/constants.mjs +3 -0
- package/es/data-source/utils.d.ts +2 -2
- package/es/data-source/utils.mjs +1 -1
- package/es/exports.d.ts +46 -0
- package/es/exports.mjs +46 -0
- package/es/filter-provider/utils.d.ts +2 -14
- package/es/filter-provider/utils.mjs +2 -57
- package/es/index.d.ts +1 -46
- package/es/index.mjs +4 -46
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +2 -86
- package/es/record-provider/index.mjs +3 -3
- package/es/schema-component/antd/action/Action.mjs +7 -6
- package/es/schema-component/antd/action/hooks.mjs +3 -2
- package/es/schema-component/antd/association-field/AssociationSelect.mjs +4 -3
- package/es/schema-component/antd/association-field/hooks.mjs +18 -1
- package/es/schema-component/antd/cron/CronSet.mjs +9 -3
- package/es/schema-component/antd/date-picker/util.mjs +4 -0
- package/es/schema-component/antd/filter/conditionUtils.d.ts +2 -0
- package/es/schema-component/antd/filter/conditionUtils.mjs +133 -0
- package/es/schema-component/antd/filter/dateValueUtils.d.ts +13 -0
- package/es/schema-component/antd/filter/dateValueUtils.mjs +66 -0
- package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -4
- package/es/schema-component/antd/filter/useFilterActionProps.mjs +3 -181
- package/es/schema-component/antd/filter/useGetFilterOptions.d.ts +2 -0
- package/es/schema-component/antd/filter/useGetFilterOptions.mjs +54 -0
- package/es/schema-component/antd/form/Form.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.FilterFormDesigner.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.d.ts +1 -1
- package/es/schema-component/antd/form-item/FormItem.mjs +14 -12
- package/es/schema-component/antd/form-item/SchemaSettingOptions.d.ts +1 -14
- package/es/schema-component/antd/form-item/SchemaSettingOptions.mjs +1 -33
- package/es/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.mjs +4 -3
- package/es/schema-component/antd/form-item/hooks/useParseDefaultValue.mjs +5 -3
- package/es/schema-component/antd/form-item/operatorUtils.d.ts +14 -0
- package/es/schema-component/antd/form-item/operatorUtils.mjs +36 -0
- package/es/schema-component/antd/form-v2/Form.mjs +26 -167
- package/es/schema-component/antd/form-v2/FormLinkageRules.d.ts +9 -0
- package/es/schema-component/antd/form-v2/FormLinkageRules.mjs +191 -0
- package/es/schema-component/antd/form-v2/Templates.mjs +1 -1
- package/es/schema-component/antd/grid/Grid.mjs +6 -4
- package/es/schema-component/antd/grid-card/GridCard.Item.mjs +2 -2
- package/es/schema-component/antd/icon-picker/IconFilterInput.mjs +12 -4
- package/es/schema-component/antd/icon-picker/IconPicker.mjs +1 -1
- package/es/schema-component/antd/input/Json.d.ts +1 -4
- package/es/schema-component/antd/input/ReadPretty.mjs +2 -2
- package/es/schema-component/antd/input-number/ReadPretty.mjs +1 -1
- package/es/schema-component/antd/markdown/Markdown.Void.Designer.mjs +2 -1
- package/es/schema-component/antd/markdown/Markdown.Void.mjs +10 -2
- package/es/schema-component/antd/markdown/Markdown.mjs +1 -1
- package/es/schema-component/antd/markdown/util.mjs +5 -0
- package/es/schema-component/antd/rich-text/RichText.mjs +1 -1
- package/es/schema-component/antd/select/FormulaSelect.mjs +1 -2
- package/es/schema-component/antd/select/ReadPretty.mjs +2 -2
- package/es/schema-component/antd/select/Select.mjs +1 -2
- package/es/schema-component/antd/select/utils.d.ts +2 -1
- package/es/schema-component/antd/select/utils.mjs +2 -2
- package/es/schema-component/antd/time-picker/ReadPretty.mjs +1 -1
- package/es/schema-component/antd/upload/ReadPretty.mjs +5 -5
- package/es/schema-component/antd/upload/Upload.mjs +6 -5
- package/es/schema-component/antd/variable/Input.mjs +1 -1
- package/es/schema-component/antd/variable/TextArea.mjs +1 -1
- package/es/schema-component/hooks/useDesigner.mjs +9 -3
- package/es/schema-component/hooks/useOptionalNavigate.d.ts +1 -0
- package/es/schema-component/hooks/useOptionalNavigate.mjs +2 -0
- package/es/schema-settings/DataTemplates/components/Designer.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useBaseVariable.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useBlockCollection.mjs +1 -1
- package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useFormVariable.mjs +1 -1
- package/es/schema-settings/VariableInput/hooks/useRecordVariable.mjs +1 -1
- package/es/style/theme/AntdAppProvider.mjs +2 -2
- package/es/user/ChangePassword.d.ts +4 -1
- package/es/user/CurrentUserContext.d.ts +2 -0
- package/es/user/CurrentUserContext.mjs +5 -0
- package/es/user/CurrentUserProvider.d.ts +0 -3
- package/es/user/CurrentUserProvider.mjs +3 -5
- package/es/user/EditProfile.d.ts +4 -1
- package/es/user/LanguageSettings.d.ts +4 -1
- package/es/user/SwitchRole.d.ts +4 -1
- package/es/user/index.d.ts +1 -0
- package/es/user/index.mjs +1 -0
- package/es/variables/VariablesProvider.mjs +1 -1
- package/lib/api-client/APIClient.js +8 -5
- package/lib/application/hoc/withDynamicSchemaProps.js +3 -3
- package/lib/application/schema-initializer/hooks/index.js +4 -1
- package/lib/application/schema-settings/components/SchemaSettingsChildren.js +14 -14
- package/lib/application/utils/clientModuleRegistry.js +46 -0
- package/lib/application/utils/globalDeps.js +2 -2
- package/lib/block-provider/BlockProvider.js +6 -8
- package/lib/block-provider/BlockRequestContext.js +42 -0
- package/lib/block-provider/FormBlockContext.js +42 -0
- package/lib/block-provider/FormBlockProvider.js +13 -14
- package/lib/built-in/acl/ACLCollectionFieldProvider.js +76 -0
- package/lib/built-in/acl/ACLContext.js +70 -0
- package/lib/built-in/acl/ACLPlugin.js +2 -1
- package/lib/built-in/acl/ACLProvider.js +13 -76
- package/lib/built-in/acl/index.js +27 -9
- package/lib/collection-manager/hooks/useCollectionManager_deprecated.js +4 -3
- package/lib/data-source/data-source/DataSourceManager.js +6 -7
- package/lib/data-source/data-source/constants.js +40 -0
- package/lib/data-source/utils.js +2 -2
- package/lib/exports.js +769 -0
- package/lib/filter-provider/utils.js +7 -63
- package/lib/index.js +10 -714
- package/lib/record-provider/index.js +6 -6
- package/lib/schema-component/antd/action/Action.js +9 -8
- package/lib/schema-component/antd/action/hooks.js +3 -2
- package/lib/schema-component/antd/association-field/AssociationSelect.js +3 -2
- package/lib/schema-component/antd/association-field/hooks.js +18 -1
- package/lib/schema-component/antd/cron/CronSet.js +8 -2
- package/lib/schema-component/antd/date-picker/util.js +4 -0
- package/lib/schema-component/antd/filter/conditionUtils.js +180 -0
- package/lib/schema-component/antd/filter/dateValueUtils.js +116 -0
- package/lib/schema-component/antd/filter/useFilterActionProps.js +7 -186
- package/lib/schema-component/antd/filter/useGetFilterOptions.js +91 -0
- package/lib/schema-component/antd/form/Form.js +4 -4
- package/lib/schema-component/antd/form-item/FormItem.FilterFormDesigner.js +2 -2
- package/lib/schema-component/antd/form-item/FormItem.js +23 -20
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +6 -38
- package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js +9 -7
- package/lib/schema-component/antd/form-item/hooks/useParseDefaultValue.js +12 -8
- package/lib/schema-component/antd/form-item/operatorUtils.js +76 -0
- package/lib/schema-component/antd/form-v2/Form.js +204 -317
- package/lib/schema-component/antd/form-v2/FormLinkageRules.js +236 -0
- package/lib/schema-component/antd/form-v2/Templates.js +2 -2
- package/lib/schema-component/antd/grid/Grid.js +11 -9
- package/lib/schema-component/antd/grid-card/GridCard.Item.js +2 -2
- package/lib/schema-component/antd/icon-picker/IconFilterInput.js +12 -4
- package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -1
- package/lib/schema-component/antd/input/ReadPretty.js +10 -10
- package/lib/schema-component/antd/input-number/ReadPretty.js +1 -1
- package/lib/schema-component/antd/markdown/Markdown.Void.Designer.js +6 -5
- package/lib/schema-component/antd/markdown/Markdown.Void.js +138 -111
- package/lib/schema-component/antd/markdown/Markdown.js +2 -2
- package/lib/schema-component/antd/markdown/util.js +5 -0
- package/lib/schema-component/antd/rich-text/RichText.js +2 -2
- package/lib/schema-component/antd/select/FormulaSelect.js +1 -2
- package/lib/schema-component/antd/select/ReadPretty.js +2 -2
- package/lib/schema-component/antd/select/Select.js +1 -2
- package/lib/schema-component/antd/select/utils.js +6 -3
- package/lib/schema-component/antd/time-picker/ReadPretty.js +2 -2
- package/lib/schema-component/antd/upload/ReadPretty.js +5 -5
- package/lib/schema-component/antd/upload/Upload.js +6 -5
- package/lib/schema-component/antd/variable/Input.js +1 -1
- package/lib/schema-component/antd/variable/TextArea.js +1 -1
- package/lib/schema-component/hooks/useDesigner.js +57 -23
- package/lib/schema-component/hooks/useOptionalNavigate.js +36 -0
- package/lib/schema-settings/DataTemplates/components/Designer.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useBaseVariable.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useBlockCollection.js +2 -2
- package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +2 -2
- package/lib/schema-settings/VariableInput/hooks/useRecordVariable.js +2 -2
- package/lib/style/theme/AntdAppProvider.js +4 -4
- package/lib/user/CurrentUserContext.js +42 -0
- package/lib/user/CurrentUserProvider.js +6 -14
- package/lib/user/index.js +24 -12
- package/lib/variables/VariablesProvider.js +2 -2
- package/package.json +5 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIClient as APIClientSDK } from '@tego/client';
|
|
2
2
|
import { Result } from 'ahooks/es/useRequest/src/types';
|
|
3
|
-
import { Application } from '../application';
|
|
3
|
+
import type { Application } from '../application';
|
|
4
4
|
export declare class APIClient extends APIClientSDK {
|
|
5
5
|
services: Record<string, Result<any, any>>;
|
|
6
6
|
silence: boolean;
|
|
@@ -11,6 +11,7 @@ export declare class APIClient extends APIClientSDK {
|
|
|
11
11
|
getHeaders(): {};
|
|
12
12
|
service(uid: string): Result<any, any>;
|
|
13
13
|
interceptors(): void;
|
|
14
|
+
reloadLocation(): void;
|
|
14
15
|
toErrMessages(error: any): any;
|
|
15
16
|
handleNotificationError(error: any): Promise<any>;
|
|
16
17
|
useNotificationMiddleware(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { APIClient } from "@tego/client";
|
|
3
3
|
import { notification as external_antd_notification } from "antd";
|
|
4
|
-
import { i18n } from "../index.mjs";
|
|
4
|
+
import { i18n } from "../i18n/index.mjs";
|
|
5
5
|
function _define_property(obj, key, value) {
|
|
6
6
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
7
7
|
value: value,
|
|
@@ -104,16 +104,19 @@ class APIClient_APIClient extends APIClient {
|
|
|
104
104
|
const errs = this.toErrMessages(error);
|
|
105
105
|
if (errs.find((error)=>'ROLE_NOT_FOUND_ERR' === error.code)) {
|
|
106
106
|
this.auth.setRole(null);
|
|
107
|
-
|
|
107
|
+
this.reloadLocation();
|
|
108
108
|
}
|
|
109
109
|
if (errs.find((error)=>'TOKEN_INVALID' === error.code || 'USER_LOCKED' === error.code)) this.auth.setToken(null);
|
|
110
110
|
if (errs.find((error)=>'ROLE_NOT_FOUND_FOR_USER' === error.code)) {
|
|
111
111
|
this.auth.setRole(null);
|
|
112
|
-
|
|
112
|
+
this.reloadLocation();
|
|
113
113
|
}
|
|
114
114
|
throw error;
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
+
reloadLocation() {
|
|
118
|
+
window.location.reload();
|
|
119
|
+
}
|
|
117
120
|
toErrMessages(error) {
|
|
118
121
|
var _error_response, _error_response_data, _error_response1, _error_response_data1, _error_response2, _error_response3;
|
|
119
122
|
if ('string' == typeof (null == error ? void 0 : null == (_error_response = error.response) ? void 0 : _error_response.data)) {
|
|
@@ -9,8 +9,8 @@ export declare class Plugin<T = any> {
|
|
|
9
9
|
get router(): import("./RouterManager").RouterManager;
|
|
10
10
|
get systemSettingsManager(): import("./SystemSettingsManager").SystemSettingsManager;
|
|
11
11
|
get userSettingsManager(): import("./UserSettingsManager").UserSettingsManager;
|
|
12
|
-
get schemaInitializerManager(): import("
|
|
13
|
-
get schemaSettingsManager(): import("
|
|
12
|
+
get schemaInitializerManager(): import("..").SchemaInitializerManager;
|
|
13
|
+
get schemaSettingsManager(): import("..").SchemaSettingsManager;
|
|
14
14
|
get dataSourceManager(): import("..").DataSourceManager;
|
|
15
15
|
get AttachmentPreviewManager(): import("./AttachmentPreviewManager").AttachmentPreviewManager;
|
|
16
16
|
afterAdd(): Promise<void>;
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { useExpressionScope } from "@tachybase/schema";
|
|
4
4
|
import lodash from "lodash";
|
|
5
|
-
import { useDesignable } from "../../schema-component/
|
|
5
|
+
import { useDesignable } from "../../schema-component/hooks/useDesignable.mjs";
|
|
6
6
|
const useDefaultSchemaProps = ()=>void 0;
|
|
7
7
|
function withDynamicSchemaProps(Component) {
|
|
8
8
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
@@ -115,7 +115,10 @@ InitializerComponent.displayName = 'InitializerComponent';
|
|
|
115
115
|
function useSchemaInitializerRender(name, options) {
|
|
116
116
|
const app = useApp();
|
|
117
117
|
const renderCache = react.useRef({});
|
|
118
|
-
const initializer = useMemo(()=>
|
|
118
|
+
const initializer = useMemo(()=>{
|
|
119
|
+
var _app_schemaInitializerManager;
|
|
120
|
+
return null == (_app_schemaInitializerManager = app.schemaInitializerManager) ? void 0 : _app_schemaInitializerManager.get(name);
|
|
121
|
+
}, [
|
|
119
122
|
app.schemaInitializerManager,
|
|
120
123
|
name
|
|
121
124
|
]);
|
|
@@ -4,19 +4,19 @@ import { useFieldComponentName } from "../../../common/useFieldComponentName.mjs
|
|
|
4
4
|
import { useFindComponent } from "../../../schema-component/index.mjs";
|
|
5
5
|
import { SchemaSettingsActionModalItem, SchemaSettingsCascaderItem, SchemaSettingsDivider, SchemaSettingsItem, SchemaSettingsItemGroup, SchemaSettingsModalItem, SchemaSettingsPopupItem, SchemaSettingsRemove, SchemaSettingsSelectItem, SchemaSettingsSubMenu, SchemaSettingsSwitchItem, useSchemaSettings } from "../../../schema-settings/SchemaSettings.mjs";
|
|
6
6
|
import { SchemaSettingItemContext } from "../context/index.mjs";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
7
|
+
const getTypeComponentMap = ()=>({
|
|
8
|
+
item: SchemaSettingsItem,
|
|
9
|
+
itemGroup: SchemaSettingsItemGroup,
|
|
10
|
+
subMenu: SchemaSettingsSubMenu,
|
|
11
|
+
divider: SchemaSettingsDivider,
|
|
12
|
+
remove: SchemaSettingsRemove,
|
|
13
|
+
select: SchemaSettingsSelectItem,
|
|
14
|
+
cascader: SchemaSettingsCascaderItem,
|
|
15
|
+
switch: SchemaSettingsSwitchItem,
|
|
16
|
+
popup: SchemaSettingsPopupItem,
|
|
17
|
+
actionModal: SchemaSettingsActionModalItem,
|
|
18
|
+
modal: SchemaSettingsModalItem
|
|
19
|
+
});
|
|
20
20
|
const SchemaSettingsChildren = (props)=>{
|
|
21
21
|
const { children } = props;
|
|
22
22
|
const { visible } = useSchemaSettings();
|
|
@@ -65,7 +65,7 @@ const SchemaSettingsChild = /*#__PURE__*/ memo((props)=>{
|
|
|
65
65
|
children
|
|
66
66
|
]);
|
|
67
67
|
const visibleResult = useVisible();
|
|
68
|
-
const ComponentValue = useMemo(()=>!Component && type
|
|
68
|
+
const ComponentValue = useMemo(()=>!Component && type ? getTypeComponentMap()[type] : Component, [
|
|
69
69
|
type,
|
|
70
70
|
Component
|
|
71
71
|
]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
let tachybaseClientExports;
|
|
2
|
+
function registerTachybaseClientExports(exports) {
|
|
3
|
+
tachybaseClientExports = exports;
|
|
4
|
+
}
|
|
5
|
+
function getTachybaseClientExports() {
|
|
6
|
+
if (null == tachybaseClientExports) throw new Error('@tachybase/client exports have not been registered. Ensure the package root entry is loaded first.');
|
|
7
|
+
return tachybaseClientExports;
|
|
8
|
+
}
|
|
9
|
+
export { getTachybaseClientExports, registerTachybaseClientExports };
|
|
@@ -4,15 +4,16 @@ import dayjs from "dayjs";
|
|
|
4
4
|
import lodash from "lodash";
|
|
5
5
|
import react_dom from "react-dom";
|
|
6
6
|
import jsx_runtime from "react/jsx-runtime";
|
|
7
|
+
import { getTachybaseClientExports } from "./clientModuleRegistry.mjs";
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next_05dede28__ from "react-i18next";
|
|
8
9
|
import * as __WEBPACK_EXTERNAL_MODULE__tego_client_7f3175c1__ from "@tego/client";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
10
11
|
import * as __WEBPACK_EXTERNAL_MODULE_ahooks__ from "ahooks";
|
|
11
12
|
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema_532e17e1__ from "@tachybase/schema";
|
|
12
13
|
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__ from "react-router-dom";
|
|
13
|
-
import * as __WEBPACK_EXTERNAL_MODULE_antd_style_1dcbd21e__ from "antd-style";
|
|
14
14
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons_a8184985__ from "@ant-design/icons";
|
|
15
15
|
import * as __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__ from "@emotion/css";
|
|
16
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd_style_1dcbd21e__ from "antd-style";
|
|
16
17
|
import * as __WEBPACK_EXTERNAL_MODULE_i18next__ from "i18next";
|
|
17
18
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_cssinjs_c619260f__ from "@ant-design/cssinjs";
|
|
18
19
|
import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_accessibility_682092eb__ from "@dnd-kit/accessibility";
|
|
@@ -22,7 +23,6 @@ import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_sortable_a8361dd8__ from "@dnd-ki
|
|
|
22
23
|
import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_utilities_3c8eb4c2__ from "@dnd-kit/utilities";
|
|
23
24
|
import * as __WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__ from "@floating-ui/react";
|
|
24
25
|
import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router";
|
|
25
|
-
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs_52ce5380__ from "../../index.mjs";
|
|
26
26
|
function defineGlobalDeps(requirejs) {
|
|
27
27
|
requirejs.define('react', ()=>react);
|
|
28
28
|
requirejs.define('react-dom', ()=>react_dom);
|
|
@@ -36,7 +36,7 @@ function defineGlobalDeps(requirejs) {
|
|
|
36
36
|
requirejs.define('i18next', ()=>__WEBPACK_EXTERNAL_MODULE_i18next__);
|
|
37
37
|
requirejs.define('react-i18next', ()=>__WEBPACK_EXTERNAL_MODULE_react_i18next_05dede28__);
|
|
38
38
|
requirejs.define('@tego/client', ()=>__WEBPACK_EXTERNAL_MODULE__tego_client_7f3175c1__);
|
|
39
|
-
requirejs.define('@tachybase/client', ()=>
|
|
39
|
+
requirejs.define('@tachybase/client', ()=>getTachybaseClientExports());
|
|
40
40
|
requirejs.define('@tachybase/schema', ()=>__WEBPACK_EXTERNAL_MODULE__tachybase_schema_532e17e1__);
|
|
41
41
|
requirejs.define('@tachybase/utils/client', ()=>__WEBPACK_EXTERNAL_MODULE__tego_client_7f3175c1__);
|
|
42
42
|
requirejs.define('@dnd-kit/accessibility', ()=>__WEBPACK_EXTERNAL_MODULE__dnd_kit_accessibility_682092eb__);
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
export { BlockRequestContext_deprecated, useBlockRequestContext } from './BlockRequestContext';
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated
|
|
5
5
|
*/
|
|
6
6
|
export declare const BlockResourceContext: React.Context<any>;
|
|
7
7
|
export declare const BlockAssociationContext: React.Context<any>;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated
|
|
10
|
-
*/
|
|
11
|
-
export declare const BlockRequestContext_deprecated: React.Context<{
|
|
12
|
-
block?: string;
|
|
13
|
-
props?: any;
|
|
14
|
-
field?: GeneralField;
|
|
15
|
-
service?: any;
|
|
16
|
-
resource?: any;
|
|
17
|
-
allowedActions?: any;
|
|
18
|
-
__parent?: any;
|
|
19
|
-
updateAssociationValues?: any[];
|
|
20
|
-
}>;
|
|
21
8
|
export declare const useBlockResource: () => any;
|
|
22
9
|
export declare const MaybeCollectionProvider: (props: any) => any;
|
|
23
10
|
/**
|
|
@@ -26,19 +13,6 @@ export declare const MaybeCollectionProvider: (props: any) => any;
|
|
|
26
13
|
* @returns
|
|
27
14
|
*/
|
|
28
15
|
export declare const BlockRequestProvider_deprecated: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated
|
|
31
|
-
*/
|
|
32
|
-
export declare const useBlockRequestContext: () => {
|
|
33
|
-
block?: string;
|
|
34
|
-
props?: any;
|
|
35
|
-
field?: GeneralField;
|
|
36
|
-
service?: any;
|
|
37
|
-
resource?: any;
|
|
38
|
-
allowedActions?: any;
|
|
39
|
-
__parent?: any;
|
|
40
|
-
updateAssociationValues?: any[];
|
|
41
|
-
};
|
|
42
16
|
export declare const RenderChildrenWithAssociationFilter: React.FC<any>;
|
|
43
17
|
export declare const useBlockContext: () => {
|
|
44
18
|
/** 用以区分卡片的标识 */
|
|
@@ -11,6 +11,7 @@ import { CollectionProvider_deprecated, useCollectionManager_deprecated, useColl
|
|
|
11
11
|
import { DataBlockCollector, useFilterBlock } from "../filter-provider/FilterProvider.mjs";
|
|
12
12
|
import { mergeIncomingFiltersFromSourceBlocks } from "../filter-provider/incomingFilterFromSources.mjs";
|
|
13
13
|
import { RecordProvider, useRecordIndex } from "../record-provider/index.mjs";
|
|
14
|
+
import { BlockRequestContext_deprecated, useBlockRequestContext } from "./BlockRequestContext.mjs";
|
|
14
15
|
import { useAssociationNames } from "./hooks/index.mjs";
|
|
15
16
|
import { useDataBlockParentRecord } from "./hooks/useDataBlockSourceId.mjs";
|
|
16
17
|
function _tagged_template_literal(strings, raw) {
|
|
@@ -61,8 +62,6 @@ const BlockResourceContext = /*#__PURE__*/ createContext(null);
|
|
|
61
62
|
BlockResourceContext.displayName = 'BlockResourceContext';
|
|
62
63
|
const BlockAssociationContext = /*#__PURE__*/ createContext(null);
|
|
63
64
|
BlockAssociationContext.displayName = 'BlockAssociationContext';
|
|
64
|
-
const BlockRequestContext_deprecated = /*#__PURE__*/ createContext({});
|
|
65
|
-
BlockRequestContext_deprecated.displayName = 'BlockRequestContext_deprecated';
|
|
66
65
|
const useBlockResource = ()=>{
|
|
67
66
|
const resource = useDataBlockResource();
|
|
68
67
|
return useContext(BlockResourceContext) || resource;
|
|
@@ -111,7 +110,6 @@ const BlockRequestProvider_deprecated = (props)=>{
|
|
|
111
110
|
})
|
|
112
111
|
});
|
|
113
112
|
};
|
|
114
|
-
const useBlockRequestContext = ()=>useContext(BlockRequestContext_deprecated);
|
|
115
113
|
const useStyles = createStyles((param)=>{
|
|
116
114
|
let { css } = param;
|
|
117
115
|
return {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { GeneralField } from '@tachybase/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*/
|
|
5
|
+
export declare const BlockRequestContext_deprecated: import("react").Context<{
|
|
6
|
+
block?: string;
|
|
7
|
+
props?: any;
|
|
8
|
+
field?: GeneralField;
|
|
9
|
+
service?: any;
|
|
10
|
+
resource?: any;
|
|
11
|
+
allowedActions?: any;
|
|
12
|
+
__parent?: any;
|
|
13
|
+
updateAssociationValues?: any[];
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
export declare const useBlockRequestContext: () => {
|
|
19
|
+
block?: string;
|
|
20
|
+
props?: any;
|
|
21
|
+
field?: GeneralField;
|
|
22
|
+
service?: any;
|
|
23
|
+
resource?: any;
|
|
24
|
+
allowedActions?: any;
|
|
25
|
+
__parent?: any;
|
|
26
|
+
updateAssociationValues?: any[];
|
|
27
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const BlockRequestContext_deprecated = createContext({});
|
|
3
|
+
BlockRequestContext_deprecated.displayName = 'BlockRequestContext_deprecated';
|
|
4
|
+
const useBlockRequestContext = ()=>useContext(BlockRequestContext_deprecated);
|
|
5
|
+
export { BlockRequestContext_deprecated, useBlockRequestContext };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CollectionRecord } from '../data-source';
|
|
2
|
+
export declare const FormBlockContext: import("react").Context<{
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
form?: any;
|
|
5
|
+
type?: "update" | "create";
|
|
6
|
+
action?: string;
|
|
7
|
+
field?: any;
|
|
8
|
+
service?: any;
|
|
9
|
+
resource?: any;
|
|
10
|
+
updateAssociationValues?: any;
|
|
11
|
+
formBlockRef?: any;
|
|
12
|
+
collectionName?: string;
|
|
13
|
+
params?: any;
|
|
14
|
+
formRecord?: CollectionRecord;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare const useFormBlockContext: () => {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
form?: any;
|
|
22
|
+
type?: "update" | "create";
|
|
23
|
+
action?: string;
|
|
24
|
+
field?: any;
|
|
25
|
+
service?: any;
|
|
26
|
+
resource?: any;
|
|
27
|
+
updateAssociationValues?: any;
|
|
28
|
+
formBlockRef?: any;
|
|
29
|
+
collectionName?: string;
|
|
30
|
+
params?: any;
|
|
31
|
+
formRecord?: CollectionRecord;
|
|
32
|
+
};
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Schema } from '@tachybase/schema';
|
|
3
|
-
|
|
4
|
-
export declare const FormBlockContext: React.Context<{
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
form?: any;
|
|
7
|
-
type?: "update" | "create";
|
|
8
|
-
action?: string;
|
|
9
|
-
field?: any;
|
|
10
|
-
service?: any;
|
|
11
|
-
resource?: any;
|
|
12
|
-
updateAssociationValues?: any;
|
|
13
|
-
formBlockRef?: any;
|
|
14
|
-
collectionName?: string;
|
|
15
|
-
params?: any;
|
|
16
|
-
formRecord?: CollectionRecord;
|
|
17
|
-
}>;
|
|
3
|
+
export { FormBlockContext, useFormBlockContext } from './FormBlockContext';
|
|
18
4
|
/**
|
|
19
5
|
* @internal
|
|
20
6
|
* 获取表单卡片的类型:update 表示是表单编辑卡片,create 表示是表单新增卡片
|
|
@@ -25,24 +11,6 @@ export declare const useFormBlockType: () => {
|
|
|
25
11
|
};
|
|
26
12
|
export declare const useIsDetailBlock: () => boolean;
|
|
27
13
|
export declare const FormBlockProvider: React.FunctionComponent<any>;
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export declare const useFormBlockContext: () => {
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
form?: any;
|
|
35
|
-
type?: "update" | "create";
|
|
36
|
-
action?: string;
|
|
37
|
-
field?: any;
|
|
38
|
-
service?: any;
|
|
39
|
-
resource?: any;
|
|
40
|
-
updateAssociationValues?: any;
|
|
41
|
-
formBlockRef?: any;
|
|
42
|
-
collectionName?: string;
|
|
43
|
-
params?: any;
|
|
44
|
-
formRecord?: CollectionRecord;
|
|
45
|
-
};
|
|
46
14
|
/**
|
|
47
15
|
* @internal
|
|
48
16
|
*/
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import react, {
|
|
2
|
+
import react, { useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { RecursionField, createForm, useField, useFieldSchema } from "@tachybase/schema";
|
|
4
4
|
import { Spin } from "antd";
|
|
5
5
|
import { withDynamicSchemaProps } from "../application/hoc/withDynamicSchemaProps.mjs";
|
|
6
6
|
import { useCollectionManager, useCollectionParentRecordData, useCollectionRecord } from "../data-source/index.mjs";
|
|
7
7
|
import { RecordProvider, useRecord } from "../record-provider/index.mjs";
|
|
8
|
-
import { useActionContext
|
|
8
|
+
import { useActionContext } from "../schema-component/antd/action/hooks.mjs";
|
|
9
9
|
import { Templates } from "../schema-component/antd/form-v2/Templates.mjs";
|
|
10
|
+
import { useDesignable } from "../schema-component/hooks/useDesignable.mjs";
|
|
10
11
|
import { BlockProvider, useBlockRequestContext } from "./BlockProvider.mjs";
|
|
12
|
+
import { FormBlockContext, useFormBlockContext } from "./FormBlockContext.mjs";
|
|
11
13
|
import { FormActiveFieldsProvider } from "./hooks/useFormActiveFields.mjs";
|
|
12
|
-
const FormBlockContext = /*#__PURE__*/ createContext({});
|
|
13
|
-
FormBlockContext.displayName = 'FormBlockContext';
|
|
14
14
|
const InternalFormBlockProvider = (props)=>{
|
|
15
15
|
var _Object_keys, _record_parentRecord;
|
|
16
16
|
const cm = useCollectionManager();
|
|
@@ -101,7 +101,6 @@ const FormBlockProvider = withDynamicSchemaProps((props)=>{
|
|
|
101
101
|
})
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
|
-
const useFormBlockContext = ()=>useContext(FormBlockContext);
|
|
105
104
|
const useFormBlockProps = function() {
|
|
106
105
|
arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
|
|
107
106
|
var _fieldSchema_xcomponentprops, _ctx_service;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ACLCollectionFieldProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { useField, useFieldSchema } from "@tachybase/schema";
|
|
4
|
+
import { useACLFieldWhitelist } from "./ACLContext.mjs";
|
|
5
|
+
import { useACLRoleContext } from "./ACLProvider.mjs";
|
|
6
|
+
const ACLCollectionFieldProvider = (props)=>{
|
|
7
|
+
const fieldSchema = useFieldSchema();
|
|
8
|
+
const field = useField();
|
|
9
|
+
const { allowAll } = useACLRoleContext();
|
|
10
|
+
const { whitelist } = useACLFieldWhitelist();
|
|
11
|
+
const [name] = fieldSchema.name.split('.');
|
|
12
|
+
const allowed = !fieldSchema['x-acl-ignore'] && whitelist.length > 0 ? whitelist.includes(name) : true;
|
|
13
|
+
const originalFieldStateRef = useRef();
|
|
14
|
+
useEffect(()=>{
|
|
15
|
+
var _originalFieldStateRef;
|
|
16
|
+
(_originalFieldStateRef = originalFieldStateRef).current || (_originalFieldStateRef.current = {
|
|
17
|
+
required: field.required,
|
|
18
|
+
display: field.display
|
|
19
|
+
});
|
|
20
|
+
if (allowed) {
|
|
21
|
+
field.required = originalFieldStateRef.current.required;
|
|
22
|
+
field.display = originalFieldStateRef.current.display;
|
|
23
|
+
} else {
|
|
24
|
+
field.required = false;
|
|
25
|
+
field.display = 'hidden';
|
|
26
|
+
}
|
|
27
|
+
}, [
|
|
28
|
+
allowed,
|
|
29
|
+
field
|
|
30
|
+
]);
|
|
31
|
+
if (allowAll) return /*#__PURE__*/ jsx(Fragment, {
|
|
32
|
+
children: props.children
|
|
33
|
+
});
|
|
34
|
+
if (!fieldSchema['x-collection-field']) return /*#__PURE__*/ jsx(Fragment, {
|
|
35
|
+
children: props.children
|
|
36
|
+
});
|
|
37
|
+
if (!allowed) return null;
|
|
38
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
39
|
+
children: props.children
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export { ACLCollectionFieldProvider };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Schema } from '@tachybase/schema';
|
|
2
|
+
export declare const ACLContext: import("react").Context<any>;
|
|
3
|
+
export declare const useACLContext: () => any;
|
|
4
|
+
export declare const ACLActionParamsContext: import("react").Context<any>;
|
|
5
|
+
export declare const useACLActionParamsContext: () => any;
|
|
6
|
+
export declare const useACLFieldWhitelist: () => {
|
|
7
|
+
whitelist: any[];
|
|
8
|
+
schemaInWhitelist(fieldSchema: Schema, isSkip?: any): boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const ACLContext = createContext({});
|
|
3
|
+
ACLContext.displayName = 'ACLContext';
|
|
4
|
+
const useACLContext = ()=>useContext(ACLContext);
|
|
5
|
+
const ACLActionParamsContext = createContext({});
|
|
6
|
+
ACLActionParamsContext.displayName = 'ACLActionParamsContext';
|
|
7
|
+
const useACLActionParamsContext = ()=>useContext(ACLActionParamsContext);
|
|
8
|
+
const useACLFieldWhitelist = ()=>{
|
|
9
|
+
const context = useContext(ACLActionParamsContext);
|
|
10
|
+
const params = (null == context ? void 0 : context.params) || context;
|
|
11
|
+
const whitelist = [].concat((null == params ? void 0 : params.whitelist) || []).concat((null == params ? void 0 : params.fields) || []).concat((null == params ? void 0 : params.appends) || []);
|
|
12
|
+
return {
|
|
13
|
+
whitelist,
|
|
14
|
+
schemaInWhitelist (fieldSchema, isSkip) {
|
|
15
|
+
if (isSkip) return true;
|
|
16
|
+
if (0 === whitelist.length) return true;
|
|
17
|
+
if (!fieldSchema) return true;
|
|
18
|
+
if (!fieldSchema['x-collection-field']) return true;
|
|
19
|
+
const [key1, key2] = fieldSchema['x-collection-field'].split('.');
|
|
20
|
+
return null == whitelist ? void 0 : whitelist.includes(key2 || key1);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export { ACLActionParamsContext, ACLContext, useACLActionParamsContext, useACLContext, useACLFieldWhitelist };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Plugin } from "../../application/Plugin.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { ACLCollectionFieldProvider } from "./ACLCollectionFieldProvider.mjs";
|
|
3
|
+
import { ACLActionProvider, ACLCollectionProvider, ACLMenuItemProvider } from "./ACLProvider.mjs";
|
|
3
4
|
class ACLPlugin extends Plugin {
|
|
4
5
|
async load() {
|
|
5
6
|
this.app.addComponents({
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Schema } from '@tachybase/schema';
|
|
3
|
-
export declare const ACLContext: React.Context<any>;
|
|
4
1
|
export declare const ACLProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
5
2
|
export declare const ACLRolesCheckProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
6
3
|
export declare const useRoleRecheck: () => () => void;
|
|
7
|
-
export declare const useACLContext: () => any;
|
|
8
|
-
export declare const ACLActionParamsContext: React.Context<any>;
|
|
9
4
|
export declare const useACLRolesCheck: () => {
|
|
10
5
|
data: any;
|
|
11
6
|
getActionAlias: (actionPath: string) => any;
|
|
@@ -15,12 +10,6 @@ export declare const useACLRolesCheck: () => {
|
|
|
15
10
|
};
|
|
16
11
|
export declare function useACLRoleContext(): any;
|
|
17
12
|
export declare const ACLCollectionProvider: (props: any) => any;
|
|
18
|
-
export declare const useACLActionParamsContext: () => any;
|
|
19
13
|
export declare const useRecordPkValue: () => any;
|
|
20
14
|
export declare const ACLActionProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export declare const useACLFieldWhitelist: () => {
|
|
22
|
-
whitelist: any[];
|
|
23
|
-
schemaInWhitelist(fieldSchema: Schema, isSkip?: any): boolean;
|
|
24
|
-
};
|
|
25
|
-
export declare const ACLCollectionFieldProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
26
15
|
export declare const ACLMenuItemProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { useFieldSchema } from "@tachybase/schema";
|
|
4
4
|
import { omit } from "lodash";
|
|
5
5
|
import { Navigate } from "react-router-dom";
|
|
6
6
|
import { useAPIClient, useRequest } from "../../api-client/index.mjs";
|
|
@@ -11,11 +11,11 @@ import { useResourceActionContext } from "../../collection-manager/ResourceActio
|
|
|
11
11
|
import { useDataSourceKey } from "../../data-source/data-source/DataSourceProvider.mjs";
|
|
12
12
|
import { useRecord } from "../../record-provider/index.mjs";
|
|
13
13
|
import { SchemaComponentOptions, useDesignable } from "../../schema-component/index.mjs";
|
|
14
|
-
|
|
15
|
-
ACLContext
|
|
14
|
+
import { ACLCollectionFieldProvider } from "./ACLCollectionFieldProvider.mjs";
|
|
15
|
+
import { ACLActionParamsContext, ACLContext } from "./ACLContext.mjs";
|
|
16
16
|
const ACLProvider = (props)=>/*#__PURE__*/ jsx(SchemaComponentOptions, {
|
|
17
17
|
components: {
|
|
18
|
-
ACLCollectionFieldProvider,
|
|
18
|
+
ACLCollectionFieldProvider: ACLCollectionFieldProvider,
|
|
19
19
|
ACLActionProvider,
|
|
20
20
|
ACLMenuItemProvider,
|
|
21
21
|
ACLCollectionProvider
|
|
@@ -63,9 +63,6 @@ const useRoleRecheck = ()=>{
|
|
|
63
63
|
ctx.refresh();
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
const useACLContext = ()=>useContext(ACLContext);
|
|
67
|
-
const ACLActionParamsContext = /*#__PURE__*/ createContext({});
|
|
68
|
-
ACLActionParamsContext.displayName = 'ACLActionParamsContext';
|
|
69
66
|
const useACLRolesCheck = ()=>{
|
|
70
67
|
var _ctx_data, _ctx_data1;
|
|
71
68
|
const ctx = useContext(ACLContext);
|
|
@@ -176,7 +173,6 @@ const ACLCollectionProvider = (props)=>{
|
|
|
176
173
|
children: props.children
|
|
177
174
|
});
|
|
178
175
|
};
|
|
179
|
-
const useACLActionParamsContext = ()=>useContext(ACLActionParamsContext);
|
|
180
176
|
const useRecordPkValue = ()=>{
|
|
181
177
|
const { getPrimaryKey } = useCollection_deprecated();
|
|
182
178
|
const record = useRecord();
|
|
@@ -224,47 +220,6 @@ const ACLActionProvider = (props)=>{
|
|
|
224
220
|
children: props.children
|
|
225
221
|
});
|
|
226
222
|
};
|
|
227
|
-
const useACLFieldWhitelist = ()=>{
|
|
228
|
-
const params = useContext(ACLActionParamsContext);
|
|
229
|
-
const whitelist = [].concat((null == params ? void 0 : params.whitelist) || []).concat((null == params ? void 0 : params.fields) || []).concat((null == params ? void 0 : params.appends) || []);
|
|
230
|
-
return {
|
|
231
|
-
whitelist,
|
|
232
|
-
schemaInWhitelist (fieldSchema, isSkip) {
|
|
233
|
-
if (isSkip) return true;
|
|
234
|
-
if (0 === whitelist.length) return true;
|
|
235
|
-
if (!fieldSchema) return true;
|
|
236
|
-
if (!fieldSchema['x-collection-field']) return true;
|
|
237
|
-
const [key1, key2] = fieldSchema['x-collection-field'].split('.');
|
|
238
|
-
return null == whitelist ? void 0 : whitelist.includes(key2 || key1);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
const ACLCollectionFieldProvider = (props)=>{
|
|
243
|
-
const fieldSchema = useFieldSchema();
|
|
244
|
-
const field = useField();
|
|
245
|
-
const { allowAll } = useACLRoleContext();
|
|
246
|
-
const { whitelist } = useACLFieldWhitelist();
|
|
247
|
-
const [name] = fieldSchema.name.split('.');
|
|
248
|
-
const allowed = !fieldSchema['x-acl-ignore'] && whitelist.length > 0 ? whitelist.includes(name) : true;
|
|
249
|
-
useEffect(()=>{
|
|
250
|
-
if (!allowed) {
|
|
251
|
-
field.required = false;
|
|
252
|
-
field.display = 'hidden';
|
|
253
|
-
}
|
|
254
|
-
}, [
|
|
255
|
-
allowed
|
|
256
|
-
]);
|
|
257
|
-
if (allowAll) return /*#__PURE__*/ jsx(Fragment, {
|
|
258
|
-
children: props.children
|
|
259
|
-
});
|
|
260
|
-
if (!fieldSchema['x-collection-field']) return /*#__PURE__*/ jsx(Fragment, {
|
|
261
|
-
children: props.children
|
|
262
|
-
});
|
|
263
|
-
if (!allowed) return null;
|
|
264
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
265
|
-
children: props.children
|
|
266
|
-
});
|
|
267
|
-
};
|
|
268
223
|
const ACLMenuItemProvider = (props)=>{
|
|
269
224
|
const { allowAll, allowMenuItemIds = [], snippets } = useACLRoleContext();
|
|
270
225
|
const fieldSchema = useFieldSchema();
|
|
@@ -279,4 +234,4 @@ const ACLMenuItemProvider = (props)=>{
|
|
|
279
234
|
});
|
|
280
235
|
return null;
|
|
281
236
|
};
|
|
282
|
-
export {
|
|
237
|
+
export { ACLActionProvider, ACLCollectionProvider, ACLMenuItemProvider, ACLProvider, ACLRolesCheckProvider, useACLRoleContext, useACLRolesCheck, useRecordPkValue, useRoleRecheck };
|
|
@@ -5,7 +5,8 @@ import { useCollectionManager } from "../../data-source/collection/CollectionMan
|
|
|
5
5
|
import { DEFAULT_DATA_SOURCE_KEY } from "../../data-source/data-source/DataSourceManager.mjs";
|
|
6
6
|
import { useDataSourceManager } from "../../data-source/data-source/DataSourceManagerProvider.mjs";
|
|
7
7
|
import { useDataSource } from "../../data-source/data-source/DataSourceProvider.mjs";
|
|
8
|
-
import { useCompile
|
|
8
|
+
import { useCompile } from "../../schema-component/hooks/useCompile.mjs";
|
|
9
|
+
import { useSchemaComponentContext } from "../../schema-component/hooks/useSchemaComponentContext.mjs";
|
|
9
10
|
const useCollectionManager_deprecated = (dataSourceName)=>{
|
|
10
11
|
const dm = useDataSourceManager();
|
|
11
12
|
const dataSource = useDataSource();
|