@nocobase/plugin-workflow 0.7.4-alpha.7 → 0.7.6-alpha.1

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.
package/client.d.ts CHANGED
File without changes
package/client.js CHANGED
File without changes
@@ -1,13 +1,12 @@
1
1
  import React from "react";
2
+ import { Registry } from "@nocobase/utils/client";
2
3
  declare function NullRender(): any;
3
- export declare const calculators: {
4
- value: string;
5
- title: string;
6
- children: {
7
- value: string;
8
- name: string;
9
- }[];
10
- }[];
4
+ interface Calculator {
5
+ name: string;
6
+ type: 'boolean' | 'number' | 'string' | 'date' | 'unknown' | 'null' | 'array';
7
+ group: string;
8
+ }
9
+ export declare const calculators: Registry<Calculator>;
11
10
  export declare function parseStringValue(value: string, Types: any): {
12
11
  type: string;
13
12
  value: string;
@@ -97,5 +96,4 @@ export declare function VariableComponent({ value, onChange, renderSchemaCompone
97
96
  onChange: any;
98
97
  renderSchemaComponent: any;
99
98
  }): JSX.Element;
100
- export declare const CollectionFieldset: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
101
99
  export {};
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BaseTypeSet = void 0;
7
7
  exports.Calculation = Calculation;
8
- exports.CollectionFieldset = void 0;
9
8
  exports.Operand = Operand;
10
9
  exports.VariableComponent = VariableComponent;
11
10
  exports.calculators = exports.VariableTypesContext = exports.VariableTypes = void 0;
@@ -22,16 +21,6 @@ function _react() {
22
21
  return data;
23
22
  }
24
23
 
25
- function _react2() {
26
- const data = require("@formily/react");
27
-
28
- _react2 = function _react2() {
29
- return data;
30
- };
31
-
32
- return data;
33
- }
34
-
35
24
  function _antd() {
36
25
  const data = require("antd");
37
26
 
@@ -52,16 +41,6 @@ function _css() {
52
41
  return data;
53
42
  }
54
43
 
55
- function _icons() {
56
- const data = require("@ant-design/icons");
57
-
58
- _icons = function _icons() {
59
- return data;
60
- };
61
-
62
- return data;
63
- }
64
-
65
44
  function _client() {
66
45
  const data = require("@nocobase/client");
67
46
 
@@ -88,15 +67,17 @@ function _reactI18next() {
88
67
  return data;
89
68
  }
90
69
 
91
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
70
+ function _client2() {
71
+ const data = require("@nocobase/utils/client");
92
72
 
93
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
94
-
95
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
73
+ _client2 = function _client2() {
74
+ return data;
75
+ };
96
76
 
97
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
77
+ return data;
78
+ }
98
79
 
99
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
80
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
100
81
 
101
82
  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; }
102
83
 
@@ -120,75 +101,116 @@ function NullRender() {
120
101
  return null;
121
102
  }
122
103
 
123
- const calculators = [{
104
+ const calculators = new (_client2().Registry)();
105
+ exports.calculators = calculators;
106
+ calculators.register('equal', {
107
+ name: '=',
108
+ type: 'boolean',
109
+ group: 'boolean'
110
+ });
111
+ calculators.register('notEqual', {
112
+ name: '≠',
113
+ type: 'boolean',
114
+ group: 'boolean'
115
+ });
116
+ calculators.register('gt', {
117
+ name: '>',
118
+ type: 'boolean',
119
+ group: 'boolean'
120
+ });
121
+ calculators.register('gte', {
122
+ name: '≥',
123
+ type: 'boolean',
124
+ group: 'boolean'
125
+ });
126
+ calculators.register('lt', {
127
+ name: '<',
128
+ type: 'boolean',
129
+ group: 'boolean'
130
+ });
131
+ calculators.register('lte', {
132
+ name: '≤',
133
+ type: 'boolean',
134
+ group: 'boolean'
135
+ });
136
+ calculators.register('add', {
137
+ name: '+',
138
+ type: 'number',
139
+ group: 'number'
140
+ });
141
+ calculators.register('minus', {
142
+ name: '-',
143
+ type: 'number',
144
+ group: 'number'
145
+ });
146
+ calculators.register('multiple', {
147
+ name: '*',
148
+ type: 'number',
149
+ group: 'number'
150
+ });
151
+ calculators.register('divide', {
152
+ name: '/',
153
+ type: 'number',
154
+ group: 'number'
155
+ });
156
+ calculators.register('mod', {
157
+ name: '%',
158
+ type: 'number',
159
+ group: 'number'
160
+ });
161
+ calculators.register('includes', {
162
+ name: '{{t("contains")}}',
163
+ type: 'boolean',
164
+ group: 'string'
165
+ });
166
+ calculators.register('notIncludes', {
167
+ name: '{{t("does not contain")}}',
168
+ type: 'boolean',
169
+ group: 'string'
170
+ });
171
+ calculators.register('startsWith', {
172
+ name: '{{t("starts with")}}',
173
+ type: 'boolean',
174
+ group: 'string'
175
+ });
176
+ calculators.register('notStartsWith', {
177
+ name: '{{t("not starts with")}}',
178
+ type: 'boolean',
179
+ group: 'string'
180
+ });
181
+ calculators.register('endsWith', {
182
+ name: '{{t("ends with")}}',
183
+ type: 'boolean',
184
+ group: 'string'
185
+ });
186
+ calculators.register('notEndsWith', {
187
+ name: '{{t("not ends with")}}',
188
+ type: 'boolean',
189
+ group: 'string'
190
+ });
191
+ calculators.register('concat', {
192
+ name: '{{t("concat")}}',
193
+ type: 'string',
194
+ group: 'string'
195
+ });
196
+ const calculatorGroups = [{
124
197
  value: 'boolean',
125
- title: '{{t("Comparison")}}',
126
- children: [{
127
- value: 'equal',
128
- name: '='
129
- }, {
130
- value: 'notEqual',
131
- name: '≠'
132
- }, {
133
- value: 'gt',
134
- name: '>'
135
- }, {
136
- value: 'gte',
137
- name: '≥'
138
- }, {
139
- value: 'lt',
140
- name: '<'
141
- }, {
142
- value: 'lte',
143
- name: '≤'
144
- }]
198
+ title: '{{t("Comparison")}}'
145
199
  }, {
146
200
  value: 'number',
147
- title: '{{t("Arithmetic calculation")}}',
148
- children: [{
149
- value: 'add',
150
- name: '+'
151
- }, {
152
- value: 'minus',
153
- name: '-'
154
- }, {
155
- value: 'multiple',
156
- name: '*'
157
- }, {
158
- value: 'divide',
159
- name: '/'
160
- }, {
161
- value: 'mod',
162
- name: '%'
163
- }]
201
+ title: '{{t("Arithmetic calculation")}}'
164
202
  }, {
165
203
  value: 'string',
166
- title: '{{t("String operation")}}',
167
- children: [{
168
- value: 'includes',
169
- name: '{{t("contains")}}'
170
- }, {
171
- value: 'notIncludes',
172
- name: '{{t("does not contain")}}'
173
- }, {
174
- value: 'startsWith',
175
- name: '{{t("starts with")}}'
176
- }, {
177
- value: 'notStartsWith',
178
- name: '{{t("not starts with")}}'
179
- }, {
180
- value: 'endsWith',
181
- name: '{{t("ends with")}}'
182
- }, {
183
- value: 'notEndsWith',
184
- name: '{{t("not ends with")}}'
185
- }]
204
+ title: '{{t("String operation")}}'
186
205
  }, {
187
206
  value: 'date',
188
- title: '{{t("Date")}}',
189
- children: []
207
+ title: '{{t("Date")}}'
190
208
  }];
191
- exports.calculators = calculators;
209
+
210
+ function getGroupCalculators(group) {
211
+ return Array.from(calculators.getEntities()).filter(([key, value]) => value.group === group);
212
+ }
213
+
192
214
  const JT_VALUE_RE = /^\s*\{\{([\s\S]*)\}\}\s*$/;
193
215
 
194
216
  function parseStringValue(value, Types) {
@@ -577,13 +599,15 @@ function Calculation({
577
599
  calculator: v
578
600
  }),
579
601
  placeholder: t('Calculator')
580
- }, calculators.map(group => _react().default.createElement(_antd().Select.OptGroup, {
602
+ }, calculatorGroups.map(group => _react().default.createElement(_antd().Select.OptGroup, {
581
603
  key: group.value,
582
604
  label: compile(group.title)
583
- }, group.children.map(item => _react().default.createElement(_antd().Select.Option, {
584
- key: item.value,
585
- value: item.value
586
- }, compile(item.name)))))), _react().default.createElement(Operand, {
605
+ }, getGroupCalculators(group.value).map(([value, {
606
+ name
607
+ }]) => _react().default.createElement(_antd().Select.Option, {
608
+ key: value,
609
+ value: value
610
+ }, compile(name)))))), _react().default.createElement(Operand, {
587
611
  value: operands[1],
588
612
  onChange: v => _onChange5({
589
613
  calculator,
@@ -623,117 +647,4 @@ function VariableComponent({
623
647
  }
624
648
  }
625
649
  }, operand.type === 'constant' ? renderSchemaComponent() : null));
626
- } // NOTE: observer for watching useProps
627
-
628
-
629
- const CollectionFieldset = (0, _react2().observer)(({
630
- value,
631
- onChange: _onChange7
632
- }) => {
633
- var _data$config;
634
-
635
- const _useTranslation3 = (0, _reactI18next().useTranslation)(),
636
- t = _useTranslation3.t;
637
-
638
- const compile = (0, _client().useCompile)();
639
-
640
- const _useCollectionManager = (0, _client().useCollectionManager)(),
641
- getCollectionFields = _useCollectionManager.getCollectionFields;
642
-
643
- const _useForm = (0, _react2().useForm)(),
644
- data = _useForm.values;
645
-
646
- const fields = getCollectionFields(data === null || data === void 0 ? void 0 : (_data$config = data.config) === null || _data$config === void 0 ? void 0 : _data$config.collection).filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false));
647
-
648
- const VTypes = _objectSpread(_objectSpread({}, VariableTypes), {}, {
649
- constant: {
650
- title: '{{t("Constant")}}',
651
- value: 'constant',
652
- options: undefined
653
- }
654
- });
655
-
656
- return _react().default.createElement("fieldset", {
657
- className: (0, _css().css)`
658
- margin-top: .5em;
659
-
660
- > .ant-formily-item{
661
- flex-direction: column;
662
-
663
- > .ant-formily-item-label{
664
- line-height: 32px;
665
- }
666
- }
667
- `
668
- }, fields.length ? _react().default.createElement(_react().default.Fragment, null, fields.filter(field => field.name in value).map(field => {
669
- var _field$uiSchema$title, _field$uiSchema;
670
-
671
- const operand = typeof value[field.name] === 'string' ? parseStringValue(value[field.name], VTypes) : {
672
- type: 'constant',
673
- value: value[field.name]
674
- }; // TODO: try to use <ObjectField> to replace this map
675
-
676
- return _react().default.createElement(_antd().Form.Item, {
677
- key: field.name,
678
- label: compile((_field$uiSchema$title = (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) !== null && _field$uiSchema$title !== void 0 ? _field$uiSchema$title : field.name),
679
- labelAlign: "left",
680
- className: (0, _css().css)`
681
- .ant-form-item-control-input-content{
682
- display: flex;
683
- }
684
- `
685
- }, _react().default.createElement(VariableTypesContext.Provider, {
686
- value: VTypes
687
- }, _react().default.createElement(Operand, {
688
- value: operand,
689
- onChange: next => {
690
- if (next.type !== operand.type && next.type === 'constant') {
691
- _onChange7(_objectSpread(_objectSpread({}, value), {}, {
692
- [field.name]: null
693
- }));
694
- } else {
695
- const stringify = VTypes[next.type].stringify;
696
-
697
- _onChange7(_objectSpread(_objectSpread({}, value), {}, {
698
- [field.name]: stringify(next)
699
- }));
700
- }
701
- }
702
- }, operand.type === 'constant' ? _react().default.createElement(_client().SchemaComponent, {
703
- schema: _objectSpread(_objectSpread({}, field.uiSchema), {}, {
704
- name: field.name
705
- })
706
- }) : null), _react().default.createElement(_antd().Button, {
707
- type: "link",
708
- icon: _react().default.createElement(_icons().CloseCircleOutlined, null),
709
- onClick: () => {
710
- const _field$name = field.name,
711
- _ = value[_field$name],
712
- rest = _objectWithoutProperties(value, [_field$name].map(_toPropertyKey));
713
-
714
- _onChange7(rest);
715
- }
716
- })));
717
- }), Object.keys(value).length < fields.length ? _react().default.createElement(_antd().Dropdown, {
718
- overlay: _react().default.createElement(_antd().Menu, {
719
- onClick: ({
720
- key
721
- }) => _onChange7(_objectSpread(_objectSpread({}, value), {}, {
722
- [key]: null
723
- })),
724
- className: (0, _css().css)`
725
- max-height: 300px;
726
- overflow-y: auto;
727
- `
728
- }, fields.filter(field => !(field.name in value)).map(field => {
729
- var _field$uiSchema$title2, _field$uiSchema2;
730
-
731
- return _react().default.createElement(_antd().Menu.Item, {
732
- key: field.name
733
- }, compile((_field$uiSchema$title2 = (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title) !== null && _field$uiSchema$title2 !== void 0 ? _field$uiSchema$title2 : field.name));
734
- }))
735
- }, _react().default.createElement(_antd().Button, {
736
- icon: _react().default.createElement(_icons().PlusOutlined, null)
737
- }, t('Add field'))) : null) : _react().default.createElement("p", null, t('Please select collection first')));
738
- });
739
- exports.CollectionFieldset = CollectionFieldset;
650
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const _default: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
3
+ export default _default;
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function _react() {
9
+ const data = _interopRequireDefault(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _react2() {
19
+ const data = require("@formily/react");
20
+
21
+ _react2 = function _react2() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _antd() {
29
+ const data = require("antd");
30
+
31
+ _antd = function _antd() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _icons() {
39
+ const data = require("@ant-design/icons");
40
+
41
+ _icons = function _icons() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _reactI18next() {
49
+ const data = require("react-i18next");
50
+
51
+ _reactI18next = function _reactI18next() {
52
+ return data;
53
+ };
54
+
55
+ return data;
56
+ }
57
+
58
+ function _css() {
59
+ const data = require("@emotion/css");
60
+
61
+ _css = function _css() {
62
+ return data;
63
+ };
64
+
65
+ return data;
66
+ }
67
+
68
+ function _client() {
69
+ const data = require("@nocobase/client");
70
+
71
+ _client = function _client() {
72
+ return data;
73
+ };
74
+
75
+ return data;
76
+ }
77
+
78
+ var _calculators = require("../calculators");
79
+
80
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
81
+
82
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
83
+
84
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
85
+
86
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
87
+
88
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
89
+
90
+ 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; }
91
+
92
+ 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; }
93
+
94
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
95
+
96
+ function AssociationInput(props) {
97
+ var _data$config;
98
+
99
+ const _useCollectionManager = (0, _client().useCollectionManager)(),
100
+ getCollectionFields = _useCollectionManager.getCollectionFields;
101
+
102
+ const _useField = (0, _react2().useField)(),
103
+ path = _useField.path;
104
+
105
+ const fieldName = path.segments[path.segments.length - 1];
106
+
107
+ const _useForm = (0, _react2().useForm)(),
108
+ data = _useForm.values;
109
+
110
+ const fields = getCollectionFields(data === null || data === void 0 ? void 0 : (_data$config = data.config) === null || _data$config === void 0 ? void 0 : _data$config.collection);
111
+
112
+ const _fields$find = fields.find(item => item.name === fieldName),
113
+ type = _fields$find.type;
114
+
115
+ const value = Array.isArray(props.value) ? props.value.join(',') : props.value;
116
+
117
+ function onChange(ev) {
118
+ const trimed = ev.target.value.trim();
119
+ props.onChange(['belongsTo', 'hasOne'].includes(type) ? trimed : trimed.split(/[,\s]+/));
120
+ }
121
+
122
+ return _react().default.createElement(_antd().Input, _objectSpread(_objectSpread({}, props), {}, {
123
+ value: value,
124
+ onChange: onChange
125
+ }));
126
+ } // NOTE: observer for watching useProps
127
+
128
+
129
+ var _default = (0, _react2().observer)(({
130
+ value,
131
+ onChange: _onChange
132
+ }) => {
133
+ var _data$config2;
134
+
135
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
136
+ t = _useTranslation.t;
137
+
138
+ const compile = (0, _client().useCompile)();
139
+
140
+ const _useCollectionManager2 = (0, _client().useCollectionManager)(),
141
+ getCollection = _useCollectionManager2.getCollection,
142
+ getCollectionFields = _useCollectionManager2.getCollectionFields;
143
+
144
+ const _useForm2 = (0, _react2().useForm)(),
145
+ data = _useForm2.values;
146
+
147
+ const collectionName = data === null || data === void 0 ? void 0 : (_data$config2 = data.config) === null || _data$config2 === void 0 ? void 0 : _data$config2.collection;
148
+ const fields = getCollectionFields(collectionName).filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false) // && (!['linkTo', 'hasMany', 'hasOne', 'belongsToMany'].includes(field.type))
149
+ );
150
+ const unassignedFields = fields.filter(field => !(field.name in value));
151
+ return _react().default.createElement("fieldset", {
152
+ className: (0, _css().css)`
153
+ margin-top: .5em;
154
+
155
+ > .ant-formily-item{
156
+ flex-direction: column;
157
+
158
+ > .ant-formily-item-label{
159
+ line-height: 32px;
160
+ }
161
+ }
162
+ `
163
+ }, fields.length ? _react().default.createElement(_client().CollectionProvider, {
164
+ collection: getCollection(collectionName)
165
+ }, fields.filter(field => field.name in value).map(field => {
166
+ var _field$uiSchema$title, _field$uiSchema;
167
+
168
+ const VTypes = _objectSpread(_objectSpread({}, ['linkTo', 'hasMany', 'belongsToMany'].includes(field.type) ? {} : _calculators.VariableTypes), {}, {
169
+ constant: {
170
+ title: '{{t("Constant")}}',
171
+ value: 'constant',
172
+ options: undefined
173
+ }
174
+ });
175
+
176
+ const operand = typeof value[field.name] === 'string' ? (0, _calculators.parseStringValue)(value[field.name], VTypes) : {
177
+ type: 'constant',
178
+ value: value[field.name]
179
+ }; // constant for associations to use Input, others to use CollectionField
180
+ // dynamic values only support belongsTo/hasOne association, other association type should disable
181
+ // TODO: try to use <ObjectField> to replace this map
182
+
183
+ return _react().default.createElement(_antd().Form.Item, {
184
+ key: field.name,
185
+ label: compile((_field$uiSchema$title = (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) !== null && _field$uiSchema$title !== void 0 ? _field$uiSchema$title : field.name),
186
+ labelAlign: "left",
187
+ className: (0, _css().css)`
188
+ .ant-form-item-control-input-content{
189
+ display: flex;
190
+ }
191
+ `
192
+ }, _react().default.createElement(_calculators.VariableTypesContext.Provider, {
193
+ value: VTypes
194
+ }, _react().default.createElement(_calculators.Operand, {
195
+ value: operand,
196
+ onChange: next => {
197
+ if (next.type !== operand.type && next.type === 'constant') {
198
+ _onChange(_objectSpread(_objectSpread({}, value), {}, {
199
+ [field.name]: null
200
+ }));
201
+ } else {
202
+ const stringify = VTypes[next.type].stringify;
203
+
204
+ _onChange(_objectSpread(_objectSpread({}, value), {}, {
205
+ [field.name]: stringify(next)
206
+ }));
207
+ }
208
+ }
209
+ }, operand.type === 'constant' ? _react().default.createElement(_client().SchemaComponent, {
210
+ schema: {
211
+ type: 'void',
212
+ properties: {
213
+ [field.name]: {
214
+ 'x-component': ['linkTo', 'belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type) ? 'AssociationInput' : 'CollectionField'
215
+ }
216
+ }
217
+ },
218
+ components: {
219
+ CollectionField: _client().CollectionField,
220
+ AssociationInput
221
+ }
222
+ }) // ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />
223
+ : null), _react().default.createElement(_antd().Button, {
224
+ type: "link",
225
+ icon: _react().default.createElement(_icons().CloseCircleOutlined, null),
226
+ onClick: () => {
227
+ const _field$name = field.name,
228
+ _ = value[_field$name],
229
+ rest = _objectWithoutProperties(value, [_field$name].map(_toPropertyKey));
230
+
231
+ _onChange(rest);
232
+ }
233
+ })));
234
+ }), unassignedFields.length ? _react().default.createElement(_antd().Dropdown, {
235
+ overlay: _react().default.createElement(_antd().Menu, {
236
+ onClick: ({
237
+ key
238
+ }) => _onChange(_objectSpread(_objectSpread({}, value), {}, {
239
+ [key]: null
240
+ })),
241
+ className: (0, _css().css)`
242
+ max-height: 300px;
243
+ overflow-y: auto;
244
+ `
245
+ }, unassignedFields.map(field => {
246
+ var _field$uiSchema$title2, _field$uiSchema2;
247
+
248
+ return _react().default.createElement(_antd().Menu.Item, {
249
+ key: field.name
250
+ }, compile((_field$uiSchema$title2 = (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title) !== null && _field$uiSchema$title2 !== void 0 ? _field$uiSchema$title2 : field.name));
251
+ }))
252
+ }, _react().default.createElement(_antd().Button, {
253
+ icon: _react().default.createElement(_icons().PlusOutlined, null)
254
+ }, t('Add field'))) : null) : _react().default.createElement("p", null, t('Please select collection first')));
255
+ });
256
+
257
+ exports.default = _default;
@@ -1,3 +1,4 @@
1
1
  export { triggers } from './triggers';
2
2
  export * from './nodes';
3
+ export { calculators } from './calculators';
3
4
  export { WorkflowProvider as default } from './WorkflowProvider';