Merge branch 'main' into next

This commit is contained in:
Zeke Zhang 2024-09-26 10:28:12 +08:00
commit cdc188c8c8
2 changed files with 14 additions and 7 deletions

View File

@ -13,6 +13,6 @@ export * from './FixedBlockDesignerItem';
export * from './Page';
export * from './Page.Settings';
export { PagePopups } from './PagePopups';
export { storePopupContext, getStoredPopupContext, withSearchParams, getPopupPathFromParams } from './pagePopupUtils';
export { getPopupPathFromParams, getStoredPopupContext, storePopupContext, withSearchParams } from './pagePopupUtils';
export * from './PageTab.Settings';
export { PopupSettingsProvider } from './PopupSettingsProvider';
export { PopupSettingsProvider, usePopupSettings } from './PopupSettingsProvider';

View File

@ -17,12 +17,13 @@ import {
PopupContextProvider,
useCollection,
useCollectionRecordData,
usePopupSettings,
usePopupUtils,
VariablePopupRecordProvider,
} from '@nocobase/client';
import { Schema } from '@nocobase/utils';
import { Card } from 'antd';
import React, { useCallback, useContext, useMemo } from 'react';
import React, { useCallback, useContext, useMemo, useState } from 'react';
import { KanbanCardContext } from './context';
const cardCss = css`
@ -74,14 +75,20 @@ export const KanbanCard: any = observer(
const { openPopup, getPopupSchemaFromSchema } = usePopupUtils();
const recordData = useCollectionRecordData();
const popupSchema = getPopupSchemaFromSchema(fieldSchema) || getPopupSchemaFromParent(fieldSchema);
const [visible, setVisible] = useState(false);
const { isPopupVisibleControlledByURL } = usePopupSettings();
const handleCardClick = useCallback(
(e: React.MouseEvent) => {
const targetElement = e.target as Element; // 将事件目标转换为Element类型
const currentTargetElement = e.currentTarget as Element;
if (currentTargetElement.contains(targetElement)) {
if (!isPopupVisibleControlledByURL()) {
setVisible(true);
} else {
openPopup({
popupUidUsedInURL: popupSchema?.['x-uid'],
});
}
e.stopPropagation();
} else {
e.stopPropagation();
@ -130,7 +137,7 @@ export const KanbanCard: any = observer(
</FormLayout>
</DndContext>
</Card>
<PopupContextProvider>
<PopupContextProvider visible={visible} setVisible={setVisible}>
<VariablePopupRecordProvider recordData={recordData} collection={collection}>
<MemorizedRecursionField schema={wrappedPopupSchema} />
</VariablePopupRecordProvider>