fix: when the page has FixedBlock, the table of popup is not displayed (#1619)
* fix: when the page has FixedBlock, the table of popup is not displayed * feat: improve disable link * docs: update * feat: improve fixedblock design item
This commit is contained in:
parent
0853915f23
commit
6b47597256
@ -1,7 +1,7 @@
|
|||||||
import { ISchema, useField, useFieldSchema } from '@formily/react';
|
import { ISchema, useField, useFieldSchema } from '@formily/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useCompile, useDesignable, useFixedBlockDesignerSetting } from '../..';
|
import { FixedBlockDesignerItem, useCompile, useDesignable } from '../..';
|
||||||
import { useCalendarBlockContext } from '../../../block-provider';
|
import { useCalendarBlockContext } from '../../../block-provider';
|
||||||
import { useCollection, useCollectionManager } from '../../../collection-manager';
|
import { useCollection, useCollectionManager } from '../../../collection-manager';
|
||||||
import { useCollectionFilterOptions } from '../../../collection-manager/action-hooks';
|
import { useCollectionFilterOptions } from '../../../collection-manager/action-hooks';
|
||||||
@ -21,7 +21,6 @@ export const CalendarDesigner = () => {
|
|||||||
const defaultFilter = fieldSchema?.['x-decorator-props']?.params?.filter || {};
|
const defaultFilter = fieldSchema?.['x-decorator-props']?.params?.filter || {};
|
||||||
const fieldNames = fieldSchema?.['x-decorator-props']?.['fieldNames'] || {};
|
const fieldNames = fieldSchema?.['x-decorator-props']?.['fieldNames'] || {};
|
||||||
const defaultResource = fieldSchema?.['x-decorator-props']?.resource;
|
const defaultResource = fieldSchema?.['x-decorator-props']?.resource;
|
||||||
const fixedBlockDesignerSetting = useFixedBlockDesignerSetting();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner template={template} title={title || name}>
|
<GeneralSchemaDesigner template={template} title={title || name}>
|
||||||
@ -62,7 +61,7 @@ export const CalendarDesigner = () => {
|
|||||||
dn.refresh();
|
dn.refresh();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{fixedBlockDesignerSetting}
|
<FixedBlockDesignerItem />
|
||||||
<SchemaSettings.CascaderItem
|
<SchemaSettings.CascaderItem
|
||||||
title={t('Start date field')}
|
title={t('Start date field')}
|
||||||
value={fieldNames.start}
|
value={fieldNames.start}
|
||||||
|
@ -7,7 +7,7 @@ import { useCollectionFilterOptions } from '../../../collection-manager/action-h
|
|||||||
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
||||||
import { useSchemaTemplate } from '../../../schema-templates';
|
import { useSchemaTemplate } from '../../../schema-templates';
|
||||||
import { useDesignable } from '../../hooks';
|
import { useDesignable } from '../../hooks';
|
||||||
import { useFixedBlockDesignerSetting } from '../page';
|
import { FixedBlockDesignerItem } from '../page';
|
||||||
|
|
||||||
export const KanbanDesigner = () => {
|
export const KanbanDesigner = () => {
|
||||||
const { name, title } = useCollection();
|
const { name, title } = useCollection();
|
||||||
@ -20,7 +20,6 @@ export const KanbanDesigner = () => {
|
|||||||
const defaultFilter = fieldSchema?.['x-decorator-props']?.params?.filter || {};
|
const defaultFilter = fieldSchema?.['x-decorator-props']?.params?.filter || {};
|
||||||
const defaultResource = fieldSchema?.['x-decorator-props']?.resource;
|
const defaultResource = fieldSchema?.['x-decorator-props']?.resource;
|
||||||
const template = useSchemaTemplate();
|
const template = useSchemaTemplate();
|
||||||
const fixedBlockDesignerSetting = useFixedBlockDesignerSetting();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner template={template} title={title || name}>
|
<GeneralSchemaDesigner template={template} title={title || name}>
|
||||||
@ -55,7 +54,7 @@ export const KanbanDesigner = () => {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{fixedBlockDesignerSetting}
|
<FixedBlockDesignerItem />
|
||||||
<SchemaSettings.Divider />
|
<SchemaSettings.Divider />
|
||||||
<SchemaSettings.Template componentName={'Kanban'} collectionName={name} resourceName={defaultResource} />
|
<SchemaSettings.Template componentName={'Kanban'} collectionName={name} resourceName={defaultResource} />
|
||||||
<SchemaSettings.Divider />
|
<SchemaSettings.Divider />
|
||||||
|
@ -41,9 +41,13 @@ export const useFixedBlock = () => {
|
|||||||
export const FixedBlockWrapper: React.FC = (props) => {
|
export const FixedBlockWrapper: React.FC = (props) => {
|
||||||
const fixedBlock = useFixedSchema();
|
const fixedBlock = useFixedSchema();
|
||||||
const { height, fixedBlockUID } = useFixedBlock();
|
const { height, fixedBlockUID } = useFixedBlock();
|
||||||
|
const record = useRecord();
|
||||||
// The fixedBlockUID of false means that the page has no fixed blocks
|
const isPopup = Object.keys(record);
|
||||||
if (!fixedBlock && fixedBlockUID) return null;
|
/**
|
||||||
|
* The fixedBlockUID of false means that the page has no fixed blocks
|
||||||
|
* isPopup means that the FixedBlock is in the popup mode
|
||||||
|
*/
|
||||||
|
if (!fixedBlock && fixedBlockUID && !isPopup) return null;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="nb-fixed-block"
|
className="nb-fixed-block"
|
||||||
@ -56,7 +60,7 @@ export const FixedBlockWrapper: React.FC = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useFixedBlockDesignerSetting = () => {
|
export const FixedBlockDesignerItem = () => {
|
||||||
const field = useField();
|
const field = useField();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
|
@ -53,14 +53,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|||||||
{snapshot ? (
|
{snapshot ? (
|
||||||
text
|
text
|
||||||
) : isTagsMode ? (
|
) : isTagsMode ? (
|
||||||
<Typography.Text
|
<Typography.Text underline>{text}</Typography.Text>
|
||||||
className={css`
|
|
||||||
margin-left: 8px;
|
|
||||||
`}
|
|
||||||
underline
|
|
||||||
>
|
|
||||||
{text}
|
|
||||||
</Typography.Text>
|
|
||||||
) : (
|
) : (
|
||||||
<a
|
<a
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@ -75,7 +68,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
{index < arr.length - 1 && !isTagsMode ? <span style={{ marginRight: 4, color: '#aaa' }}>,</span> : null}
|
{index < arr.length - 1 ? <span style={{ marginRight: 4, color: '#aaa' }}>,</span> : null}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,7 @@ import { FilterBlockType } from '../../../filter-provider/utils';
|
|||||||
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
||||||
import { useSchemaTemplate } from '../../../schema-templates';
|
import { useSchemaTemplate } from '../../../schema-templates';
|
||||||
import { useDesignable } from '../../hooks';
|
import { useDesignable } from '../../hooks';
|
||||||
import { useFixedBlockDesignerSetting } from '../page';
|
import { FixedBlockDesignerItem } from '../page';
|
||||||
|
|
||||||
export const TableBlockDesigner = () => {
|
export const TableBlockDesigner = () => {
|
||||||
const { name, title, sortable } = useCollection();
|
const { name, title, sortable } = useCollection();
|
||||||
@ -41,7 +41,6 @@ export const TableBlockDesigner = () => {
|
|||||||
const collection = useCollection();
|
const collection = useCollection();
|
||||||
const { dragSort, resource } = field.decoratorProps;
|
const { dragSort, resource } = field.decoratorProps;
|
||||||
const treeChildren = resource?.includes('.') ? getCollectionField(resource)?.treeChildren : !!collection?.tree;
|
const treeChildren = resource?.includes('.') ? getCollectionField(resource)?.treeChildren : !!collection?.tree;
|
||||||
const fixedBlockDesignerSetting = useFixedBlockDesignerSetting();
|
|
||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner template={template} title={title || name}>
|
<GeneralSchemaDesigner template={template} title={title || name}>
|
||||||
<SchemaSettings.BlockTitleItem />
|
<SchemaSettings.BlockTitleItem />
|
||||||
@ -82,7 +81,7 @@ export const TableBlockDesigner = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{fixedBlockDesignerSetting}
|
<FixedBlockDesignerItem />
|
||||||
<SchemaSettings.ModalItem
|
<SchemaSettings.ModalItem
|
||||||
title={t('Set the data scope')}
|
title={t('Set the data scope')}
|
||||||
schema={
|
schema={
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
useCollectionFilterOptions,
|
useCollectionFilterOptions,
|
||||||
useDesignable,
|
useDesignable,
|
||||||
useSchemaTemplate,
|
useSchemaTemplate,
|
||||||
useFixedBlockDesignerSetting,
|
FixedBlockDesignerItem,
|
||||||
GeneralSchemaDesigner,
|
GeneralSchemaDesigner,
|
||||||
SchemaSettings,
|
SchemaSettings,
|
||||||
mergeFilter,
|
mergeFilter,
|
||||||
@ -12,7 +12,7 @@ import {
|
|||||||
} from '@nocobase/client';
|
} from '@nocobase/client';
|
||||||
import set from 'lodash/set';
|
import set from 'lodash/set';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation} from 'react-i18next'
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useMapTranslation } from '../locale';
|
import { useMapTranslation } from '../locale';
|
||||||
import { useMapBlockContext } from './MapBlockProvider';
|
import { useMapBlockContext } from './MapBlockProvider';
|
||||||
|
|
||||||
@ -33,7 +33,6 @@ export const MapBlockDesigner = () => {
|
|||||||
const defaultZoom = fieldSchema?.['x-component-props']?.['zoom'] || 13;
|
const defaultZoom = fieldSchema?.['x-component-props']?.['zoom'] || 13;
|
||||||
|
|
||||||
const template = useSchemaTemplate();
|
const template = useSchemaTemplate();
|
||||||
const fixedBlockDesignerSetting = useFixedBlockDesignerSetting();
|
|
||||||
|
|
||||||
const mapFieldOptions = getCollectionFieldsOptions(collection?.name, ['point', 'lineString', 'polygon']);
|
const mapFieldOptions = getCollectionFieldsOptions(collection?.name, ['point', 'lineString', 'polygon']);
|
||||||
const markerFieldOptions = getCollectionFieldsOptions(collection?.name, 'string');
|
const markerFieldOptions = getCollectionFieldsOptions(collection?.name, 'string');
|
||||||
@ -41,7 +40,7 @@ export const MapBlockDesigner = () => {
|
|||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner template={template} title={title || name}>
|
<GeneralSchemaDesigner template={template} title={title || name}>
|
||||||
<SchemaSettings.BlockTitleItem />
|
<SchemaSettings.BlockTitleItem />
|
||||||
{fixedBlockDesignerSetting}
|
<FixedBlockDesignerItem />
|
||||||
<SchemaSettings.SelectItem
|
<SchemaSettings.SelectItem
|
||||||
title={mapT('Map field')}
|
title={mapT('Map field')}
|
||||||
value={fieldNames.field}
|
value={fieldNames.field}
|
||||||
|
Loading…
Reference in New Issue
Block a user