@nocobase/plugin-workflow 0.11.1-alpha.3 → 0.11.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function useCollectionUIFields(collection: any): import("@nocobase/client").CollectionFieldOptions[];
|
|
3
2
|
declare const CollectionFieldSet: React.MemoExoticComponent<import("@formily/react").ReactFC<Omit<any, "ref">>>;
|
|
4
3
|
export default CollectionFieldSet;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
exports.useCollectionUIFields = useCollectionUIFields;
|
|
8
7
|
function _icons() {
|
|
9
8
|
const data = require("@ant-design/icons");
|
|
10
9
|
_icons = function _icons() {
|
|
@@ -79,11 +78,6 @@ function AssociationInput(props) {
|
|
|
79
78
|
onChange: onChange
|
|
80
79
|
}));
|
|
81
80
|
}
|
|
82
|
-
function useCollectionUIFields(collection) {
|
|
83
|
-
const _useCollectionManager2 = (0, _client().useCollectionManager)(),
|
|
84
|
-
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
85
|
-
return getCollectionFields(collection).filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false));
|
|
86
|
-
}
|
|
87
81
|
// NOTE: observer for watching useProps
|
|
88
82
|
const CollectionFieldSet = (0, _react().observer)(({
|
|
89
83
|
value,
|
|
@@ -97,12 +91,13 @@ const CollectionFieldSet = (0, _react().observer)(({
|
|
|
97
91
|
t = _useTranslation.t;
|
|
98
92
|
const compile = (0, _client().useCompile)();
|
|
99
93
|
const form = (0, _react().useForm)();
|
|
100
|
-
const
|
|
101
|
-
getCollection =
|
|
94
|
+
const _useCollectionManager2 = (0, _client().useCollectionManager)(),
|
|
95
|
+
getCollection = _useCollectionManager2.getCollection,
|
|
96
|
+
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
102
97
|
const scope = (0, _variable.useWorkflowVariableOptions)();
|
|
103
98
|
const config = form.values;
|
|
104
99
|
const collectionName = config === null || config === void 0 ? void 0 : config.collection;
|
|
105
|
-
const collectionFields =
|
|
100
|
+
const collectionFields = getCollectionFields(collectionName);
|
|
106
101
|
const fields = filter ? collectionFields.filter(filter.bind(config)) : collectionFields;
|
|
107
102
|
const unassignedFields = (0, _react2().useMemo)(() => fields.filter(field => !value || !(field.name in value)), [fields, value]);
|
|
108
103
|
const mergedDisabled = disabled || form.disabled;
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
function _react() {
|
|
8
|
-
const data =
|
|
8
|
+
const data = require("@formily/react");
|
|
9
9
|
_react = function _react() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
function _react2() {
|
|
15
|
-
const data = require("
|
|
15
|
+
const data = _interopRequireDefault(require("react"));
|
|
16
16
|
_react2 = function _react2() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
@@ -25,15 +25,13 @@ function _client() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
+
var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
|
|
28
29
|
var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
|
|
29
|
-
var
|
|
30
|
-
var _utils = require("../utils");
|
|
30
|
+
var _RadioWithTooltip = require("../components/RadioWithTooltip");
|
|
31
31
|
var _locale = require("../locale");
|
|
32
32
|
var _collection = require("../schemas/collection");
|
|
33
|
-
var
|
|
33
|
+
var _utils = require("../utils");
|
|
34
34
|
const _excluded = ["onChange"];
|
|
35
|
-
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); }
|
|
36
|
-
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; }
|
|
37
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
38
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -45,10 +43,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
45
43
|
function IndividualHooksRadioWithTooltip(_ref) {
|
|
46
44
|
let onChange = _ref.onChange,
|
|
47
45
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
-
const
|
|
46
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
47
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
48
|
+
const form = (0, _react().useForm)();
|
|
49
49
|
const collection = form.values.collection;
|
|
50
|
-
const fields = (
|
|
51
|
-
const field = (0,
|
|
50
|
+
const fields = getCollectionFields(collection);
|
|
51
|
+
const field = (0, _react().useField)();
|
|
52
52
|
function onValueChange({
|
|
53
53
|
target
|
|
54
54
|
}) {
|
|
@@ -65,7 +65,7 @@ function IndividualHooksRadioWithTooltip(_ref) {
|
|
|
65
65
|
form.setValuesIn('params.values', filteredValues);
|
|
66
66
|
onChange(target.value);
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return _react2().default.createElement(_RadioWithTooltip.RadioWithTooltip, _objectSpread(_objectSpread({}, props), {}, {
|
|
69
69
|
onChange: onValueChange
|
|
70
70
|
}));
|
|
71
71
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": "A powerful workflow plugin designed to support business process management and automation.",
|
|
6
6
|
"description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
|
|
7
|
-
"version": "0.11.1-alpha.
|
|
7
|
+
"version": "0.11.1-alpha.4",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./lib/server/index.js",
|
|
10
10
|
"files": [
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"winston": "^3.8.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@nocobase/test": "0.11.1-alpha.
|
|
51
|
+
"@nocobase/test": "0.11.1-alpha.4",
|
|
52
52
|
"@types/ejs": "^3.1.1"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "d9b5bde913013f1057e1aab49587eb0ad3dcb06e"
|
|
55
55
|
}
|
|
@@ -32,14 +32,6 @@ function AssociationInput(props) {
|
|
|
32
32
|
return <Input {...props} value={value} onChange={onChange} />;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export function useCollectionUIFields(collection) {
|
|
36
|
-
const { getCollectionFields } = useCollectionManager();
|
|
37
|
-
|
|
38
|
-
return getCollectionFields(collection).filter(
|
|
39
|
-
(field) => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false),
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
35
|
// NOTE: observer for watching useProps
|
|
44
36
|
const CollectionFieldSet = observer(
|
|
45
37
|
({ value, disabled, onChange, filter }: any) => {
|
|
@@ -47,11 +39,11 @@ const CollectionFieldSet = observer(
|
|
|
47
39
|
const { t } = useTranslation();
|
|
48
40
|
const compile = useCompile();
|
|
49
41
|
const form = useForm();
|
|
50
|
-
const { getCollection } = useCollectionManager();
|
|
42
|
+
const { getCollection, getCollectionFields } = useCollectionManager();
|
|
51
43
|
const scope = useWorkflowVariableOptions();
|
|
52
44
|
const { values: config } = form;
|
|
53
45
|
const collectionName = config?.collection;
|
|
54
|
-
const collectionFields =
|
|
46
|
+
const collectionFields = getCollectionFields(collectionName);
|
|
55
47
|
const fields = filter ? collectionFields.filter(filter.bind(config)) : collectionFields;
|
|
56
48
|
|
|
57
49
|
const unassignedFields = useMemo(() => fields.filter((field) => !value || !(field.name in value)), [fields, value]);
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { useField, useForm } from '@formily/react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { useForm, useField } from '@formily/react';
|
|
3
3
|
|
|
4
|
-
import { useCollectionDataSource } from '@nocobase/client';
|
|
4
|
+
import { useCollectionDataSource, useCollectionManager } from '@nocobase/client';
|
|
5
5
|
|
|
6
|
+
import CollectionFieldset from '../components/CollectionFieldset';
|
|
6
7
|
import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
|
|
7
|
-
import CollectionFieldset, { useCollectionUIFields } from '../components/CollectionFieldset';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
10
10
|
import { NAMESPACE, lang } from '../locale';
|
|
11
11
|
import { collection, filter, values } from '../schemas/collection';
|
|
12
|
-
import {
|
|
12
|
+
import { isValidFilter } from '../utils';
|
|
13
13
|
|
|
14
14
|
function IndividualHooksRadioWithTooltip({ onChange, ...props }) {
|
|
15
|
+
const { getCollectionFields } = useCollectionManager();
|
|
15
16
|
const form = useForm();
|
|
16
17
|
const { collection } = form.values;
|
|
17
|
-
const fields =
|
|
18
|
+
const fields = getCollectionFields(collection);
|
|
18
19
|
const field = useField<any>();
|
|
19
20
|
|
|
20
21
|
function onValueChange({ target }) {
|