diff --git a/packages/app/client/src/pages/index.tsx b/packages/app/client/src/pages/index.tsx index 99d0bab45..deaba138b 100644 --- a/packages/app/client/src/pages/index.tsx +++ b/packages/app/client/src/pages/index.tsx @@ -8,6 +8,7 @@ export const app = new Application({ require('@nocobase/plugin-china-region/client').default, require('@nocobase/plugin-export/client').default, require('@nocobase/plugin-audit-logs/client').default, + require('@nocobase/plugin-workflow/client').default, ], }); diff --git a/packages/core/client/src/application/Application.tsx b/packages/core/client/src/application/Application.tsx index 23df94457..a59b16379 100644 --- a/packages/core/client/src/application/Application.tsx +++ b/packages/core/client/src/application/Application.tsx @@ -90,7 +90,7 @@ export class Application { this.use(AntdSchemaComponentProvider); this.use(ACLProvider); this.use(RemoteDocumentTitleProvider); - this.use(require('../workflow').WorkflowProvider); + for (const plugin of options.plugins) { const [component, props] = Array.isArray(plugin) ? plugin : [plugin]; this.use(component, props); diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index 837c0a9e3..834cdc7b1 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -1,6 +1,6 @@ import { Schema as SchemaCompiler } from '@formily/json-schema'; import { useField, useFieldSchema, useForm } from '@formily/react'; -import { useFormBlockContext } from '@nocobase/client'; +import { useFormBlockContext } from '../..'; import { message, Modal } from 'antd'; import get from 'lodash/get'; import { useTranslation } from 'react-i18next'; diff --git a/packages/core/client/src/index.tsx b/packages/core/client/src/index.tsx index f36a684cc..196decddc 100644 --- a/packages/core/client/src/index.tsx +++ b/packages/core/client/src/index.tsx @@ -25,5 +25,3 @@ export * from './schema-templates'; export * from './settings-form'; export * from './system-settings'; export * from './user'; -export * from './workflow'; - diff --git a/packages/core/client/src/workflow/index.tsx b/packages/core/client/src/workflow/index.tsx deleted file mode 100644 index 3693ff0ae..000000000 --- a/packages/core/client/src/workflow/index.tsx +++ /dev/null @@ -1,6 +0,0 @@ -export * from './ExecutionResourceProvider'; -export * from './WorkflowLink'; -export * from './WorkflowPage'; -export * from './WorkflowProvider'; -export * from './WorkflowShortcut'; - diff --git a/packages/plugins/workflow/client.d.ts b/packages/plugins/workflow/client.d.ts new file mode 100755 index 000000000..765db9222 --- /dev/null +++ b/packages/plugins/workflow/client.d.ts @@ -0,0 +1,4 @@ +// @ts-nocheck +export * from './lib/client'; +export { default } from './lib/client'; + diff --git a/packages/plugins/workflow/client.js b/packages/plugins/workflow/client.js new file mode 100755 index 000000000..238820257 --- /dev/null +++ b/packages/plugins/workflow/client.js @@ -0,0 +1,30 @@ +"use strict"; + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var _index = _interopRequireWildcard(require("./lib/client")); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _exportNames = {}; +Object.defineProperty(exports, "default", { + enumerable: true, + get: function get() { + return _index.default; + } +}); + +Object.keys(_index).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _index[key]; + } + }); +}); diff --git a/packages/plugins/workflow/package.json b/packages/plugins/workflow/package.json index 625d09a1a..e8e356f24 100644 --- a/packages/plugins/workflow/package.json +++ b/packages/plugins/workflow/package.json @@ -11,6 +11,7 @@ ], "dependencies": { "@nocobase/actions": "0.7.1-alpha.7", + "@nocobase/client": "0.7.1-alpha.7", "@nocobase/database": "0.7.1-alpha.7", "@nocobase/server": "0.7.1-alpha.7", "@nocobase/utils": "0.7.1-alpha.7", diff --git a/packages/plugins/workflow/server.d.ts b/packages/plugins/workflow/server.d.ts new file mode 100755 index 000000000..e70edb928 --- /dev/null +++ b/packages/plugins/workflow/server.d.ts @@ -0,0 +1,4 @@ +// @ts-nocheck +export * from './lib/server'; +export { default } from './lib/server'; + diff --git a/packages/plugins/workflow/server.js b/packages/plugins/workflow/server.js new file mode 100755 index 000000000..d06a7eb92 --- /dev/null +++ b/packages/plugins/workflow/server.js @@ -0,0 +1,30 @@ +"use strict"; + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var _index = _interopRequireWildcard(require("./lib/server")); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _exportNames = {}; +Object.defineProperty(exports, "default", { + enumerable: true, + get: function get() { + return _index.default; + } +}); + +Object.keys(_index).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _index[key]; + } + }); +}); diff --git a/packages/core/client/src/workflow/ExecutionResourceProvider.tsx b/packages/plugins/workflow/src/client/ExecutionResourceProvider.tsx similarity index 86% rename from packages/core/client/src/workflow/ExecutionResourceProvider.tsx rename to packages/plugins/workflow/src/client/ExecutionResourceProvider.tsx index 97a5f8e2f..aad16b655 100644 --- a/packages/core/client/src/workflow/ExecutionResourceProvider.tsx +++ b/packages/plugins/workflow/src/client/ExecutionResourceProvider.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { ResourceActionProvider, useRecord } from ".."; +import { ResourceActionProvider, useRecord } from "@nocobase/client"; export const ExecutionResourceProvider = ({ request, ...others }) => { const workflow = useRecord(); diff --git a/packages/core/client/src/workflow/WorkflowCanvas.tsx b/packages/plugins/workflow/src/client/WorkflowCanvas.tsx similarity index 99% rename from packages/core/client/src/workflow/WorkflowCanvas.tsx rename to packages/plugins/workflow/src/client/WorkflowCanvas.tsx index e2bfb8f65..6c39c4afb 100644 --- a/packages/core/client/src/workflow/WorkflowCanvas.tsx +++ b/packages/plugins/workflow/src/client/WorkflowCanvas.tsx @@ -1,4 +1,5 @@ import React, { useContext, useEffect } from 'react'; +import { useHistory } from 'react-router-dom'; import { Dropdown, Menu, Button, Tag, Switch, message } from 'antd'; import { PlusOutlined, DownOutlined, RightOutlined } from '@ant-design/icons'; import { cx } from '@emotion/css'; @@ -10,11 +11,11 @@ import { useDocumentTitle, useResourceActionContext, useResourceContext -} from '..'; +} from '@nocobase/client'; + import { Instruction, instructions, Node } from './nodes'; import { addButtonClass, branchBlockClass, branchClass, nodeCardClass, nodeMetaClass, workflowVersionDropdownClass } from './style'; import { TriggerConfig } from './triggers'; -import { useHistory } from 'react-router-dom'; diff --git a/packages/core/client/src/workflow/WorkflowLink.tsx b/packages/plugins/workflow/src/client/WorkflowLink.tsx similarity index 85% rename from packages/core/client/src/workflow/WorkflowLink.tsx rename to packages/plugins/workflow/src/client/WorkflowLink.tsx index 1e872b39a..34c6ce953 100644 --- a/packages/core/client/src/workflow/WorkflowLink.tsx +++ b/packages/plugins/workflow/src/client/WorkflowLink.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { useActionContext, useRecord } from '..'; + +import { useActionContext, useRecord } from '@nocobase/client'; export const WorkflowLink = () => { diff --git a/packages/core/client/src/workflow/WorkflowPage.tsx b/packages/plugins/workflow/src/client/WorkflowPage.tsx similarity index 96% rename from packages/core/client/src/workflow/WorkflowPage.tsx rename to packages/plugins/workflow/src/client/WorkflowPage.tsx index 9f5d3ac46..1bc6ff7e4 100644 --- a/packages/core/client/src/workflow/WorkflowPage.tsx +++ b/packages/plugins/workflow/src/client/WorkflowPage.tsx @@ -1,7 +1,7 @@ import { cx } from '@emotion/css'; import React from 'react'; import { useRouteMatch } from 'react-router-dom'; -import { SchemaComponent } from '..'; +import { SchemaComponent } from '@nocobase/client'; import { workflowPageClass } from './style'; import { WorkflowCanvas } from './WorkflowCanvas'; diff --git a/packages/core/client/src/workflow/WorkflowProvider.tsx b/packages/plugins/workflow/src/client/WorkflowProvider.tsx similarity index 88% rename from packages/core/client/src/workflow/WorkflowProvider.tsx rename to packages/plugins/workflow/src/client/WorkflowProvider.tsx index 016ee0f7c..44e05f261 100644 --- a/packages/core/client/src/workflow/WorkflowProvider.tsx +++ b/packages/plugins/workflow/src/client/WorkflowProvider.tsx @@ -1,6 +1,5 @@ import React, { useContext } from 'react'; -import { PluginManagerContext } from '../plugin-manager'; -import { RouteSwitchContext } from '../route-switch'; +import { PluginManagerContext, RouteSwitchContext } from '@nocobase/client'; import { WorkflowPage } from './WorkflowPage'; import { WorkflowShortcut } from './WorkflowShortcut'; diff --git a/packages/core/client/src/workflow/WorkflowShortcut.tsx b/packages/plugins/workflow/src/client/WorkflowShortcut.tsx similarity index 90% rename from packages/core/client/src/workflow/WorkflowShortcut.tsx rename to packages/plugins/workflow/src/client/WorkflowShortcut.tsx index f4ffe620c..04fd2a4d1 100644 --- a/packages/core/client/src/workflow/WorkflowShortcut.tsx +++ b/packages/plugins/workflow/src/client/WorkflowShortcut.tsx @@ -3,9 +3,9 @@ import { PartitionOutlined } from '@ant-design/icons'; import { ISchema } from '@formily/react'; import { uid } from '@formily/shared'; import { useTranslation } from 'react-i18next'; -import { PluginManager } from '../plugin-manager'; -import { ActionContext, SchemaComponent } from '../schema-component'; +import { PluginManager, ActionContext, SchemaComponent } from '@nocobase/client'; + import { workflowSchema } from './schemas/workflows'; import { WorkflowLink } from './WorkflowLink'; import { ExecutionResourceProvider } from './ExecutionResourceProvider'; diff --git a/packages/core/client/src/workflow/calculators.tsx b/packages/plugins/workflow/src/client/calculators.tsx similarity index 99% rename from packages/core/client/src/workflow/calculators.tsx rename to packages/plugins/workflow/src/client/calculators.tsx index 935491ac1..6b1f5b323 100644 --- a/packages/core/client/src/workflow/calculators.tsx +++ b/packages/plugins/workflow/src/client/calculators.tsx @@ -4,10 +4,11 @@ import { Button, Cascader, Dropdown, Input, InputNumber, Menu, Select, Form } fr import { css } from "@emotion/css"; import { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons'; +import { SchemaComponent, useCollectionManager, useCompile } from "@nocobase/client"; + import { instructions, useNodeContext } from "./nodes"; import { useFlowContext } from "./WorkflowCanvas"; import { triggers } from "./triggers"; -import { SchemaComponent, useCollectionManager, useCompile } from ".."; import { useTranslation } from "react-i18next"; function NullRender() { diff --git a/packages/core/client/src/workflow/components/Duration.tsx b/packages/plugins/workflow/src/client/components/Duration.tsx similarity index 100% rename from packages/core/client/src/workflow/components/Duration.tsx rename to packages/plugins/workflow/src/client/components/Duration.tsx diff --git a/packages/plugins/workflow/src/client/index.tsx b/packages/plugins/workflow/src/client/index.tsx new file mode 100644 index 000000000..aefc7200d --- /dev/null +++ b/packages/plugins/workflow/src/client/index.tsx @@ -0,0 +1,3 @@ +export { triggers } from './triggers'; +export * from './nodes'; +export { WorkflowProvider as default } from './WorkflowProvider'; diff --git a/packages/core/client/src/workflow/nodes/calculation.tsx b/packages/plugins/workflow/src/client/nodes/calculation.tsx similarity index 99% rename from packages/core/client/src/workflow/nodes/calculation.tsx rename to packages/plugins/workflow/src/client/nodes/calculation.tsx index 53a3abaae..2fe7fd364 100644 --- a/packages/core/client/src/workflow/nodes/calculation.tsx +++ b/packages/plugins/workflow/src/client/nodes/calculation.tsx @@ -1,6 +1,7 @@ import { css } from '@emotion/css'; import React from 'react'; import { useTranslation } from 'react-i18next'; + import { Calculation } from '../calculators'; export default { diff --git a/packages/core/client/src/workflow/nodes/condition.tsx b/packages/plugins/workflow/src/client/nodes/condition.tsx similarity index 98% rename from packages/core/client/src/workflow/nodes/condition.tsx rename to packages/plugins/workflow/src/client/nodes/condition.tsx index 96bcffce7..0cd16e9d9 100644 --- a/packages/core/client/src/workflow/nodes/condition.tsx +++ b/packages/plugins/workflow/src/client/nodes/condition.tsx @@ -4,12 +4,14 @@ import { Button, Select } from "antd"; import { CloseCircleOutlined } from '@ant-design/icons'; import { Trans, useTranslation } from "react-i18next"; +import { i18n } from "@nocobase/client"; + import { NodeDefaultView } from "."; import { Branch, useFlowContext } from "../WorkflowCanvas"; import { branchBlockClass, nodeSubtreeClass } from "../style"; import { Calculation } from "../calculators"; -import { i18n } from "../../i18n"; -// import { SchemaComponent } from "../../schema-component"; + + function CalculationItem({ value, onChange, onRemove }) { if (!value) { diff --git a/packages/core/client/src/workflow/nodes/create.tsx b/packages/plugins/workflow/src/client/nodes/create.tsx similarity index 98% rename from packages/core/client/src/workflow/nodes/create.tsx rename to packages/plugins/workflow/src/client/nodes/create.tsx index 5332babe1..8d21ff915 100644 --- a/packages/core/client/src/workflow/nodes/create.tsx +++ b/packages/plugins/workflow/src/client/nodes/create.tsx @@ -1,12 +1,13 @@ import { Select } from 'antd'; import React from 'react'; import { useTranslation } from 'react-i18next'; -import { useCollectionDataSource, useCollectionManager, useCompile } from '../..'; +import { useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client'; import { BaseTypeSet, CollectionFieldset } from '../calculators'; import { collection, values } from '../schemas/collection'; import { useFlowContext } from '../WorkflowCanvas'; + export default { title: '{{t("Create record")}}', type: 'create', diff --git a/packages/core/client/src/workflow/nodes/delay.tsx b/packages/plugins/workflow/src/client/nodes/delay.tsx similarity index 100% rename from packages/core/client/src/workflow/nodes/delay.tsx rename to packages/plugins/workflow/src/client/nodes/delay.tsx diff --git a/packages/core/client/src/workflow/nodes/destroy.tsx b/packages/plugins/workflow/src/client/nodes/destroy.tsx similarity index 90% rename from packages/core/client/src/workflow/nodes/destroy.tsx rename to packages/plugins/workflow/src/client/nodes/destroy.tsx index a24c8310f..75c0457f0 100644 --- a/packages/core/client/src/workflow/nodes/destroy.tsx +++ b/packages/plugins/workflow/src/client/nodes/destroy.tsx @@ -1,4 +1,4 @@ -import { useCollectionDataSource } from '../..'; +import { useCollectionDataSource } from '@nocobase/client'; import { VariableComponent } from '../calculators'; import { collection, filter } from '../schemas/collection'; diff --git a/packages/core/client/src/workflow/nodes/index.tsx b/packages/plugins/workflow/src/client/nodes/index.tsx similarity index 99% rename from packages/core/client/src/workflow/nodes/index.tsx rename to packages/plugins/workflow/src/client/nodes/index.tsx index 42a1d4a4e..a82bfaece 100644 --- a/packages/core/client/src/workflow/nodes/index.tsx +++ b/packages/plugins/workflow/src/client/nodes/index.tsx @@ -5,7 +5,8 @@ import { Registry } from '@nocobase/utils/client'; import { Button, message, Modal, Tag } from 'antd'; import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; -import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRequest, useResourceActionContext } from '../..'; +import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRequest, useResourceActionContext } from '@nocobase/client'; + import { nodeBlockClass, nodeCardClass, nodeClass, nodeHeaderClass, nodeMetaClass, nodeTitleClass } from '../style'; import { AddButton, useFlowContext } from '../WorkflowCanvas'; diff --git a/packages/core/client/src/workflow/nodes/parallel.tsx b/packages/plugins/workflow/src/client/nodes/parallel.tsx similarity index 97% rename from packages/core/client/src/workflow/nodes/parallel.tsx rename to packages/plugins/workflow/src/client/nodes/parallel.tsx index ed6e89707..bbfbedd2f 100644 --- a/packages/core/client/src/workflow/nodes/parallel.tsx +++ b/packages/plugins/workflow/src/client/nodes/parallel.tsx @@ -1,14 +1,16 @@ import React, { useState } from "react"; import { css, cx } from "@emotion/css"; import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons'; +import { Button, Tooltip } from "antd"; +import { useTranslation } from "react-i18next"; + +import { i18n } from "@nocobase/client"; import { NodeDefaultView } from "."; import { Branch, useFlowContext } from "../WorkflowCanvas"; import { branchBlockClass, nodeSubtreeClass } from "../style"; -import { Button, Tooltip } from "antd"; -import { i18n } from "../../i18n"; -import { useTranslation } from "react-i18next"; -// import { SchemaComponent } from "../../schema-component"; + + export default { title: '{{t("Parallel branch")}}', diff --git a/packages/core/client/src/workflow/nodes/query.tsx b/packages/plugins/workflow/src/client/nodes/query.tsx similarity index 98% rename from packages/core/client/src/workflow/nodes/query.tsx rename to packages/plugins/workflow/src/client/nodes/query.tsx index 90ed8eddd..0a97eaf3e 100644 --- a/packages/core/client/src/workflow/nodes/query.tsx +++ b/packages/plugins/workflow/src/client/nodes/query.tsx @@ -1,12 +1,14 @@ import React from 'react'; import { Select } from 'antd'; +import { useTranslation } from 'react-i18next'; -import { useCollectionDataSource, useCollectionManager, useCompile } from '../..'; +import { useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client'; import { useFlowContext } from '../WorkflowCanvas'; import { BaseTypeSet, VariableComponent } from '../calculators'; import { collection, filter } from '../schemas/collection'; -import { useTranslation } from 'react-i18next'; + + export default { title: '{{t("Query record")}}', diff --git a/packages/core/client/src/workflow/nodes/update.tsx b/packages/plugins/workflow/src/client/nodes/update.tsx similarity index 90% rename from packages/core/client/src/workflow/nodes/update.tsx rename to packages/plugins/workflow/src/client/nodes/update.tsx index 970df36cd..3472c159a 100644 --- a/packages/core/client/src/workflow/nodes/update.tsx +++ b/packages/plugins/workflow/src/client/nodes/update.tsx @@ -1,7 +1,10 @@ -import { useCollectionDataSource } from '../..'; +import { useCollectionDataSource } from '@nocobase/client'; + import { CollectionFieldset, VariableComponent } from '../calculators'; import { collection, filter, values } from '../schemas/collection'; + + export default { title: '{{t("Update record")}}', type: 'update', diff --git a/packages/core/client/src/workflow/schemas/collection.ts b/packages/plugins/workflow/src/client/schemas/collection.ts similarity index 94% rename from packages/core/client/src/workflow/schemas/collection.ts rename to packages/plugins/workflow/src/client/schemas/collection.ts index 240949e66..a99cad1b2 100644 --- a/packages/core/client/src/workflow/schemas/collection.ts +++ b/packages/plugins/workflow/src/client/schemas/collection.ts @@ -1,6 +1,6 @@ import { css } from "@emotion/css"; import { useForm } from "@formily/react"; -import { useCollectionFilterOptions } from "../../collection-manager/action-hooks"; +import { useCollectionFilterOptions } from "@nocobase/client"; export const collection = { type: 'string', diff --git a/packages/core/client/src/workflow/schemas/executions.ts b/packages/plugins/workflow/src/client/schemas/executions.ts similarity index 100% rename from packages/core/client/src/workflow/schemas/executions.ts rename to packages/plugins/workflow/src/client/schemas/executions.ts diff --git a/packages/core/client/src/workflow/schemas/workflows.ts b/packages/plugins/workflow/src/client/schemas/workflows.ts similarity index 100% rename from packages/core/client/src/workflow/schemas/workflows.ts rename to packages/plugins/workflow/src/client/schemas/workflows.ts diff --git a/packages/core/client/src/workflow/style.tsx b/packages/plugins/workflow/src/client/style.tsx similarity index 100% rename from packages/core/client/src/workflow/style.tsx rename to packages/plugins/workflow/src/client/style.tsx diff --git a/packages/core/client/src/workflow/triggers/collection.tsx b/packages/plugins/workflow/src/client/triggers/collection.tsx similarity index 96% rename from packages/core/client/src/workflow/triggers/collection.tsx rename to packages/plugins/workflow/src/client/triggers/collection.tsx index 7b2cd856b..9844405c0 100644 --- a/packages/core/client/src/workflow/triggers/collection.tsx +++ b/packages/plugins/workflow/src/client/triggers/collection.tsx @@ -2,8 +2,7 @@ import React from 'react'; import { Select } from 'antd'; import { observer, useForm, useFormEffects } from '@formily/react'; -import { useCollectionDataSource, useCollectionManager } from '../../collection-manager'; -import { useCompile } from '../../schema-component'; +import { useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client'; import { useFlowContext } from '../WorkflowCanvas'; import { BaseTypeSet } from '../calculators'; diff --git a/packages/core/client/src/workflow/triggers/index.tsx b/packages/plugins/workflow/src/client/triggers/index.tsx similarity index 98% rename from packages/core/client/src/workflow/triggers/index.tsx rename to packages/plugins/workflow/src/client/triggers/index.tsx index c5e2d4761..cd3818674 100644 --- a/packages/core/client/src/workflow/triggers/index.tsx +++ b/packages/plugins/workflow/src/client/triggers/index.tsx @@ -5,7 +5,7 @@ import { message, Tag } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; -import { SchemaComponent, useActionContext, useAPIClient, useCompile, useResourceActionContext } from '../../'; +import { SchemaComponent, useActionContext, useAPIClient, useCompile, useResourceActionContext } from '@nocobase/client'; import { nodeCardClass, nodeMetaClass } from "../style"; import { useFlowContext } from "../WorkflowCanvas"; diff --git a/packages/core/client/src/workflow/triggers/schedule/DateFieldsSelect.tsx b/packages/plugins/workflow/src/client/triggers/schedule/DateFieldsSelect.tsx similarity index 92% rename from packages/core/client/src/workflow/triggers/schedule/DateFieldsSelect.tsx rename to packages/plugins/workflow/src/client/triggers/schedule/DateFieldsSelect.tsx index 13ba6032f..65ec314d3 100644 --- a/packages/core/client/src/workflow/triggers/schedule/DateFieldsSelect.tsx +++ b/packages/plugins/workflow/src/client/triggers/schedule/DateFieldsSelect.tsx @@ -1,10 +1,10 @@ import React from "react"; import { observer, useForm } from "@formily/react"; import { Select } from "antd"; - -import { useCollectionManager, useCompile } from "../../../"; import { useTranslation } from "react-i18next"; +import { useCollectionManager, useCompile } from "@nocobase/client"; + export const DateFieldsSelect: React.FC = observer((props) => { const { t } = useTranslation(); const compile = useCompile(); diff --git a/packages/core/client/src/workflow/triggers/schedule/EndsByField.tsx b/packages/plugins/workflow/src/client/triggers/schedule/EndsByField.tsx similarity index 100% rename from packages/core/client/src/workflow/triggers/schedule/EndsByField.tsx rename to packages/plugins/workflow/src/client/triggers/schedule/EndsByField.tsx diff --git a/packages/core/client/src/workflow/triggers/schedule/OnField.tsx b/packages/plugins/workflow/src/client/triggers/schedule/OnField.tsx similarity index 100% rename from packages/core/client/src/workflow/triggers/schedule/OnField.tsx rename to packages/plugins/workflow/src/client/triggers/schedule/OnField.tsx diff --git a/packages/core/client/src/workflow/triggers/schedule/RepeatField.tsx b/packages/plugins/workflow/src/client/triggers/schedule/RepeatField.tsx similarity index 100% rename from packages/core/client/src/workflow/triggers/schedule/RepeatField.tsx rename to packages/plugins/workflow/src/client/triggers/schedule/RepeatField.tsx diff --git a/packages/core/client/src/workflow/triggers/schedule/ScheduleConfig.tsx b/packages/plugins/workflow/src/client/triggers/schedule/ScheduleConfig.tsx similarity index 98% rename from packages/core/client/src/workflow/triggers/schedule/ScheduleConfig.tsx rename to packages/plugins/workflow/src/client/triggers/schedule/ScheduleConfig.tsx index d3a427249..0b3013f48 100644 --- a/packages/core/client/src/workflow/triggers/schedule/ScheduleConfig.tsx +++ b/packages/plugins/workflow/src/client/triggers/schedule/ScheduleConfig.tsx @@ -3,7 +3,7 @@ import { onFieldValueChange } from '@formily/core'; import { useForm, useFormEffects } from '@formily/react'; import { css } from '@emotion/css'; -import { SchemaComponent } from '../../../'; +import { SchemaComponent } from '@nocobase/client'; import { collection } from '../../schemas/collection'; import { OnField } from './OnField'; diff --git a/packages/core/client/src/workflow/triggers/schedule/index.tsx b/packages/plugins/workflow/src/client/triggers/schedule/index.tsx similarity index 98% rename from packages/core/client/src/workflow/triggers/schedule/index.tsx rename to packages/plugins/workflow/src/client/triggers/schedule/index.tsx index 29dd9d384..895b926ae 100644 --- a/packages/core/client/src/workflow/triggers/schedule/index.tsx +++ b/packages/plugins/workflow/src/client/triggers/schedule/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { Select } from 'antd'; -import { useCompile, useCollectionDataSource, useCollectionManager } from '../../../'; +import { useCompile, useCollectionDataSource, useCollectionManager } from '@nocobase/client'; import { ScheduleConfig } from './ScheduleConfig'; import { useFlowContext } from '../../WorkflowCanvas'; diff --git a/packages/core/client/src/workflow/triggers/schedule/locale/Cron.zh-CN.ts b/packages/plugins/workflow/src/client/triggers/schedule/locale/Cron.zh-CN.ts similarity index 100% rename from packages/core/client/src/workflow/triggers/schedule/locale/Cron.zh-CN.ts rename to packages/plugins/workflow/src/client/triggers/schedule/locale/Cron.zh-CN.ts diff --git a/packages/plugins/workflow/src/index.ts b/packages/plugins/workflow/src/index.ts index c774f4411..7ddad5814 100644 --- a/packages/plugins/workflow/src/index.ts +++ b/packages/plugins/workflow/src/index.ts @@ -1,6 +1 @@ -export * from './calculators'; -export * from './constants'; -export * from './instructions'; -export * from './triggers'; -export * from './Processor'; -export { default } from './Plugin'; +export { default } from './server'; diff --git a/packages/plugins/workflow/src/Plugin.ts b/packages/plugins/workflow/src/server/Plugin.ts similarity index 100% rename from packages/plugins/workflow/src/Plugin.ts rename to packages/plugins/workflow/src/server/Plugin.ts diff --git a/packages/plugins/workflow/src/Processor.ts b/packages/plugins/workflow/src/server/Processor.ts similarity index 100% rename from packages/plugins/workflow/src/Processor.ts rename to packages/plugins/workflow/src/server/Processor.ts diff --git a/packages/plugins/workflow/src/__tests__/Plugin.test.ts b/packages/plugins/workflow/src/server/__tests__/Plugin.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/Plugin.test.ts rename to packages/plugins/workflow/src/server/__tests__/Plugin.test.ts diff --git a/packages/plugins/workflow/src/__tests__/Processor.test.ts b/packages/plugins/workflow/src/server/__tests__/Processor.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/Processor.test.ts rename to packages/plugins/workflow/src/server/__tests__/Processor.test.ts diff --git a/packages/plugins/workflow/src/__tests__/collections/comments.ts b/packages/plugins/workflow/src/server/__tests__/collections/comments.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/collections/comments.ts rename to packages/plugins/workflow/src/server/__tests__/collections/comments.ts diff --git a/packages/plugins/workflow/src/__tests__/collections/posts.ts b/packages/plugins/workflow/src/server/__tests__/collections/posts.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/collections/posts.ts rename to packages/plugins/workflow/src/server/__tests__/collections/posts.ts diff --git a/packages/plugins/workflow/src/__tests__/collections/tags.ts b/packages/plugins/workflow/src/server/__tests__/collections/tags.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/collections/tags.ts rename to packages/plugins/workflow/src/server/__tests__/collections/tags.ts diff --git a/packages/plugins/workflow/src/__tests__/index.ts b/packages/plugins/workflow/src/server/__tests__/index.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/index.ts rename to packages/plugins/workflow/src/server/__tests__/index.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/calculation.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/calculation.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/calculation.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/calculation.test.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/condition.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/condition.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/condition.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/condition.test.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/create.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/create.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/create.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/create.test.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/delay.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/delay.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/delay.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/delay.test.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/destroy.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/destroy.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/destroy.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/destroy.test.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/parallel.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/parallel.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/parallel.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/parallel.test.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/query.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/query.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/query.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/query.test.ts diff --git a/packages/plugins/workflow/src/__tests__/instructions/update.test.ts b/packages/plugins/workflow/src/server/__tests__/instructions/update.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/instructions/update.test.ts rename to packages/plugins/workflow/src/server/__tests__/instructions/update.test.ts diff --git a/packages/plugins/workflow/src/__tests__/triggers/collection.test.ts b/packages/plugins/workflow/src/server/__tests__/triggers/collection.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/triggers/collection.test.ts rename to packages/plugins/workflow/src/server/__tests__/triggers/collection.test.ts diff --git a/packages/plugins/workflow/src/__tests__/triggers/schedule.test.ts b/packages/plugins/workflow/src/server/__tests__/triggers/schedule.test.ts similarity index 100% rename from packages/plugins/workflow/src/__tests__/triggers/schedule.test.ts rename to packages/plugins/workflow/src/server/__tests__/triggers/schedule.test.ts diff --git a/packages/plugins/workflow/src/actions/index.ts b/packages/plugins/workflow/src/server/actions/index.ts similarity index 100% rename from packages/plugins/workflow/src/actions/index.ts rename to packages/plugins/workflow/src/server/actions/index.ts diff --git a/packages/plugins/workflow/src/actions/nodes.ts b/packages/plugins/workflow/src/server/actions/nodes.ts similarity index 100% rename from packages/plugins/workflow/src/actions/nodes.ts rename to packages/plugins/workflow/src/server/actions/nodes.ts diff --git a/packages/plugins/workflow/src/actions/workflows.ts b/packages/plugins/workflow/src/server/actions/workflows.ts similarity index 100% rename from packages/plugins/workflow/src/actions/workflows.ts rename to packages/plugins/workflow/src/server/actions/workflows.ts diff --git a/packages/plugins/workflow/src/calculators/index.ts b/packages/plugins/workflow/src/server/calculators/index.ts similarity index 100% rename from packages/plugins/workflow/src/calculators/index.ts rename to packages/plugins/workflow/src/server/calculators/index.ts diff --git a/packages/plugins/workflow/src/collections/executions.ts b/packages/plugins/workflow/src/server/collections/executions.ts similarity index 100% rename from packages/plugins/workflow/src/collections/executions.ts rename to packages/plugins/workflow/src/server/collections/executions.ts diff --git a/packages/plugins/workflow/src/collections/flow_nodes.ts b/packages/plugins/workflow/src/server/collections/flow_nodes.ts similarity index 100% rename from packages/plugins/workflow/src/collections/flow_nodes.ts rename to packages/plugins/workflow/src/server/collections/flow_nodes.ts diff --git a/packages/plugins/workflow/src/collections/jobs.ts b/packages/plugins/workflow/src/server/collections/jobs.ts similarity index 100% rename from packages/plugins/workflow/src/collections/jobs.ts rename to packages/plugins/workflow/src/server/collections/jobs.ts diff --git a/packages/plugins/workflow/src/collections/workflows.ts b/packages/plugins/workflow/src/server/collections/workflows.ts similarity index 100% rename from packages/plugins/workflow/src/collections/workflows.ts rename to packages/plugins/workflow/src/server/collections/workflows.ts diff --git a/packages/plugins/workflow/src/constants.ts b/packages/plugins/workflow/src/server/constants.ts similarity index 100% rename from packages/plugins/workflow/src/constants.ts rename to packages/plugins/workflow/src/server/constants.ts diff --git a/packages/plugins/workflow/src/server/index.ts b/packages/plugins/workflow/src/server/index.ts new file mode 100644 index 000000000..c774f4411 --- /dev/null +++ b/packages/plugins/workflow/src/server/index.ts @@ -0,0 +1,6 @@ +export * from './calculators'; +export * from './constants'; +export * from './instructions'; +export * from './triggers'; +export * from './Processor'; +export { default } from './Plugin'; diff --git a/packages/plugins/workflow/src/instructions/calculation.ts b/packages/plugins/workflow/src/server/instructions/calculation.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/calculation.ts rename to packages/plugins/workflow/src/server/instructions/calculation.ts diff --git a/packages/plugins/workflow/src/instructions/condition.ts b/packages/plugins/workflow/src/server/instructions/condition.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/condition.ts rename to packages/plugins/workflow/src/server/instructions/condition.ts diff --git a/packages/plugins/workflow/src/instructions/create.ts b/packages/plugins/workflow/src/server/instructions/create.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/create.ts rename to packages/plugins/workflow/src/server/instructions/create.ts diff --git a/packages/plugins/workflow/src/instructions/delay.ts b/packages/plugins/workflow/src/server/instructions/delay.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/delay.ts rename to packages/plugins/workflow/src/server/instructions/delay.ts diff --git a/packages/plugins/workflow/src/instructions/destroy.ts b/packages/plugins/workflow/src/server/instructions/destroy.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/destroy.ts rename to packages/plugins/workflow/src/server/instructions/destroy.ts diff --git a/packages/plugins/workflow/src/instructions/index.ts b/packages/plugins/workflow/src/server/instructions/index.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/index.ts rename to packages/plugins/workflow/src/server/instructions/index.ts diff --git a/packages/plugins/workflow/src/instructions/parallel.ts b/packages/plugins/workflow/src/server/instructions/parallel.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/parallel.ts rename to packages/plugins/workflow/src/server/instructions/parallel.ts diff --git a/packages/plugins/workflow/src/instructions/prompt.ts b/packages/plugins/workflow/src/server/instructions/prompt.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/prompt.ts rename to packages/plugins/workflow/src/server/instructions/prompt.ts diff --git a/packages/plugins/workflow/src/instructions/query.ts b/packages/plugins/workflow/src/server/instructions/query.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/query.ts rename to packages/plugins/workflow/src/server/instructions/query.ts diff --git a/packages/plugins/workflow/src/instructions/update.ts b/packages/plugins/workflow/src/server/instructions/update.ts similarity index 100% rename from packages/plugins/workflow/src/instructions/update.ts rename to packages/plugins/workflow/src/server/instructions/update.ts diff --git a/packages/plugins/workflow/src/models/Execution.ts b/packages/plugins/workflow/src/server/models/Execution.ts similarity index 100% rename from packages/plugins/workflow/src/models/Execution.ts rename to packages/plugins/workflow/src/server/models/Execution.ts diff --git a/packages/plugins/workflow/src/models/FlowNode.ts b/packages/plugins/workflow/src/server/models/FlowNode.ts similarity index 100% rename from packages/plugins/workflow/src/models/FlowNode.ts rename to packages/plugins/workflow/src/server/models/FlowNode.ts diff --git a/packages/plugins/workflow/src/models/Job.ts b/packages/plugins/workflow/src/server/models/Job.ts similarity index 100% rename from packages/plugins/workflow/src/models/Job.ts rename to packages/plugins/workflow/src/server/models/Job.ts diff --git a/packages/plugins/workflow/src/models/Workflow.ts b/packages/plugins/workflow/src/server/models/Workflow.ts similarity index 100% rename from packages/plugins/workflow/src/models/Workflow.ts rename to packages/plugins/workflow/src/server/models/Workflow.ts diff --git a/packages/plugins/workflow/src/triggers/collection.ts b/packages/plugins/workflow/src/server/triggers/collection.ts similarity index 100% rename from packages/plugins/workflow/src/triggers/collection.ts rename to packages/plugins/workflow/src/server/triggers/collection.ts diff --git a/packages/plugins/workflow/src/triggers/index.ts b/packages/plugins/workflow/src/server/triggers/index.ts similarity index 100% rename from packages/plugins/workflow/src/triggers/index.ts rename to packages/plugins/workflow/src/server/triggers/index.ts diff --git a/packages/plugins/workflow/src/triggers/schedule.ts b/packages/plugins/workflow/src/server/triggers/schedule.ts similarity index 100% rename from packages/plugins/workflow/src/triggers/schedule.ts rename to packages/plugins/workflow/src/server/triggers/schedule.ts