From 63c351ea1a41eb5a317776afe0dee27225b500bd Mon Sep 17 00:00:00 2001 From: wjh Date: Thu, 23 May 2024 21:00:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=AE=A1=E6=89=B9=E7=BB=84=E4=BB=B6=20(#1042)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1042 Co-authored-by: wjh Co-committed-by: wjh --- .../AppendsTreeSelectV2.tsx | 4 +- .../approval/ApprovalBlockInitializer.tsx | 33 +--- .../src/client/approval/ApprovalSettings.tsx | 45 ++++-- .../component/ApprovalReachDataType.tsx | 2 +- .../component/ApprovalTemplateType.tsx | 2 +- .../src/client/approval/index.ts | 2 - .../approval/initiations/InitiationsBlock.tsx | 148 ++++++++++-------- .../initiations/UserInitiationsBlock.tsx | 48 ------ .../initiations/component/ApprovalItem.tsx | 46 ++++-- .../initiations/component/ApprovalStatus.tsx | 4 +- .../initiations/component/InitiationsItem.tsx | 69 ++++++++ .../component/UserInitiationsItem.tsx | 34 ++++ .../ViewActionInitiationsContent.tsx | 30 ++-- .../initiations/hook/useCreateSubmit.tsx | 24 +-- .../initiations/hook/useUpadteSubmit.tsx | 29 ++-- .../initiations/hook/useWithdrawAction.tsx | 20 ++- .../src/client/approval/style/style.css | 30 +++- .../src/client/approval/todos/TodosBlock.tsx | 49 +++--- .../todos/component/TabApprovalItem.tsx | 62 +++++--- .../client/approval/todos/hook/useSubmit.tsx | 21 ++- .../src/locale/en-US.json | 4 +- .../src/locale/zh-CN.json | 4 +- .../trigger/Approval.trigger.tsx | 5 +- .../launch/Sm.ApprovalBlockLaunch.tsx | 3 +- .../src/client/usage/approval-block/plugin.ts | 1 + .../todos/Sm.ApprovalBlockTodos.tsx | 1 + .../approval-common/Approvals.collection.tsx | 2 +- .../approval-common/ApprovalsSummary.view.tsx | 3 +- .../client/usage/approval-common/plugin.ts | 1 + .../usage/approval-record-block/plugin.ts | 1 + .../src/client/usage/plugin.ts | 3 +- .../src/server/ApprovalInstruction.ts | 6 +- .../src/server/ApprovalTrigger.ts | 12 +- .../plugin-approval/src/server/actions.ts | 5 +- .../src/client/component/BulkEditField.tsx | 7 +- .../src/client/DuplicateAction.tsx | 13 +- .../src/client/pages/AuthLayout.tsx | 4 +- .../src/client/pages/SignInPage.tsx | 6 +- .../Configuration/CollectionFields.tsx | 10 +- .../CollectionFieldsTableArray.tsx | 9 +- .../ViewDatabaseConnectionAction.tsx | 5 +- .../client/configure/ChartConfigProvider.tsx | 9 +- .../client/filter/FilterBlockInitializer.tsx | 14 +- .../src/client/filter/FilterBlockProvider.tsx | 24 +-- .../client/filter/FilterItemInitializers.tsx | 30 ++-- .../client/components/calendar/calendar.tsx | 3 +- .../src/client/components/calendar/style.tsx | 3 +- .../calendar/top-part-of-calendar.tsx | 2 +- .../src/client/components/gantt/gantt.tsx | 13 +- .../src/client/components/grid/grid-body.tsx | 3 +- .../components/other/horizontal-scroll.tsx | 1 + .../src/client/components/other/tooltip.tsx | 3 +- .../components/other/vertical-scroll.tsx | 3 +- .../components/task-item/bar/bar-display.tsx | 3 +- .../components/task-item/bar/bar-small.tsx | 3 +- .../client/components/task-item/bar/bar.tsx | 3 +- .../task-item/milestone/milestone.tsx | 3 +- .../components/task-item/project/project.tsx | 3 +- .../client/components/task-item/task-item.tsx | 3 +- .../src/client/GraphDrawPage.tsx | 27 ++-- .../src/client/components/ConnectorAction.tsx | 8 +- .../src/client/components/DirectionAction.tsx | 6 +- .../src/client/components/Entity.tsx | 13 +- .../components/LocateCollectionAction.tsx | 11 +- .../plugin-kanban/src/client/Kanban.Card.tsx | 10 +- .../client/components/theme-editor/index.tsx | 11 +- .../src/client/index.tsx | 3 + 67 files changed, 641 insertions(+), 381 deletions(-) delete mode 100644 packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/UserInitiationsBlock.tsx create mode 100644 packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/InitiationsItem.tsx create mode 100644 packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/UserInitiationsItem.tsx diff --git a/packages/core/client/src/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.tsx b/packages/core/client/src/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.tsx index f9aa705ed..e128b6e0e 100644 --- a/packages/core/client/src/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.tsx +++ b/packages/core/client/src/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.tsx @@ -1,8 +1,10 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; + import { CloseCircleFilled } from '@ant-design/icons'; import { Tag, TreeSelect } from 'antd'; import type { DefaultOptionType, TreeSelectProps } from 'rc-tree-select/es/TreeSelect'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { CollectionFieldOptions_deprecated, parseCollectionName, diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalBlockInitializer.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalBlockInitializer.tsx index 58bdde8e8..e008dbcf0 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalBlockInitializer.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalBlockInitializer.tsx @@ -1,16 +1,7 @@ -import { - ExtendCollectionsProvider, - SchemaInitializerItem, - useSchemaInitializer, - useSchemaInitializerItem, -} from '@tachybase/client'; +import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; import React from 'react'; import { ISchema } from '@tachybase/schema'; import { CalendarOutline } from 'antd-mobile-icons'; -import { CollectionWorkflows } from './collection/Workflows.collection'; -import { CollectionFlowNodes } from './collection/FlowNodes.collection'; -import { CollectionApprovals } from './collection/Approvals.collection'; -import { CollectionApprovalTodos } from './collection/ApprovalTodos'; export const ApprovalBlockInitializer = () => { const { insert } = useSchemaInitializer(); @@ -25,6 +16,7 @@ export const ApprovalBlockInitializer = () => { 'x-component': item.itemComponent, 'x-component-props': { collectionName: item.collectionName, + settingBlock: item?.settingBlock, }, }; insert(schema); @@ -42,26 +34,10 @@ export const ApprovalBlockInitializer = () => { export const ApprovalInitializerItem = [ { - type: 'itemGroup', + type: 'item', name: 'initiations', title: '发起', - children: [ - { - type: 'item', - name: 'initiationsApproval', - title: '发起申请', - itemComponent: 'InitiationsBlock', - collectionName: 'workflows', - }, - { - type: 'item', - name: 'currApproval', - title: '我发起的', - itemComponent: 'UserInitiationsBlock', - dataSource: 'main', - collectionName: 'approvals', - }, - ], + itemComponent: 'InitiationsBlock', }, { type: 'item', @@ -69,5 +45,6 @@ export const ApprovalInitializerItem = [ name: 'todos', itemComponent: 'TodosBlock', collectionName: 'approvalRecords', + settingBlock: true, }, ]; diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalSettings.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalSettings.tsx index 3287af5cf..15d5306d1 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalSettings.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/ApprovalSettings.tsx @@ -1,7 +1,7 @@ import { + removeNullCondition, SchemaSettings, SchemaSettingsDataScope, - removeNullCondition, useCollection, useCollectionManager, useDataLoadingMode, @@ -10,6 +10,7 @@ import { useFormBlockContext, } from '@tachybase/client'; import { useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; export const ApprovalSettings = new SchemaSettings({ @@ -24,15 +25,33 @@ export const ApprovalSettings = new SchemaSettings({ const field = useField(); const { form } = useFormBlockContext(); const { dn } = useDesignable(); - + const tabKey = fieldSchema['x-component-props']?.['tabKey']; + let defaultFilter = {}; + if (tabKey && field.componentProps.params) { + defaultFilter = field.componentProps.params[tabKey]; + } else if (tabKey && !field.componentProps.params) { + defaultFilter = field.componentProps.parantParams?.[tabKey]; + } return { collectionName, - defaultFilter: fieldSchema?.['x-component-props']?.params?.filter || {}, + defaultFilter: tabKey ? defaultFilter : fieldSchema?.['x-component-props']?.params || {}, form: form, onSubmit: ({ filter }) => { + let params; + if (tabKey) { + params = { ...field.componentProps?.params }; + params[tabKey] = { + ...field.componentProps?.params?.[tabKey], + ...filter, + }; + } else { + params = { + ...field.componentProps?.params, + ...filter, + }; + } _.set(field.componentProps, 'params', { - ...field.componentProps?.params, - filter, + ...params, }); fieldSchema['x-component-props']['params'] = field.componentProps.params; dn.emit('patch', { @@ -41,13 +60,21 @@ export const ApprovalSettings = new SchemaSettings({ 'x-component-props': fieldSchema['x-component-props'], }, }); + if (tabKey) { + dn.emit('patch', { + schema: { + ['x-uid']: fieldSchema['x-component-props']['parantUid'], + 'x-component-props': { params: fieldSchema['x-component-props']['params'] }, + }, + }); + } }, }; }, - // useVisible() { - // const fieldSchema = useFieldSchema(); - // return !isTabSearchCollapsibleInputItem(fieldSchema['x-component']); - // }, + useVisible() { + const fieldSchema = useFieldSchema(); + return fieldSchema['x-component-props']['settingBlock']; + }, }, { name: 'divider', diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/component/ApprovalReachDataType.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/component/ApprovalReachDataType.tsx index b971be2e8..c10ac8f0e 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/component/ApprovalReachDataType.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/component/ApprovalReachDataType.tsx @@ -19,7 +19,7 @@ export const ApprovalReachDataType = observer((props) => { setPopupVisible(true); }} > - {filter['createdAt'] ? `${formatDate(startData)}-${formatDate(endData)} ` : '到达日期'} + {filter?.['createdAt'] ? `${formatDate(startData)}-${formatDate(endData)} ` : '到达日期'} { setVisible(true); }} > - {columns.length && filter.workflowId && filter.workflowId !== 'all' + {columns.length && filter?.workflowId && filter?.workflowId !== 'all' ? columns.find((item) => item.value === filter.workflowId).label : '模版类型'} diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/index.ts b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/index.ts index 9ad6653b5..3d7546f86 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/index.ts +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/index.ts @@ -5,7 +5,6 @@ import { TodosBlock } from './todos/TodosBlock'; import { InitiationsBlock } from './initiations/InitiationsBlock'; import { LauncherActionConfigInitializer } from './initiations/config/LauncherActionConfig'; import { ViewActionTodosContent } from './todos/component/ViewActionTodosContent'; -import { UserInitiationsBlock } from './initiations/UserInitiationsBlock'; import { ViewActionUserInitiationsContent } from './initiations/component/ViewActionUserInitiationsContent'; import { ApprovalProcess } from './component/ApprovalProcess.view'; import { ViewActionInitiationsContent } from './initiations/component/ViewActionInitiationsContent'; @@ -16,7 +15,6 @@ class PluginApproval extends Plugin { ApprovalBlockInitializer, InitiationsBlock, TodosBlock, - UserInitiationsBlock, ViewActionTodosContent, ViewActionUserInitiationsContent, ViewActionInitiationsContent, diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/InitiationsBlock.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/InitiationsBlock.tsx index 9a0caf47c..dee3caacd 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/InitiationsBlock.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/InitiationsBlock.tsx @@ -1,87 +1,105 @@ -import { BlockItem, ExtendCollectionsProvider, css, useAPIClient, useRequest } from '@tachybase/client'; -import React, { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { AutoCenter, Card, SearchBar, Selector, Space } from 'antd-mobile'; -import { TeamFill } from 'antd-mobile-icons'; +import { BlockItem, ExtendCollectionsProvider, SchemaComponent, useDesignable } from '@tachybase/client'; +import { SearchBar, Space, Tabs } from 'antd-mobile'; +import React, { createContext, useEffect, useState } from 'react'; +import { observer, useFieldSchema } from '@tachybase/schema'; +import '../style/style.css'; import { CollectionWorkflows } from '../collection/Workflows.collection'; import { CollectionFlowNodes } from '../collection/FlowNodes.collection'; import { CollectionApprovals } from '../collection/Approvals.collection'; import { CollectionApprovalTodos } from '../collection/ApprovalTodos'; -import { observer } from '@tachybase/schema'; +import { InitiationsItem } from './component/InitiationsItem'; +import { UserInitiationsItem } from './component/UserInitiationsItem'; +import { useTranslation } from '../locale'; +import '../style/style.css'; + +export const InitiationsBlockContext = createContext({}); export const InitiationsBlock = observer((props) => { - const { params } = props as any; - const [filter, setFilter] = useState({}); - const [options, setOptions] = useState([]); - const api = useAPIClient(); - const navigate = useNavigate(); - useEffect(() => { - api - .request({ - url: 'workflows:list', - params: { pageSize: 9999, filter: { ...params?.filter, ...filter } }, - }) - .then((res) => { - const option = res?.data?.data.map((value) => { - return { - ...value, - value: value.id, - label: ( -
{ - navigate(`/mobile/${value.title?.replace('审批流:', '') || ''}/approval/${value.id}/page`); - }} - > -
- -
- {value.title?.replace('审批流:', '') || ''} -
- ), - }; - }); - setOptions(option); - }) - .catch(() => {}); - }, [params, filter]); + const fieldSchema = useFieldSchema(); + const { t } = useTranslation(); + const [contextFilter, setContextFilter] = useState({ key: 'initiations', inputFilter: '' }); + const [changeValue, setChangeValue] = useState(''); return ( -
+ { - if (!value) setFilter({}); + if (!value) { + const filter = { ...contextFilter }; + filter.inputFilter = ''; + setContextFilter(filter); + } + setChangeValue(value); }} + value={changeValue} onSearch={(value) => { - setFilter({ - title: { $includes: value }, - }); + const filter = { ...contextFilter }; + filter.inputFilter = value; + setContextFilter(filter); }} /> - { + const filter = { ...contextFilter }; + filter['key'] = key; + filter['inputFilter'] = ''; + setChangeValue(''); + setContextFilter(filter); + }} > - - -
+ + + + + + + +
); diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/UserInitiationsBlock.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/UserInitiationsBlock.tsx deleted file mode 100644 index b3ae79a3f..000000000 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/UserInitiationsBlock.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { BlockItem, ExtendCollectionsProvider, SchemaComponent, css } from '@tachybase/client'; -import { Divider, SearchBar, Space, Tabs } from 'antd-mobile'; -import React, { useEffect, useState } from 'react'; -import { observer, useFieldSchema } from '@tachybase/schema'; -import { ApprovalTemplateType } from '../component/ApprovalTemplateType'; -import { ApprovalStatus } from './component/ApprovalStatus'; -import { ApprovalItem } from './component/ApprovalItem'; -import { ApprovalReachDataType } from '../component/ApprovalReachDataType'; -import '../style/style.css'; -import { CollectionWorkflows } from '../collection/Workflows.collection'; -import { CollectionFlowNodes } from '../collection/FlowNodes.collection'; -import { CollectionApprovals } from '../collection/Approvals.collection'; -import { CollectionApprovalTodos } from '../collection/ApprovalTodos'; - -export const UserInitiationsBlock = observer((props) => { - const [filter, setFilter] = useState({}); - const fieldSchema = useFieldSchema(); - const changeFilter = (data) => { - setFilter(data); - }; - const filterProps = { - ...props, - changeFilter, - filter, - }; - return ( - - - - - {/* 模版类型 */} - - {/* 到达日期 */} - - {/* 审批状态 */} - - - - - - ); -}); diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx index 72829044f..d7f02a773 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx @@ -1,23 +1,34 @@ import { useAPIClient, useCurrentUserContext } from '@tachybase/client'; import { Badge, Empty, List, Space, Tag } from 'antd-mobile'; -import React, { useState } from 'react'; +import React, { useContext, useEffect, useState } from 'react'; import { useDeepCompareEffect } from 'ahooks'; import { ApprovalPriorityType, ApprovalStatusEnums } from '../../constants'; import { useNavigate } from 'react-router-dom'; import { useTranslation } from '../../locale'; import { observer } from '@tachybase/schema'; +import { InitiationsBlockContext } from '../InitiationsBlock'; export const ApprovalItem = observer((props) => { - const { filter, params } = props as any; + const { filter, params, tabKey } = props as any; const api = useAPIClient(); + const [defaultData, setDefaultData] = useState([]); const [data, setData] = useState([]); const { t } = useTranslation(); const navigate = useNavigate(); const user = useCurrentUserContext(); + const contextFilter = useContext(InitiationsBlockContext); + const inputFilter = contextFilter['key'] === 'userInitiations' ? contextFilter['inputFilter'] : ''; useDeepCompareEffect(() => { - changService(api, setData, user, { ...params?.filter, ...filter }, t); + changService(api, setData, user, { ...params?.[tabKey], ...filter }, t, setDefaultData); }, [filter, params]); - + useEffect(() => { + if (inputFilter && defaultData.length) { + const filterData = defaultData.filter((value) => (value.title as string)?.includes(inputFilter)); + setData(filterData); + } else { + setData(defaultData); + } + }, [contextFilter]); return (
{data.length ? ( @@ -30,17 +41,17 @@ export const ApprovalItem = observer((props) => { navigate(`/mobile/approval/${item.id}/page`); }} > - - - {item.title} - - {item.statusTitle} - - - {item.priorityTitle} - - - + {/* */} + + {item.title} + + {item.statusTitle} + + + {item.priorityTitle} + + + {/* */} 事由:{item.reason} ); @@ -58,8 +69,7 @@ const approvalTodoListStatus = (item, t) => { return ApprovalStatusEnums.find((value) => value.value === status); }; -const changService = (api, setData, user, filter, t) => { - console.log('🚀 ~ changService ~ filter:', filter); +const changService = (api, setData, user, filter, t, setDefaultData) => { api .request({ url: 'approvals:listCentralized', @@ -85,7 +95,9 @@ const changService = (api, setData, user, filter, t) => { return Date.parse(b.createdAt) - Date.parse(a.createdAt); }); setData(result); + setDefaultData(result); }) + .catch(() => { console.error; }); diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx index ba5b00195..b9fdbe4e7 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx @@ -15,7 +15,7 @@ export const ApprovalStatus = observer((props) => { setVisible(true); }} > - {filter['status'] && filter['status'] !== 'all' + {filter?.['status'] && filter?.['status'] !== 'all' ? t(columns.find((item) => item.value === filter['status']).label) : '申请状态'} @@ -30,7 +30,7 @@ export const ApprovalStatus = observer((props) => { onClose={() => { setVisible(false); }} - value={[filter['status'] || 'all']} + value={[filter?.['status'] || 'all']} onConfirm={(e) => { const changeData = { ...filter }; if (e[0] === 'all') { diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/InitiationsItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/InitiationsItem.tsx new file mode 100644 index 000000000..2206d9aed --- /dev/null +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/InitiationsItem.tsx @@ -0,0 +1,69 @@ +import { BlockItem, ExtendCollectionsProvider, css, useAPIClient, useRequest } from '@tachybase/client'; +import React, { useContext, useEffect, useState } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { AutoCenter, Card, Empty, SearchBar, Selector, Space } from 'antd-mobile'; +import { TeamFill } from 'antd-mobile-icons'; +import { observer } from '@tachybase/schema'; +import '../../style/style.css'; +import { InitiationsBlockContext } from '../InitiationsBlock'; + +export const InitiationsItem = observer((props) => { + const { params, tabKey } = props as any; + const [options, setOptions] = useState([]); + const api = useAPIClient(); + const navigate = useNavigate(); + const contextFilter = useContext(InitiationsBlockContext); + const filter = contextFilter['key'] === 'initiations' ? contextFilter['inputFilter'] : ''; + + useEffect(() => { + api + .request({ + url: 'workflows:list', + params: { pageSize: 9999, filter: { ...params?.[tabKey] } }, + }) + .then((res) => { + const option = res?.data?.data.map((value) => { + return { + ...value, + value: value.id, + label: ( +
{ + navigate(`/mobile/${value.title?.replace('审批流:', '') || ''}/approval/${value.id}/page`); + }} + > +
+ +
+ {value.title?.replace('审批流:', '') || ''} +
+ ), + }; + }); + if (filter && options.length) { + const filterData = option.filter((value) => (value.title as string)?.includes(filter)); + setOptions(filterData); + } else { + setOptions(option); + } + }) + .catch(() => {}); + }, [params]); + return ( + + + {options.length ? ( + + ) : ( + + )} + + + ); +}); diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/UserInitiationsItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/UserInitiationsItem.tsx new file mode 100644 index 000000000..f47f222dd --- /dev/null +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/UserInitiationsItem.tsx @@ -0,0 +1,34 @@ +import { BlockItem } from '@tachybase/client'; +import { Space } from 'antd-mobile'; +import React, { useState } from 'react'; +import { observer } from '@tachybase/schema'; +import { ApprovalTemplateType } from '../../component/ApprovalTemplateType'; +import { ApprovalStatus } from './ApprovalStatus'; +import { ApprovalItem } from './ApprovalItem'; +import { ApprovalReachDataType } from '../../component/ApprovalReachDataType'; +import '../../style/style.css'; + +export const UserInitiationsItem = observer((props) => { + const [filter, setFilter] = useState([]); + const changeFilter = (data) => { + setFilter(data); + }; + const filterProps = { + ...props, + filter, + changeFilter, + }; + return ( + + + {/* 模版类型 */} + + {/* 到达日期 */} + + {/* 审批状态 */} + + + + + ); +}); diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx index c81f97cbb..bbaa9c44f 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx @@ -77,20 +77,22 @@ export const ViewActionInitiationsContent = () => { {name} - +
+ +
); diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx index 7f37b195a..903ec75d1 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx @@ -1,18 +1,18 @@ import { joinCollectionName, useAPIClient, useBlockRequestContext, useCollection_deprecated } from '@tachybase/client'; import { useField, useForm } from '@tachybase/schema'; import { APPROVAL_ACTION_STATUS } from '../../constants'; -import { useParams } from 'react-router-dom'; +import { useNavigate, useParams } from 'react-router-dom'; +import { Toast } from 'antd-mobile'; export function useCreateSubmit() { const from = useForm(); const field = useField(); - const { __parent } = useBlockRequestContext(); const collection = useCollection_deprecated(); const contextWe = APPROVAL_ACTION_STATUS.SUBMITTED; const apiClient = useAPIClient(); const params = useParams(); const { id: workflowId } = params; - + const navigate = useNavigate(); return { async run() { try { @@ -20,7 +20,7 @@ export function useCreateSubmit() { field.data = field.data || {}; field.data.loading = true; - await apiClient.resource('approvals').create({ + const res = await apiClient.resource('approvals').create({ values: { collectionName: joinCollectionName(collection.dataSource, collection.name), data: from.values, @@ -28,13 +28,17 @@ export function useCreateSubmit() { workflowId: workflowId, }, }); - - from.reset(); - field.data.loading = false; - const service = __parent.service; - if (service) { - service.refresh(); + console.log('🚀 ~ res ~ res:', res); + if (res.status === 200) { + Toast.show({ + icon: 'success', + content: '提交成功', + }); + from.reset(); + navigate(`/mobile/approval/${res.data.data.id}/page`); } + + field.data.loading = false; } catch (h) { field.data && (field.data.loading = false); } diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx index 545bb3a01..106b767cb 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx @@ -1,20 +1,18 @@ import { useAPIClient, useActionContext } from '@tachybase/client'; -import { useFlowContext } from '@tachybase/plugin-workflow/client'; import { useField, useForm } from '@tachybase/schema'; import _ from 'lodash'; import { useContextApprovalExecution } from '../../context/ApprovalExecution'; import { useContextApprovalStatus } from '../provider/ApplyActionStatus'; +import { Toast } from 'antd-mobile'; export function useUpdateSubmit() { const from = useForm(); const field = useField(); const { approval } = useContextApprovalExecution(); - const { setVisible, setSubmitted } = useActionContext() as any; - const { id } = approval; - const { workflow } = useFlowContext(); + const { setSubmitted } = useActionContext() as any; + const { workflow, id } = approval; const contextApprovalStatus = useContextApprovalStatus(); const apiClient = useAPIClient(); - return { async run() { try { @@ -22,7 +20,7 @@ export function useUpdateSubmit() { _.set(field, ['data', 'loading'], true); - apiClient.resource('approvals').update({ + const res = await apiClient.resource('approvals').update({ filterByTk: id, values: { collectionName: workflow.config.collection, @@ -30,10 +28,21 @@ export function useUpdateSubmit() { status: contextApprovalStatus, }, }); - setSubmitted(true); - setVisible(false); - from.reset(); - _.set(field, ['data', 'loading'], false); + if (res.status === 200) { + Toast.show({ + icon: 'success', + content: '处理成功', + }); + setTimeout(() => { + location.reload(); + }, 1000); + setSubmitted(true); + } else { + Toast.show({ + icon: 'fail', + content: '处理失败', + }); + } } catch (m) { _.set(field, ['data', 'loading'], false); } diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx index d5c56b862..2ac62abf2 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx @@ -1,6 +1,7 @@ import { useAPIClient, useActionContext } from '@tachybase/client'; import { useField } from '@tachybase/schema'; import { useContextApprovalExecution } from '../../context/ApprovalExecution'; +import { Toast } from 'antd-mobile'; // 撤回 export function useWithdrawAction() { @@ -14,12 +15,25 @@ export function useWithdrawAction() { field.data = field.data ?? {}; field.data.loading = true; - await api.resource('approvals').withdraw({ + const res = await api.resource('approvals').withdraw({ filterByTk: approval.id, }); - setSubmitted(true); - + if (res.status === 202) { + Toast.show({ + icon: 'success', + content: '撤回成功', + }); + setTimeout(() => { + location.reload(); + }, 1000); + setSubmitted(true); + } else { + Toast.show({ + icon: 'fail', + content: '撤回失败', + }); + } field.data.loading = false; } catch (v) { if (field.data) { diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css index 9c11ca282..07a15cd9e 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css @@ -9,7 +9,6 @@ .navBarStyle{ background-color: #ffffff; - margin-bottom: 10px; position: fixed; z-index: 2; height: 5vh; @@ -28,8 +27,35 @@ .userInitiationsStyle{ width: 100%; - margin-top: 10px; padding: 10px 0 10px 0; background-color: #ffffff; + font-size: 10px; + color: #8e8e8e; } +.adm-tabs-tab-list{ + background-color: #ffffff; + font-size: 12px; +} + +.blockItem{ + background-color: #f3f3f3; +} + + .adm-card-body { + padding: 0; + } + + .initiationsItemCard{ + padding: 0px; + border-radius: 0px; + overflow: hidden; + background-color: #f3f3f3; + } + + .adm-tabs-content{ + padding: 0; + } + + + diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx index 932be9991..c96a4ad88 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx @@ -15,28 +15,18 @@ import { CollectionApprovals } from '../collection/Approvals.collection'; import { CollectionApprovalTodos } from '../collection/ApprovalTodos'; export const TodosBlock = observer((props) => { - const [tabValue, setTabValue] = useState('pending'); - const [filter, setFilter] = useState({}); + const [filter, setFilter] = useState({ + status: PendingStatus, + }); + const [changeInputValue, setChangeInputValue] = useState(''); + const [input, setInput] = useState(''); const changeFilter = (data) => { setFilter(data); }; - useEffect(() => { - const changeTabs = { ...filter }; - switch (tabValue) { - case 'pending': - changeTabs['status'] = PendingStatus; - break; - case 'processed': - changeTabs['status'] = ProcessedStatus; - break; - case 'duplicate': - break; - } - setFilter(changeTabs); - }, [tabValue]); const filterProps = { ...props, filter, + input, changeFilter, }; return ( @@ -48,11 +38,34 @@ export const TodosBlock = observer((props) => { placeholder="搜索人名,标题、内容" clearable style={{ '--background': '#ffffff', padding: '10px' }} + onChange={(value) => { + if (!value) { + setInput(value); + } + setChangeInputValue(value); + }} + value={changeInputValue} + onSearch={(value) => { + setInput(value); + }} /> { - setFilter({}); - setTabValue(key); + const tabFilter = { status: PendingStatus }; + switch (key) { + case 'pending': + tabFilter['status'] = PendingStatus; + break; + case 'processed': + tabFilter['status'] = ProcessedStatus; + break; + case 'duplicate': + delete tabFilter['status']; + break; + } + setChangeInputValue(''); + setInput(''); + setFilter(tabFilter); }} style={{ '--title-font-size': '12px', backgroundColor: '#ffffff', marginTop: '10px' }} > diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx index ccdad7566..e10bd549d 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx @@ -1,27 +1,39 @@ -import { mergeFilter, useAPIClient, useCollectionManager, useRequest } from '@tachybase/client'; -import { connect, observer, useFieldSchema } from '@tachybase/schema'; -import { Badge, Empty, List, Space, Tag } from 'antd-mobile'; import React, { useEffect, useState } from 'react'; +import { mergeFilter, useAPIClient, useCollectionManager, useCompile, useRequest } from '@tachybase/client'; +import { connect, observer, useFieldSchema } from '@tachybase/schema'; + import { useAsyncEffect } from 'ahooks'; -import { APPROVAL_STATUS, ApprovalPriorityType, approvalStatusOptions } from '../../constants'; +import { Badge, Empty, List, Space, Tag } from 'antd-mobile'; import { useNavigate } from 'react-router-dom'; + +import { APPROVAL_STATUS, ApprovalPriorityType, approvalStatusOptions } from '../../constants'; import { tval, useTranslation } from '../../locale'; export const TabApprovalItem = observer((props) => { - const { filter, params } = props as any; + const { filter, params, input } = props as any; const api = useAPIClient(); const [data, setData] = useState([]); + const [defData, setDefData] = useState([]); const { t } = useTranslation(); + const compile = useCompile(); const navigate = useNavigate(); + useEffect(() => { + if (input && defData.length) { + const filterData = defData.filter((value) => value.title.includes(input)); + setData(filterData); + } else { + setData(defData); + } + }, [input]); useAsyncEffect(async () => { const { data: user } = await api.request({ url: 'users:list', params: { pageSize: 999, appends: ['roles'] } }); api .request({ url: 'approvalRecords:listCentralized', params: { - pageSize: 99999, + pageSize: 9999, appends: ['execution', 'job', 'node', 'workflow'], - filter: { ...params?.filter, ...filter }, + filter: { ...params, ...filter }, }, }) .then((res) => { @@ -32,14 +44,19 @@ export const TabApprovalItem = observer((props) => { ); const statusType = approvalTodoListStatus(item, t); const categoryTitle = item.workflow.title.replace('审批流:', ''); - + const summary = Object.entries(item.summary).map(([key, value]) => { + return { + label: compile(key), + value: value?.['name'] || value || '', + }; + }); return { ...item, title: `${itemUser.nickname}的${categoryTitle}`, categoryTitle: categoryTitle, statusTitle: t(statusType.label), statusColor: statusType.color, - reason: item.snapshot.reason || item.snapshot.reason_pay, + reason: summary, priorityTitle: priorityType.label, priorityColor: priorityType.color, }; @@ -48,6 +65,7 @@ export const TabApprovalItem = observer((props) => { return Date.parse(b.createdAt) - Date.parse(a.createdAt); }); setData(result); + setDefData(result); }) .catch(() => { console.error; @@ -66,18 +84,20 @@ export const TabApprovalItem = observer((props) => { navigate(`/mobile/approval/${item.id}/${item.categoryTitle}/detailspage`); }} > - - - {item.title} - - {item.statusTitle} - - - {item.priorityTitle} - - - - 事由:{item.reason} + {/* */} + + {item.title} + + {item.statusTitle} + + + {item.priorityTitle} + + + {/* */} + {item.reason.map((reasonItem, index) => { + return {`${reasonItem.label}:${reasonItem.value}`}; + })} ); })} diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useSubmit.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useSubmit.tsx index 22d3545f5..18fc7240b 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useSubmit.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useSubmit.tsx @@ -2,6 +2,7 @@ import { useAPIClient, useActionContext } from '@tachybase/client'; import { useField, useForm } from '@tachybase/schema'; import { useContextApprovalExecution } from '../../context/ApprovalExecution'; import { useContextApprovalAction } from '../provider/ApprovalAction'; +import { Toast } from 'antd-mobile'; export function useSubmit() { const field = useField(); @@ -20,14 +21,26 @@ export function useSubmit() { field.data = field.data ?? {}; field.data.loading = true; setVisible(false); - await api.resource('approvalRecords').submit({ + const res = await api.resource('approvalRecords').submit({ filterByTk: id, values: { ...form.values, status }, }); field.data.loading = false; - await form.reset(); - // refreshAction?.(); - setSubmitted?.(true); + if (res.status === 202) { + Toast.show({ + icon: 'success', + content: '处理成功', + }); + setTimeout(() => { + location.reload(); + }, 1000); + setSubmitted(true); + } else { + Toast.show({ + icon: 'fail', + content: '处理失败', + }); + } } catch (error) { console.error(error); field.data && (field.data.loading = false); diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/locale/en-US.json b/packages/plugins/@hera/plugin-approval-mobile/src/locale/en-US.json index e18e7d8c8..d46f69b06 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/locale/en-US.json +++ b/packages/plugins/@hera/plugin-approval-mobile/src/locale/en-US.json @@ -62,5 +62,7 @@ "If checked, the workflow will be terminated after rejection branch processed.": "If checked, the workflow will be terminated after rejection branch processed.", "Disabled": "Disabled", "Trigger data": "Trigger data", - "All":"All" + "All":"All", + "Initiations":"Initiations", + "UserInitiations":"UserInitiations" } diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/locale/zh-CN.json b/packages/plugins/@hera/plugin-approval-mobile/src/locale/zh-CN.json index c87c4a26b..28af3e422 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/locale/zh-CN.json +++ b/packages/plugins/@hera/plugin-approval-mobile/src/locale/zh-CN.json @@ -77,5 +77,7 @@ "Disabled": "已失效", "Submission may be withdrawn, please try refresh the list.": "提交可能已被撤回,请尝试刷新列表。", "Trigger data": "触发器数据", - "All":"全部" + "All":"全部", + "Initiations":"发起申请", + "UserInitiations":"我的发起" } diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/trigger/Approval.trigger.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/trigger/Approval.trigger.tsx index 4910159f9..967174181 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/trigger/Approval.trigger.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/trigger/Approval.trigger.tsx @@ -1,15 +1,16 @@ import { SchemaInitializerItemType, useCollectionManager_deprecated, useCompile } from '@tachybase/client'; import { CollectionBlockInitializer, + getCollectionFieldOptions, RadioWithTooltip, Trigger, UseVariableOptions, - getCollectionFieldOptions, useWorkflowAnyExecuted, } from '@tachybase/plugin-workflow/client'; import { useForm } from '@tachybase/schema'; -import { ConfigButtonView } from './ConfigButton.view'; + import { NAMESPACE, tval, usePluginTranslation } from '../../locale'; +import { ConfigButtonView } from './ConfigButton.view'; import { LauncherInterface } from './launcher-interface/LauncherInterface.schema'; // 工作流节点-审批触发器节点 diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx index 9096d7f6e..a22973dd2 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx @@ -1,6 +1,7 @@ -import { NAMESPACE, tval } from '../../../locale'; import { css } from '@tachybase/client'; +import { NAMESPACE, tval } from '../../../locale'; + export const SchemaApprovalBlockLaunch = { type: 'void', name: 'launch', diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/plugin.ts b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/plugin.ts index b08d74ee1..bb2ffbe7f 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/plugin.ts +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/plugin.ts @@ -1,4 +1,5 @@ import { Plugin } from '@tachybase/client'; + import { tval } from '../../locale'; import { KitApprovalCommon } from '../approval-common/plugin'; import { ApprovalBlockComponent, SCApprovalBlock } from './ApprovalBlock.schema'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Sm.ApprovalBlockTodos.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Sm.ApprovalBlockTodos.tsx index 2a6dbd5c2..cef9d6a3c 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Sm.ApprovalBlockTodos.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Sm.ApprovalBlockTodos.tsx @@ -1,4 +1,5 @@ import { css } from '@tachybase/client'; + import { NAMESPACE, tval } from '../../../locale'; export const SchemaApprovalBlockTodos = { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/Approvals.collection.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/Approvals.collection.tsx index 09f5f7dea..61001a717 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/Approvals.collection.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/Approvals.collection.tsx @@ -1,5 +1,5 @@ -import { NAMESPACE, tval } from '../../locale'; import { ApprovalStatusEnums } from '../../constants'; +import { NAMESPACE, tval } from '../../locale'; export const CollectionApprovals = { title: `{{t("Approval applications", { ns: "${NAMESPACE}" })}}`, diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/ApprovalsSummary.view.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/ApprovalsSummary.view.tsx index 4e4f9ce88..8f60bf014 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/ApprovalsSummary.view.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/ApprovalsSummary.view.tsx @@ -1,5 +1,6 @@ -import { useCollectionManager, useCollectionRecordData, useCompile } from '@tachybase/client'; import React from 'react'; +import { useCollectionManager, useCollectionRecordData, useCompile } from '@tachybase/client'; + import useStyles from './style'; export const ApprovalsSummary = (props) => { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/plugin.ts b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/plugin.ts index 07ee16795..64db48512 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/plugin.ts +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/plugin.ts @@ -1,4 +1,5 @@ import { Plugin } from '@tachybase/client'; + import { ApprovalDataProvider } from './ApprovalData.provider'; import { ApprovalProcess } from './ApprovalProcess.view'; import { ApprovalsSummary } from './ApprovalsSummary.view'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-record-block/plugin.ts b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-record-block/plugin.ts index 02f76d760..db38a4d16 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-record-block/plugin.ts +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-record-block/plugin.ts @@ -1,4 +1,5 @@ import { Plugin } from '@tachybase/client'; + import { tval } from '../../locale'; import { KitApprovalCommon } from '../approval-common/plugin'; import { RecordApprovalsDecorator } from './RecordApprovals.decorator'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/plugin.ts b/packages/plugins/@hera/plugin-approval/src/client/usage/plugin.ts index 8c1c4a113..fd3dec349 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/plugin.ts +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/plugin.ts @@ -1,6 +1,7 @@ import { Plugin } from '@tachybase/client'; -import { KitApprovalRecordBlock } from './approval-record-block/plugin'; + import { KitApprovalBlock } from './approval-block/plugin'; +import { KitApprovalRecordBlock } from './approval-record-block/plugin'; export class KitApprovalUsage extends Plugin { async afterAdd() { diff --git a/packages/plugins/@hera/plugin-approval/src/server/ApprovalInstruction.ts b/packages/plugins/@hera/plugin-approval/src/server/ApprovalInstruction.ts index abbf03d91..03ddbb8e0 100644 --- a/packages/plugins/@hera/plugin-approval/src/server/ApprovalInstruction.ts +++ b/packages/plugins/@hera/plugin-approval/src/server/ApprovalInstruction.ts @@ -1,7 +1,9 @@ -import { uid } from '@tachybase/utils'; import { Instruction, JOB_STATUS } from '@tachybase/plugin-workflow'; -import { APPROVAL_STATUS, APPROVAL_ACTION_STATUS } from './constants'; +import { uid } from '@tachybase/utils'; import { UiSchemaRepository } from '@nocobase/plugin-ui-schema-storage'; + +import { APPROVAL_ACTION_STATUS, APPROVAL_STATUS } from './constants'; + const NEGOTIATION_MODE = { SINGLE: Symbol('single'), ALL: Symbol('all'), diff --git a/packages/plugins/@hera/plugin-approval/src/server/ApprovalTrigger.ts b/packages/plugins/@hera/plugin-approval/src/server/ApprovalTrigger.ts index 409b9a2cc..52a6c8434 100644 --- a/packages/plugins/@hera/plugin-approval/src/server/ApprovalTrigger.ts +++ b/packages/plugins/@hera/plugin-approval/src/server/ApprovalTrigger.ts @@ -1,10 +1,12 @@ -import { get } from 'lodash'; -import { Op, BelongsTo, HasOne } from 'sequelize'; -import { modelAssociationByKey } from '@tachybase/database'; import { parseCollectionName } from '@tachybase/data-source-manager'; -import { EXECUTION_STATUS, Trigger, toJSON, JOB_STATUS } from '@tachybase/plugin-workflow'; -import { APPROVAL_ACTION_STATUS, APPROVAL_STATUS } from './constants'; +import { modelAssociationByKey } from '@tachybase/database'; +import { EXECUTION_STATUS, JOB_STATUS, toJSON, Trigger } from '@tachybase/plugin-workflow'; import { UiSchemaRepository } from '@nocobase/plugin-ui-schema-storage'; + +import { get } from 'lodash'; +import { BelongsTo, HasOne, Op } from 'sequelize'; + +import { APPROVAL_ACTION_STATUS, APPROVAL_STATUS } from './constants'; import { getSummary } from './tools'; const ExecutionStatusMap = { diff --git a/packages/plugins/@hera/plugin-approval/src/server/actions.ts b/packages/plugins/@hera/plugin-approval/src/server/actions.ts index 7f18f484f..4d6164d38 100644 --- a/packages/plugins/@hera/plugin-approval/src/server/actions.ts +++ b/packages/plugins/@hera/plugin-approval/src/server/actions.ts @@ -1,7 +1,8 @@ import actions, { utils } from '@tachybase/actions'; -import WorkflowPlugin, { EXECUTION_STATUS, JOB_STATUS, toJSON } from '@tachybase/plugin-workflow'; -import { APPROVAL_STATUS, APPROVAL_ACTION_STATUS } from './constants'; import { parseCollectionName } from '@tachybase/data-source-manager'; +import WorkflowPlugin, { EXECUTION_STATUS, JOB_STATUS, toJSON } from '@tachybase/plugin-workflow'; + +import { APPROVAL_ACTION_STATUS, APPROVAL_STATUS } from './constants'; import { getSummary } from './tools'; const workflows = { diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/component/BulkEditField.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/component/BulkEditField.tsx index 5337d8fdb..a4b0825cc 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/component/BulkEditField.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/component/BulkEditField.tsx @@ -1,15 +1,16 @@ +import React, { useEffect, useState } from 'react'; import { CollectionFieldProvider, css, - useCollectionField_deprecated, useCollection_deprecated, + useCollectionField_deprecated, useCompile, useComponent, useFormBlockContext, } from '@tachybase/client'; -import { Field, connect, merge, useField, useFieldSchema } from '@tachybase/schema'; +import { connect, Field, merge, useField, useFieldSchema } from '@tachybase/schema'; + import { Checkbox, Select, Space } from 'antd'; -import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; export const DeletedField = () => { diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateAction.tsx b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateAction.tsx index b65854f69..c9a66a3a6 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateAction.tsx +++ b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateAction.tsx @@ -1,25 +1,26 @@ +import React, { useState } from 'react'; import { ActionContextProvider, CollectionProvider_deprecated, - FormBlockContext, - RecordProvider, css, cx, fetchTemplateData, - useAPIClient, + FormBlockContext, + RecordProvider, useActionContext, + useAPIClient, useBlockRequestContext, useCollection, + useCollection_deprecated, useCollectionManager_deprecated, useCollectionParentRecordData, - useCollection_deprecated, useDesignable, useFormBlockContext, useRecord, } from '@tachybase/client'; -import { RecursionField, observer, useField, useFieldSchema } from '@tachybase/schema'; +import { observer, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; + import { App, Button } from 'antd'; -import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; export const actionDesignerCss = css` diff --git a/packages/plugins/@nocobase/plugin-auth/src/client/pages/AuthLayout.tsx b/packages/plugins/@nocobase/plugin-auth/src/client/pages/AuthLayout.tsx index 2fd2d2708..139be3f91 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/client/pages/AuthLayout.tsx +++ b/packages/plugins/@nocobase/plugin-auth/src/client/pages/AuthLayout.tsx @@ -1,6 +1,8 @@ -import { PoweredByV2 as PoweredBy, css, useAPIClient, useRequest, useSystemSettings } from '@tachybase/client'; import React from 'react'; +import { css, PoweredByV2 as PoweredBy, useAPIClient, useRequest, useSystemSettings } from '@tachybase/client'; + import { Outlet } from 'react-router-dom'; + import { AuthenticatorsContext } from '../authenticator'; export function AuthLayout(props: any) { diff --git a/packages/plugins/@nocobase/plugin-auth/src/client/pages/SignInPage.tsx b/packages/plugins/@nocobase/plugin-auth/src/client/pages/SignInPage.tsx index f8d35eca6..69cea28d6 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/client/pages/SignInPage.tsx +++ b/packages/plugins/@nocobase/plugin-auth/src/client/pages/SignInPage.tsx @@ -1,6 +1,8 @@ -import { css, useCurrentDocumentTitle, usePlugin, useViewport } from '@tachybase/client'; -import { Space, Tabs } from 'antd'; import React, { createElement, useContext } from 'react'; +import { css, useCurrentDocumentTitle, usePlugin, useViewport } from '@tachybase/client'; + +import { Space, Tabs } from 'antd'; + import AuthPlugin, { AuthOptions } from '..'; import { Authenticator, AuthenticatorsContext } from '../authenticator'; import { useAuthTranslation } from '../locale'; diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFields.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFields.tsx index 806bc1804..de71da20c 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFields.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFields.tsx @@ -1,12 +1,8 @@ -import { css } from '@tachybase/client'; -import { createForm, Field } from '@tachybase/schema'; -import { FieldContext, FormContext, useField } from '@tachybase/schema'; -import { Space, Switch, Table, TableColumnProps, Tag, Tooltip } from 'antd'; import React, { useContext, useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; import { Action, AddCollectionField, + css, EditCollectionField, Input, isDeleteButtonDisabled, @@ -28,6 +24,10 @@ import { useResourceContext, ViewCollectionField, } from '@tachybase/client'; +import { createForm, Field, FieldContext, FormContext, useField } from '@tachybase/schema'; + +import { Space, Switch, Table, TableColumnProps, Tag, Tooltip } from 'antd'; +import { useTranslation } from 'react-i18next'; import { collection } from './schemas/collectionFields'; diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFieldsTableArray.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFieldsTableArray.tsx index 59599e865..ce2760ce4 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFieldsTableArray.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/MainDataSourceManager/Configuration/CollectionFieldsTableArray.tsx @@ -1,7 +1,6 @@ -import { css } from '@tachybase/client'; -import { ArrayField, Field } from '@tachybase/schema'; -import { RecursionField, Schema, observer, useField, useFieldSchema } from '@tachybase/schema'; +import React, { useState } from 'react'; import { + css, RecordIndexProvider, RecordProvider, SchemaComponent, @@ -11,11 +10,13 @@ import { useRequest, useSchemaInitializerRender, } from '@tachybase/client'; +import { ArrayField, Field, observer, RecursionField, Schema, useField, useFieldSchema } from '@tachybase/schema'; + import { Table, TableColumnProps } from 'antd'; import { default as classNames } from 'classnames'; import { findIndex } from 'lodash'; -import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { overridingSchema } from '../Configuration/schemas/collectionFields'; const isColumnComponent = (schema: Schema) => { diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/ViewDatabaseConnectionAction.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/ViewDatabaseConnectionAction.tsx index 12c2d4e3f..62e0d7323 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/ViewDatabaseConnectionAction.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/ViewDatabaseConnectionAction.tsx @@ -1,9 +1,10 @@ -import { useRecord } from '@tachybase/client'; import React from 'react'; +import { css, useRecord } from '@tachybase/client'; + import { Button } from 'antd'; -import { css } from '@tachybase/client'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; + import { getConnectionCollectionPath } from '../constant'; export const ViewDatabaseConnectionAction = () => { diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/configure/ChartConfigProvider.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/configure/ChartConfigProvider.tsx index 2bd62d450..096d2c0c6 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/configure/ChartConfigProvider.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/configure/ChartConfigProvider.tsx @@ -1,10 +1,11 @@ +import React, { createContext, PropsWithChildren, useState } from 'react'; +import { css, useDesignable } from '@tachybase/client'; import { ISchema } from '@tachybase/schema'; -import React, { PropsWithChildren, createContext, useState } from 'react'; + +import { theme } from 'antd'; + import { ChartRendererProvider } from '../renderer'; import { ChartConfigure } from './ChartConfigure'; -import { useDesignable } from '@tachybase/client'; -import { css } from '@tachybase/client'; -import { theme } from 'antd'; export type ChartConfigCurrent = { schema: ISchema; diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx index 57663fb05..8e12dcaf3 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx @@ -1,18 +1,20 @@ import React, { useContext } from 'react'; -import { FilterOutlined } from '@ant-design/icons'; import { + css, Grid, gridRowColWrap, - useDesignable, - useCurrentSchema, SchemaInitializerSwitch, + useCurrentSchema, + useDesignable, useSchemaInitializerItem, } from '@tachybase/client'; -import { uid, merge } from '@tachybase/schema'; -import { ChartFilterContext } from './FilterProvider'; -import { css } from '@tachybase/client'; +import { merge, uid } from '@tachybase/schema'; + +import { FilterOutlined } from '@ant-design/icons'; import { theme } from 'antd'; +import { ChartFilterContext } from './FilterProvider'; + const createFilterSchema = () => { return { type: 'void', diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockProvider.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockProvider.tsx index 729b2be4e..94a9b58fb 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockProvider.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockProvider.tsx @@ -1,22 +1,22 @@ import React, { useContext, useEffect } from 'react'; -import { SchemaComponentOptions } from '@tachybase/client'; -import { ChartFilterItemDesigner } from './FilterItemDesigner'; +import { css, SchemaComponentOptions } from '@tachybase/client'; +import { ArrayItems } from '@tachybase/components'; + +import { useChartsTranslation } from '../locale'; +import { CollectionFieldInitializer } from './CollectionFieldInitializer'; import { - useChartFilterActionProps, - useChartFilterResetProps, - useChartFilterCollapseProps, - ChartFilterCollapseDesigner, ChartFilterActionDesigner, + ChartFilterCollapseDesigner, + useChartFilterActionProps, + useChartFilterCollapseProps, + useChartFilterResetProps, } from './FilterActionInitializers'; import { ChartFilterGrid } from './FilterBlockInitializer'; -import { useChartsTranslation } from '../locale'; -import { css } from '@tachybase/client'; -import { ChartFilterContext } from './FilterProvider'; import { ChartFilterCheckbox } from './FilterCheckbox'; -import { ArrayItems } from '@tachybase/components'; -import { ChartFilterFormItem } from './FilterItemInitializers'; import { ChartFilterForm } from './FilterForm'; -import { CollectionFieldInitializer } from './CollectionFieldInitializer'; +import { ChartFilterItemDesigner } from './FilterItemDesigner'; +import { ChartFilterFormItem } from './FilterItemInitializers'; +import { ChartFilterContext } from './FilterProvider'; export const ChartFilterBlockProvider: React.FC = (props) => { const { t } = useChartsTranslation(); diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx index afb58230f..48b3b05c1 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx @@ -1,36 +1,48 @@ -import { css, cx } from '@tachybase/client'; -import { FormItem, FormLayout } from '@tachybase/components'; -import { Field, onFieldValueChange } from '@tachybase/schema'; -import { Schema, SchemaOptionsContext, observer, useField, useFieldSchema, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React, { memo, useCallback, useContext, useMemo } from 'react'; import { ACLCollectionFieldProvider, BlockItem, CollectionFieldProvider, CollectionManagerProvider, CollectionProvider, - DEFAULT_DATA_SOURCE_KEY, CompatibleSchemaInitializer, + css, + cx, + DEFAULT_DATA_SOURCE_KEY, FormDialog, + gridRowColWrap, HTMLEncode, SchemaComponent, SchemaComponentOptions, SchemaInitializerItem, - gridRowColWrap, useCollectionManager_deprecated, + useCompile, useDataSourceManager, useDesignable, useGlobalTheme, useSchemaInitializerItem, - useCompile, } from '@tachybase/client'; +import { FormItem, FormLayout } from '@tachybase/components'; +import { + Field, + observer, + onFieldValueChange, + Schema, + SchemaOptionsContext, + uid, + useField, + useFieldSchema, + useForm, +} from '@tachybase/schema'; + import { useMemoizedFn } from 'ahooks'; import { Alert, ConfigProvider, Typography } from 'antd'; -import React, { memo, useCallback, useContext, useMemo } from 'react'; import { ErrorBoundary } from 'react-error-boundary'; + import { useChartData, useChartFilter, useChartFilterSourceFields, useFieldComponents } from '../hooks/filter'; import { lang, useChartsTranslation } from '../locale'; import { getPropsSchemaByComponent } from './utils'; + const { Paragraph, Text } = Typography; const FieldComponentProps: React.FC = observer( diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/calendar.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/calendar.tsx index 7acb9125e..4aeb65342 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/calendar.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/calendar.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React, { ReactChild } from 'react'; +import { cx } from '@tachybase/client'; + import { getCachedDateTimeFormat, getDaysInMonth, diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/style.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/style.tsx index 6a2daa049..36ee5db85 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/style.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/style.tsx @@ -1,6 +1,7 @@ -import { TinyColor } from '@ctrl/tinycolor'; import { createStyles } from '@tachybase/client'; +import { TinyColor } from '@ctrl/tinycolor'; + const useStyles = createStyles(({ token, css }) => { const colorFillAlterSolid = new TinyColor(token.colorFillAlter) .onBackground(token.colorBgContainer) diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/top-part-of-calendar.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/top-part-of-calendar.tsx index b61c954a1..cd5f0e1bb 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/top-part-of-calendar.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/calendar/top-part-of-calendar.tsx @@ -1,5 +1,5 @@ -import { cx } from '@tachybase/client'; import React from 'react'; +import { cx } from '@tachybase/client'; type TopPartOfCalendarProps = { value: string; diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/gantt/gantt.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/gantt/gantt.tsx index 21bf36bf5..4271a3772 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/gantt/gantt.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/gantt/gantt.tsx @@ -1,21 +1,24 @@ -import { css, cx } from '@tachybase/client'; -import { RecursionField, Schema, useFieldSchema } from '@tachybase/schema'; +import React, { SyntheticEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { ActionContextProvider, + css, + cx, RecordProvider, useAPIClient, useBlockRequestContext, - useCurrentAppInfo, useCollectionParentRecordData, + useCurrentAppInfo, + useProps, useTableBlockContext, useToken, withDynamicSchemaProps, - useProps, } from '@tachybase/client'; +import { RecursionField, Schema, useFieldSchema } from '@tachybase/schema'; + import { message } from 'antd'; import { debounce } from 'lodash'; -import React, { SyntheticEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useGanttBlockContext } from '../../GanttBlockProvider'; import { convertToBarTasks } from '../../helpers/bar-helper'; import { ganttDateRange, seedDates } from '../../helpers/date-helper'; diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/grid/grid-body.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/grid/grid-body.tsx index 547f6f05a..4cc44e088 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/grid/grid-body.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/grid/grid-body.tsx @@ -1,6 +1,7 @@ +import React, { ReactChild } from 'react'; import { cx } from '@tachybase/client'; import { uid } from '@tachybase/utils/client'; -import React, { ReactChild } from 'react'; + import { addToDate } from '../../helpers/date-helper'; import { Task } from '../../types/public-types'; import useStyles from './style'; diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/horizontal-scroll.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/horizontal-scroll.tsx index da3de845f..b99b0727e 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/horizontal-scroll.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/horizontal-scroll.tsx @@ -1,5 +1,6 @@ import React, { SyntheticEvent, useEffect, useRef } from 'react'; import { cx } from '@tachybase/client'; + import useStyles from './style'; export const HorizontalScroll: React.FC<{ diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/tooltip.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/tooltip.tsx index 71c82fc61..f651b6e15 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/tooltip.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/tooltip.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React, { useEffect, useRef, useState } from 'react'; +import { cx } from '@tachybase/client'; + import { getYmd } from '../../helpers/other-helper'; import { BarTask } from '../../types/bar-task'; import { Task } from '../../types/public-types'; diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/vertical-scroll.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/vertical-scroll.tsx index 65887b556..33d483dd7 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/vertical-scroll.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/other/vertical-scroll.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React, { SyntheticEvent, useEffect, useRef } from 'react'; +import { cx } from '@tachybase/client'; + import useStyles from './style'; export const VerticalScroll: React.FC<{ diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-display.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-display.tsx index d73d99316..8560aa50e 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-display.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-display.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React from 'react'; +import { cx } from '@tachybase/client'; + import { barBackground } from './style'; type BarDisplayProps = { diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-small.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-small.tsx index 7cf409051..84567c5bf 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-small.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar-small.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React from 'react'; +import { cx } from '@tachybase/client'; + import { getProgressPoint } from '../../../helpers/bar-helper'; import { TaskItemProps } from '../task-item'; import { BarDisplay } from './bar-display'; diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar.tsx index 9c62782e5..444409efb 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/bar/bar.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React from 'react'; +import { cx } from '@tachybase/client'; + import { getProgressPoint } from '../../../helpers/bar-helper'; import { TaskItemProps } from '../task-item'; import { BarDateHandle } from './bar-date-handle'; diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/milestone/milestone.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/milestone/milestone.tsx index 18bbc145b..e3090a634 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/milestone/milestone.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/milestone/milestone.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { cx } from '@tachybase/client'; + import { TaskItemProps } from '../task-item'; -import { milestoneWrapper, milestoneBackground } from './style'; +import { milestoneBackground, milestoneWrapper } from './style'; export const Milestone: React.FC = ({ task, isDateChangeable, onEventStart, isSelected }) => { const transform = `rotate(45 ${task.x1 + task.height * 0.356} diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/project/project.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/project/project.tsx index b8cedfa3b..fe77878bf 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/project/project.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/project/project.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React from 'react'; +import { cx } from '@tachybase/client'; + import { TaskItemProps } from '../task-item'; import { projectBackground, projectWrapper } from './style'; diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/task-item.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/task-item.tsx index 4999c77b7..8ea6081b7 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/task-item.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/components/task-item/task-item.tsx @@ -1,5 +1,6 @@ -import { cx } from '@tachybase/client'; import React, { useEffect, useRef, useState } from 'react'; +import { cx } from '@tachybase/client'; + import { getYmd } from '../../helpers/other-helper'; import { BarTask } from '../../types/bar-task'; import { GanttContentMoveAction } from '../../types/gantt-task-actions'; diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/GraphDrawPage.tsx b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/GraphDrawPage.tsx index 3bb9165cb..dbcd82d6d 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/GraphDrawPage.tsx +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/GraphDrawPage.tsx @@ -1,18 +1,11 @@ -import { ApartmentOutlined } from '@ant-design/icons'; -import { Graph } from '@antv/x6'; -import { MiniMap } from '@antv/x6-plugin-minimap'; -import { Scroller } from '@antv/x6-plugin-scroller'; -import { Selection } from '@antv/x6-plugin-selection'; -import { Snapline } from '@antv/x6-plugin-snapline'; -import { register } from '@antv/x6-react-shape'; -import { cx } from '@tachybase/client'; -import { SchemaOptionsContext } from '@tachybase/schema'; +import React, { createContext, forwardRef, useContext, useEffect, useLayoutEffect, useState } from 'react'; import { APIClientProvider, ApplicationContext, CollectionCategroriesContext, CollectionCategroriesProvider, CurrentAppInfoContext, + cx, DataSourceApplicationProvider, SchemaComponent, SchemaComponentOptions, @@ -22,15 +15,24 @@ import { useCollectionManager_deprecated, useCompile, useCurrentAppInfo, - useDataSourceManager, useDataSource, + useDataSourceManager, useGlobalTheme, } from '@tachybase/client'; +import { SchemaOptionsContext } from '@tachybase/schema'; + +import { ApartmentOutlined } from '@ant-design/icons'; +import { Graph } from '@antv/x6'; +import { MiniMap } from '@antv/x6-plugin-minimap'; +import { Scroller } from '@antv/x6-plugin-scroller'; +import { Selection } from '@antv/x6-plugin-selection'; +import { Snapline } from '@antv/x6-plugin-snapline'; +import { register } from '@antv/x6-react-shape'; import { App, Button, ConfigProvider, Layout, Spin, Switch, Tooltip } from 'antd'; import dagre from 'dagre'; import lodash from 'lodash'; -import React, { createContext, forwardRef, useContext, useEffect, useLayoutEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; + import { useAsyncDataSource, useCreateActionAndRefreshCM } from './action-hooks'; import { AddCollectionAction } from './components/AddCollectionAction'; import { ConnectorAction } from './components/ConnectorAction'; @@ -43,6 +45,7 @@ import { SimpleNodeView } from './components/ViewNode'; import useStyles from './style'; import { cleanGraphContainer, + collection, formatData, getChildrenCollections, getDiffEdge, @@ -50,8 +53,8 @@ import { getInheritCollections, getPopupContainer, useGCMTranslation, - collection, } from './utils'; + const { drop, groupBy, last, maxBy, minBy, take, uniq } = lodash; const LINE_HEIGHT = 40; diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/ConnectorAction.tsx b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/ConnectorAction.tsx index 340c35f56..203628543 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/ConnectorAction.tsx +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/ConnectorAction.tsx @@ -1,9 +1,11 @@ import React from 'react'; -import { ShareAltOutlined } from '@ant-design/icons'; -import { Menu, Popover, Button } from 'antd'; import { css } from '@tachybase/client'; -import { getPopupContainer, useGCMTranslation } from '../utils'; + +import { ShareAltOutlined } from '@ant-design/icons'; +import { Button, Menu, Popover } from 'antd'; + import { ConnectionType } from '../GraphDrawPage'; +import { getPopupContainer, useGCMTranslation } from '../utils'; export const ConnectorAction = (props) => { const { onClick } = props; diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/DirectionAction.tsx b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/DirectionAction.tsx index 50ac20571..fffc197f2 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/DirectionAction.tsx +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/DirectionAction.tsx @@ -1,9 +1,11 @@ import React from 'react'; -import { Popover, Button, Menu } from 'antd'; import { css } from '@tachybase/client'; + import { LineHeightOutlined } from '@ant-design/icons'; -import { getPopupContainer, useGCMTranslation } from '../utils'; +import { Button, Menu, Popover } from 'antd'; + import { DirectionType } from '../GraphDrawPage'; +import { getPopupContainer, useGCMTranslation } from '../utils'; export const DirectionAction = (props) => { const { onClick } = props; diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/Entity.tsx b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/Entity.tsx index 6a265e917..9b6592532 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/Entity.tsx +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/Entity.tsx @@ -1,10 +1,8 @@ -import { DeleteOutlined, DownOutlined, EditOutlined, UpOutlined } from '@ant-design/icons'; -import { css } from '@tachybase/client'; -import { SchemaOptionsContext } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React, { useContext, useRef, useState } from 'react'; import { CollectionCategroriesContext, CollectionProvider_deprecated, + css, SchemaComponent, SchemaComponentProvider, Select, @@ -14,9 +12,12 @@ import { useCurrentAppInfo, useRecord, } from '@tachybase/client'; +import { SchemaOptionsContext, uid } from '@tachybase/schema'; + +import { DeleteOutlined, DownOutlined, EditOutlined, UpOutlined } from '@ant-design/icons'; import { Badge, Tag } from 'antd'; import lodash from 'lodash'; -import React, { useContext, useRef, useState } from 'react'; + import { useAsyncDataSource, useCancelAction, @@ -26,7 +27,7 @@ import { useValuesFromRecord, } from '../action-hooks'; import useStyles from '../style'; -import { getPopupContainer, useGCMTranslation, collection } from '../utils'; +import { collection, getPopupContainer, useGCMTranslation } from '../utils'; import { AddFieldAction } from './AddFieldAction'; import { CollectionNodeProvder } from './CollectionNodeProvder'; import { ConnectAssociationAction } from './ConnectAssociationAction'; diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/LocateCollectionAction.tsx b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/LocateCollectionAction.tsx index e6dedccd2..bc518b506 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/LocateCollectionAction.tsx +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/src/client/components/LocateCollectionAction.tsx @@ -1,10 +1,11 @@ -import React, { useState, useContext } from 'react'; -import { Input, Menu, Popover, Button } from 'antd'; -import { css } from '@tachybase/client'; +import React, { useContext, useState } from 'react'; +import { css, useCompile } from '@tachybase/client'; + import { MenuOutlined } from '@ant-design/icons'; -import { useCompile } from '@tachybase/client'; -import { getPopupContainer, useGCMTranslation } from '../utils'; +import { Button, Input, Menu, Popover } from 'antd'; + import { CollapsedContext } from '../GraphDrawPage'; +import { getPopupContainer, useGCMTranslation } from '../utils'; export const LocateCollectionAction = (props) => { const { handleFiterCollections } = props; diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx index 405dc506a..58465b6f8 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx @@ -1,16 +1,18 @@ -import { css } from '@tachybase/client'; -import { FormLayout } from '@tachybase/components'; -import { observer, RecursionField, useFieldSchema } from '@tachybase/schema'; +import React, { useContext, useState } from 'react'; import { ActionContextProvider, + css, DndContext, RecordProvider, SchemaComponentOptions, useCollectionParentRecordData, } from '@tachybase/client'; +import { FormLayout } from '@tachybase/components'; +import { observer, RecursionField, useFieldSchema } from '@tachybase/schema'; + import { Card } from 'antd'; import cls from 'classnames'; -import React, { useContext, useState } from 'react'; + import { KanbanCardContext } from './context'; export const KanbanCard: any = observer( diff --git a/packages/plugins/@nocobase/plugin-theme-editor/src/client/components/theme-editor/index.tsx b/packages/plugins/@nocobase/plugin-theme-editor/src/client/components/theme-editor/index.tsx index 1823a50e4..e502465b0 100644 --- a/packages/plugins/@nocobase/plugin-theme-editor/src/client/components/theme-editor/index.tsx +++ b/packages/plugins/@nocobase/plugin-theme-editor/src/client/components/theme-editor/index.tsx @@ -1,12 +1,13 @@ -import { css, cx } from '@tachybase/client'; -import { createStyles, useAPIClient, useGlobalTheme } from '@tachybase/client'; +import React, { useEffect } from 'react'; +import { createStyles, css, cx, useAPIClient, useGlobalTheme } from '@tachybase/client'; import { error } from '@tachybase/utils/client'; -import { Button, ConfigProvider, Input, Space, message } from 'antd'; + +import { Button, ConfigProvider, Input, message, Space } from 'antd'; import antdEnUs from 'antd/locale/en_US'; import antdZhCN from 'antd/locale/zh_CN'; -import React, { useEffect } from 'react'; + import { ThemeConfig } from '../../../types'; -import { ThemeEditor, enUS, zhCN } from '../../antd-token-previewer'; +import { enUS, ThemeEditor, zhCN } from '../../antd-token-previewer'; import { useUpdateThemeSettings } from '../../hooks/useUpdateThemeSettings'; import { useTranslation } from '../../locale'; import { changeAlgorithmFromFunctionToString } from '../../utils/changeAlgorithmFromFunctionToString'; diff --git a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/index.tsx b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/index.tsx index 1cfed8c4a..539205f31 100644 --- a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/index.tsx +++ b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/index.tsx @@ -1,7 +1,10 @@ import { Plugin } from '@tachybase/client'; + import 'vditor/dist/index.css'; + import { MarkdownVditor } from './components'; import { MarkdownVditorFieldInterface } from './interfaces/markdown-vditor'; + export class PluginFieldMarkdownVditorClient extends Plugin { async afterAdd() {}