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:
parent
d3b157075e
commit
4a3cb6e65f
@ -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,
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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';
|
||||
|
@ -25,5 +25,3 @@ export * from './schema-templates';
|
||||
export * from './settings-form';
|
||||
export * from './system-settings';
|
||||
export * from './user';
|
||||
export * from './workflow';
|
||||
|
||||
|
@ -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
4
packages/plugins/workflow/client.d.ts
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
// @ts-nocheck
|
||||
export * from './lib/client';
|
||||
export { default } from './lib/client';
|
||||
|
30
packages/plugins/workflow/client.js
Executable file
30
packages/plugins/workflow/client.js
Executable 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];
|
||||
}
|
||||
});
|
||||
});
|
@ -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",
|
||||
|
4
packages/plugins/workflow/server.d.ts
vendored
Executable file
4
packages/plugins/workflow/server.d.ts
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
// @ts-nocheck
|
||||
export * from './lib/server';
|
||||
export { default } from './lib/server';
|
||||
|
30
packages/plugins/workflow/server.js
Executable file
30
packages/plugins/workflow/server.js
Executable 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];
|
||||
}
|
||||
});
|
||||
});
|
@ -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();
|
@ -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';
|
||||
|
||||
|
||||
|
@ -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 = () => {
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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';
|
@ -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() {
|
3
packages/plugins/workflow/src/client/index.tsx
Normal file
3
packages/plugins/workflow/src/client/index.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
export { triggers } from './triggers';
|
||||
export * from './nodes';
|
||||
export { WorkflowProvider as default } from './WorkflowProvider';
|
@ -1,6 +1,7 @@
|
||||
import { css } from '@emotion/css';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Calculation } from '../calculators';
|
||||
|
||||
export default {
|
@ -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) {
|
@ -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',
|
@ -1,4 +1,4 @@
|
||||
import { useCollectionDataSource } from '../..';
|
||||
import { useCollectionDataSource } from '@nocobase/client';
|
||||
|
||||
import { VariableComponent } from '../calculators';
|
||||
import { collection, filter } from '../schemas/collection';
|
@ -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';
|
||||
|
@ -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")}}',
|
@ -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")}}',
|
@ -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',
|
@ -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',
|
@ -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';
|
@ -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";
|
@ -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<any> = observer((props) => {
|
||||
const { t } = useTranslation();
|
||||
const compile = useCompile();
|
@ -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';
|
@ -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';
|
@ -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';
|
||||
|
6
packages/plugins/workflow/src/server/index.ts
Normal file
6
packages/plugins/workflow/src/server/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './calculators';
|
||||
export * from './constants';
|
||||
export * from './instructions';
|
||||
export * from './triggers';
|
||||
export * from './Processor';
|
||||
export { default } from './Plugin';
|
Loading…
Reference in New Issue
Block a user