refactor: reorganize files and fix association field config visible problem
This commit is contained in:
parent
f6646f5825
commit
930e077e68
@ -1,4 +1,4 @@
|
|||||||
export * from './GroupBlockConfigure/GroupBlockConfigure';
|
export * from '../schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure';
|
||||||
export * from './PDFViewer';
|
export * from './PDFViewer';
|
||||||
export * from './Sheet';
|
export * from './Sheet';
|
||||||
export * from './SignatureInput';
|
export * from './SignatureInput';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { useField, useFieldSchema } from '@formily/react';
|
import { useField, useFieldSchema } from '@formily/react';
|
||||||
import { findFilterTargets, useAPIClient, useBlockRequestContext, useFilterBlock } from '@nocobase/client';
|
import { findFilterTargets, useAPIClient, useBlockRequestContext, useFilterBlock } from '@nocobase/client';
|
||||||
import { Descriptions, DescriptionsProps, Spin } from 'antd';
|
import { Descriptions, DescriptionsProps, Spin } from 'antd';
|
||||||
import { transformers } from '../components/GroupBlockConfigure/transformers';
|
import { transformers } from './GroupBlockConfigure/transformers';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useAsyncEffect } from 'ahooks';
|
import { useAsyncEffect } from 'ahooks';
|
||||||
|
|
||||||
type DataItem = {
|
type DataItem = {
|
@ -1,8 +1,8 @@
|
|||||||
import { SchemaSettingsItem } from '@nocobase/client';
|
import { SchemaSettingsItem } from '@nocobase/client';
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { useTranslation } from '../../locale';
|
import { useTranslation } from '../../../locale';
|
||||||
import { Modal } from 'antd';
|
import { Modal } from 'antd';
|
||||||
import { GroupBlockContext } from '../../schema-initializer/blocks/GroupBlockInitializer';
|
import { GroupBlockContext } from '../../../schema-initializer/blocks/GroupBlockInitializer';
|
||||||
|
|
||||||
export const GroupBlockConfigure = (props) => {
|
export const GroupBlockConfigure = (props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
@ -2,8 +2,8 @@ import { useField, useFieldSchema } from '@formily/react';
|
|||||||
import { useDesignable, useFieldNames, useFilterBlock } from '@nocobase/client';
|
import { useDesignable, useFieldNames, useFilterBlock } from '@nocobase/client';
|
||||||
import { App, Button, Flex, Input, Modal, Select } from 'antd';
|
import { App, Button, Flex, Input, Modal, Select } from 'antd';
|
||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useContext, useEffect, useState } from 'react';
|
||||||
import { useTranslation } from '../../locale';
|
import { useTranslation } from '../../../locale';
|
||||||
import { GroupBlockContext } from '../../schema-initializer/blocks/GroupBlockInitializer';
|
import { GroupBlockContext } from '../../../schema-initializer/blocks/GroupBlockInitializer';
|
||||||
import { transformers } from './transformers';
|
import { transformers } from './transformers';
|
||||||
import { DeleteOutlined, PullRequestOutlined } from '@ant-design/icons';
|
import { DeleteOutlined, PullRequestOutlined } from '@ant-design/icons';
|
||||||
import { uid } from '@formily/shared';
|
import { uid } from '@formily/shared';
|
@ -1,8 +1,8 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { PDFViewer } from '../components/PDFViewer';
|
import { PDFViewer } from '../../components/PDFViewer';
|
||||||
import { Space } from 'antd';
|
import { Space } from 'antd';
|
||||||
import { css } from '@nocobase/client';
|
import { css } from '@nocobase/client';
|
||||||
import { usePDFViewerRef } from '../schema-initializer/blocks/PDFVIewerBlockInitializer';
|
import { usePDFViewerRef } from '../../schema-initializer/blocks/PDFVIewerBlockInitializer';
|
||||||
|
|
||||||
export const InternalPDFViewer = (props) => {
|
export const InternalPDFViewer = (props) => {
|
||||||
const { usePdfPath: useMaybePdfPath } = props;
|
const { usePdfPath: useMaybePdfPath } = props;
|
@ -1,6 +1,6 @@
|
|||||||
export * from './AutoComplete/AutoComplete';
|
export * from './auto-complete/AutoComplete';
|
||||||
export * from './GroupBlock';
|
export * from './blocks/GroupBlock';
|
||||||
export * from './PDFViewer';
|
export * from './blocks/PDFViewer';
|
||||||
export * from './date-picker';
|
export * from './date-picker';
|
||||||
export * from './deprecated/ExtendedMenuDesigner';
|
export * from './deprecated/ExtendedMenuDesigner';
|
||||||
export * from './remote-select';
|
export * from './remote-select';
|
||||||
|
@ -16,8 +16,8 @@ import {
|
|||||||
import React, { createContext, useState } from 'react';
|
import React, { createContext, useState } from 'react';
|
||||||
import { uid } from '@nocobase/utils/client';
|
import { uid } from '@nocobase/utils/client';
|
||||||
import { Checkbox, Spin } from 'antd';
|
import { Checkbox, Spin } from 'antd';
|
||||||
import { GroupBlockConfigure } from '../../components/GroupBlockConfigure/GroupBlockConfigure';
|
import { GroupBlockConfigure } from '../../schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure';
|
||||||
import { GroupConfigure } from '../../components/GroupBlockConfigure/GroupConfigure';
|
import { GroupConfigure } from '../../schema-components/blocks/GroupBlockConfigure/GroupConfigure';
|
||||||
|
|
||||||
export const GroupBlockContext = createContext<any>({});
|
export const GroupBlockContext = createContext<any>({});
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from './CustomFilterFormItemInitializer';
|
export * from './items/CustomFilterFormItemInitializer';
|
||||||
export * from './blocks/PDFVIewerBlockInitializer';
|
export * from './blocks/PDFVIewerBlockInitializer';
|
||||||
export * from './actions/OutboundLinkActionInitializer';
|
export * from './actions/OutboundLinkActionInitializer';
|
||||||
export * from './actions/CreateSubmitActionInitializer';
|
export * from './actions/CreateSubmitActionInitializer';
|
||||||
|
@ -37,10 +37,10 @@ import {
|
|||||||
EditTitleField,
|
EditTitleField,
|
||||||
SchemaSettingCollection,
|
SchemaSettingCollection,
|
||||||
SchemaSettingComponent,
|
SchemaSettingComponent,
|
||||||
} from '../schema-settings';
|
} from '../../schema-settings';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { SchemaSettingsRemove } from '../components/FormFilter/SchemaSettingsRemove';
|
import { SchemaSettingsRemove } from '../../components/FormFilter/SchemaSettingsRemove';
|
||||||
import { tval, useTranslation } from '../locale';
|
import { tval, useTranslation } from '../../locale';
|
||||||
import { ContractsController } from 'packages/plugins/@hera/plugin-rental/dist/server/actions';
|
import { ContractsController } from 'packages/plugins/@hera/plugin-rental/dist/server/actions';
|
||||||
|
|
||||||
const FieldComponentProps: React.FC = observer(
|
const FieldComponentProps: React.FC = observer(
|
||||||
@ -221,13 +221,14 @@ export const FilterCustomItemInitializer: React.FC<{
|
|||||||
title: tval('Association field'),
|
title: tval('Association field'),
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Select',
|
'x-component': 'Select',
|
||||||
|
'x-visible': false,
|
||||||
|
required: true,
|
||||||
'x-reactions': [
|
'x-reactions': [
|
||||||
{
|
{
|
||||||
dependencies: ['collection', 'component'],
|
dependencies: ['collection', 'component'],
|
||||||
when: "{{$deps[1] === 'AssociationCascader'}}",
|
|
||||||
fulfill: {
|
fulfill: {
|
||||||
schema: {
|
schema: {
|
||||||
'x-visible': '{{$deps[0] ? true : false}}',
|
'x-visible': "{{$deps[0] && $deps[1] === 'AssociationCascader'}}",
|
||||||
enum: '{{ useAssociationFields($deps[0]) }}',
|
enum: '{{ useAssociationFields($deps[0]) }}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -278,14 +279,8 @@ export const FilterCustomItemInitializer: React.FC<{
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { title, component, collection, associationField } = values;
|
const { title, component, collection, associationField } = values;
|
||||||
console.log('=-=======', associationField);
|
|
||||||
const defaultSchema = getInterface(component)?.default?.uiSchema || {};
|
const defaultSchema = getInterface(component)?.default?.uiSchema || {};
|
||||||
let name;
|
const name = uid();
|
||||||
if (component === 'Select' || component === 'AutoComplete') {
|
|
||||||
name = collection;
|
|
||||||
} else {
|
|
||||||
name = component + uid();
|
|
||||||
}
|
|
||||||
insert(
|
insert(
|
||||||
gridRowColWrap({
|
gridRowColWrap({
|
||||||
'x-component': component,
|
'x-component': component,
|
@ -17,5 +17,6 @@
|
|||||||
"Signature input": "Signature input",
|
"Signature input": "Signature input",
|
||||||
"Pick a data entry for viewing and editing": "Pick a data entry for viewing and editing",
|
"Pick a data entry for viewing and editing": "Pick a data entry for viewing and editing",
|
||||||
"Please select": "Please select",
|
"Please select": "Please select",
|
||||||
|
"Association field": "Association field",
|
||||||
"HomePage Config": "HomePage Config"
|
"HomePage Config": "HomePage Config"
|
||||||
}
|
}
|
||||||
|
@ -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": "关联字段",
|
||||||
"HomePage Config": "主页配置"
|
"HomePage Config": "主页配置"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user