mirror of
https://github.com/nocobase/nocobase
synced 2024-11-14 22:36:35 +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';
|
||||||
export * from './Page.Settings';
|
export * from './Page.Settings';
|
||||||
export { PagePopups } from './PagePopups';
|
export { PagePopups } from './PagePopups';
|
||||||
export { storePopupContext, getStoredPopupContext } from './pagePopupUtils';
|
export { getStoredPopupContext, storePopupContext } from './pagePopupUtils';
|
||||||
export * from './PageTab.Settings';
|
export * from './PageTab.Settings';
|
||||||
export { PopupSettingsProvider } from './PopupSettingsProvider';
|
export { PopupSettingsProvider, usePopupSettings } from './PopupSettingsProvider';
|
||||||
|
@ -17,12 +17,13 @@ import {
|
|||||||
PopupContextProvider,
|
PopupContextProvider,
|
||||||
useCollection,
|
useCollection,
|
||||||
useCollectionRecordData,
|
useCollectionRecordData,
|
||||||
|
usePopupSettings,
|
||||||
usePopupUtils,
|
usePopupUtils,
|
||||||
VariablePopupRecordProvider,
|
VariablePopupRecordProvider,
|
||||||
} from '@nocobase/client';
|
} from '@nocobase/client';
|
||||||
import { Schema } from '@nocobase/utils';
|
import { Schema } from '@nocobase/utils';
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
import React, { useCallback, useContext, useMemo } from 'react';
|
import React, { useCallback, useContext, useMemo, useState } from 'react';
|
||||||
import { KanbanCardContext } from './context';
|
import { KanbanCardContext } from './context';
|
||||||
|
|
||||||
const cardCss = css`
|
const cardCss = css`
|
||||||
@ -80,14 +81,20 @@ export const KanbanCard: any = observer(
|
|||||||
const { openPopup, getPopupSchemaFromSchema } = usePopupUtils();
|
const { openPopup, getPopupSchemaFromSchema } = usePopupUtils();
|
||||||
const recordData = useCollectionRecordData();
|
const recordData = useCollectionRecordData();
|
||||||
const popupSchema = getPopupSchemaFromSchema(fieldSchema) || getPopupSchemaFromParent(fieldSchema);
|
const popupSchema = getPopupSchemaFromSchema(fieldSchema) || getPopupSchemaFromParent(fieldSchema);
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
const { isPopupVisibleControlledByURL } = usePopupSettings();
|
||||||
const handleCardClick = useCallback(
|
const handleCardClick = useCallback(
|
||||||
(e: React.MouseEvent) => {
|
(e: React.MouseEvent) => {
|
||||||
const targetElement = e.target as Element; // 将事件目标转换为Element类型
|
const targetElement = e.target as Element; // 将事件目标转换为Element类型
|
||||||
const currentTargetElement = e.currentTarget as Element;
|
const currentTargetElement = e.currentTarget as Element;
|
||||||
if (currentTargetElement.contains(targetElement)) {
|
if (currentTargetElement.contains(targetElement)) {
|
||||||
openPopup({
|
if (!isPopupVisibleControlledByURL()) {
|
||||||
popupUidUsedInURL: popupSchema?.['x-uid'],
|
setVisible(true);
|
||||||
});
|
} else {
|
||||||
|
openPopup({
|
||||||
|
popupUidUsedInURL: popupSchema?.['x-uid'],
|
||||||
|
});
|
||||||
|
}
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
} else {
|
} else {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -136,7 +143,7 @@ export const KanbanCard: any = observer(
|
|||||||
</FormLayout>
|
</FormLayout>
|
||||||
</DndContext>
|
</DndContext>
|
||||||
</Card>
|
</Card>
|
||||||
<PopupContextProvider>
|
<PopupContextProvider visible={visible} setVisible={setVisible}>
|
||||||
<VariablePopupRecordProvider recordData={recordData} collection={collection}>
|
<VariablePopupRecordProvider recordData={recordData} collection={collection}>
|
||||||
<MemorizedRecursionField schema={wrappedPopupSchema} />
|
<MemorizedRecursionField schema={wrappedPopupSchema} />
|
||||||
</VariablePopupRecordProvider>
|
</VariablePopupRecordProvider>
|
||||||
|
Loading…
Reference in New Issue
Block a user