mirror of
https://github.com/nocobase/nocobase
synced 2024-11-14 21:55:55 +00:00
fix(embed): fix issue with unable to open popup in kanban (#5326)
Some checks are pending
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
deploy client docs / Build (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
Some checks are pending
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
deploy client docs / Build (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
This commit is contained in:
parent
2199969579
commit
eb49b8fec0
@ -13,6 +13,6 @@ export * from './FixedBlockDesignerItem';
|
||||
export * from './Page';
|
||||
export * from './Page.Settings';
|
||||
export { PagePopups } from './PagePopups';
|
||||
export { storePopupContext, getStoredPopupContext } from './pagePopupUtils';
|
||||
export { getStoredPopupContext, storePopupContext } from './pagePopupUtils';
|
||||
export * from './PageTab.Settings';
|
||||
export { PopupSettingsProvider } from './PopupSettingsProvider';
|
||||
export { PopupSettingsProvider, usePopupSettings } from './PopupSettingsProvider';
|
||||
|
@ -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`
|
||||
@ -80,14 +81,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)) {
|
||||
openPopup({
|
||||
popupUidUsedInURL: popupSchema?.['x-uid'],
|
||||
});
|
||||
if (!isPopupVisibleControlledByURL()) {
|
||||
setVisible(true);
|
||||
} else {
|
||||
openPopup({
|
||||
popupUidUsedInURL: popupSchema?.['x-uid'],
|
||||
});
|
||||
}
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopPropagation();
|
||||
@ -136,7 +143,7 @@ export const KanbanCard: any = observer(
|
||||
</FormLayout>
|
||||
</DndContext>
|
||||
</Card>
|
||||
<PopupContextProvider>
|
||||
<PopupContextProvider visible={visible} setVisible={setVisible}>
|
||||
<VariablePopupRecordProvider recordData={recordData} collection={collection}>
|
||||
<MemorizedRecursionField schema={wrappedPopupSchema} />
|
||||
</VariablePopupRecordProvider>
|
||||
|
Loading…
Reference in New Issue
Block a user