mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
feat: support attachment file fields in public forms (#5749)
* feat: support attachment file fields in public forms * fix: bug
This commit is contained in:
parent
9aae0e68fa
commit
2fcd584846
@ -20,7 +20,7 @@ import {
|
||||
SchemaComponentOptions,
|
||||
Uploader,
|
||||
useActionContext,
|
||||
useSchemaOptionsContext,
|
||||
useDesignable,
|
||||
} from '../..';
|
||||
import {
|
||||
TableSelectorParamsProvider,
|
||||
@ -157,6 +157,7 @@ const InternalFileManager = (props) => {
|
||||
const [selectedRows, setSelectedRows] = useState([]);
|
||||
const insertSelector = useInsertSchema('Selector');
|
||||
const fieldNames = useFieldNames(props);
|
||||
const { designable } = useDesignable();
|
||||
const field: any = useField();
|
||||
const [options, setOptions] = useState([]);
|
||||
const { getField } = useCollection_deprecated();
|
||||
@ -167,7 +168,11 @@ const InternalFileManager = (props) => {
|
||||
const handleSelect = (ev) => {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
if (designable) {
|
||||
insertSelector(schema.Selector);
|
||||
} else {
|
||||
fieldSchema.addProperty('selector', schema.Selector);
|
||||
}
|
||||
setVisibleSelector(true);
|
||||
setSelectedRows([]);
|
||||
};
|
||||
|
@ -162,11 +162,17 @@ export class PluginPublicFormsServer extends Plugin {
|
||||
return next();
|
||||
}
|
||||
const { resourceName, actionName } = ctx.action;
|
||||
const collection = this.db.getCollection(resourceName);
|
||||
if (actionName === 'create' && ctx.PublicForm['collectionName'] === resourceName) {
|
||||
ctx.permission = {
|
||||
skip: true,
|
||||
};
|
||||
} else if (actionName === 'list' && ctx.PublicForm['targetCollections'].includes(resourceName)) {
|
||||
} else if (
|
||||
(actionName === 'list' && ctx.PublicForm['targetCollections'].includes(resourceName)) ||
|
||||
(collection.options.template === 'file' && actionName === 'create') ||
|
||||
(resourceName === 'storages' && actionName === 'getRules') ||
|
||||
(resourceName === 'map-configuration' && actionName === 'get')
|
||||
) {
|
||||
ctx.permission = {
|
||||
skip: true,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user