Refactor(plugin workflow): move client files into plugin (#556)

* refactor(plugin-workflow): move client files into plugin

* fix(client): fix package path block build

* test(plugin-workflow): trigger ci
This commit is contained in:
Junyi 2022-06-29 23:42:03 +08:00 committed by GitHub
parent d3b157075e
commit 4a3cb6e65f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
87 changed files with 125 additions and 46 deletions

View File

@ -8,6 +8,7 @@ export const app = new Application({
require('@nocobase/plugin-china-region/client').default, require('@nocobase/plugin-china-region/client').default,
require('@nocobase/plugin-export/client').default, require('@nocobase/plugin-export/client').default,
require('@nocobase/plugin-audit-logs/client').default, require('@nocobase/plugin-audit-logs/client').default,
require('@nocobase/plugin-workflow/client').default,
], ],
}); });

View File

@ -90,7 +90,7 @@ export class Application {
this.use(AntdSchemaComponentProvider); this.use(AntdSchemaComponentProvider);
this.use(ACLProvider); this.use(ACLProvider);
this.use(RemoteDocumentTitleProvider); this.use(RemoteDocumentTitleProvider);
this.use(require('../workflow').WorkflowProvider);
for (const plugin of options.plugins) { for (const plugin of options.plugins) {
const [component, props] = Array.isArray(plugin) ? plugin : [plugin]; const [component, props] = Array.isArray(plugin) ? plugin : [plugin];
this.use(component, props); this.use(component, props);

View File

@ -1,6 +1,6 @@
import { Schema as SchemaCompiler } from '@formily/json-schema'; import { Schema as SchemaCompiler } from '@formily/json-schema';
import { useField, useFieldSchema, useForm } from '@formily/react'; import { useField, useFieldSchema, useForm } from '@formily/react';
import { useFormBlockContext } from '@nocobase/client'; import { useFormBlockContext } from '../..';
import { message, Modal } from 'antd'; import { message, Modal } from 'antd';
import get from 'lodash/get'; import get from 'lodash/get';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';

View File

@ -25,5 +25,3 @@ export * from './schema-templates';
export * from './settings-form'; export * from './settings-form';
export * from './system-settings'; export * from './system-settings';
export * from './user'; export * from './user';
export * from './workflow';

View File

@ -1,6 +0,0 @@
export * from './ExecutionResourceProvider';
export * from './WorkflowLink';
export * from './WorkflowPage';
export * from './WorkflowProvider';
export * from './WorkflowShortcut';

4
packages/plugins/workflow/client.d.ts vendored Executable file
View File

@ -0,0 +1,4 @@
// @ts-nocheck
export * from './lib/client';
export { default } from './lib/client';

View File

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

View File

@ -11,6 +11,7 @@
], ],
"dependencies": { "dependencies": {
"@nocobase/actions": "0.7.1-alpha.7", "@nocobase/actions": "0.7.1-alpha.7",
"@nocobase/client": "0.7.1-alpha.7",
"@nocobase/database": "0.7.1-alpha.7", "@nocobase/database": "0.7.1-alpha.7",
"@nocobase/server": "0.7.1-alpha.7", "@nocobase/server": "0.7.1-alpha.7",
"@nocobase/utils": "0.7.1-alpha.7", "@nocobase/utils": "0.7.1-alpha.7",

4
packages/plugins/workflow/server.d.ts vendored Executable file
View File

@ -0,0 +1,4 @@
// @ts-nocheck
export * from './lib/server';
export { default } from './lib/server';

View File

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

View File

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { ResourceActionProvider, useRecord } from ".."; import { ResourceActionProvider, useRecord } from "@nocobase/client";
export const ExecutionResourceProvider = ({ request, ...others }) => { export const ExecutionResourceProvider = ({ request, ...others }) => {
const workflow = useRecord(); const workflow = useRecord();

View File

@ -1,4 +1,5 @@
import React, { useContext, useEffect } from 'react'; import React, { useContext, useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { Dropdown, Menu, Button, Tag, Switch, message } from 'antd'; import { Dropdown, Menu, Button, Tag, Switch, message } from 'antd';
import { PlusOutlined, DownOutlined, RightOutlined } from '@ant-design/icons'; import { PlusOutlined, DownOutlined, RightOutlined } from '@ant-design/icons';
import { cx } from '@emotion/css'; import { cx } from '@emotion/css';
@ -10,11 +11,11 @@ import {
useDocumentTitle, useDocumentTitle,
useResourceActionContext, useResourceActionContext,
useResourceContext useResourceContext
} from '..'; } from '@nocobase/client';
import { Instruction, instructions, Node } from './nodes'; import { Instruction, instructions, Node } from './nodes';
import { addButtonClass, branchBlockClass, branchClass, nodeCardClass, nodeMetaClass, workflowVersionDropdownClass } from './style'; import { addButtonClass, branchBlockClass, branchClass, nodeCardClass, nodeMetaClass, workflowVersionDropdownClass } from './style';
import { TriggerConfig } from './triggers'; import { TriggerConfig } from './triggers';
import { useHistory } from 'react-router-dom';

View File

@ -1,7 +1,8 @@
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useActionContext, useRecord } from '..';
import { useActionContext, useRecord } from '@nocobase/client';
export const WorkflowLink = () => { export const WorkflowLink = () => {

View File

@ -1,7 +1,7 @@
import { cx } from '@emotion/css'; import { cx } from '@emotion/css';
import React from 'react'; import React from 'react';
import { useRouteMatch } from 'react-router-dom'; import { useRouteMatch } from 'react-router-dom';
import { SchemaComponent } from '..'; import { SchemaComponent } from '@nocobase/client';
import { workflowPageClass } from './style'; import { workflowPageClass } from './style';
import { WorkflowCanvas } from './WorkflowCanvas'; import { WorkflowCanvas } from './WorkflowCanvas';

View File

@ -1,6 +1,5 @@
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { PluginManagerContext } from '../plugin-manager'; import { PluginManagerContext, RouteSwitchContext } from '@nocobase/client';
import { RouteSwitchContext } from '../route-switch';
import { WorkflowPage } from './WorkflowPage'; import { WorkflowPage } from './WorkflowPage';
import { WorkflowShortcut } from './WorkflowShortcut'; import { WorkflowShortcut } from './WorkflowShortcut';

View File

@ -3,9 +3,9 @@ import { PartitionOutlined } from '@ant-design/icons';
import { ISchema } from '@formily/react'; import { ISchema } from '@formily/react';
import { uid } from '@formily/shared'; import { uid } from '@formily/shared';
import { useTranslation } from 'react-i18next'; 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 { workflowSchema } from './schemas/workflows';
import { WorkflowLink } from './WorkflowLink'; import { WorkflowLink } from './WorkflowLink';
import { ExecutionResourceProvider } from './ExecutionResourceProvider'; import { ExecutionResourceProvider } from './ExecutionResourceProvider';

View File

@ -4,10 +4,11 @@ import { Button, Cascader, Dropdown, Input, InputNumber, Menu, Select, Form } fr
import { css } from "@emotion/css"; import { css } from "@emotion/css";
import { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons'; import { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons';
import { SchemaComponent, useCollectionManager, useCompile } from "@nocobase/client";
import { instructions, useNodeContext } from "./nodes"; import { instructions, useNodeContext } from "./nodes";
import { useFlowContext } from "./WorkflowCanvas"; import { useFlowContext } from "./WorkflowCanvas";
import { triggers } from "./triggers"; import { triggers } from "./triggers";
import { SchemaComponent, useCollectionManager, useCompile } from "..";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
function NullRender() { function NullRender() {

View File

@ -0,0 +1,3 @@
export { triggers } from './triggers';
export * from './nodes';
export { WorkflowProvider as default } from './WorkflowProvider';

View File

@ -1,6 +1,7 @@
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Calculation } from '../calculators'; import { Calculation } from '../calculators';
export default { export default {

View File

@ -4,12 +4,14 @@ import { Button, Select } from "antd";
import { CloseCircleOutlined } from '@ant-design/icons'; import { CloseCircleOutlined } from '@ant-design/icons';
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { i18n } from "@nocobase/client";
import { NodeDefaultView } from "."; import { NodeDefaultView } from ".";
import { Branch, useFlowContext } from "../WorkflowCanvas"; import { Branch, useFlowContext } from "../WorkflowCanvas";
import { branchBlockClass, nodeSubtreeClass } from "../style"; import { branchBlockClass, nodeSubtreeClass } from "../style";
import { Calculation } from "../calculators"; import { Calculation } from "../calculators";
import { i18n } from "../../i18n";
// import { SchemaComponent } from "../../schema-component";
function CalculationItem({ value, onChange, onRemove }) { function CalculationItem({ value, onChange, onRemove }) {
if (!value) { if (!value) {

View File

@ -1,12 +1,13 @@
import { Select } from 'antd'; import { Select } from 'antd';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useCollectionDataSource, useCollectionManager, useCompile } from '../..'; import { useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client';
import { BaseTypeSet, CollectionFieldset } from '../calculators'; import { BaseTypeSet, CollectionFieldset } from '../calculators';
import { collection, values } from '../schemas/collection'; import { collection, values } from '../schemas/collection';
import { useFlowContext } from '../WorkflowCanvas'; import { useFlowContext } from '../WorkflowCanvas';
export default { export default {
title: '{{t("Create record")}}', title: '{{t("Create record")}}',
type: 'create', type: 'create',

View File

@ -1,4 +1,4 @@
import { useCollectionDataSource } from '../..'; import { useCollectionDataSource } from '@nocobase/client';
import { VariableComponent } from '../calculators'; import { VariableComponent } from '../calculators';
import { collection, filter } from '../schemas/collection'; import { collection, filter } from '../schemas/collection';

View File

@ -5,7 +5,8 @@ import { Registry } from '@nocobase/utils/client';
import { Button, message, Modal, Tag } from 'antd'; import { Button, message, Modal, Tag } from 'antd';
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next'; 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 { nodeBlockClass, nodeCardClass, nodeClass, nodeHeaderClass, nodeMetaClass, nodeTitleClass } from '../style';
import { AddButton, useFlowContext } from '../WorkflowCanvas'; import { AddButton, useFlowContext } from '../WorkflowCanvas';

View File

@ -1,14 +1,16 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { css, cx } from "@emotion/css"; import { css, cx } from "@emotion/css";
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons'; 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 { NodeDefaultView } from ".";
import { Branch, useFlowContext } from "../WorkflowCanvas"; import { Branch, useFlowContext } from "../WorkflowCanvas";
import { branchBlockClass, nodeSubtreeClass } from "../style"; 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 { export default {
title: '{{t("Parallel branch")}}', title: '{{t("Parallel branch")}}',

View File

@ -1,12 +1,14 @@
import React from 'react'; import React from 'react';
import { Select } from 'antd'; 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 { useFlowContext } from '../WorkflowCanvas';
import { BaseTypeSet, VariableComponent } from '../calculators'; import { BaseTypeSet, VariableComponent } from '../calculators';
import { collection, filter } from '../schemas/collection'; import { collection, filter } from '../schemas/collection';
import { useTranslation } from 'react-i18next';
export default { export default {
title: '{{t("Query record")}}', title: '{{t("Query record")}}',

View File

@ -1,7 +1,10 @@
import { useCollectionDataSource } from '../..'; import { useCollectionDataSource } from '@nocobase/client';
import { CollectionFieldset, VariableComponent } from '../calculators'; import { CollectionFieldset, VariableComponent } from '../calculators';
import { collection, filter, values } from '../schemas/collection'; import { collection, filter, values } from '../schemas/collection';
export default { export default {
title: '{{t("Update record")}}', title: '{{t("Update record")}}',
type: 'update', type: 'update',

View File

@ -1,6 +1,6 @@
import { css } from "@emotion/css"; import { css } from "@emotion/css";
import { useForm } from "@formily/react"; import { useForm } from "@formily/react";
import { useCollectionFilterOptions } from "../../collection-manager/action-hooks"; import { useCollectionFilterOptions } from "@nocobase/client";
export const collection = { export const collection = {
type: 'string', type: 'string',

View File

@ -2,8 +2,7 @@ import React from 'react';
import { Select } from 'antd'; import { Select } from 'antd';
import { observer, useForm, useFormEffects } from '@formily/react'; import { observer, useForm, useFormEffects } from '@formily/react';
import { useCollectionDataSource, useCollectionManager } from '../../collection-manager'; import { useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client';
import { useCompile } from '../../schema-component';
import { useFlowContext } from '../WorkflowCanvas'; import { useFlowContext } from '../WorkflowCanvas';
import { BaseTypeSet } from '../calculators'; import { BaseTypeSet } from '../calculators';

View File

@ -5,7 +5,7 @@ import { message, Tag } from "antd";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; 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 { nodeCardClass, nodeMetaClass } from "../style";
import { useFlowContext } from "../WorkflowCanvas"; import { useFlowContext } from "../WorkflowCanvas";

View File

@ -1,10 +1,10 @@
import React from "react"; import React from "react";
import { observer, useForm } from "@formily/react"; import { observer, useForm } from "@formily/react";
import { Select } from "antd"; import { Select } from "antd";
import { useCollectionManager, useCompile } from "../../../";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useCollectionManager, useCompile } from "@nocobase/client";
export const DateFieldsSelect: React.FC<any> = observer((props) => { export const DateFieldsSelect: React.FC<any> = observer((props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const compile = useCompile(); const compile = useCompile();

View File

@ -3,7 +3,7 @@ import { onFieldValueChange } from '@formily/core';
import { useForm, useFormEffects } from '@formily/react'; import { useForm, useFormEffects } from '@formily/react';
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import { SchemaComponent } from '../../../'; import { SchemaComponent } from '@nocobase/client';
import { collection } from '../../schemas/collection'; import { collection } from '../../schemas/collection';
import { OnField } from './OnField'; import { OnField } from './OnField';

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Select } from 'antd'; import { Select } from 'antd';
import { useCompile, useCollectionDataSource, useCollectionManager } from '../../../'; import { useCompile, useCollectionDataSource, useCollectionManager } from '@nocobase/client';
import { ScheduleConfig } from './ScheduleConfig'; import { ScheduleConfig } from './ScheduleConfig';
import { useFlowContext } from '../../WorkflowCanvas'; import { useFlowContext } from '../../WorkflowCanvas';

View File

@ -1,6 +1 @@
export * from './calculators'; export { default } from './server';
export * from './constants';
export * from './instructions';
export * from './triggers';
export * from './Processor';
export { default } from './Plugin';

View File

@ -0,0 +1,6 @@
export * from './calculators';
export * from './constants';
export * from './instructions';
export * from './triggers';
export * from './Processor';
export { default } from './Plugin';