refactor: group components
This commit is contained in:
parent
4ec92ea1e5
commit
240accc39e
@ -1,31 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Popover, Space, Button, Input } from 'antd';
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { useProps } from '@nocobase/client';
|
||||
import { ShareAltOutlined } from '@ant-design/icons';
|
||||
|
||||
export const OutboundButton = (props) => {
|
||||
const { onClick } = useProps(props);
|
||||
const schema = useFieldSchema();
|
||||
const url = window.location.href.split('/', 3).join('/');
|
||||
return (
|
||||
<Popover
|
||||
placement="bottomRight"
|
||||
trigger="click"
|
||||
autoAdjustOverflow
|
||||
content={
|
||||
<Space.Compact style={{ width: '100%' }}>
|
||||
<Input defaultValue={`${url}/r/${schema['x-uid']}`} />
|
||||
<Button type="primary" onClick={onClick}>
|
||||
复制链接
|
||||
</Button>
|
||||
</Space.Compact>
|
||||
}
|
||||
>
|
||||
<Button>
|
||||
<ShareAltOutlined />
|
||||
外链
|
||||
</Button>
|
||||
</Popover>
|
||||
);
|
||||
};
|
@ -1,10 +1,10 @@
|
||||
import { SchemaComponent, SchemaSettings, useApp, useDesignable, usePlugin } from '@nocobase/client';
|
||||
import React from 'react';
|
||||
import { useTranslation } from '../locale';
|
||||
import { useTranslation } from '../../locale';
|
||||
import { useField, useFieldSchema } from '@formily/react';
|
||||
import { Field } from '@nocobase/database';
|
||||
import { useCustomComponent } from '../hooks/useCustomComponent';
|
||||
import { CustomComponentType } from '../custom-components';
|
||||
import { useCustomComponent } from '../../hooks/useCustomComponent';
|
||||
import { CustomComponentType } from '../../custom-components';
|
||||
|
||||
export const CustomComponentStub = (props) => {
|
||||
return <div>请选择组件</div>;
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { css } from '@nocobase/client';
|
||||
import { Button, Tooltip } from 'antd';
|
||||
import { MobileOutlined } from '@ant-design/icons';
|
||||
import { useTranslation } from '../locale';
|
||||
import { useTranslation } from '../../locale';
|
||||
|
||||
export const MobileLink = () => {
|
||||
const { t } = useTranslation();
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { css, useRequest } from '@nocobase/client';
|
||||
import { Badge, Button, Popover, List, message } from 'antd';
|
||||
import { BellOutlined } from '@ant-design/icons';
|
||||
import { useLinkKey, useInitializationLinkKey } from '../hooks/useNotifications';
|
||||
import { useLinkKey, useInitializationLinkKey } from '../../hooks/useNotifications';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { dayjs } from '@nocobase/utils/client';
|
||||
|
@ -10,9 +10,7 @@ import {
|
||||
} from '@nocobase/client';
|
||||
import { remove } from 'lodash';
|
||||
import { CalendarBlockInitializer } from './schema-initializer/CalendarBlockInitializer';
|
||||
import { MenuDesigner } from './components/ExtendedMenuDesigner';
|
||||
import { HomePageConfiguration } from './pages/HomePageConfiguration';
|
||||
import { Configuration } from './components/TokenConfiguration';
|
||||
import { MenuDesigner } from './schema-components/deprecated/ExtendedMenuDesigner';
|
||||
import { InternalPDFViewer } from './schema-components/PDFViewer';
|
||||
import {
|
||||
PDFViewerBlockInitializer,
|
||||
@ -21,9 +19,8 @@ import {
|
||||
pdfViewActionInitializer,
|
||||
usePDFViewerPrintActionProps,
|
||||
} from './schema-initializer/PDFVIewerBlockInitializer';
|
||||
import { OutboundButton } from './components/OutboundButton';
|
||||
import { useCustomizeUpdateActionProps } from './hooks/useCustomizeUpdateActionProps';
|
||||
import { OutboundLinkActionInitializer } from './schema-initializer/OutboundLinkActionInitializer';
|
||||
import { OutboundButton, OutboundLinkActionInitializer } from './schema-initializer/OutboundLinkActionInitializer';
|
||||
import { CreateSubmitActionInitializer } from './schema-initializer/CreateSubmitActionInitializer';
|
||||
import { FilterAssociatedFields } from './schema-initializer/FilterAssociatedFields';
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
@ -49,7 +46,6 @@ import { SignatureInput } from './components/SignatureInput';
|
||||
import { RemoteSelect } from './schema-components/remote-select';
|
||||
import { Select } from './schema-components/select/Select';
|
||||
import { Locale, tval } from './locale';
|
||||
import { LinkManager } from './components/LinkManager';
|
||||
import {
|
||||
GroupBlockInitializer,
|
||||
GroupBlockProvider,
|
||||
@ -67,7 +63,7 @@ import {
|
||||
CustomComponentDispatcher,
|
||||
CustomComponentStub,
|
||||
customComponentDispatcherSettings,
|
||||
} from './components/CustomComponentDispatcher';
|
||||
} from './components/custom-components/CustomComponentDispatcher';
|
||||
import { useFilterBlockActionProps } from './hooks/useFilterBlockActionProps';
|
||||
import { GroupBlockConfigure } from './components/GroupBlockConfigure/GroupBlockConfigure';
|
||||
import { AssociatedFieldInterface } from './interfaces/associated';
|
||||
@ -75,14 +71,15 @@ import { CalcFieldInterface } from './interfaces/calc';
|
||||
import { CustomFieldInterface } from './interfaces/custom';
|
||||
import { CustomAssociatedFieldInterface } from './interfaces/customAssociated';
|
||||
import { SignaturePadFieldInterface } from './interfaces/signatureSchema';
|
||||
import { CalcResult } from './components/CalcResult';
|
||||
import { CustomAssociatedField } from './components/CustomAssociatedField';
|
||||
import { CalcResult } from './components/calc/CalcResult';
|
||||
import { CustomAssociatedField } from './components/custom-components/CustomAssociatedField';
|
||||
import Expression from './components/Expression';
|
||||
import { CustomField } from './components/CustomField';
|
||||
import { CustomField } from './components/custom-components/CustomField';
|
||||
import { useGetCustomAssociatedComponents } from './hooks/useGetCustomAssociatedComponents';
|
||||
import { useGetCustomComponents } from './hooks/useGetCustomComponents';
|
||||
import { AutoComplete } from './schema-components/AutoComplete/AutoComplete';
|
||||
import { AdminLayout, DetailsPage, HomePage, OutboundPage, PageLayout } from './pages';
|
||||
import { Configuration, HomePageConfiguration, LinkManager } from './settings-manager-components';
|
||||
export { usePDFViewerRef } from './schema-initializer/PDFVIewerBlockInitializer';
|
||||
export * from './custom-components';
|
||||
|
||||
|
@ -26,9 +26,9 @@ import {
|
||||
import { Tabs } from 'antd';
|
||||
import type { TabsProps } from 'antd';
|
||||
import { usePluginVersion } from '../hooks/usePluginVersion';
|
||||
import { OnlineUserDropdown } from '../components/OnlineUserProvider';
|
||||
import { MobileLink } from '../components/MobileLink';
|
||||
import { Notifications } from '../components/Notifications';
|
||||
import { OnlineUserDropdown } from '../components/system/OnlineUserProvider';
|
||||
import { MobileLink } from '../components/system/MobileLink';
|
||||
import { Notifications } from '../components/system/Notifications';
|
||||
import { useTranslation } from '../locale';
|
||||
|
||||
export const useAppSpin = () => {
|
||||
|
@ -1,6 +1,5 @@
|
||||
export * from './AdminLayout';
|
||||
export * from './DetailsPage';
|
||||
export * from './Home';
|
||||
export * from './HomePageConfiguration';
|
||||
export * from './OutboundPage';
|
||||
export * from './PageLayout';
|
||||
|
@ -1,5 +1,9 @@
|
||||
import React from 'react';
|
||||
import { ActionInitializer } from '@nocobase/client';
|
||||
import { Popover, Space, Button, Input } from 'antd';
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { useProps } from '@nocobase/client';
|
||||
import { ShareAltOutlined } from '@ant-design/icons';
|
||||
|
||||
export const OutboundLinkActionInitializer = (props) => {
|
||||
const schema = {
|
||||
@ -14,3 +18,29 @@ export const OutboundLinkActionInitializer = (props) => {
|
||||
};
|
||||
return <ActionInitializer {...props} schema={schema} />;
|
||||
};
|
||||
|
||||
export const OutboundButton = (props) => {
|
||||
const { onClick } = useProps(props);
|
||||
const schema = useFieldSchema();
|
||||
const url = window.location.href.split('/', 3).join('/');
|
||||
return (
|
||||
<Popover
|
||||
placement="bottomRight"
|
||||
trigger="click"
|
||||
autoAdjustOverflow
|
||||
content={
|
||||
<Space.Compact style={{ width: '100%' }}>
|
||||
<Input defaultValue={`${url}/r/${schema['x-uid']}`} />
|
||||
<Button type="primary" onClick={onClick}>
|
||||
复制链接
|
||||
</Button>
|
||||
</Space.Compact>
|
||||
}
|
||||
>
|
||||
<Button>
|
||||
<ShareAltOutlined />
|
||||
外链
|
||||
</Button>
|
||||
</Popover>
|
||||
);
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ export const LinkManager = () => {
|
||||
updateLink();
|
||||
// 更新表格数据
|
||||
const mergedArray = tableData.map((item) => {
|
||||
const matchingItem = item.id == formData.id;
|
||||
const matchingItem = item.id === formData.id;
|
||||
if (matchingItem) {
|
||||
return formData;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
export * from './HomePageConfiguration';
|
||||
export * from './LinkManager';
|
||||
export * from './TokenConfiguration';
|
Loading…
Reference in New Issue
Block a user