diff --git a/packages/api/package.json b/packages/api/package.json
index 4a595ea58..852277bfd 100644
--- a/packages/api/package.json
+++ b/packages/api/package.json
@@ -1,6 +1,5 @@
{
"name": "@nocobase/api",
- "private": true,
"version": "0.6.0-alpha.0",
"description": "",
"license": "MIT",
diff --git a/packages/app/package.json b/packages/app/package.json
index aa1ecd5b4..d6341677c 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -1,7 +1,6 @@
{
"name": "@nocobase/app",
"version": "0.6.0-alpha.0",
- "private": true,
"scripts": {
"start": "umi dev",
"build": "umi build",
diff --git a/packages/client/src/acl/ACLProvider.tsx b/packages/client/src/acl/ACLProvider.tsx
index 8e54f29d7..8e476d686 100644
--- a/packages/client/src/acl/ACLProvider.tsx
+++ b/packages/client/src/acl/ACLProvider.tsx
@@ -46,6 +46,21 @@ export const ACLRolesCheckProvider = (props) => {
return {props.children};
};
+export const useRoleRecheck = () => {
+ const ctx = useContext(ACLContext);
+ const { allowAll, allowConfigure } = useACLRoleContext();
+ return () => {
+ if (allowAll) {
+ return;
+ }
+ ctx.refresh();
+ }
+}
+
+export const useACLContext = () => {
+ return useContext(ACLContext);
+}
+
export const useACLRoleContext = () => {
const ctx = useContext(ACLContext);
const data = ctx.data?.data;
diff --git a/packages/client/src/schema-component/antd/menu/MenuItemInitializers/index.tsx b/packages/client/src/schema-component/antd/menu/MenuItemInitializers/index.tsx
index b35d976f9..2e757d38c 100644
--- a/packages/client/src/schema-component/antd/menu/MenuItemInitializers/index.tsx
+++ b/packages/client/src/schema-component/antd/menu/MenuItemInitializers/index.tsx
@@ -3,16 +3,21 @@ import { SchemaOptionsContext } from '@formily/react';
import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next';
import { SchemaComponent, SchemaComponentOptions } from '../../..';
+import { useRoleRecheck } from '../../../../acl';
import { SchemaInitializer } from '../../../../schema-initializer';
export const MenuItemInitializers = (props: any) => {
const { t } = useTranslation();
+ const recheck = useRoleRecheck();
return (
{
+ recheck?.();
+ }}
{...props}
items={[
{
diff --git a/packages/client/src/schema-component/hooks/useDesignable.tsx b/packages/client/src/schema-component/hooks/useDesignable.tsx
index a9b066f67..2ee78ee90 100644
--- a/packages/client/src/schema-component/hooks/useDesignable.tsx
+++ b/packages/client/src/schema-component/hooks/useDesignable.tsx
@@ -306,7 +306,7 @@ export class Designable {
if (!Schema.isSchemaInstance(this.current)) {
return;
}
- const opts = {};
+ const opts = { onSuccess: options.onSuccess };
const { wrap = defaultWrap, breakRemoveOn, removeParentsIfNoChildren } = options;
if (Schema.isSchemaInstance(schema)) {
if (this.parentsIn(schema)) {
@@ -363,7 +363,7 @@ export class Designable {
if (!Schema.isSchemaInstance(this.current)) {
return;
}
- const opts = {};
+ const opts = { onSuccess: options.onSuccess };
const { wrap = defaultWrap, breakRemoveOn, removeParentsIfNoChildren } = options;
if (Schema.isSchemaInstance(schema)) {
if (this.parentsIn(schema)) {
@@ -411,7 +411,7 @@ export class Designable {
if (!Schema.isSchemaInstance(this.current)) {
return;
}
- const opts = {};
+ const opts = { onSuccess: options.onSuccess };
const { wrap = defaultWrap, breakRemoveOn, removeParentsIfNoChildren } = options;
if (Schema.isSchemaInstance(schema)) {
if (this.parentsIn(schema)) {
diff --git a/packages/client/src/schema-initializer/SchemaInitializer.tsx b/packages/client/src/schema-initializer/SchemaInitializer.tsx
index 76a423dc8..6fd9d0dcd 100644
--- a/packages/client/src/schema-initializer/SchemaInitializer.tsx
+++ b/packages/client/src/schema-initializer/SchemaInitializer.tsx
@@ -29,6 +29,7 @@ SchemaInitializer.Button = observer((props: SchemaInitializerButtonProps) => {
component,
style,
icon,
+ onSuccess,
...others
} = props;
const compile = useCompile();
@@ -38,7 +39,7 @@ SchemaInitializer.Button = observer((props: SchemaInitializerButtonProps) => {
if (props.insert) {
props.insert(wrap(schema));
} else {
- insertAdjacent(insertPosition, wrap(schema));
+ insertAdjacent(insertPosition, wrap(schema), { onSuccess });
}
};
const renderItems = (items: any) => {
diff --git a/packages/client/src/schema-initializer/types.ts b/packages/client/src/schema-initializer/types.ts
index b44f649d2..cd1a6adb9 100644
--- a/packages/client/src/schema-initializer/types.ts
+++ b/packages/client/src/schema-initializer/types.ts
@@ -9,6 +9,7 @@ export interface SchemaInitializerButtonProps extends ButtonProps {
dropdown?: DropDownProps;
component?: any;
designable?: boolean;
+ onSuccess?: any;
}
export type SchemaInitializerItemOptions = ItemGroupOptions | SubMenuOptions | ItemOptions | DividerOptions;
diff --git a/packages/database/package.json b/packages/database/package.json
index 8f1da5854..8ce3294d8 100644
--- a/packages/database/package.json
+++ b/packages/database/package.json
@@ -1,7 +1,6 @@
{
"name": "@nocobase/database",
"version": "0.6.0-alpha.0",
- "private": true,
"description": "",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
diff --git a/packages/plugin-workflow/package.json b/packages/plugin-workflow/package.json
index 3ec9ef352..bcdbe2bda 100644
--- a/packages/plugin-workflow/package.json
+++ b/packages/plugin-workflow/package.json
@@ -2,7 +2,6 @@
"name": "@nocobase/plugin-workflow",
"version": "0.6.0-alpha.0",
"main": "lib/index.js",
- "private": true,
"license": "MIT",
"scripts": {
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm",