fix: 完善移动端审批组件 (#1042)

Reviewed-on: daoyoucloud/tachybase#1042
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-05-23 21:00:32 +08:00 committed by sealday
parent ad079d4e5f
commit 63c351ea1a
67 changed files with 641 additions and 381 deletions

View File

@ -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,

View File

@ -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,
},
];

View File

@ -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',

View File

@ -19,7 +19,7 @@ export const ApprovalReachDataType = observer((props) => {
setPopupVisible(true);
}}
>
{filter['createdAt'] ? `${formatDate(startData)}-${formatDate(endData)} ` : '到达日期'}
{filter?.['createdAt'] ? `${formatDate(startData)}-${formatDate(endData)} ` : '到达日期'}
<DownOutline />
</Space>
<Popup

View File

@ -38,7 +38,7 @@ export const ApprovalTemplateType = observer((props) => {
setVisible(true);
}}
>
{columns.length && filter.workflowId && filter.workflowId !== 'all'
{columns.length && filter?.workflowId && filter?.workflowId !== 'all'
? columns.find((item) => item.value === filter.workflowId).label
: '模版类型'}
<DownOutline />

View File

@ -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,

View File

@ -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: (
<div
style={{ display: 'flex', flexDirection: 'column', alignContent: 'center' }}
onClick={(c) => {
navigate(`/mobile/${value.title?.replace('审批流:', '') || ''}/approval/${value.id}/page`);
}}
>
<div>
<TeamFill />
</div>
{value.title?.replace('审批流:', '') || ''}
</div>
),
};
});
setOptions(option);
})
.catch(() => {});
}, [params, filter]);
const fieldSchema = useFieldSchema();
const { t } = useTranslation();
const [contextFilter, setContextFilter] = useState({ key: 'initiations', inputFilter: '' });
const [changeValue, setChangeValue] = useState('');
return (
<ExtendCollectionsProvider
collections={[CollectionWorkflows, CollectionFlowNodes, CollectionApprovals, CollectionApprovalTodos]}
>
<BlockItem>
<div style={{ padding: '10px', minHeight: '90vh' }}>
<InitiationsBlockContext.Provider value={contextFilter}>
<SearchBar
placeholder="请输入内容"
placeholder="搜索内容"
clearable
style={{ '--background': '#ffffff' }}
style={{ '--background': '#ffffff', padding: '10px', marginBottom: '10px ' }}
onChange={(value) => {
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);
}}
/>
<Card
className={css`
overflow: hidden;
margin-top: 20px;
.adm-card-body {
padding: 0;
}
`}
style={{ padding: '0', backgroundColor: '#f3f3f3' }}
<Tabs
style={{ '--title-font-size': '12px', backgroundColor: '#f3f3f3' }}
onChange={(key) => {
const filter = { ...contextFilter };
filter['key'] = key;
filter['inputFilter'] = '';
setChangeValue('');
setContextFilter(filter);
}}
>
<Selector
style={{ '--color': '#ffffff', '--gap': '1px' }}
columns={3}
showCheckMark={false}
options={options}
/>
</Card>
</div>
<Tabs.Tab title="发起申请" key="initiations">
<SchemaComponent
components={{
InitiationsItem,
}}
schema={{
type: 'void',
name: 'initiations',
title: t('Initiations'),
'x-settings': 'ApprovalSettings',
'x-component': 'InitiationsItem',
'x-component-props': {
...props,
collectionName: 'workflows',
settingBlock: true,
tabKey: 'initiations',
parantUid: fieldSchema['x-uid'],
parantParams: props['params'],
},
}}
/>
</Tabs.Tab>
<Tabs.Tab title="我的发起" key="userInitiations">
<SchemaComponent
components={{
UserInitiationsItem,
}}
schema={{
type: 'void',
name: 'userInitiations',
title: t('UserInitiations'),
'x-settings': 'ApprovalSettings',
'x-component': 'UserInitiationsItem',
'x-component-props': {
...props,
collectionName: 'approvals',
settingBlock: true,
tabKey: 'userInitiations',
parantUid: fieldSchema['x-uid'],
parantParams: props['params'],
},
}}
/>
</Tabs.Tab>
</Tabs>
</InitiationsBlockContext.Provider>
</BlockItem>
</ExtendCollectionsProvider>
);

View File

@ -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 (
<ExtendCollectionsProvider
collections={[CollectionWorkflows, CollectionFlowNodes, CollectionApprovals, CollectionApprovalTodos]}
>
<BlockItem>
<SearchBar
placeholder="搜索人名,标题、内容"
clearable
style={{ '--background': '#ffffff', padding: '10px' }}
/>
<Space justify="evenly" className="userInitiationsStyle">
{/* 模版类型 */}
<ApprovalTemplateType {...filterProps} />
{/* 到达日期 */}
<ApprovalReachDataType {...filterProps} />
{/* 审批状态 */}
<ApprovalStatus {...filterProps} />
</Space>
<ApprovalItem {...filterProps} />
</BlockItem>
</ExtendCollectionsProvider>
);
});

View File

@ -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 (
<div style={{ minHeight: '73vh' }}>
{data.length ? (
@ -30,17 +41,17 @@ export const ApprovalItem = observer((props) => {
navigate(`/mobile/approval/${item.id}/page`);
}}
>
<Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}>
<Space block>
{item.title}
<Tag color={item.statusColor} fill="outline">
{item.statusTitle}
</Tag>
<Tag color={item.priorityColor} fill="outline">
{item.priorityTitle}
</Tag>
</Space>
</Badge>
{/* <Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}> */}
<Space block>
{item.title}
<Tag color={item.statusColor} fill="outline">
{item.statusTitle}
</Tag>
<Tag color={item.priorityColor} fill="outline">
{item.priorityTitle}
</Tag>
</Space>
{/* </Badge> */}
<Space block> :{item.reason}</Space>
</List.Item>
);
@ -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;
});

View File

@ -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)
: '申请状态'}
<DownOutline />
@ -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') {

View File

@ -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: (
<div
style={{ display: 'flex', flexDirection: 'column', alignContent: 'center' }}
onClick={(c) => {
navigate(`/mobile/${value.title?.replace('审批流:', '') || ''}/approval/${value.id}/page`);
}}
>
<div>
<TeamFill />
</div>
{value.title?.replace('审批流:', '') || ''}
</div>
),
};
});
if (filter && options.length) {
const filterData = option.filter((value) => (value.title as string)?.includes(filter));
setOptions(filterData);
} else {
setOptions(option);
}
})
.catch(() => {});
}, [params]);
return (
<BlockItem>
<Card className="initiationsItemCard">
{options.length ? (
<Selector
style={{ '--color': '#ffffff', '--gap': '1px' }}
columns={3}
showCheckMark={false}
options={options}
/>
) : (
<Empty description="暂无数据" />
)}
</Card>
</BlockItem>
);
});

View File

@ -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 (
<BlockItem>
<Space justify="evenly" className="userInitiationsStyle">
{/* 模版类型 */}
<ApprovalTemplateType {...filterProps} />
{/* 到达日期 */}
<ApprovalReachDataType {...filterProps} />
{/* 审批状态 */}
<ApprovalStatus {...filterProps} />
</Space>
<ApprovalItem {...filterProps} />
</BlockItem>
);
});

View File

@ -77,20 +77,22 @@ export const ViewActionInitiationsContent = () => {
{name}
</NavBar>
<SchemaComponentContext.Provider value={{ ...context, designable: false }}>
<SchemaComponent
schema={schema}
components={{
RemoteSchemaComponent: RemoteSchemaComponent,
CollectionProvider_deprecated: CollectionProvider_deprecated,
ApplyActionStatusProvider: ContextInitiationsApprovalStatusProvider,
ActionBarProvider,
WithdrawActionProvider: WithdrawActionProvider,
}}
scope={{
useSubmit: useCreateSubmit,
useWithdrawAction,
}}
/>
<div className="approvalContext">
<SchemaComponent
schema={schema}
components={{
RemoteSchemaComponent: RemoteSchemaComponent,
CollectionProvider_deprecated: CollectionProvider_deprecated,
ApplyActionStatusProvider: ContextInitiationsApprovalStatusProvider,
ActionBarProvider,
WithdrawActionProvider: WithdrawActionProvider,
}}
scope={{
useSubmit: useCreateSubmit,
useWithdrawAction,
}}
/>
</div>
</SchemaComponentContext.Provider>
</div>
);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);
}}
/>
<Tabs
onChange={(key) => {
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' }}
>

View File

@ -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`);
}}
>
<Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}>
<Space block>
{item.title}
<Tag color={item.statusColor} fill="outline">
{item.statusTitle}
</Tag>
<Tag color={item.priorityColor} fill="outline">
{item.priorityTitle}
</Tag>
</Space>
</Badge>
<Space block> :{item.reason}</Space>
{/* <Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}> */}
<Space block>
{item.title}
<Tag color={item.statusColor} fill="outline">
{item.statusTitle}
</Tag>
<Tag color={item.priorityColor} fill="outline">
{item.priorityTitle}
</Tag>
</Space>
{/* </Badge> */}
{item.reason.map((reasonItem, index) => {
return <Space block key={index}>{`${reasonItem.label}:${reasonItem.value}`}</Space>;
})}
</List.Item>
);
})}

View File

@ -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);

View File

@ -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"
}

View File

@ -77,5 +77,7 @@
"Disabled": "已失效",
"Submission may be withdrawn, please try refresh the list.": "提交可能已被撤回,请尝试刷新列表。",
"Trigger data": "触发器数据",
"All":"全部"
"All":"全部",
"Initiations":"发起申请",
"UserInitiations":"我的发起"
}

View File

@ -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';
// 工作流节点-审批触发器节点

View File

@ -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',

View File

@ -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';

View File

@ -1,4 +1,5 @@
import { css } from '@tachybase/client';
import { NAMESPACE, tval } from '../../../locale';
export const SchemaApprovalBlockTodos = {

View File

@ -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}" })}}`,

View File

@ -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) => {

View File

@ -1,4 +1,5 @@
import { Plugin } from '@tachybase/client';
import { ApprovalDataProvider } from './ApprovalData.provider';
import { ApprovalProcess } from './ApprovalProcess.view';
import { ApprovalsSummary } from './ApprovalsSummary.view';

View File

@ -1,4 +1,5 @@
import { Plugin } from '@tachybase/client';
import { tval } from '../../locale';
import { KitApprovalCommon } from '../approval-common/plugin';
import { RecordApprovalsDecorator } from './RecordApprovals.decorator';

View File

@ -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() {

View File

@ -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'),

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = () => {

View File

@ -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`

View File

@ -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) {

View File

@ -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';

View File

@ -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';

View File

@ -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) => {

View File

@ -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 = () => {

View File

@ -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;

View File

@ -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',

View File

@ -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();

View File

@ -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(

View File

@ -1,5 +1,6 @@
import { cx } from '@tachybase/client';
import React, { ReactChild } from 'react';
import { cx } from '@tachybase/client';
import {
getCachedDateTimeFormat,
getDaysInMonth,

View File

@ -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)

View File

@ -1,5 +1,5 @@
import { cx } from '@tachybase/client';
import React from 'react';
import { cx } from '@tachybase/client';
type TopPartOfCalendarProps = {
value: string;

View File

@ -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';

View File

@ -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';

View File

@ -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<{

View File

@ -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';

View File

@ -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<{

View File

@ -1,5 +1,6 @@
import { cx } from '@tachybase/client';
import React from 'react';
import { cx } from '@tachybase/client';
import { barBackground } from './style';
type BarDisplayProps = {

View File

@ -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';

View File

@ -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';

View File

@ -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<TaskItemProps> = ({ task, isDateChangeable, onEventStart, isSelected }) => {
const transform = `rotate(45 ${task.x1 + task.height * 0.356}

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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;

View File

@ -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(

View File

@ -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';

View File

@ -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() {}