refactor: reorganize files and fix association field config visible problem

This commit is contained in:
sealday 2024-03-22 03:38:19 +08:00
parent f6646f5825
commit 930e077e68
13 changed files with 24 additions and 27 deletions

View File

@ -1,4 +1,4 @@
export * from './GroupBlockConfigure/GroupBlockConfigure';
export * from '../schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure';
export * from './PDFViewer';
export * from './Sheet';
export * from './SignatureInput';

View File

@ -1,8 +1,8 @@
import { useField, useFieldSchema } from '@formily/react';
import { findFilterTargets, useAPIClient, useBlockRequestContext, useFilterBlock } from '@nocobase/client';
import { Descriptions, DescriptionsProps, Spin } from 'antd';
import { transformers } from '../components/GroupBlockConfigure/transformers';
import React, { useEffect, useState } from 'react';
import { transformers } from './GroupBlockConfigure/transformers';
import React, { useState } from 'react';
import { useAsyncEffect } from 'ahooks';
type DataItem = {

View File

@ -1,8 +1,8 @@
import { SchemaSettingsItem } from '@nocobase/client';
import React, { useContext } from 'react';
import { useTranslation } from '../../locale';
import { useTranslation } from '../../../locale';
import { Modal } from 'antd';
import { GroupBlockContext } from '../../schema-initializer/blocks/GroupBlockInitializer';
import { GroupBlockContext } from '../../../schema-initializer/blocks/GroupBlockInitializer';
export const GroupBlockConfigure = (props) => {
const { t } = useTranslation();

View File

@ -2,8 +2,8 @@ import { useField, useFieldSchema } from '@formily/react';
import { useDesignable, useFieldNames, useFilterBlock } from '@nocobase/client';
import { App, Button, Flex, Input, Modal, Select } from 'antd';
import React, { useContext, useEffect, useState } from 'react';
import { useTranslation } from '../../locale';
import { GroupBlockContext } from '../../schema-initializer/blocks/GroupBlockInitializer';
import { useTranslation } from '../../../locale';
import { GroupBlockContext } from '../../../schema-initializer/blocks/GroupBlockInitializer';
import { transformers } from './transformers';
import { DeleteOutlined, PullRequestOutlined } from '@ant-design/icons';
import { uid } from '@formily/shared';

View File

@ -1,8 +1,8 @@
import React, { useEffect, useRef, useState } from 'react';
import { PDFViewer } from '../components/PDFViewer';
import { PDFViewer } from '../../components/PDFViewer';
import { Space } from 'antd';
import { css } from '@nocobase/client';
import { usePDFViewerRef } from '../schema-initializer/blocks/PDFVIewerBlockInitializer';
import { usePDFViewerRef } from '../../schema-initializer/blocks/PDFVIewerBlockInitializer';
export const InternalPDFViewer = (props) => {
const { usePdfPath: useMaybePdfPath } = props;

View File

@ -1,6 +1,6 @@
export * from './AutoComplete/AutoComplete';
export * from './GroupBlock';
export * from './PDFViewer';
export * from './auto-complete/AutoComplete';
export * from './blocks/GroupBlock';
export * from './blocks/PDFViewer';
export * from './date-picker';
export * from './deprecated/ExtendedMenuDesigner';
export * from './remote-select';

View File

@ -16,8 +16,8 @@ import {
import React, { createContext, useState } from 'react';
import { uid } from '@nocobase/utils/client';
import { Checkbox, Spin } from 'antd';
import { GroupBlockConfigure } from '../../components/GroupBlockConfigure/GroupBlockConfigure';
import { GroupConfigure } from '../../components/GroupBlockConfigure/GroupConfigure';
import { GroupBlockConfigure } from '../../schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure';
import { GroupConfigure } from '../../schema-components/blocks/GroupBlockConfigure/GroupConfigure';
export const GroupBlockContext = createContext<any>({});

View File

@ -1,4 +1,4 @@
export * from './CustomFilterFormItemInitializer';
export * from './items/CustomFilterFormItemInitializer';
export * from './blocks/PDFVIewerBlockInitializer';
export * from './actions/OutboundLinkActionInitializer';
export * from './actions/CreateSubmitActionInitializer';

View File

@ -37,10 +37,10 @@ import {
EditTitleField,
SchemaSettingCollection,
SchemaSettingComponent,
} from '../schema-settings';
} from '../../schema-settings';
import _ from 'lodash';
import { SchemaSettingsRemove } from '../components/FormFilter/SchemaSettingsRemove';
import { tval, useTranslation } from '../locale';
import { SchemaSettingsRemove } from '../../components/FormFilter/SchemaSettingsRemove';
import { tval, useTranslation } from '../../locale';
import { ContractsController } from 'packages/plugins/@hera/plugin-rental/dist/server/actions';
const FieldComponentProps: React.FC = observer(
@ -221,13 +221,14 @@ export const FilterCustomItemInitializer: React.FC<{
title: tval('Association field'),
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-visible': false,
required: true,
'x-reactions': [
{
dependencies: ['collection', 'component'],
when: "{{$deps[1] === 'AssociationCascader'}}",
fulfill: {
schema: {
'x-visible': '{{$deps[0] ? true : false}}',
'x-visible': "{{$deps[0] && $deps[1] === 'AssociationCascader'}}",
enum: '{{ useAssociationFields($deps[0]) }}',
},
},
@ -278,14 +279,8 @@ export const FilterCustomItemInitializer: React.FC<{
},
});
const { title, component, collection, associationField } = values;
console.log('=-=======', associationField);
const defaultSchema = getInterface(component)?.default?.uiSchema || {};
let name;
if (component === 'Select' || component === 'AutoComplete') {
name = collection;
} else {
name = component + uid();
}
const name = uid();
insert(
gridRowColWrap({
'x-component': component,

View File

@ -17,5 +17,6 @@
"Signature input": "Signature input",
"Pick a data entry for viewing and editing": "Pick a data entry for viewing and editing",
"Please select": "Please select",
"Association field": "Association field",
"HomePage Config": "HomePage Config"
}

View File

@ -17,5 +17,6 @@
"Signature input": "手写签名",
"Pick a data entry for viewing and editing": "选择一条数据用于查看与编辑",
"Please select": "请选择",
"Association field": "关联字段",
"HomePage Config": "主页配置"
}